2023-11-16 03:34:33

by Yonghong Song

[permalink] [raw]
Subject: Re: [PATCH 2/3] bpf: bpf_iter_task_next: use __next_thread() rather than next_thread()


On 11/14/23 11:32 AM, Oleg Nesterov wrote:
> Lockless use of next_thread() should be avoided, kernel/bpf/task_iter.c
> is the last user and the usage is wrong.
>
> bpf_iter_task_next() can loop forever, "kit->pos == kit->task" can never
> happen if kit->pos execs. Change this code to use __next_thread().
>
> With or without this change the usage of kit->pos/task and next_task()
> doesn't look nice, see the next patch.
>
> Signed-off-by: Oleg Nesterov <[email protected]>

Acked-by: Yonghong Song <[email protected]>