From 3f8bb242622cf12e8c22d63e55164772cbb5c393 Mon Sep 17 00:00:00 2001 From: Andrii Nakryiko Date: Wed, 24 Aug 2022 11:19:50 +0800 Subject: [PATCH] bpf: Keep module's btf_data_size intact after load mainline inclusion from mainline-5.11-rc1 commit 2fe8890848c799515a881502339a0a7b2b555988 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I5EUVD CVE: NA Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2fe8890848c799515a881502339a0a7b2b555988 ------------------------------------------------- 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: 607c543f939d ("bpf: Sanitize BTF data pointer after module is loaded") Signed-off-by: Andrii Nakryiko Signed-off-by: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20201203204634.1325171-3-andrii@kernel.org (cherry picked from commit 2fe8890848c799515a881502339a0a7b2b555988) Signed-off-by: Wang Yufen --- kernel/module.c | 1 - 1 file changed, 1 deletion(-) diff --git a/kernel/module.c b/kernel/module.c index 131162d94ccb..1a7adb5073aa 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -3829,7 +3829,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 -- GitLab