]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Make CONFIG_DEBUG_INFO_BTF depend upon CONFIG_BPF_SYSCALL
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Mon, 22 Nov 2021 14:47:40 +0000 (20:17 +0530)
committerAndrii Nakryiko <andrii@kernel.org>
Thu, 2 Dec 2021 21:39:46 +0000 (13:39 -0800)
commit36fdc2d024d04f0524cddde8f10a4b6ff8a87108
tree7265378e4f5c2cb960c01afc816f15de93b66d12
parente167a37a2e6d307e7168c34ff0f709f8f5cc1509
bpf: Make CONFIG_DEBUG_INFO_BTF depend upon CONFIG_BPF_SYSCALL

Vinicius Costa Gomes reported [0] that build fails when
CONFIG_DEBUG_INFO_BTF is enabled and CONFIG_BPF_SYSCALL is disabled.
This leads to btf.c not being compiled, and then no symbol being present
in vmlinux for the declarations in btf.h. Since BTF is not useful
without enabling BPF subsystem, disallow this combination.

However, theoretically disabling both now could still fail, as the
symbol for kfunc_btf_id_list variables is not available. This isn't a
problem as the compiler usually optimizes the whole register/unregister
call, but at lower optimization levels it can fail the build in linking
stage.

Fix that by adding dummy variables so that modules taking address of
them still work, but the whole thing is a noop.

  [0]: https://lore.kernel.org/bpf/20211110205418.332403-1-vinicius.gomes@intel.com

Fixes: 9bf568f41642 ("bpf: btf: Introduce helpers for dynamic BTF set registration")
Reported-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/bpf/20211122144742.477787-2-memxor@gmail.com
include/linux/btf.h
kernel/bpf/btf.c
lib/Kconfig.debug