[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 10 Oct 2019 17:52:16 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Masami Hiramatsu <mhiramat@...nel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
"H. Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: [RFC][PATCH] kprobes/x86: While list ftrace locations in kprobe
blacklist areas
From: Steven Rostedt (VMware) <rostedt@...dmis.org>
I noticed some of my old tests failing on kprobes, and realized that
this was due to black listing irq_entry functions on x86 from being
used by kprobes. IIRC, this was due to the cr2 being corrupted and
such, and I believe other things were to cause. But black listing all
irq_entry code is a big hammer to this.
(See commit 0eae81dc9f026 "x86/kprobes: Prohibit probing on IRQ
handlers directly" for more details)
Anyway, if kprobes is using ftrace as a hook, there shouldn't be any
problems here. If we white list ftrace locations in the range of
kprobe_add_area_blacklist(), it should be safe.
Signed-off-by: Steven Rostedt (VMware) <rostedt@...dmis.org>
---
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index d9770a5393c8..9d28a279282c 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2124,6 +2124,11 @@ int kprobe_add_area_blacklist(unsigned long start, unsigned long end)
int ret = 0;
for (entry = start; entry < end; entry += ret) {
+#ifdef CONFIG_KPROBES_ON_FTRACE
+ /* We are safe if using ftrace */
+ if (ftrace_location(entry))
+ continue;
+#endif
ret = kprobe_add_ksym_blacklist(entry);
if (ret < 0)
return ret;
Powered by blists - more mailing lists