aboutsummaryrefslogtreecommitdiffstats
path: root/lib/syscall.c
diff options
context:
space:
mode:
authorKees Cook <[email protected]>2017-03-23 22:46:16 +0000
committerIngo Molnar <[email protected]>2017-03-24 06:43:35 +0000
commit854fbd6e5f60fe99e8e3a569865409fca378f143 (patch)
tree7f0d56d40169921ca321b22a5c3f7074569ec52e /lib/syscall.c
parentMerge tag 'pm-4.11-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafa... (diff)
downloadkernel-854fbd6e5f60fe99e8e3a569865409fca378f143.tar.gz
kernel-854fbd6e5f60fe99e8e3a569865409fca378f143.zip
lib/syscall: Clear return values when no stack
Commit: aa1f1a639621 ("lib/syscall: Pin the task stack in collect_syscall()") ... added logic to handle a process stack not existing, but left sp and pc uninitialized, which can be later reported via /proc/$pid/syscall for zombie processes, potentially exposing kernel memory to userspace. Zombie /proc/$pid/syscall before: -1 0xffffffff9a060100 0xffff92f42d6ad900 Zombie /proc/$pid/syscall after: -1 0x0 0x0 Reported-by: Robert Święcki <[email protected]> Signed-off-by: Kees Cook <[email protected]> Reviewed-by: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: [email protected] # v4.9+ Fixes: aa1f1a639621 ("lib/syscall: Pin the task stack in collect_syscall()") Link: http://lkml.kernel.org/r/20170323224616.GA92694@beast Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'lib/syscall.c')
-rw-r--r--lib/syscall.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/syscall.c b/lib/syscall.c
index 17d5ff5fa6a3..2c6cd1b5c3ea 100644
--- a/lib/syscall.c
+++ b/lib/syscall.c
@@ -12,6 +12,7 @@ static int collect_syscall(struct task_struct *target, long *callno,
if (!try_get_task_stack(target)) {
/* Task has no stack, so the task isn't in a syscall. */
+ *sp = *pc = 0;
*callno = -1;
return 0;
}