tracing/kprobe: bpf: Check error injectable event is on function entry
authorMasami Hiramatsu <mhiramat@kernel.org>
Fri, 12 Jan 2018 17:54:04 +0000 (02:54 +0900)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 13 Jan 2018 01:33:37 +0000 (17:33 -0800)
commitb4da3340eae2c3932144be3e81ccfd4e424d87b7
tree0a8d2bfcd4dc6a32524dc2b83d2c9169f9bf124a
parentdaaf24c634ab951cad3dcef28492001ef9c931d0
tracing/kprobe: bpf: Check error injectable event is on function entry

Check whether error injectable event is on function entry or not.
Currently it checks the event is ftrace-based kprobes or not,
but that is wrong. It should check if the event is on the entry
of target function. Since error injection will override a function
to just return with modified return value, that operation must
be done before the target function starts making stackframe.

As a side effect, bpf error injection is no need to depend on
function-tracer. It can work with sw-breakpoint based kprobe
events too.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/x86/include/asm/kprobes.h
arch/x86/kernel/kprobes/core.c
arch/x86/kernel/kprobes/ftrace.c
kernel/trace/Kconfig
kernel/trace/bpf_trace.c
kernel/trace/trace_kprobe.c
kernel/trace/trace_probe.h