The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH bpf-next] bpf: Fix bpf_arena_handle_page_fault() redefinition without CONFIG_BPF_SYSCALL
@ 2026-05-27 19:26 Tejun Heo
  2026-05-27 19:54 ` Song Liu
  2026-05-27 21:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Tejun Heo @ 2026-05-27 19:26 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, bpf
  Cc: John Fastabend, Martin KaFai Lau, Eduard Zingerman, Song Liu,
	Yonghong Song, Jiri Olsa, Kumar Kartikeya Dwivedi,
	Emil Tsalapatis, Mark Brown, linux-kernel

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.

Fixes: dc11a4dba246 ("bpf: Recover arena kernel faults with scratch page")
Reported-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
---
 kernel/bpf/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c
index 8ecba2989d88..a656a8572bdb 100644
--- a/kernel/bpf/core.c
+++ b/kernel/bpf/core.c
@@ -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;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] bpf: Fix bpf_arena_handle_page_fault() redefinition without CONFIG_BPF_SYSCALL
  2026-05-27 19:26 [PATCH bpf-next] bpf: Fix bpf_arena_handle_page_fault() redefinition without CONFIG_BPF_SYSCALL Tejun Heo
@ 2026-05-27 19:54 ` Song Liu
  2026-05-27 21:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Song Liu @ 2026-05-27 19:54 UTC (permalink / raw)
  To: Tejun Heo
  Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko, bpf,
	John Fastabend, Martin KaFai Lau, Eduard Zingerman, Yonghong Song,
	Jiri Olsa, Kumar Kartikeya Dwivedi, Emil Tsalapatis, Mark Brown,
	linux-kernel

On Wed, May 27, 2026 at 12:26 PM Tejun Heo <tj@kernel.org> wrote:
>
> 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.
>
> Fixes: dc11a4dba246 ("bpf: Recover arena kernel faults with scratch page")
> Reported-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Tejun Heo <tj@kernel.org>

Acked-by: Song Liu <song@kernel.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] bpf: Fix bpf_arena_handle_page_fault() redefinition without CONFIG_BPF_SYSCALL
  2026-05-27 19:26 [PATCH bpf-next] bpf: Fix bpf_arena_handle_page_fault() redefinition without CONFIG_BPF_SYSCALL Tejun Heo
  2026-05-27 19:54 ` Song Liu
@ 2026-05-27 21:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-05-27 21:00 UTC (permalink / raw)
  To: Tejun Heo
  Cc: ast, daniel, andrii, bpf, john.fastabend, martin.lau, eddyz87,
	song, yonghong.song, jolsa, memxor, emil, broonie, linux-kernel

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:

On Wed, 27 May 2026 09:26:32 -1000 you wrote:
> 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.
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-27 21:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-27 19:26 [PATCH bpf-next] bpf: Fix bpf_arena_handle_page_fault() redefinition without CONFIG_BPF_SYSCALL Tejun Heo
2026-05-27 19:54 ` Song Liu
2026-05-27 21:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox