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>

authored by Masami Hiramatsu and committed by Ingo Molnar fabe38ab 3ff9c075

+5 -1
+5 -1
kernel/trace/ftrace.c
··· 33 #include <linux/list.h> 34 #include <linux/hash.h> 35 #include <linux/rcupdate.h> 36 37 #include <trace/events/sched.h> 38 ··· 6247 tr->ops->func = ftrace_stub; 6248 } 6249 6250 - static inline void 6251 __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, 6252 struct ftrace_ops *ignored, struct pt_regs *regs) 6253 { ··· 6307 { 6308 __ftrace_ops_list_func(ip, parent_ip, NULL, regs); 6309 } 6310 #else 6311 static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip) 6312 { 6313 __ftrace_ops_list_func(ip, parent_ip, NULL, NULL); 6314 } 6315 #endif 6316 6317 /* ··· 6340 preempt_enable_notrace(); 6341 trace_clear_recursion(bit); 6342 } 6343 6344 /** 6345 * ftrace_ops_get_func - get the function a trampoline should call
··· 33 #include <linux/list.h> 34 #include <linux/hash.h> 35 #include <linux/rcupdate.h> 36 + #include <linux/kprobes.h> 37 38 #include <trace/events/sched.h> 39 ··· 6246 tr->ops->func = ftrace_stub; 6247 } 6248 6249 + static nokprobe_inline void 6250 __ftrace_ops_list_func(unsigned long ip, unsigned long parent_ip, 6251 struct ftrace_ops *ignored, struct pt_regs *regs) 6252 { ··· 6306 { 6307 __ftrace_ops_list_func(ip, parent_ip, NULL, regs); 6308 } 6309 + NOKPROBE_SYMBOL(ftrace_ops_list_func); 6310 #else 6311 static void ftrace_ops_no_ops(unsigned long ip, unsigned long parent_ip) 6312 { 6313 __ftrace_ops_list_func(ip, parent_ip, NULL, NULL); 6314 } 6315 + NOKPROBE_SYMBOL(ftrace_ops_no_ops); 6316 #endif 6317 6318 /* ··· 6337 preempt_enable_notrace(); 6338 trace_clear_recursion(bit); 6339 } 6340 + NOKPROBE_SYMBOL(ftrace_ops_assist_func); 6341 6342 /** 6343 * ftrace_ops_get_func - get the function a trampoline should call