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

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
3376{3376{
3377 return 0;3377 return 0;
3378}3378}
3379
3380#ifdef CONFIG_BPF_SYSCALL
3379__weak bool bpf_arena_handle_page_fault(unsigned long addr, bool is_write,3381__weak bool bpf_arena_handle_page_fault(unsigned long addr, bool is_write,
3380 unsigned long fault_ip)3382 unsigned long fault_ip)
3381{3383{
3382 return false;3384 return false;
3383}3385}
3384 3386
3385#ifdef CONFIG_BPF_SYSCALL
3386static int __init bpf_global_ma_init(void)3387static int __init bpf_global_ma_init(void)
3387{3388{
3388 int ret;3389 int ret;