[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tip-854fbd6e5f60fe99e8e3a569865409fca378f143@git.kernel.org>
Date: Thu, 23 Mar 2017 23:45:56 -0700
From: tip-bot for Kees Cook <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: hpa@...or.com, peterz@...radead.org, keescook@...omium.org,
jpoimboe@...hat.com, tglx@...utronix.de, luto@...nel.org,
mingo@...nel.org, bp@...en8.de, torvalds@...ux-foundation.org,
dvlasenk@...hat.com, linux-kernel@...r.kernel.org,
brgerst@...il.com, robert@...ecki.net
Subject: [tip:core/urgent] lib/syscall: Clear return values when no stack
Commit-ID: 854fbd6e5f60fe99e8e3a569865409fca378f143
Gitweb: http://git.kernel.org/tip/854fbd6e5f60fe99e8e3a569865409fca378f143
Author: Kees Cook <keescook@...omium.org>
AuthorDate: Thu, 23 Mar 2017 15:46:16 -0700
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Fri, 24 Mar 2017 07:43:35 +0100
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 <robert@...ecki.net>
Signed-off-by: Kees Cook <keescook@...omium.org>
Reviewed-by: Andy Lutomirski <luto@...nel.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: stable@...r.kernel.org # 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 <mingo@...nel.org>
---
lib/syscall.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/syscall.c b/lib/syscall.c
index 17d5ff5..2c6cd1b 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;
}
Powered by blists - more mailing lists