mbox series

[bpf-next,00/13] bpf/tests: Extend JIT test suite coverage

Message ID 20210902185229.1840281-1-johan.almbladh@anyfinetworks.com (mailing list archive)
Headers show
Series bpf/tests: Extend JIT test suite coverage | expand

Message

Johan Almbladh Sept. 2, 2021, 6:52 p.m. UTC
This patch set adds a number of new tests to the test_bpf.ko test suite.
The tests are intended to verify the correctness of eBPF JITs.

In cases when it is feasible to test all possible values exhaustively, for
example every legal ALU shift value, so is done. In other cases, a pattern
of operand values that are likely to trigger different JIT code paths are
tested. For example, instructions with two 64-bit operands are tested with
every power-of-two value combination, with some small pertubations added.

Some tests might seem a bit artificial. However this patch set, as well
as my other recent additions to test suite, is essentially a bi-product of
my work implementing a JIT for 32-bit MIPS. The tests exercise mechanisms
and aspects that I encountered during JIT development, and that I found to
be non-trivial to implement correctly.

Johan

Johan Almbladh (13):
  bpf/tests: Allow different number of runs per test case
  bpf/tests: Reduce memory footprint of test suite
  bpf/tests: Add exhaustive tests of ALU shift values
  bpf/tests: Add exhaustive tests of ALU operand magnitudes
  bpf/tests: Add exhaustive tests of JMP operand magnitudes
  bpf/tests: Add staggered JMP and JMP32 tests
  bpf/tests: Add exhaustive test of LD_IMM64 immediate magnitudes
  bpf/tests: Add test case flag for verifier zero-extension
  bpf/tests: Add JMP tests with small offsets
  bpf/tests: Add JMP tests with degenerate conditional
  bpf/tests: Expand branch conversion JIT test
  bpf/tests: Add more BPF_END byte order conversion tests
  bpf/tests: Add tail call limit test with external function call

 lib/test_bpf.c | 3314 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 3272 insertions(+), 42 deletions(-)