]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: add a bpf_override_function helper
authorJosef Bacik <jbacik@fb.com>
Mon, 11 Dec 2017 16:36:48 +0000 (11:36 -0500)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 12 Dec 2017 17:02:34 +0000 (09:02 -0800)
commit1d9b25b057f2a750b80b1196b19fa442c43dd729
tree53b334864518dd27b243eafc9ab510ac56ee3b74
parent4c516130c1b1a7df8b7151cc9dc0e0ee65129e65
bpf: add a bpf_override_function helper

Error injection is sloppy and very ad-hoc.  BPF could fill this niche
perfectly with it's kprobe functionality.  We could make sure errors are
only triggered in specific call chains that we care about with very
specific situations.  Accomplish this with the bpf_override_funciton
helper.  This will modify the probe'd callers return value to the
specified value and set the PC to an override function that simply
returns, bypassing the originally probed function.  This gives us a nice
clean way to implement systematic error injection for all of our code
paths.

Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
15 files changed:
arch/Kconfig
arch/x86/Kconfig
arch/x86/include/asm/kprobes.h
arch/x86/include/asm/ptrace.h
arch/x86/kernel/kprobes/ftrace.c
include/linux/filter.h
include/linux/trace_events.h
include/uapi/linux/bpf.h
kernel/bpf/core.c
kernel/bpf/verifier.c
kernel/events/core.c
kernel/trace/Kconfig
kernel/trace/bpf_trace.c
kernel/trace/trace_kprobe.c
kernel/trace/trace_probe.h