selftests/bpf: test no_caller_saved_registers spill/fill removal
authorEduard Zingerman <eddyz87@gmail.com>
Mon, 22 Jul 2024 23:38:44 +0000 (16:38 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 29 Jul 2024 22:05:06 +0000 (15:05 -0700)
commitd0ad1f8f8846cffebca55abdd1ed275e276a6754
tree78ca7ff80b11b4d4f68a30979e87b9f5b43c4eee
parentee7fe84468b1732fe65c5af3836437d54ac4c419
selftests/bpf: test no_caller_saved_registers spill/fill removal

Tests for no_caller_saved_registers processing logic
(see verifier.c:match_and_mark_nocsr_pattern()):
- a canary positive test case;
- a canary test case for arm64 and riscv64;
- various tests with broken patterns;
- tests with read/write fixed/varying stack access that violate nocsr
  stack access contract;
- tests with multiple subprograms;
- tests using nocsr in combination with may_goto/bpf_loop,
  as all of these features affect stack depth;
- tests for nocsr stack spills below max stack depth.

Signed-off-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20240722233844.1406874-11-eddyz87@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
tools/testing/selftests/bpf/prog_tests/verifier.c
tools/testing/selftests/bpf/progs/verifier_nocsr.c [new file with mode: 0644]