]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: Test 32-bit scalar spill pruning in stacksafe()
authorAlexei Starovoitov <ast@kernel.org>
Mon, 23 Mar 2026 02:24:10 +0000 (19:24 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 24 Mar 2026 19:10:38 +0000 (12:10 -0700)
commit7b4f1a29c704f2c28f32dca5fea6d173891c16a9
treeff1a626e259c8f7215c62a4291a9036357b21d58
parent596bef1d718d7a98def7945fad694c3ddbbbfef1
selftests/bpf: Test 32-bit scalar spill pruning in stacksafe()

Add a test verifying that stacksafe() correctly handles 32-bit scalar
spills when comparing stack states for equivalence during state pruning.

A 32-bit scalar spill creates slot[0-3] = STACK_INVALID and
slot[4-7] = STACK_SPILL. Without the im=4 check in stacksafe(), the
STACK_SPILL vs STACK_MISC mismatch at byte 4 causes pruning to fail,
forcing the verifier to re-explore a path that is provably safe.

Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20260323022410.75444-2-alexei.starovoitov@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/verifier_spill_fill.c