[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-e3e4d5019c2dd0f91600f6df377b215a73d506fe@git.kernel.org>
Date: Mon, 3 Sep 2018 06:17:01 -0700
From: tip-bot for Jann Horn <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: keescook@...omium.org, viro@...iv.linux.org.uk,
linux-kernel@...r.kernel.org, mhiramat@...nel.org, hpa@...or.com,
naveen.n.rao@...ux.vnet.ibm.com, jannh@...gle.com, bp@...en8.de,
tglx@...utronix.de, luto@...nel.org, davem@...emloft.net,
mingo@...nel.org, anil.s.keshavamurthy@...el.com
Subject: [tip:x86/core] x86/kprobes: Stop calling fixup_exception() from
kprobe_fault_handler()
Commit-ID: e3e4d5019c2dd0f91600f6df377b215a73d506fe
Gitweb: https://git.kernel.org/tip/e3e4d5019c2dd0f91600f6df377b215a73d506fe
Author: Jann Horn <jannh@...gle.com>
AuthorDate: Tue, 28 Aug 2018 22:14:17 +0200
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Mon, 3 Sep 2018 15:12:08 +0200
x86/kprobes: Stop calling fixup_exception() from kprobe_fault_handler()
This removes the call into exception fixup that was added in commit
c28f896634f2 ("[PATCH] kprobes: fix broken fault handling for x86_64").
On X86, kprobe_fault_handler() is called from two places:
do_general_protection() (for #GP) and kprobes_fault() (for #PF). In both
paths, the fixup_exception() call in the kprobe fault handler is redundant.
In case of #GP, fixup_exception() is called immediately before
kprobe_fault_handler() is invoked, so no need to try that again. This
assumes that the kprobe's fault handler isn't going to do something crazy
like changing RIP so that it suddenly points to an instruction that does
userspace access.
For #PF on a kernel address from kernel space, after the kprobe fault
handler has run, no_context() is invoked, which calls fixup_exception().
Signed-off-by: Jann Horn <jannh@...gle.com>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Tested-by: Kees Cook <keescook@...omium.org>
Acked-by: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Andy Lutomirski <luto@...nel.org>
Cc: kernel-hardening@...ts.openwall.com
Cc: linux-kernel@...r.kernel.org
Cc: dvyukov@...gle.com
Cc: "Naveen N. Rao" <naveen.n.rao@...ux.vnet.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Alexander Viro <viro@...iv.linux.org.uk>
Cc: linux-fsdevel@...r.kernel.org
Cc: Borislav Petkov <bp@...en8.de>
Link: https://lkml.kernel.org/r/20180828201421.157735-4-jannh@google.com
---
arch/x86/kernel/kprobes/core.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 467ac22691b0..f72a47b602e2 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -1020,15 +1020,6 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
*/
if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
return 1;
-
- /*
- * In case the user-specified fault handler returned
- * zero, try to fix up.
- */
- if (fixup_exception(regs, trapnr))
- return 1;
-
- /* fixup routine could not handle it. */
}
return 0;
Powered by blists - more mailing lists