]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: Add test for stack arg read without caller write
authorYonghong Song <yonghong.song@linux.dev>
Fri, 15 May 2026 22:50:45 +0000 (15:50 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 17 May 2026 00:46:16 +0000 (17:46 -0700)
commitef1b54e0db671a161887475ef70cd570cbb2a6ab
tree2db628686a3943c2e7c555e08f2c750edcb30af2
parent4286f5deee14b26a9f0447b566d4c7cb7e2e2702
selftests/bpf: Add test for stack arg read without caller write

Add negative tests for the outgoing stack arg validation.
A static subprog with a 'long *' arg causes
btf_prepare_func_args() to fail after setting arg_cnt. The
validation ensures check_outgoing_stack_args() still runs.

Also update two existing tests (release_ref, stale_pkt_ptr) whose
expected error messages changed: invalidated stack arg slots are now
caught by check_outgoing_stack_args() at the call site instead of
at the callee's dereference.

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20260515225045.822104-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/btf__verifier_stack_arg_order.c
tools/testing/selftests/bpf/progs/verifier_stack_arg.c
tools/testing/selftests/bpf/progs/verifier_stack_arg_order.c