linux-stable/tools/testing/selftests
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
..
arm64 selftests: arm64: Factor out utility functions for assembly FP tests 2021-10-21 11:11:27 +01:00
bpf bpf: Add selftests to cover packet access corner cases 2021-12-08 15:42:26 +01:00
breakpoints selftests: breakpoints: Use correct error messages in breakpoint_test_arm64.c 2021-02-08 17:04:41 -07:00
capabilities
cgroup tests/cgroup: test cgroup.kill 2021-05-10 10:41:11 -04:00
clone3 selftests/clone3: Fix build error 2020-12-07 14:34:55 -07:00
core selftests/core: fix conflicting types compile error for close_range() 2021-10-29 13:09:42 -06:00
cpu-hotplug
cpufreq selftests/cpufreq: Rename DEBUG_PI_LIST to DEBUG_PLIST 2021-08-31 11:00:02 -06:00
damon selftests/damon: support watermarks 2021-11-06 13:30:45 -07:00
dma dma-mapping: benchmark: Add support for multi-pages map/unmap 2021-04-02 16:41:08 +02:00
dmabuf-heaps kselftests: dmabuf-heaps: Add extra checking that allocated buffers are zeroed 2021-02-08 16:25:53 -07:00
drivers selftests: mlxsw: Test offloadability of root TBF 2021-10-28 19:47:49 -07:00
efivarfs
exec tools/testing/selftests/exec: fix link error 2021-05-22 15:09:07 -10:00
filesystems selftests/binderfs: add test for feature files 2021-07-21 13:46:36 +02:00
firmware selftests: firmware: Fix ignored return val of asprintf() warn 2021-07-21 16:11:42 +02:00
fpu
ftrace s390 updates for the 5.16 merge window 2021-11-06 14:48:06 -07:00
futex selftests: futex: Test sys_futex_waitv() wouldblock 2021-10-07 13:51:12 +02:00
gpio selftests: gpio: update .gitignore 2021-03-08 11:59:16 +01:00
ia64
intel_pstate selftests: intel_pstate: ftime() is deprecated 2020-11-10 14:41:32 -07:00
ipc selftests/ipc: remove unneeded semicolon 2021-02-08 16:32:43 -07:00
ir
kcmp
kexec
kmod
kselftest selftests/kselftest/runner/run_one(): allow running non-executable files 2021-11-09 10:02:53 -08:00
kvm linux-kselftest-next-5.16-rc1 2021-11-02 22:00:17 -07:00
landlock landlock: Enable user space to infer supported features 2021-04-22 12:22:11 -07:00
lib selftests: lib: Add wrapper script for test_scanf 2021-05-19 15:05:11 +02:00
livepatch
lkdtm lkdtm/bugs: Check that a per-task stack canary exists 2021-10-25 09:13:46 +02:00
locking
media_tests
membarrier
memfd selftests/memfd: remove unused variable 2021-09-08 11:50:28 -07:00
memory-hotplug mm/memory_hotplug: remove CONFIG_MEMORY_HOTPLUG_SPARSE 2021-11-06 13:30:42 -07:00
mincore selftests: remove duplicate include 2021-05-07 00:26:33 -07:00
mount
mount_setattr tests: test MOUNT_ATTR_NOSYMFOLLOW with mount_setattr() 2021-06-01 15:06:51 +02:00
move_mount_set_group tests: add move_mount(MOVE_MOUNT_SET_GROUP) selftest 2021-07-26 14:45:19 +02:00
mqueue
nci selftests: nci: replace unsigned int with int 2021-09-16 13:55:51 +01:00
net selftests: add a test case for mirred egress to ingress 2021-11-16 19:17:38 -08:00
netfilter selftests: netfilter: remove stray bash debug line 2021-10-14 23:08:35 +02:00
nsfs
ntb
openat2 selftests: openat2: Fix testing failure for O_LARGEFILE flag 2021-08-25 13:46:13 -06:00
perf_events signal: Deliver all of the siginfo perf data in _perf 2021-05-18 16:20:54 -05:00
pid_namespace
pidfd selftests: pidfd: drop needless linux/kcmp.h inclusion in pidfd_setns_test.c 2020-10-27 17:04:01 -06:00
powerpc selftests/powerpc: Use date instead of EPOCHSECONDS in mitigation-patching.sh 2021-10-27 22:34:02 +11:00
prctl
proc procfs: do not list TID 0 in /proc/<pid>/task 2021-11-09 10:02:48 -08:00
pstore
ptp
ptrace selftests: Add missing gitignore entries 2020-09-23 10:19:25 -06:00
rcutorture torture: Make kvm-remote.sh print size of downloaded tarball 2021-09-16 10:32:35 -07:00
resctrl selftests/resctrl: Fix incorrect parsing of option "-t" 2021-06-07 18:38:58 -06:00
rlimits kselftests: Add test to check for rlimit changes in different user namespaces 2021-04-30 14:14:03 -05:00
rseq rseq/selftests: Fix MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ build error under other arch. 2020-12-07 14:09:45 -07:00
rtc
safesetid selftests: safesetid: Fix spelling mistake "cant" -> "can't" 2021-08-26 15:15:24 -06:00
sched kselftests/sched: cleanup the child processes 2021-10-05 15:51:43 +02:00
seccomp selftests/seccomp: Use __BYTE_ORDER__ 2021-10-25 20:39:42 -07:00
sgx selftests/sgx: Fix Q1 and Q2 calculation in sigstruct.c 2021-07-30 17:20:01 -06:00
sigaltstack selftest/sigaltstack: Use the AT_MINSIGSTKSZ aux vector if available 2021-05-19 12:38:17 +02:00
size
sparc64
splice selftests: splice: Adjust for handler fallback removal 2021-06-07 18:39:43 -06:00
static_keys
sync selftests/sync: Remove the deprecated config SYNC 2021-08-31 10:58:00 -06:00
syscall_user_dispatch entry: Use different define for selector variable in SUD 2021-02-06 00:21:42 +01:00
sysctl
tc-testing tc-testing: Add control-plane selftests for sch_mq 2021-08-04 12:42:27 +01:00
timens selftests/timens: Fix gettime_perf to work on powerpc 2021-04-21 22:52:32 +10:00
timers selftests: timers: rtcpie: skip test if default RTC device does not exist 2021-06-07 19:18:52 -06:00
tmpfs
tpm2
uevent
user
vDSO selftests/vDSO: fix ABI selftest on riscv 2021-02-08 16:38:34 -07:00
vm selftests/vm: make MADV_POPULATE_(READ|WRITE) use in-tree headers 2021-11-06 13:30:42 -07:00
watchdog
wireguard wireguard: selftests: make sure rp_filter is disabled on vethc 2021-06-04 14:25:14 -07:00
x86 linux-kselftest-next-5.16-rc1 2021-11-02 22:00:17 -07:00
zram
.gitignore
gen_kselftest_tar.sh
kselftest.h
kselftest_deps.sh selftests: remove obsolete gpio references from kselftest_deps.sh 2021-02-15 11:43:28 +01:00
kselftest_harness.h selftests: kselftest_harness.h: partially fix kernel-doc markups 2021-01-21 14:06:00 -07:00
kselftest_install.sh
kselftest_module.h kselftest: add support for skipped tests 2021-02-15 11:07:42 +01:00
lib.mk selftests: be sure to make khdr before other targets 2021-09-15 10:34:21 -06:00
Makefile Core: 2021-08-31 16:43:06 -07:00
run_kselftest.sh selftests/run_kselftest.sh: fix dry-run typo 2020-11-10 14:51:39 -07:00