diff options
author | Josef Bacik <jbacik@fb.com> | 2017-12-11 11:36:46 -0500 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2017-12-12 08:56:26 -0800 |
commit | 92ace9991da08827e809c2d120108a96a281e7fc (patch) | |
tree | f228d246aabb6d72e09d97684ff9a6ac6768c50a /kernel/module.c | |
parent | a23967c181cae80becb451b38ff2a1e01c05c37b (diff) |
add infrastructure for tagging functions as error injectable
Using BPF we can override kprob'ed functions and return arbitrary
values. Obviously this can be a bit unsafe, so make this feature opt-in
for functions. Simply tag a function with KPROBE_ERROR_INJECT_SYMBOL in
order to give BPF access to that function for error injection purposes.
Signed-off-by: Josef Bacik <jbacik@fb.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/kernel/module.c b/kernel/module.c index dea01ac9cb74..bd695bfdc5c4 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -3118,7 +3118,11 @@ static int find_module_sections(struct module *mod, struct load_info *info) sizeof(*mod->ftrace_callsites), &mod->num_ftrace_callsites); #endif - +#ifdef CONFIG_BPF_KPROBE_OVERRIDE + mod->kprobe_ei_funcs = section_objs(info, "_kprobe_error_inject_list", + sizeof(*mod->kprobe_ei_funcs), + &mod->num_kprobe_ei_funcs); +#endif mod->extable = section_objs(info, "__ex_table", sizeof(*mod->extable), &mod->num_exentries); |