selftests/bpf: BPF test_verifier selftests for bpf_loop inlining
authorEduard Zingerman <eddyz87@gmail.com>
Mon, 20 Jun 2022 23:53:43 +0000 (02:53 +0300)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 21 Jun 2022 00:40:51 +0000 (17:40 -0700)
commitf8acfdd04410d26b096a7082444cdc402df10f89
treef3ea7252815a35d68dc4058ff8c7c22b95c06631
parent1ade23711971b0eececf0d7fedc29d3c1d2fce01
selftests/bpf: BPF test_verifier selftests for bpf_loop inlining

A number of test cases for BPF selftests test_verifier to check how
bpf_loop inline transformation rewrites the BPF program. The following
cases are covered:
 - happy path
 - no-rewrite when flags is non-zero
 - no-rewrite when callback is non-constant
 - subprogno in insn_aux is updated correctly when dead sub-programs
   are removed
 - check that correct stack offsets are assigned for spilling of R6-R8
   registers

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Acked-by: Song Liu <songliubraving@fb.com>
Link: https://lore.kernel.org/r/20220620235344.569325-5-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/verifier/bpf_loop_inline.c [new file with mode: 0644]