Skip to content

Commit 6bdacdb

Browse files
committed
bpf: Fix BPF_JIT kconfig symbol dependency
Randy reported a randconfig build error recently on i386: ld: arch/x86/net/bpf_jit_comp32.o: in function `do_jit': bpf_jit_comp32.c:(.text+0x28c9): undefined reference to `__bpf_call_base' ld: arch/x86/net/bpf_jit_comp32.o: in function `bpf_int_jit_compile': bpf_jit_comp32.c:(.text+0x3694): undefined reference to `bpf_jit_blind_constants' ld: bpf_jit_comp32.c:(.text+0x3719): undefined reference to `bpf_jit_binary_free' ld: bpf_jit_comp32.c:(.text+0x3745): undefined reference to `bpf_jit_binary_alloc' ld: bpf_jit_comp32.c:(.text+0x37d3): undefined reference to `bpf_jit_prog_release_other' [...] The cause was that b24abcf ("bpf, kconfig: Add consolidated menu entry for bpf with core options") moved BPF_JIT from net/Kconfig into kernel/bpf/Kconfig and previously BPF_JIT was guarded by a 'if NET'. However, there is no actual dependency on NET, it's just that menuconfig NET selects BPF. And the latter in turn causes kernel/bpf/core.o to be built which contains above symbols. Randy's randconfig didn't have NET set, and BPF wasn't either, but BPF_JIT otoh was. Detangle this by making BPF_JIT depend on BPF instead. arm64 was the only arch that pulled in its JIT in net/ via obj-$(CONFIG_NET), all others unconditionally pull this dir in via obj-y. Do the same since CONFIG_NET guard there is really useless as we compiled the JIT via obj-$(CONFIG_BPF_JIT) += bpf_jit_comp.o anyway. Fixes: b24abcf ("bpf, kconfig: Add consolidated menu entry for bpf with core options") Reported-by: Randy Dunlap <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Randy Dunlap <[email protected]> Tested-by: Randy Dunlap <[email protected]>
1 parent 440c324 commit 6bdacdb

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

arch/arm64/Kbuild

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# SPDX-License-Identifier: GPL-2.0-only
2-
obj-y += kernel/ mm/
3-
obj-$(CONFIG_NET) += net/
2+
obj-y += kernel/ mm/ net/
43
obj-$(CONFIG_KVM) += kvm/
54
obj-$(CONFIG_XEN) += xen/
65
obj-$(CONFIG_CRYPTO) += crypto/

kernel/bpf/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ config BPF_SYSCALL
3737

3838
config BPF_JIT
3939
bool "Enable BPF Just In Time compiler"
40+
depends on BPF
4041
depends on HAVE_CBPF_JIT || HAVE_EBPF_JIT
4142
depends on MODULES
4243
help

0 commit comments

Comments
 (0)