Skip to content

Commit 0348d99

Browse files
Di ShenKernel Patches Daemon
Di Shen
authored and
Kernel Patches Daemon
committed
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(). Reported-by: Xuewen Yan <[email protected]> Signed-off-by: Di Shen <[email protected]> Acked-by: Andrii Nakryiko <[email protected]>
1 parent f3a4188 commit 0348d99

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
@@ -3318,7 +3318,9 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
33183318
}
33193319

33203320
if (pid) {
3321+
rcu_read_lock();
33213322
task = get_pid_task(find_vpid(pid), PIDTYPE_TGID);
3323+
rcu_read_unlock();
33223324
if (!task) {
33233325
err = -ESRCH;
33243326
goto error_path_put;

0 commit comments

Comments
 (0)