2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-12 23:33:55 +08:00

bpf: Keep module's btf_data_size intact after load

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: 607c543f93 ("bpf: Sanitize BTF data pointer after module is loaded")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201203204634.1325171-3-andrii@kernel.org
This commit is contained in:
Andrii Nakryiko 2020-12-03 12:46:22 -08:00 committed by Alexei Starovoitov
parent 12cc126df8
commit 2fe8890848

View File

@ -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