]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/bpf: Add precision backtracking test for stack arguments
authorYonghong Song <yonghong.song@linux.dev>
Wed, 13 May 2026 04:51:48 +0000 (21:51 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 13 May 2026 16:27:32 +0000 (09:27 -0700)
commit6e277efbb19dd1a536cbffd9ea5c049a427dc7cb
treef648ac03df19d457d855b115a2ddd5a627fdb73c
parent00c3ac4292a6bc3039008cdb45bd423087acb98e
selftests/bpf: Add precision backtracking test for stack arguments

Add a test that verifies precision backtracking works correctly
across BPF-to-BPF calls when stack arguments are involved.

The test passes a size value as incoming stack arg (arg6) to a
subprog, which forwards it as the mem__sz parameter (outgoing arg7)
to bpf_kfunc_call_stack_arg_mem. The expected __msg annotations
verify that precision propagates from the kfunc's mem__sz argument
back through the subprog frame to the caller's outgoing stack arg
store.

A companion BTF file (btf__stack_arg_precision.c) provides named
parameter BTF for the __naked subprog via __btf_func_path.

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20260513045148.2400087-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/stack_arg_precision.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/btf__stack_arg_precision.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/stack_arg_precision.c [new file with mode: 0644]