linux-stable/tools/testing
Maxim Mikityanskiy b560b21f71 bpf: Add selftests to cover packet access corner cases
This commit adds BPF verifier selftests that cover all corner cases by
packet boundary checks. Specifically, 8-byte packet reads are tested at
the beginning of data and at the beginning of data_meta, using all kinds
of boundary checks (all comparison operators: <, >, <=, >=; both
permutations of operands: data + length compared to end, end compared to
data + length). For each case there are three tests:

1. Length is just enough for an 8-byte read. Length is either 7 or 8,
   depending on the comparison.

2. Length is increased by 1 - should still pass the verifier. These
   cases are useful, because they failed before commit 2fa7d94afc
   ("bpf: Fix the off-by-two error in range markings").

3. Length is decreased by 1 - should be rejected by the verifier.

Some existing tests are just renamed to avoid duplication.

Signed-off-by: Maxim Mikityanskiy <maximmi@nvidia.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20211207081521.41923-1-maximmi@nvidia.com
2021-12-08 15:42:26 +01:00
..
cxl tools/testing/cxl: Introduce a mock memory device + driver 2021-09-21 14:09:34 -07:00
fault-injection
ktest bootconfig/tracing/ktest: Update ktest example for boot-time tracing 2021-08-16 11:39:51 -04:00
kunit kunit: tool: fix typecheck errors about loading qemu configs 2021-10-29 13:05:47 -06:00
nvdimm tools/testing/nvdimm: Fix missing 'fallthrough' warning 2021-08-11 11:55:54 -07:00
radix-tree
scatterlist Merge branch 'akpm' (patches from Andrew) 2021-09-03 10:08:28 -07:00
selftests bpf: Add selftests to cover packet access corner cases 2021-12-08 15:42:26 +01:00
vsock vsock_diag_test: remove free_sock_stat() call in test_no_sockets 2021-10-15 17:21:34 -07:00