Skip to content

Commit b8537c9

Browse files
committed
bpf: Revert "bpf: remove unnecessary rcu_read_{lock,unlock}() in multi-uprobe attach logic"
JIRA: https://issues.redhat.com/browse/RHEL-96605 commit 4e2e684 Author: Di Shen <di.shen@unisoc.com> Date: Tue May 20 13:49:43 2025 +0800 bpf: Revert "bpf: remove unnecessary rcu_read_{lock,unlock}() in multi-uprobe attach logic" This reverts commit 4a8f635. Althought get_pid_task() internally already calls rcu_read_lock() and rcu_read_unlock(), the find_vpid() was not. The documentation for find_vpid() clearly states: "Must be called with the tasklist_lock or rcu_read_lock() held." Add proper rcu_read_lock/unlock() to protect the find_vpid(). Fixes: 4a8f635 ("bpf: remove unnecessary rcu_read_{lock,unlock}() in multi-uprobe attach logic") Reported-by: Xuewen Yan <xuewen.yan@unisoc.com> Signed-off-by: Di Shen <di.shen@unisoc.com> Acked-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20250520054943.5002-1-xuewen.yan@unisoc.com Signed-off-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Felix Maurer <fmaurer@redhat.com>
1 parent 693b547 commit b8537c9

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/trace/bpf_trace.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3404,7 +3404,9 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
34043404
}
34053405

34063406
if (pid) {
3407+
rcu_read_lock();
34073408
task = get_pid_task(find_vpid(pid), PIDTYPE_TGID);
3409+
rcu_read_unlock();
34083410
if (!task) {
34093411
err = -ESRCH;
34103412
goto error_path_put;

0 commit comments

Comments
 (0)