bpf: Fix bpf_arena_handle_page_fault() redefinition without CONFIG_BPF_SYSCALL
PATCH 1/1 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.
--- kernel/bpf/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/bpf/core.c +2 -1
@@ -3376,13 +3376,14 @@ __weak u64 bpf_arena_get_kern_vm_start(struct bpf_arena *arena) {return 0 ; } + +#ifdef CONFIG_BPF_SYSCALL __weak bool bpf_arena_handle_page_fault (unsigned long addr,bool is_write,unsigned long fault_ip) {return false; } -#ifdef CONFIG_BPF_SYSCALL static int __init bpf_global_ma_init (void ) {int ret;
Quoted 11 lines · Tejun Heo
On configs with
CONFIG_BPF=ybutCONFIG_BPF_SYSCALL=n(e.g. armmulti_v7_defconfig),kernel/bpf/core.cdefines a__weakbpf_arena_handle_page_fault()whilebpf_defs.halready supplies a static inline stub for it, causing a redefinition error. Build the__weakdefinition only underCONFIG_BPF_SYSCALL, matching thebpf_defs.hdeclaration and the CONFIG_BPF_SYSCALL-gated strong definition inarena.c.Fixes dc11a4dba246 ("bpf: Recover arena kernel faults with scratch page")Reported-by Mark Brown <[email protected]>Signed-off-by Tejun Heo <[email protected]>
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Alexei Starovoitov <[email protected]>:
Quoted 8 lines · On Wed, 27 May 2026 09:26:32 -1000 you wrote:
On configs with
CONFIG_BPF=ybutCONFIG_BPF_SYSCALL=n(e.g. armmulti_v7_defconfig),kernel/bpf/core.cdefines a__weakbpf_arena_handle_page_fault()whilebpf_defs.halready supplies a static inline stub for it, causing a redefinition error. Build the__weakdefinition only underCONFIG_BPF_SYSCALL, matching thebpf_defs.hdeclaration and the CONFIG_BPF_SYSCALL-gated strong definition inarena.c.[...]
Here is the summary with links:
- [bpf-next] bpf: Fix bpf_arena_handle_page_fault() redefinition without CONFIG_BPF_SYSCALL
https://git.kernel.org/bpf/bpf-next/c/e42e53ae23b7
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html