Re: [RFC PATCH v2 8/8] signal: move group_leader into signal_struct

From: Oleg Nesterov

Date: Sun Dec 06 2026 - 09:40:21 EST


On 12/06, Chris Mason wrote:
>
> 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);

Not sure...

> 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.

Yes, this was my main concern...

Chris, I can't work today (can't even think) but I'll try to make/send another
just-for-discussion RFC. IMO, we also need to simplify the transition from
task->group_leader to signal->group_leader.

Oleg.