selftests/bpf: Verify that sync_linked_regs preserves subreg_def
authorEduard Zingerman <eddyz87@gmail.com>
Tue, 24 Sep 2024 21:08:44 +0000 (14:08 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 1 Oct 2024 15:19:04 +0000 (17:19 +0200)
commita41b3828ec056a631ad22413d4560017fed5c3bd
treeb3515f5e853b9d52181baad893184849c2a182a7
parente9bd9c498cb0f5843996dbe5cbce7a1836a83c70
selftests/bpf: Verify that sync_linked_regs preserves subreg_def

This test was added because of a bug in verifier.c:sync_linked_regs(),
upon range propagation it destroyed subreg_def marks for registers.
The test is written in a way to return an upper half of a register
that is affected by range propagation and must have it's subreg_def
preserved. This gives a return value of 0 and leads to undefined
return value if subreg_def mark is not preserved.

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20240924210844.1758441-2-eddyz87@gmail.com
tools/testing/selftests/bpf/progs/verifier_scalar_ids.c