public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 3.16] x86,kprobes: Don't try to resolve kprobe faults from userspace
@ 2014-07-11 17:27 Andy Lutomirski
  2014-07-13 22:39 ` Masami Hiramatsu
  2014-07-16 19:23 ` [tip:perf/urgent] kprobes/x86: Don' t " tip-bot for Andy Lutomirski
  0 siblings, 2 replies; 3+ messages in thread
From: Andy Lutomirski @ 2014-07-11 17:27 UTC (permalink / raw)
  To: Ingo Molnar, x86, linux-kernel, Masami Hiramatsu; +Cc: Andy Lutomirski

This commit:

    commit 6f6343f53d133bae516caf3d254bce37d8774625
    Author: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Date:   Thu Apr 17 17:17:33 2014 +0900

        kprobes/x86: Call exception handlers directly from do_int3/do_debug

appears to have inadvertently dropped a check that the int3 came
from kernel mode.  Trying to dereference addr when addr is
user-controlled is completely bogus.

Signed-off-by: Andy Lutomirski <luto@amacapital.net>
---

Changes from v1: Fixed the changelog message

 arch/x86/kernel/kprobes/core.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
index 7596df6..67e6d19 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -574,6 +574,9 @@ int kprobe_int3_handler(struct pt_regs *regs)
 	struct kprobe *p;
 	struct kprobe_ctlblk *kcb;
 
+	if (user_mode_vm(regs))
+		return 0;
+
 	addr = (kprobe_opcode_t *)(regs->ip - sizeof(kprobe_opcode_t));
 	/*
 	 * We don't want to be preempted for the entire
-- 
1.9.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-16 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-11 17:27 [PATCH v2 3.16] x86,kprobes: Don't try to resolve kprobe faults from userspace Andy Lutomirski
2014-07-13 22:39 ` Masami Hiramatsu
2014-07-16 19:23 ` [tip:perf/urgent] kprobes/x86: Don' t " tip-bot for Andy Lutomirski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox