selftests/bpf: Check if mark_chain_precision() follows scalar ids
authorEduard Zingerman <eddyz87@gmail.com>
Tue, 13 Jun 2023 15:38:22 +0000 (18:38 +0300)
committerAndrii Nakryiko <andrii@kernel.org>
Tue, 13 Jun 2023 22:14:27 +0000 (15:14 -0700)
commitdec020280373c60d6df48d1954e72dd6c5640282
treefd69b00e46846599204b02a89b16f3838eb0f396
parent904e6ddf4133c52fdb9654c2cd2ad90f320d48b9
selftests/bpf: Check if mark_chain_precision() follows scalar ids

Check __mark_chain_precision() log to verify that scalars with same
IDs are marked as precise. Use several scenarios to test that
precision marks are propagated through:
- registers of scalar type with the same ID within one state;
- registers of scalar type with the same ID cross several states;
- registers of scalar type  with the same ID cross several stack frames;
- stack slot of scalar type with the same ID;
- multiple scalar IDs are tracked independently.

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20230613153824.3324830-3-eddyz87@gmail.com
tools/testing/selftests/bpf/prog_tests/verifier.c
tools/testing/selftests/bpf/progs/verifier_scalar_ids.c [new file with mode: 0644]