linux-yocto/tools
Ihor Solodrai c14bf7f873 bpf: Make reg_not_null() true for CONST_PTR_TO_MAP
[ Upstream commit 5534e58f2e ]

When reg->type is CONST_PTR_TO_MAP, it can not be null. However the
verifier explores the branches under rX == 0 in check_cond_jmp_op()
even if reg->type is CONST_PTR_TO_MAP, because it was not checked for
in reg_not_null().

Fix this by adding CONST_PTR_TO_MAP to the set of types that are
considered non nullable in reg_not_null().

An old "unpriv: cmp map pointer with zero" selftest fails with this
change, because now early out correctly triggers in
check_cond_jmp_op(), making the verification to pass.

In practice verifier may allow pointer to null comparison in unpriv,
since in many cases the relevant branch and comparison op are removed
as dead code. So change the expected test result to __success_unpriv.

Signed-off-by: Ihor Solodrai <isolodrai@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250609183024.359974-2-isolodrai@meta.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-20 18:30:39 +02:00
..
accounting
arch x86/rdrand: Disable RDSEED on AMD Cyan Skillfish 2025-07-17 18:37:14 +02:00
bootconfig
bpf bpftool: Fix JSON writer resource leak in version command 2025-08-20 18:30:38 +02:00
build tools/build: Don't pass test log files to linker 2025-05-29 11:02:08 +02:00
certs
cgroup memcg_slabinfo: Fix use of PG_slab 2025-08-15 12:13:46 +02:00
counter
crypto
debugging
firewire
firmware
gpio
hv tools/hv: fcopy: Fix incorrect file path conversion 2025-08-01 09:48:40 +01:00
iio
include tools/nolibc: define time_t in terms of __kernel_old_time_t 2025-08-20 18:30:23 +02:00
kvm/kvm_stat
laptop
leds
lib libbpf: Verify that arena map exists when adding arena relocations 2025-08-20 18:30:29 +02:00
memory-model
mm
net tools: ynl-gen: validate 0 len strings from kernel 2025-05-29 11:03:12 +02:00
objtool objtool/rust: add one more noreturn Rust function for Rust 1.89.0 2025-07-24 08:56:22 +02:00
pci
pcmcia
perf perf record: Cache build-ID of hit DSOs only 2025-08-15 12:13:58 +02:00
power pm: cpupower: Fix the snapshot-order of tsc,mperf, clock in mperf_stop() 2025-08-20 18:30:27 +02:00
rcu
sched_ext tools/sched_ext: Add helper to check task migration state 2025-03-22 12:54:28 -07:00
scripts tools/build: Fix s390(x) cross-compilation with clang 2025-08-20 18:30:24 +02:00
sound
spi
testing bpf: Make reg_not_null() true for CONST_PTR_TO_MAP 2025-08-20 18:30:39 +02:00
thermal
time
tracing
usb
verification tools/rv: Do not skip idle in trace 2025-08-15 12:13:46 +02:00
virtio
wmi
workqueue
writeback
Makefile