linux-stable/tools/testing/selftests
Yonghong Song 86a35af628 selftests/bpf: Add a verifier scale test with unknown bounded loop
The original bcc pull request https://github.com/iovisor/bcc/pull/3270 exposed
a verifier failure with Clang 12/13 while Clang 4 works fine.

Further investigation exposed two issues:

  Issue 1: LLVM may generate code which uses less refined value. The issue is
           fixed in LLVM patch: https://reviews.llvm.org/D97479

  Issue 2: Spills with initial value 0 are marked as precise which makes later
           state pruning less effective. This is my rough initial analysis and
           further investigation is needed to find how to improve verifier
           pruning in such cases.

With the above LLVM patch, for the new loop6.c test, which has smaller loop
bound compared to original test, I got:

  $ test_progs -s -n 10/16
  ...
  stack depth 64
  processed 390735 insns (limit 1000000) max_states_per_insn 87
      total_states 8658 peak_states 964 mark_read 6
  #10/16 loop6.o:OK

Use the original loop bound, i.e., commenting out "#define WORKAROUND", I got:

  $ test_progs -s -n 10/16
  ...
  BPF program is too large. Processed 1000001 insn
  stack depth 64
  processed 1000001 insns (limit 1000000) max_states_per_insn 91
      total_states 23176 peak_states 5069 mark_read 6
  ...
  #10/16 loop6.o:FAIL

The purpose of this patch is to provide a regression test for the above LLVM fix
and also provide a test case for further analyzing the verifier pruning issue.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Zhenwei Pi <pizhenwei@bytedance.com>
Link: https://lore.kernel.org/bpf/20210226223810.236472-1-yhs@fb.com
2021-03-04 16:44:00 +01:00
..
arm64 arm64: selftests: Fix spelling of 'Mismatch' 2021-01-15 10:05:27 +00:00
bpf selftests/bpf: Add a verifier scale test with unknown bounded loop 2021-03-04 16:44:00 +01:00
breakpoints selftests: breakpoints: do not use ksft_exit_skip after ksft_set_plan 2020-07-06 15:47:48 -06:00
capabilities
cgroup selftests/cgroup: Fix build on older distros 2020-11-10 15:13:25 -07:00
clone3 selftests/clone3: Fix build error 2020-12-07 14:34:55 -07:00
core selftests/core: add regression test for CLOSE_RANGE_UNSHARE | CLOSE_RANGE_CLOEXEC 2020-12-19 16:23:19 +01:00
cpu-hotplug
cpufreq
dma dma-mapping: benchmark: use u8 for reserved field in uAPI structure 2021-02-05 12:48:46 +01:00
dmabuf-heaps
drivers selftests: netdevsim: Test route offload failure notifications 2021-02-08 16:47:03 -08:00
efivarfs
exec tools/testing/selftests: add self-test for verifying load alignment 2020-10-16 11:11:21 -07:00
filesystems selftests/filesystems: expand epoll with epoll_pwait2 2020-12-19 11:18:38 -08:00
firmware linux-kselftest-next-5.10-rc1 2020-10-15 15:14:32 -07:00
fpu selftests/fpu: Add an FPU selftest 2020-06-29 10:02:23 +02:00
ftrace selftests/ftrace: check for do_sys_openat2 in user-memory test 2020-10-27 16:45:51 -06:00
futex
gpio selftests/gpio: Add to CLEAN rule rather than overriding 2020-11-10 14:40:13 -07:00
ia64
intel_pstate selftests: intel_pstate: ftime() is deprecated 2020-11-10 14:41:32 -07:00
ipc
ir
kcmp
kexec
kmod selftests: kmod: use variable NAME in kmod_test_0001() 2020-08-12 10:58:01 -07:00
kselftest tweewide: Fix most Shebang lines 2020-12-08 23:30:04 +09:00
kvm KVM: selftests: Implement perf_test_util more conventionally 2021-01-07 18:07:31 -05:00
lib lib: make a test module with set/clear bit 2020-06-04 19:06:25 -07:00
livepatch selftests/livepatch: Do not check order when using "comm" for dmesg checking 2020-08-27 15:27:24 +02:00
lkdtm powerpc updates for 5.11 2020-12-17 13:34:25 -08:00
locking
media_tests
membarrier
memfd selftests/memfd: Fix implicit declaration warnings 2020-11-10 14:42:04 -07:00
memory-hotplug
mincore selftests: add mincore() tests 2020-08-07 11:33:27 -07:00
mount selftests: mount: add nosymfollow tests 2020-08-27 16:06:47 -04:00
mqueue
nci selftests: Add nci suite 2021-01-29 18:03:33 -08:00
net net: re-solve some conflicts after net -> net-next merge 2021-02-16 23:12:23 -08:00
netfilter selftests: netfilter: fix current year 2021-02-04 00:33:09 +01:00
nsfs
ntb NTB: ntb_test: Fix bug when counting remote files 2020-06-05 20:02:09 -04:00
openat2 selftests: openat2: add RESOLVE_ conflict test 2020-12-03 10:16:28 +01:00
pid_namespace selftests: Remove unneeded selftest API headers 2020-07-06 15:59:07 -06:00
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: Only test lwm/stmw on big endian 2021-01-20 11:49:55 +11:00
prctl
proc selftests: proc: fix warning: _GNU_SOURCE redefined 2020-11-05 10:08:14 -07:00
pstore
ptp testptp: add new options for perout phase and pulse width 2020-07-20 18:04:59 -07:00
ptrace selftests: Add missing gitignore entries 2020-09-23 10:19:25 -06:00
rcutorture Merge branch 'for-mingo-nolibc' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into core/rcu 2021-02-12 12:59:14 +01:00
resctrl
rseq rseq/selftests: Fix MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ build error under other arch. 2020-12-07 14:09:45 -07:00
rtc
safesetid
seccomp selftests/seccomp: Update kernel config 2020-12-02 11:20:54 -08:00
sgx selftests/sgx: Use a statically generated 3072-bit RSA key 2020-11-18 18:26:00 +01:00
sigaltstack selftests: sigaltstack: do not use ksft_exit_skip after ksft_set_plan 2020-07-06 15:57:15 -06:00
size
sparc64
splice selftests: splice: Check behavior of full and short splices 2020-08-07 10:50:11 -07:00
static_keys
sync selftests: sync_test: do not use ksft_exit_skip after ksft_set_plan 2020-07-06 15:57:28 -06:00
syscall_user_dispatch entry: Use different define for selector variable in SUD 2021-02-06 00:21:42 +01:00
sysctl linux-kselftest-5.8-rc1 2020-06-09 10:03:12 -07:00
tc-testing Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2021-02-16 13:14:06 -08:00
timens selftests/timens: added selftest for /proc/stat btime 2020-11-03 11:05:40 +01:00
timers selftests/timers: Turn off timeout setting 2020-08-20 15:49:28 -06:00
tmpfs
tpm2 selftests: tpm: upgrade TPM2 tests from Python 2 to Python 3 2020-07-06 14:20:35 -06:00
uevent selftests: Remove unneeded selftest API headers 2020-07-06 15:59:07 -06:00
user
vDSO selftests/vDSO: fix -Wformat warning in vdso_test_correctness 2021-01-04 09:25:45 -07:00
vm selftests/vm: rename file run_vmtests to run_vmtests.sh 2021-02-09 17:26:44 -08:00
watchdog
wireguard Compiler Attributes: remove CONFIG_ENABLE_MUST_CHECK 2020-12-02 13:47:17 +01:00
x86 selftests/x86: Use __builtin_ia32_read/writeeflags 2021-01-12 12:31:28 +01:00
zram
.gitignore
Makefile selftests: Add nci suite 2021-01-29 18:03:33 -08:00
gen_kselftest_tar.sh
kselftest.h linux-kselftest-5.9-rc1 2020-08-05 10:28:25 -07:00
kselftest_deps.sh
kselftest_harness.h linux-kselftest-fixes-5.10-rc3 2020-11-06 15:42:42 -08:00
kselftest_install.sh
kselftest_module.h
lib.mk selftests: filter kselftest headers from command in lib.mk 2020-10-27 16:51:06 -06:00
run_kselftest.sh selftests/run_kselftest.sh: fix dry-run typo 2020-11-10 14:51:39 -07:00