Re: [PATCH 0/3] fork, exit: fix BPF use-after-frees on task pointers

From: Oleg Nesterov

Date: Fri Dec 04 2026 - 07:54:20 EST


On 12/04, Alexei Starovoitov wrote:
>
> BUT the title is misleading.
> The kernel has the same bug without bpf. fill_stats_for_pid() holds
> a reference on tsk and nothing else. Then bacct_add_tsk() reads
> tsk->group_leader->start_time.

Oh yes, and IIRC there are more buggy users of ->group_leader

> > Patch 2 makes a released thread hold a reference on its group leader,
> > which I don't love. If there are better ideas, I'm happy to get
> > the bots cranking on them.

I think we should move ->group_leader from task_struct to ->signal_struct.

I was going to do this a long ago, but was distructed. See the preparations
I sent https://lore.kernel.org/all/aXY_h8i78n6yD9JY@xxxxxxxxxx/

I'll try to take a look this weekend, I need to recall the implications.

But ->real_parent has to stay per task, and I don't really understand 1/3,
even the changelog.

Oleg.