linux-yocto/kernel/bpf
Hou Tao 2f8c69a72e bpf: Check rcu_read_lock_trace_held() in bpf_map_lookup_percpu_elem()
[ Upstream commit d496557826 ]

bpf_map_lookup_percpu_elem() helper is also available for sleepable bpf
program. When BPF JIT is disabled or under 32-bit host,
bpf_map_lookup_percpu_elem() will not be inlined. Using it in a
sleepable bpf program will trigger the warning in
bpf_map_lookup_percpu_elem(), because the bpf program only holds
rcu_read_lock_trace lock. Therefore, add the missed check.

Reported-by: syzbot+dce5aae19ae4d6399986@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/bpf/000000000000176a130617420310@google.com/
Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20250526062534.1105938-1-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-27 11:07:32 +01:00
..
preload
arraymap.c bpf: Check percpu map value size first 2024-10-17 15:22:12 +02:00
bloom_filter.c bpf: Check bloom filter map value size 2024-05-17 11:56:05 +02:00
bpf_inode_storage.c bpf: Refactor some inode/task/sk storage functions for reuse 2024-07-18 13:18:34 +02:00
bpf_iter.c
bpf_local_storage.c bpf: fix order of args in call to bpf_map_kvcalloc 2024-07-18 13:18:34 +02:00
bpf_lru_list.c bpf: Address KCSAN report on bpf_lru_list 2023-07-27 08:50:34 +02:00
bpf_lru_list.h bpf: Address KCSAN report on bpf_lru_list 2023-07-27 08:50:34 +02:00
bpf_lsm.c
bpf_struct_ops_types.h
bpf_struct_ops.c
bpf_task_storage.c bpf: Refactor some inode/task/sk storage functions for reuse 2024-07-18 13:18:34 +02:00
btf.c bpf: Fix memory leak in bpf_core_apply 2024-11-01 01:55:56 +01:00
cgroup_iter.c cgroup: bpf: use cgroup_lock()/cgroup_unlock() wrappers 2023-06-21 16:00:51 +02:00
cgroup.c cgroup/bpf: use a dedicated workqueue for cgroup bpf destruction 2024-11-08 16:26:45 +01:00
core.c bpf: Avoid __bpf_prog_ret0_warn when jit fails 2025-06-27 11:07:12 +01:00
cpumap.c bpf: report RCU QS in cpumap kthread 2024-03-26 18:21:02 -04:00
devmap.c bpf: fix OOB devmap writes when deleting elements 2024-12-14 19:54:35 +01:00
disasm.c
disasm.h
dispatcher.c bpf: Synchronize dispatcher update with bpf_dispatcher_xdp_func 2024-08-03 08:49:45 +02:00
hashtab.c bpf: fix possible endless loop in BPF map iteration 2025-06-04 14:40:02 +02:00
helpers.c bpf: Check rcu_read_lock_trace_held() in bpf_map_lookup_percpu_elem() 2025-06-27 11:07:32 +01:00
inode.c
Kconfig
link_iter.c
local_storage.c cgroup: bpf: use cgroup_lock()/cgroup_unlock() wrappers 2023-06-21 16:00:51 +02:00
log.c bpf: drop unnecessary user-triggerable WARN_ONCE in verifierl log 2024-08-29 17:30:17 +02:00
lpm_trie.c bpf: Fix exact match conditions in trie_get_next_key() 2024-12-14 19:54:31 +01:00
Makefile bpf: Split off basic BPF verifier log into separate file 2024-08-29 17:30:17 +02:00
map_in_map.c bpf: Defer the free of inner map when necessary 2024-01-25 15:27:26 -08:00
map_in_map.h bpf: Add map and need_defer parameters to .map_fd_put_ptr() 2024-01-25 15:27:26 -08:00
map_iter.c
memalloc.c
mmap_unlock_work.h
net_namespace.c
offload.c
percpu_freelist.c
percpu_freelist.h
prog_iter.c
queue_stack_maps.c bpf: Avoid deadlock when using queue and stack maps from NMI 2023-10-06 14:56:35 +02:00
reuseport_array.c
ringbuf.c bpf: Add MEM_WRITE attribute 2025-01-17 13:34:43 +01:00
stackmap.c bpf: Fix stackmap overflow check on 32-bit arches 2024-03-26 18:20:41 -04:00
syscall.c bpf: Return prog btf_id without capable check 2025-06-04 14:40:05 +02:00
sysfs_btf.c
task_iter.c bpf: Fix iter/task tid filtering 2024-11-01 01:56:01 +01:00
tnum.c
trampoline.c bpf, x64: Fix tailcall infinite loop 2024-01-10 17:10:26 +01:00
verifier.c bpf: Fix overloading of MEM_UNINIT's meaning 2025-01-17 13:34:43 +01:00