Skip to content

Commit

Permalink
bpf: Keep module's btf_data_size intact after load
Browse files Browse the repository at this point in the history
Having real btf_data_size stored in struct module is benefitial to quickly
determine which kernel modules have associated BTF object and which don't.
There is no harm in keeping this info, as opposed to keeping invalid pointer.

Fixes: 607c543 ("bpf: Sanitize BTF data pointer after module is loaded")
Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
  • Loading branch information
anakryiko authored and Alexei Starovoitov committed Dec 4, 2020
1 parent 12cc126 commit 2fe8890
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -3712,7 +3712,6 @@ static noinline int do_init_module(struct module *mod)
#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
/* .BTF is not SHF_ALLOC and will get removed, so sanitize pointer */
mod->btf_data = NULL;
mod->btf_data_size = 0;
#endif
/*
* We want to free module_init, but be aware that kallsyms may be
Expand Down

0 comments on commit 2fe8890

Please sign in to comment.