diff options
author | Amanieu d'Antras <amanieu@gmail.com> | 2015-08-06 18:46:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-08-06 21:39:40 -0400 |
commit | 3c00cb5e68dc719f2fc73a33b1b230aadfcb1309 (patch) | |
tree | 68b5f2424fb18c45aa9b67a694a75160dddbbf23 /kernel/signal.c | |
parent | 209f7512d007980fd111a74a064d70a3656079cf (diff) |
signal: fix information leak in copy_siginfo_from_user32
This function can leak kernel stack data when the user siginfo_t has a
positive si_code value. The top 16 bits of si_code descibe which fields
in the siginfo_t union are active, but they are treated inconsistently
between copy_siginfo_from_user32, copy_siginfo_to_user32 and
copy_siginfo_to_user.
copy_siginfo_from_user32 is called from rt_sigqueueinfo and
rt_tgsigqueueinfo in which the user has full control overthe top 16 bits
of si_code.
This fixes the following information leaks:
x86: 8 bytes leaked when sending a signal from a 32-bit process to
itself. This leak grows to 16 bytes if the process uses x32.
(si_code = __SI_CHLD)
x86: 100 bytes leaked when sending a signal from a 32-bit process to
a 64-bit process. (si_code = -1)
sparc: 4 bytes leaked when sending a signal from a 32-bit process to a
64-bit process. (si_code = any)
parsic and s390 have similar bugs, but they are not vulnerable because
rt_[tg]sigqueueinfo have checks that prevent sending a positive si_code
to a different process. These bugs are also fixed for consistency.
Signed-off-by: Amanieu d'Antras <amanieu@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/signal.c')
-rw-r--r-- | kernel/signal.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/signal.c b/kernel/signal.c index 836df8dac6cc..00524cf6c412 100644 --- a/kernel/signal.c +++ b/kernel/signal.c | |||
@@ -3017,7 +3017,7 @@ COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo, | |||
3017 | int, sig, | 3017 | int, sig, |
3018 | struct compat_siginfo __user *, uinfo) | 3018 | struct compat_siginfo __user *, uinfo) |
3019 | { | 3019 | { |
3020 | siginfo_t info; | 3020 | siginfo_t info = {}; |
3021 | int ret = copy_siginfo_from_user32(&info, uinfo); | 3021 | int ret = copy_siginfo_from_user32(&info, uinfo); |
3022 | if (unlikely(ret)) | 3022 | if (unlikely(ret)) |
3023 | return ret; | 3023 | return ret; |
@@ -3061,7 +3061,7 @@ COMPAT_SYSCALL_DEFINE4(rt_tgsigqueueinfo, | |||
3061 | int, sig, | 3061 | int, sig, |
3062 | struct compat_siginfo __user *, uinfo) | 3062 | struct compat_siginfo __user *, uinfo) |
3063 | { | 3063 | { |
3064 | siginfo_t info; | 3064 | siginfo_t info = {}; |
3065 | 3065 | ||
3066 | if (copy_siginfo_from_user32(&info, uinfo)) | 3066 | if (copy_siginfo_from_user32(&info, uinfo)) |
3067 | return -EFAULT; | 3067 | return -EFAULT; |