Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] alpha: osf_sys.c: fix put_tv32 regression
@ 2017-11-07 14:09 Arnd Bergmann
  2017-11-07 15:52 ` Al Viro
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2017-11-07 14:09 UTC (permalink / raw)
  To: Richard Henderson
  Cc: Ivan Kokshaysky, Matt Turner, Alexander Viro, y2038,
	Deepa Dinamani, Arnd Bergmann, stable, linux-alpha, linux-kernel

There was a typo in the new version of put_tv32() that caused
uninitialized stack data to be written back to user space, rather
than writing the actual timeval for the emulation of
gettimeofday(), wait4(), usleep_thread() and old_adjtimex().

This fixes it to write the correct data again.

Cc: stable@vger.kernel.org
Fixes: 1cc6c4635e9f ("osf_sys.c: switch handling of timeval32/itimerval32 to copy_{to,from}_user()")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/alpha/kernel/osf_sys.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index ce3a675c0c4b..75a5c35a2067 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -964,8 +964,8 @@ static inline long
 put_tv32(struct timeval32 __user *o, struct timeval *i)
 {
 	return copy_to_user(o, &(struct timeval32){
-				.tv_sec = o->tv_sec,
-				.tv_usec = o->tv_usec},
+				.tv_sec = i->tv_sec,
+				.tv_usec = i->tv_usec},
 			    sizeof(struct timeval32));
 }
 
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] alpha: osf_sys.c: fix put_tv32 regression
  2017-11-07 14:09 [PATCH 1/2] alpha: osf_sys.c: fix put_tv32 regression Arnd Bergmann
@ 2017-11-07 15:52 ` Al Viro
  2017-11-07 16:03   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Al Viro @ 2017-11-07 15:52 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner, y2038,
	Deepa Dinamani, stable, linux-alpha, linux-kernel

On Tue, Nov 07, 2017 at 03:09:24PM +0100, Arnd Bergmann wrote:
> There was a typo in the new version of put_tv32() that caused
> uninitialized stack data to be written back to user space, rather
> than writing the actual timeval for the emulation of
> gettimeofday(), wait4(), usleep_thread() and old_adjtimex().
> 
> This fixes it to write the correct data again.

*blink*

the bug is real, all right, and the fix is correct one, but where
do you get an infoleak?  What it is is a user-triggerable oops -
just pass it an unmapped address.  For anything mapped r/w it's
simply a no-op - userland data is unchanged.

IOW, the fix is correct, but commit message isn't - it's

"user-triggerable oops and in all cases failed to modify userland timeval32"

not

"uninitialized stack data to be written back to user space"

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] alpha: osf_sys.c: fix put_tv32 regression
  2017-11-07 15:52 ` Al Viro
@ 2017-11-07 16:03   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-11-07 16:03 UTC (permalink / raw)
  To: Al Viro
  Cc: Richard Henderson, Ivan Kokshaysky, Matt Turner,
	y2038 Mailman List, Deepa Dinamani, # 3.4.x, linux-alpha,
	Linux Kernel Mailing List

On Tue, Nov 7, 2017 at 4:52 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> On Tue, Nov 07, 2017 at 03:09:24PM +0100, Arnd Bergmann wrote:
>> There was a typo in the new version of put_tv32() that caused
>> uninitialized stack data to be written back to user space, rather
>> than writing the actual timeval for the emulation of
>> gettimeofday(), wait4(), usleep_thread() and old_adjtimex().
>>
>> This fixes it to write the correct data again.
>
> *blink*
>
> the bug is real, all right, and the fix is correct one, but where
> do you get an infoleak?  What it is is a user-triggerable oops -
> just pass it an unmapped address.  For anything mapped r/w it's
> simply a no-op - userland data is unchanged.
>
> IOW, the fix is correct, but commit message isn't - it's
>
> "user-triggerable oops and in all cases failed to modify userland timeval32"
>
> not
>
> "uninitialized stack data to be written back to user space"

Ah right, sorry about that. I misread the statement as setting
the temporary structure to itself rather than setting it to the contents
of the user structure.

Do you want to update the description as suggested and forward it,
or should I send a fixed version? I'm about to leave the office for
today, so I'd have to do it tomorrow then.

       Arnd

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-07 16:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-07 14:09 [PATCH 1/2] alpha: osf_sys.c: fix put_tv32 regression Arnd Bergmann
2017-11-07 15:52 ` Al Viro
2017-11-07 16:03   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox