Commit 2d834477 authored by Hou Tao's avatar Hou Tao Committed by Greg Kroah-Hartman
Browse files

bpf: Check rcu_read_lock_trace_held() in bpf_map_lookup_percpu_elem()



[ Upstream commit d4965578 ]

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: default avatar <syzbot+dce5aae19ae4d6399986@syzkaller.appspotmail.com>
Closes: https://lore.kernel.org/bpf/000000000000176a130617420310@google.com/


Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20250526062534.1105938-1-houtao@huaweicloud.com


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent b0e64744
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment