]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: Keep int return type for tailcall subprogs
authorYonghong Song <yonghong.song@linux.dev>
Tue, 9 Jun 2026 23:34:07 +0000 (16:34 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 10 Jun 2026 04:21:15 +0000 (21:21 -0700)
commitbe1d838b88e445fa6edfb9f98af1603cbf2ee94d
tree12c097f7391d6456343e8beb18a093eae32d2802
parentc15261b1bba0bb7921552cdd86c8b0202697a8f9
selftests/bpf: Keep int return type for tailcall subprogs

LLVM23 ([1]) supports 'true' function signature in BTF. The return type
of the caller of a tailcall must be an 'int'. Otherwise, verification will
fail (see check_btf_func() in check_btf.c). So with llvm23, it is possible
that the compiler may change the caller's return type from 'int' to 'void'.
To prevent this, barrier_var() and __sink() are used to avoid returning
a constant prone to be optimized.

  [1] https://github.com/llvm/llvm-project/pull/198426

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20260609233407.2711577-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/tailcall_bpf2bpf2.c
tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy1.c
tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy2.c
tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy3.c
tools/testing/selftests/bpf/progs/tailcall_bpf2bpf_hierarchy_fentry.c
tools/testing/selftests/bpf/progs/verifier_sock.c