bpf: compile out btf_parse_module() if module BTF is not enabled
Subsystems (3)
Andrii Nakryiko
maintainerPATCH 1/1 bpf: compile out btf_parse_module() if module BTF is not enabled
Make sure btf_parse_module() is compiled out if module BTFs are not enabled.
Reported-by Stephen Rothwell <[email protected]>
Fixes 36e68442d1af ("bpf: Load and verify kernel module BTFs")
Signed-off-by Andrii Nakryiko <[email protected]>
--- kernel/bpf/btf.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/bpf/btf.c +4 -0
@@ -4478,6 +4478,8 @@ struct btf *btf_parse_vmlinux(void)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) {struct btf_verifier_env *env =NULL ;
@@ -4547,6 +4549,8 @@ static struct btf *btf_parse_module(const char *module_name, const void *data, u return ERR_PTR(err); } +#endif /* CONFIG_DEBUG_INFO_BTF_MODULES */ +struct btf *bpf_prog_get_target_btf (const struct bpf_prog *prog) {struct bpf_prog *tgt_prog = prog->aux->dst_prog;
Signature · 1 line
2.24.1
Alexei Starovoitov
AppliedQuoted 6 lines · Andrii Nakryiko
Make sure
btf_parse_module()is compiled out if module BTFs are not enabled.Reported-by Stephen Rothwell <[email protected]>Fixes 36e68442d1af ("bpf: Load and verify kernel module BTFs")Signed-off-by Andrii Nakryiko <[email protected]>
Applied. Thanks for quick fix.