kprobes/trace: Fix kprobe selftest for newer gcc
authorMarcin Nowakowski <marcin.nowakowski@imgtec.com>
Fri, 9 Dec 2016 14:19:38 +0000 (15:19 +0100)
committerSteven Rostedt <rostedt@goodmis.org>
Tue, 13 Dec 2016 02:21:43 +0000 (21:21 -0500)
commitd4d7ccc834fe2401084e01fb043ad70ac410b19d
tree137ef8ce9233754ae09aa1e808e26fc70760c67e
parentf18f97ac43d72ae84fe012dd4f19fe3f8f901469
kprobes/trace: Fix kprobe selftest for newer gcc

Commit 265a5b7ee3eb ("kprobes/trace: Fix kprobe selftest for gcc 4.6")
has added __used attribute to kprobe_trace_selftest_target to ensure
that the method is listed in kallsyms table.

However, even though the method remains in the kernel image, the actual
call is optimized away as there are no side effects and the return value
is never checked.

Add a return value check and a 'noinline' attribute to ensure that an
inlined copy of the method is not used by the caller. Also add checks
that verify that the kprobe was really hit, as at the moment the tests
show positive results despite the test method being optimized away.

Finally, add __init annotations to find_trace_probe_file() and
kprobe_trace_selftest_target() as they are only called from within an
__init method.

Link: http://lkml.kernel.org/r/1481293178-3128-2-git-send-email-marcin.nowakowski@imgtec.com
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace_kprobe.c