Skip to content
Commit 2d161805 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Alexei Starovoitov
Browse files

bpf: task_group_seq_get_next: use __next_thread() rather than next_thread()



Lockless use of next_thread() should be avoided, kernel/bpf/task_iter.c
is the last user and the usage is wrong.

task_group_seq_get_next() can return the group leader twice if it races
with mt-thread exec which changes the group->leader's pid.

Change the main loop to use __next_thread(), kill "next_tid == common->pid"
check.

__next_thread() can't loop forever, we can also change this code to retry
if next_tid == 0.

Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
Acked-by: default avatarYonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/r/20231114163234.GA890@redhat.com
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 16b3129e
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment