Commit 854fbd6e authored by Kees Cook's avatar Kees Cook Committed by Ingo Molnar

lib/syscall: Clear return values when no stack


  aa1f1a63 ("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: default avatarRobert Święcki <>
Signed-off-by: default avatarKees Cook <>
Reviewed-by: default avatarAndy Lutomirski <>
Cc: Borislav Petkov <>
Cc: Brian Gerst <>
Cc: Denys Vlasenko <>
Cc: H. Peter Anvin <>
Cc: Josh Poimboeuf <>
Cc: Linus Torvalds <>
Cc: Peter Zijlstra <>
Cc: Thomas Gleixner <>
Cc: # v4.9+
Fixes: aa1f1a63 ("lib/syscall: Pin the task stack in collect_syscall()")
Link: default avatarIngo Molnar <>
parent ebe64824
......@@ -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;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment