Re: [RFC PATCH v2 8/8] signal: move group_leader into signal_struct
From: Chris Mason
Date: Sun Dec 06 2026 - 07:35:10 EST
On Sun, Dec 6, 2026, at 6:00 AM, Oleg Nesterov wrote:
> OK, this won't work if somebody increments signal->sigcnt, but probably
> __put_task_struct() can check tsk == tsk->signal->group_leader before
> put_signal_struct(). Still not sure...
The last put_signal_struct() frees the leader, so others can hold a sigcnt
too. The end of free_task() becomes:
if (tsk != sig->group_leader)
free_task_struct(tsk);
put_signal_struct(sig);
The bots tested this out and didn't find problems.
The catch is that BPF programs can still reach the leader in the meantime, so
its ->cgroups, ->exec_state and ->bpf_storage can't be left stale any more.
With those fixed, it's shorter than this patch, bacct_add_tsk() doesn't need
pid_alive(), and the pidfd, ptrace and cgroup selftests work as before, with
KASAN.
-chris