History

bpf: Fix bpf_arena_handle_page_fault() redefinition without CONFIG_BPF_SYSCALL

On configs with CONFIG_BPF=y but CONFIG_BPF_SYSCALL=n (e.g. arm multi_v7_defconfig), kernel/bpf/core.c defines a __weak bpf_arena_handle_page_fault() while bpf_defs.h already supplies a static inline stub for it, causing a redefinition error. Build the __weak definition only under CONFIG_BPF_SYSCALL, matching the bpf_defs.h declaration and the CONFIG_BPF_SYSCALL-gated strong definition in arena.c.

Tejun Heo committed 5 months ago

Commit e42e53a1 parent 8496d901 file · +2 −1Browse files

Showing the changes to kernel (1 of 1 file). Show all

Unified · Split

kernel/bpf/core.c+2−1
@@ -3376,13 +3376,14 @@ __weak u64 bpf_arena_get_kern_vm_start(struct bpf_arena *arena) · 3375 unmodified lines
33763376 {
33773377 return 0;
33783378 }
3379+
3380+#ifdef CONFIG_BPF_SYSCALL
33793381 __weak bool bpf_arena_handle_page_fault(unsigned long addr, bool is_write,
33803382 unsigned long fault_ip)
33813383 {
33823384 return false;
33833385 }
33843386
3385−#ifdef CONFIG_BPF_SYSCALL
33863387 static int __init bpf_global_ma_init(void)
33873388 {
33883389 int ret;