BPF List
 help / color / mirror / Atom feed
* [PATCH bpf-next] selftests/bpf: Fix bpf_gotox with noipa global func
@ 2026-11-04 21:49 Alexei Starovoitov
  2026-11-05  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Alexei Starovoitov @ 2026-11-04 21:49 UTC (permalink / raw)
  To: bpf; +Cc: daniel, andrii, eddyz87, memxor

From: Alexei Starovoitov <ast@kernel.org>

use_nonstatic_global_other_sec() is an fentry prog, so it has to return 0.
It returns the result of the global function __nonstatic_global(), which
always returns 0.

Before llvm commit 28b4a2032f97 ("[BPF] Mark global functions noipa") the
compiler replaced the result of the call with 0. Now it does not look into
a global function. The verifier does not either:

  11: (85) call pc+1
  Func#1 ('__nonstatic_global') is global and assumed valid.
  12: R0=scalar()
  12: (95) exit
  At program exit the register R0 has unknown scalar value should have been in [0, 0]

The skeleton does not load, and all subtests of bpf_gotox fail. Only the
cpuv4 flavour shows it: the other flavours have no gotox and skip the test.

Ignore the result of the call and return 0.

Commit fdda033f7fb5 ("selftests/bpf: Fix callback recursion test with noipa
global func") fixed the same problem in another test.

Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
 tools/testing/selftests/bpf/progs/bpf_gotox.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/bpf/progs/bpf_gotox.c b/tools/testing/selftests/bpf/progs/bpf_gotox.c
index 99b3c9c9a01c..f3488d7b4b4c 100644
--- a/tools/testing/selftests/bpf/progs/bpf_gotox.c
+++ b/tools/testing/selftests/bpf/progs/bpf_gotox.c
@@ -418,7 +418,8 @@ int use_nonstatic_global_other_sec(void *ctx)
 	if (bpf_get_current_pid_tgid() >> 32 != pid)
 		return 0;
 
-	return __nonstatic_global(in_user);
+	__nonstatic_global(in_user);
+	return 0;
 }
 
 SEC("syscall")
-- 
2.55.0


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

* Re: [PATCH bpf-next] selftests/bpf: Fix bpf_gotox with noipa global func
  2026-11-04 21:49 [PATCH bpf-next] selftests/bpf: Fix bpf_gotox with noipa global func Alexei Starovoitov
@ 2026-11-05  1:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-05  1:30 UTC (permalink / raw)
  To: Alexei Starovoitov; +Cc: bpf, daniel, andrii, eddyz87, memxor

Hello:

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

On Wed,  4 Nov 2026 21:49:12 +0000 you wrote:
> From: Alexei Starovoitov <ast@kernel.org>
> 
> use_nonstatic_global_other_sec() is an fentry prog, so it has to return 0.
> It returns the result of the global function __nonstatic_global(), which
> always returns 0.
> 
> Before llvm commit 28b4a2032f97 ("[BPF] Mark global functions noipa") the
> compiler replaced the result of the call with 0. Now it does not look into
> a global function. The verifier does not either:
> 
> [...]

Here is the summary with links:
  - [bpf-next] selftests/bpf: Fix bpf_gotox with noipa global func
    https://git.kernel.org/bpf/bpf-next/c/327c53dfd6b5

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] 2+ messages in thread

end of thread, other threads:[~2026-11-05  1:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04 21:49 [PATCH bpf-next] selftests/bpf: Fix bpf_gotox with noipa global func Alexei Starovoitov
2026-11-05  1:30 ` 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