提交 3f5caa2f 编写于 作者: A Andrii Nakryiko 提交者: Zheng Zengkai

bpf: Compile out btf_parse_module() if module BTF is not enabled

mainline inclusion
from mainline-5.11-rc1
commit 7112d127
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=7112d127984bd7b0c8ded7973b358829f16735f5

-------------------------------------------------

Make sure btf_parse_module() is compiled out if module BTFs are not enabled.

Fixes: 36e68442 ("bpf: Load and verify kernel module BTFs")
Reported-by: NStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20201111040645.903494-1-andrii@kernel.org
(cherry picked from commit 7112d127)
Signed-off-by: NWang Yufen <wangyufen@huawei.com>
上级 185ffad1
...@@ -4477,6 +4477,8 @@ struct btf *btf_parse_vmlinux(void) ...@@ -4477,6 +4477,8 @@ struct btf *btf_parse_vmlinux(void)
return ERR_PTR(err); return ERR_PTR(err);
} }
#ifdef CONFIG_DEBUG_INFO_BTF_MODULES
static struct btf *btf_parse_module(const char *module_name, const void *data, unsigned int data_size) static struct btf *btf_parse_module(const char *module_name, const void *data, unsigned int data_size)
{ {
struct btf_verifier_env *env = NULL; struct btf_verifier_env *env = NULL;
...@@ -4546,6 +4548,8 @@ static struct btf *btf_parse_module(const char *module_name, const void *data, u ...@@ -4546,6 +4548,8 @@ static struct btf *btf_parse_module(const char *module_name, const void *data, u
return ERR_PTR(err); return ERR_PTR(err);
} }
#endif /* CONFIG_DEBUG_INFO_BTF_MODULES */
struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog) struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog)
{ {
struct bpf_prog *tgt_prog = prog->aux->dst_prog; struct bpf_prog *tgt_prog = prog->aux->dst_prog;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册