mirror-linux/tools
Puranjay Mohan 7a433e5193 bpf: Support negative offsets, BPF_SUB, and alu32 for linked register tracking
Previously, the verifier only tracked positive constant deltas between
linked registers using BPF_ADD. This limitation meant patterns like:

  r1 = r0;
  r1 += -4;
  if r1 s>= 0 goto l0_%=;   // r1 >= 0 implies r0 >= 4
  // verifier couldn't propagate bounds back to r0
  if r0 != 0 goto l0_%=;
	r0 /= 0; // Verifier thinks this is reachable
  l0_%=:

Similar limitation exists for 32-bit registers.

With this change, the verifier can now track negative deltas in reg->off
enabling bound propagation for the above pattern.

For alu32, we make sure the destination register has the upper 32 bits
as 0s before creating the link. BPF_ADD_CONST is split into
BPF_ADD_CONST64 and BPF_ADD_CONST32, the latter is used in case of alu32
and sync_linked_regs uses this to zext the result if known_reg has this
flag.

Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/20260204151741.2678118-2-puranjay@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2026-02-04 13:35:28 -08:00
..
accounting
arch tools headers: Sync arm64 headers with kernel sources 2025-12-24 11:43:12 -08:00
bootconfig
bpf resolve_btfids: Refactor the sort_btf_by_name function 2026-02-04 10:17:19 -08:00
build tools build: Fix the common set of features test wrt libopenssl 2025-12-27 20:26:44 -08:00
certs
cgroup
counter
crypto
debugging
dma dma-mapping updates for Linux 6.19: 2025-12-06 09:25:05 -08:00
docs docs: makefile: move rustdoc check to the build wrapper 2025-11-29 08:42:53 -07:00
firewire
firmware
gpio
hv
iio
include bpf: add new BPF_CGROUP_ITER_CHILDREN control option 2026-01-27 09:05:54 -08:00
kvm/kvm_stat
laptop
leds
lib libbpf: add fsession support 2026-01-24 18:49:36 -08:00
memory-model
mm tools/mm/page_owner_sort: fix timestamp comparison for stable sorting 2025-12-23 11:23:14 -08:00
net tools: ynl: don't install tests 2026-01-08 08:46:36 -08:00
objtool objtool: Add more robust signal error handling, detect and warn about stack overflows 2025-12-03 19:42:37 +01:00
pcmcia
perf treewide: Update email address 2026-01-11 06:09:11 -10:00
power platform-drivers-x86 for v6.19-1 2025-12-10 06:38:17 +09:00
rcu
sched
sched_ext Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf after rc5 2026-01-14 15:22:01 -08:00
scripts tools headers: Sync syscall table with kernel sources 2025-12-24 11:43:36 -08:00
sound
spi
testing bpf: Support negative offsets, BPF_SUB, and alu32 for linked register tracking 2026-02-04 13:35:28 -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 updaets for v6.19: 2025-12-05 09:34:01 -08:00
usb
verification
virtio tools/virtio: add device, device_driver stubs 2025-12-24 08:02:56 -05:00
wmi
workqueue
writeback
Makefile