linux/tools
Paul Chaignon 024cea2d64 selftests/bpf: Avoid simplification of crafted bounds test
The reg_bounds_crafted tests validate the verifier's range analysis
logic. They focus on the actual ranges and thus ignore the tnum. As a
consequence, they carry the assumption that the tested cases can be
reproduced in userspace without using the tnum information.

Unfortunately, the previous change the refinement logic breaks that
assumption for one test case:

  (u64)2147483648 (u32)<op> [4294967294; 0x100000000]

The tested bytecode is shown below. Without our previous improvement, on
the false branch of the condition, R7 is only known to have u64 range
[0xfffffffe; 0x100000000]. With our improvement, and using the tnum
information, we can deduce that R7 equals 0x100000000.

  19: (bc) w0 = w6                ; R6=0x80000000
  20: (bc) w0 = w7                ; R7=scalar(smin=umin=0xfffffffe,smax=umax=0x100000000,smin32=-2,smax32=0,var_off=(0x0; 0x1ffffffff))
  21: (be) if w6 <= w7 goto pc+3  ; R6=0x80000000 R7=0x100000000

R7's tnum is (0; 0x1ffffffff). On the false branch, regs_refine_cond_op
refines R7's u32 range to [0; 0x7fffffff]. Then, __reg32_deduce_bounds
refines the s32 range to 0 using u32 and finally also sets u32=0.
From this, __reg_bound_offset improves the tnum to (0; 0x100000000).
Finally, our previous patch uses this new tnum to deduce that it only
intersect with u64=[0xfffffffe; 0x100000000] in a single value:
0x100000000.

Because the verifier uses the tnum to reach this constant value, the
selftest is unable to reproduce it by only simulating ranges. The
solution implemented in this patch is to change the test case such that
there is more than one overlap value between u64 and the tnum. The max.
u64 value is thus changed from 0x100000000 to 0x300000000.

Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
Link: https://lore.kernel.org/r/50641c6a7ef39520595dcafa605692427c1006ec.1772225741.git.paul.chaignon@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-02-27 16:11:50 -08:00
..
accounting delayacct: fix build regression on accounting tool 2026-02-12 15:45:56 -08:00
arch perf tools changes for v7.0: 2026-02-21 10:51:08 -08:00
bootconfig bootconfig: Check the parsed output of the good examples 2026-02-05 22:21:23 +09:00
bpf resolve_btfids: Fix memory leaks reported by ASAN 2026-02-24 08:19:49 -08:00
build tools build: Fix feature test for rust compiler 2026-02-12 17:45:22 -03:00
certs
cgroup
counter
crypto
debugging kernel-chktaint: add reporting for tainted modules 2026-01-26 19:07:15 -08:00
dma dma-mapping updates for Linux 6.19: 2025-12-06 09:25:05 -08:00
docs tools: sphinx-build-wrapper: improve its help message 2026-02-02 09:57:46 -07:00
firewire
firmware
gpio
hv
iio
include selftests/bpf: Add simple strscpy() implementation 2026-02-23 18:40:07 -08:00
kvm/kvm_stat
laptop
leds
lib perf tools changes for v7.0: 2026-02-21 10:51:08 -08:00
memory-model
mm tools/mm/slabinfo: fix --partial long option mapping 2026-01-20 19:24:43 -08:00
net NFSD 7.0 Release Notes 2026-02-12 08:23:53 -08:00
objtool Rust fixes for v7.0-rc1 2026-02-22 08:43:31 -08:00
pcmcia
perf perf tools changes for v7.0: 2026-02-21 10:51:08 -08:00
power turbostat-2026.02.14-AMD-RAPL-fix 2026-02-18 09:52:38 -08:00
rcu
sched
sched_ext tools/sched_ext: fix getopt not re-parsed on restart 2026-02-20 17:17:38 -10:00
scripts perf test workload: Add code_with_type test workload 2026-02-08 19:16:24 -03:00
sound
spi spi: tools: Add include folder to .gitignore 2026-02-09 12:27:31 +00:00
testing selftests/bpf: Avoid simplification of crafted bounds test 2026-02-27 16:11:50 -08:00
thermal tools/thermal/thermal-engine: Fix format string bug in thermal-engine 2025-11-25 11:00:28 +01:00
time
tracing rtla: Fix parse_cpu_set() bug introduced by strtoi() 2026-01-13 08:32:52 +01:00
usb tools: usb: usbip: remove dead-link from README 2026-01-23 17:16:42 +01:00
verification verification/rvgen: Remove unused variable declaration from containers 2026-01-12 07:43:51 +01:00
virtio tools/virtio: add device, device_driver stubs 2025-12-24 08:02:56 -05:00
wmi
workqueue
writeback
Makefile