]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: Add test for stale bounds on LSM retval context load
authorTristan Madani <tristan@talencesecurity.com>
Mon, 22 Jun 2026 23:01:23 +0000 (23:01 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 23 Jun 2026 00:11:46 +0000 (17:11 -0700)
commit644332f48fc22995d056a3c6ca04dac64a74457b
tree5322db63dbd9c4669c1906c86b294f0ed3f00970
parent5e0b273e0a62cc04ec338c7b502797c66c2ed42a
selftests/bpf: Add test for stale bounds on LSM retval context load

Add a verifier test that catches the stale-bounds issue fixed in the
previous patch. The test sets r6 = 0 to create known bounds, then loads
the LSM hook return value into r6 from the context. Without the fix,
the verifier intersects the retval range with the stale bounds and
incorrectly narrows r6 to a single value, pruning the fall-through
branch as dead code and missing the div-by-zero.

Suggested-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20260622230123.3695446-3-tristmd@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/verifier_lsm.c