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 <linux@jordanrome.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20241016210048.1213935-1-linux@jordanrome.com
1 parent e59db06 commit 9495a5b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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)