Merge branch 'selftests-bpf-fix-tests-for-llvm23-true-signature' Yonghong Song says: ==================== selftests/bpf: Fix tests for llvm23 true signature LLVM23 ([1]) records the 'true' function signature in BTF, i.e. the signature inferred after optimization rather than the one written in C. This caused two kinds of selftest failures (see below). Case 1: keep int return type for tailcall subprogs The verifier requires any subprog that issues a bpf_tail_call to return an 'int' (see check_btf_func() in kernel/bpf/check_btf.c, which rejects it with "tail_call is only allowed in functions that return 'int'"). Several tailcall subprogs do 'return 0' (or another constant) whose result no caller uses. With llvm23 the compiler folds the constant and, since the return value is dead, optimizes the subprog to effectively return 'void' and records 'void' in BTF, so the program fails to load. Use barrier_var() and __sink() to prevent returned value from being optimized. Case 2: adjust tracing prog ctx layout for the true signature test_pkt_access_subprog2() has an unused argument that llvm optimizes away. Before llvm23 the BTF signature did not match the optimized assembly, so the verifier fell back to MAX_BPF_FUNC_REG_ARGS (5) u64 arguments and the fexit return value sat after args[5]. With llvm23 the true signature has a single argument, so the return value moves to the slot after args[1]. Select the matching ctx struct based on __clang_major__ so the test works with both old and new llvm. [1] https://github.com/llvm/llvm-project/pull/198426 Changelogs: v1 -> v2: - v1: https://lore.kernel.org/bpf/20260609163947.1717694-1-yonghong.song@linux.dev/ - Do not use bpf array map or bpf global var. Use __sink() instead. ==================== Link: https://patch.msgid.link/20260609233402.2711071-1-yonghong.song@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>