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