]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
do_sigaltstack: avoid copying 'stack_t' as a structure to user space
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 1 Aug 2009 17:34:56 +0000 (10:34 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 1 Aug 2009 17:46:52 +0000 (10:46 -0700)
commit0083fc2c50e6c5127c2802ad323adf8143ab7856
tree0ec735c46d8be4ae4c637243b126feba0be2ebe8
parented680c4ad478d0fee9740f7d029087f181346564
do_sigaltstack: avoid copying 'stack_t' as a structure to user space

Ulrich Drepper correctly points out that there is generally padding in
the structure on 64-bit hosts, and that copying the structure from
kernel to user space can leak information from the kernel stack in those
padding bytes.

Avoid the whole issue by just copying the three members one by one
instead, which also means that the function also can avoid the need for
a stack frame.  This also happens to match how we copy the new structure
from user space, so it all even makes sense.

[ The obvious solution of adding a memset() generates horrid code, gcc
  does really stupid things. ]

Reported-by: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/signal.c