change next_thread() to use __next_thread() ?: group_leader
authorOleg Nesterov <oleg@redhat.com>
Thu, 24 Aug 2023 14:32:01 +0000 (16:32 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 4 Oct 2023 17:41:56 +0000 (10:41 -0700)
commitd639cf4abb4d171ab2456904da5668c42b5c1937
tree4f4d1c2c495b08807ddbe2ee0dc583e3346234fe
parent33a9813825710fdc2b980d566ee391fd093a36c6
change next_thread() to use __next_thread() ?: group_leader

This relies on fact that group leader is always the 1st entry in the
signal->thread_head list.

With or without this change, if the lockless next_thread(last_thread)
races with exec it can return the old or the new leader.

We are almost ready to kill task->thread_group, after this change its
only user is thread_group_empty().

Link: https://lkml.kernel.org/r/20230824143201.GB31222@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/sched/signal.h