Skip to content

Commit 900f362

Browse files
olsajirianakryiko
authored andcommitted
bpf: Fix uprobe multi pid filter check
Uprobe multi link does its own process (thread leader) filtering before running the bpf program by comparing task's vm pointers. But as Oleg pointed out there can be processes sharing the vm (CLONE_VM), so we can't just compare task->vm pointers, but instead we need to use same_thread_group call. Suggested-by: Oleg Nesterov <[email protected]> Signed-off-by: Jiri Olsa <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Acked-by: Oleg Nesterov <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent aa01d13 commit 900f362

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/trace/bpf_trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3207,7 +3207,7 @@ static int uprobe_prog_run(struct bpf_uprobe *uprobe,
32073207
struct bpf_run_ctx *old_run_ctx;
32083208
int err = 0;
32093209

3210-
if (link->task && current->mm != link->task->mm)
3210+
if (link->task && !same_thread_group(current, link->task))
32113211
return 0;
32123212

32133213
if (sleepable)

0 commit comments

Comments
 (0)