linux-stable/tools
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
..
accounting
arch x86/cpufeatures: Assign dedicated feature word for CPUID_0x8000001F[EAX] 2021-01-28 17:41:24 +01:00
bootconfig tools/bootconfig: Add tracing_on support to helper scripts 2021-01-14 10:32:20 -05:00
bpf tools/runqslower: Allow substituting custom vmlinux.h for the build 2021-03-02 20:14:02 -08:00
build tools: Factor Clang, LLC and LLVM utils definitions 2021-01-29 01:25:34 +01:00
cgroup
debugging docs: Update documentation to reflect what TAINT_CPU_OUT_OF_SPEC means 2020-12-08 10:53:58 -07:00
edid
firewire
firmware
gpio tools: gpio: fix %llu warning in gpio-watch.c 2021-01-18 10:05:35 +01:00
hv
iio
include bpf: Add bpf_for_each_map_elem() helper 2021-02-26 13:23:52 -08:00
io_uring
kvm/kvm_stat tools/kvm_stat: Exempt time-based counters 2020-12-11 19:18:51 -05:00
laptop
leds
lib libbpf: Support subprog address relocation 2021-02-26 13:23:52 -08:00
memory-model tools/memory-model: Fix typo in klitmus7 compatibility table 2021-01-04 14:40:50 -08:00
objtool static_call: Allow module use without exposing static_call_key 2021-02-17 14:12:42 +01:00
pci
pcmcia
perf Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2021-02-16 13:14:06 -08:00
power ACPI updates for 5.12-rc1 2021-02-20 21:50:59 -08:00
scripts tools: Factor Clang, LLC and LLVM utils definitions 2021-01-29 01:25:34 +01:00
spi
testing selftests/bpf: Add a verifier scale test with unknown bounded loop 2021-03-04 16:44:00 +01:00
thermal/tmon
time
usb
virtio tools/virtio: add barrier for aarch64 2020-12-18 16:14:30 -05:00
vm
wmi
Makefile