diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2019-02-23 11:50:20 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2019-04-19 08:26:06 -0400 |
commit | fabe38ab6b2bd9418350284c63825f13b8a6abba (patch) | |
tree | 60c5a5cccb291331f7375052748583a443a7da85 /kernel/trace/ftrace.c | |
parent | 3ff9c075cc767b3060bdac12da72fc94dd7da1b8 (diff) |
kprobes: Mark ftrace mcount handler functions nokprobe
Mark ftrace mcount handler functions nokprobe since
probing on these functions with kretprobe pushes
return address incorrectly on kretprobe shadow stack.
Reported-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Tested-by: Andrea Righi <righi.andrea@gmail.com>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/155094062044.6137.6419622920568680640.stgit@devbox
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/trace/ftrace.c')
-rw-r--r-- | kernel/trace/ftrace.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 26c8ca9bd06b..b920358dd8f7 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/list.h> | 33 | #include <linux/list.h> |
34 | #include <linux/hash.h> | 34 | #include <linux/hash.h> |
35 | #include <linux/rcupdate.h> | 35 | #include <linux/rcupdate.h> |
36 | #include <linux/kprobes.h> | ||
36 | 37 | ||
37 | #include <trace/events/sched.h> | 38 | #include <trace/events/sched.h> |
38 | 39 | ||
@@ -6246,7 +6247,7 @@ void ftrace_reset_array_ops(struct trace_array *tr) | |||
6246 | tr->ops->func = ftrace_stub; | 6247 | tr->ops->func = ftrace_stub; |
6247 | } | 6248 | } |
6248 | 6249 | ||
6249 | static inline void | 6250 | static nokprobe_inline void |
6250 | __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, | 6251 | __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, |
6251 | struct ftrace_ops *ignored, struct pt_regs *regs) | 6252 | struct ftrace_ops *ignored, struct pt_regs *regs) |
6252 | { | 6253 | { |
@@ -6306,11 +6307,13 @@ static void ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, | |||
6306 | { | 6307 | { |
6307 | __ftrace_ops_list_func(ip, parent_ip, NULL, regs); | 6308 | __ftrace_ops_list_func(ip, parent_ip, NULL, regs); |
6308 | } | 6309 | } |
6310 | NOKPROBE_SYMBOL(ftrace_ops_list_func); | ||
6309 | #else | 6311 | #else |
6310 | static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip) | 6312 | static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip) |
6311 | { | 6313 | { |
6312 | __ftrace_ops_list_func(ip, parent_ip, NULL, NULL); | 6314 | __ftrace_ops_list_func(ip, parent_ip, NULL, NULL); |
6313 | } | 6315 | } |
6316 | NOKPROBE_SYMBOL(ftrace_ops_no_ops); | ||
6314 | #endif | 6317 | #endif |
6315 | 6318 | ||
6316 | /* | 6319 | /* |
@@ -6337,6 +6340,7 @@ static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip, | |||
6337 | preempt_enable_notrace(); | 6340 | preempt_enable_notrace(); |
6338 | trace_clear_recursion(bit); | 6341 | trace_clear_recursion(bit); |
6339 | } | 6342 | } |
6343 | NOKPROBE_SYMBOL(ftrace_ops_assist_func); | ||
6340 | 6344 | ||
6341 | /** | 6345 | /** |
6342 | * ftrace_ops_get_func - get the function a trampoline should call | 6346 | * ftrace_ops_get_func - get the function a trampoline should call |