selftests/bpf: precision tracking test for BPF_NEG and BPF_END
authorShung-Hsi Yu <shung-hsi.yu@suse.com>
Thu, 2 Nov 2023 05:39:05 +0000 (13:39 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 2 Nov 2023 05:54:28 +0000 (22:54 -0700)
commit3c41971550f58f2e006c58aa71e8c23ad312110f
tree168c8cc8161f049ccfa8fb6f39ff3f6a0d8454bf
parent291d044fd51f8484066300ee42afecf8c8db7b3a
selftests/bpf: precision tracking test for BPF_NEG and BPF_END

As seen from previous commit that fix backtracking for BPF_ALU | BPF_TO_BE
| BPF_END, both BPF_NEG and BPF_END require special handling. Add tests
written with inline assembly to check that the verifier does not incorrecly
use the src_reg field of BPF_NEG and BPF_END (including bswap added in v4).

Suggested-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Link: https://lore.kernel.org/r/20231102053913.12004-4-shung-hsi.yu@suse.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/verifier.c
tools/testing/selftests/bpf/progs/verifier_precision.c [new file with mode: 0644]