Skip to content

Commit 9495a5b

Browse files
Jordan Romeanakryiko
authored andcommitted
bpf: Fix iter/task tid filtering
In userspace, you can add a tid filter by setting the "task.tid" field for "bpf_iter_link_info". However, `get_pid_task` when called for the `BPF_TASK_ITER_TID` type should have been using `PIDTYPE_PID` (tid) instead of `PIDTYPE_TGID` (pid). Fixes: f0d74c4 ("bpf: Parameterize task iterators.") Signed-off-by: Jordan Rome <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent e59db06 commit 9495a5b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/bpf/task_iter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static struct task_struct *task_seq_get_next(struct bpf_iter_seq_task_common *co
9999
rcu_read_lock();
100100
pid = find_pid_ns(common->pid, common->ns);
101101
if (pid) {
102-
task = get_pid_task(pid, PIDTYPE_TGID);
102+
task = get_pid_task(pid, PIDTYPE_PID);
103103
*tid = common->pid;
104104
}
105105
rcu_read_unlock();

0 commit comments

Comments
 (0)