* [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
* Re: [PATCH v2 3.16] x86,kprobes: Don't try to resolve kprobe faults from userspace
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
1 sibling, 0 replies; 3+ messages in thread
From: Masami Hiramatsu @ 2014-07-13 22:39 UTC (permalink / raw)
To: Andy Lutomirski; +Cc: Ingo Molnar, x86, linux-kernel, H. Peter Anvin
(2014/07/12 2:27), Andy Lutomirski wrote:
> 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.
Oops, right!
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Thank you very much!
>
> 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
>
--
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Research Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:perf/urgent] kprobes/x86: Don' t try to resolve kprobe faults from userspace
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-bot for Andy Lutomirski
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Andy Lutomirski @ 2014-07-16 19:23 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, luto, hpa, mingo, masami.hiramatsu.pt, tglx
Commit-ID: 0cdd192cf40fb6dbf03ec3af1c670068de3fd26c
Gitweb: http://git.kernel.org/tip/0cdd192cf40fb6dbf03ec3af1c670068de3fd26c
Author: Andy Lutomirski <luto@amacapital.net>
AuthorDate: Fri, 11 Jul 2014 10:27:01 -0700
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 16 Jul 2014 14:16:32 +0200
kprobes/x86: Don't try to resolve kprobe faults from userspace
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>
Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Link: http://lkml.kernel.org/r/c4e339882c121aa76254f2adde3fcbdf502faec2.1405099506.git.luto@amacapital.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
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
^ 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