Skip to contentSkip to conversation

Out-of-bounds access in get_wchan (arch/x86/kernel/process_64.c)

PATCH Dmitry Vyukov 1 participant 2 messages Sep 27, 2013 2 messages not in the archive

lore
Share & tools
lore
#2 lore raw
In reply to a message not in the archive
Quoted 14 lines · Wolfram Gloger
Quoted 6 lines · H. Peter Anvin

Actually, the sanest would be:

      if (fp  < (unsigned long)stack ||
          fp >= (unsigned long)stack+(THREAD_SIZE-16))

... wouldn't it (since we are accessing an 8-byte datum at offset +8?

Ok, splitting hairs maybe, what about this V2 of the patch?

fp is under userspace control. stack-8 cannot underflow, otherwise we'd have much more serious problems in kernel space.

Quoted 8 lines

Hence, for dereferencing fp+8:

The case fp == stack-8 is valid.
As is the case fp == stack+(THREAD_SIZE-16).
Everything outside is invalid.

About the worst-case implications: Like I said I have not reproduced it and cannot really comment on that.

+kees@, linux-kernel@

#3 lore raw
In reply to a message not in the archive
Quoted 14 lines · Wolfram Gloger
Quoted 6 lines · H. Peter Anvin

Actually, the sanest would be:

      if (fp  < (unsigned long)stack ||
          fp >= (unsigned long)stack+(THREAD_SIZE-16))

... wouldn't it (since we are accessing an 8-byte datum at offset +8?

Ok, splitting hairs maybe, what about this V2 of the patch?

fp is under userspace control. stack-8 cannot underflow, otherwise we'd have much more serious problems in kernel space.

Quoted 8 lines

Hence, for dereferencing fp+8:

The case fp == stack-8 is valid.
As is the case fp == stack+(THREAD_SIZE-16).
Everything outside is invalid.

About the worst-case implications: Like I said I have not reproduced it and cannot really comment on that.

+kees@, linux-kernel@