Re: [PATCH] sched/autogroup: Fix task_group UAF during thread creation
From: Tejun Heo
Date: Fri Oct 30 2026 - 22:30:26 EST
Hello, Peter.
On Fri, Oct 30, 2026 at 04:49:40PM +0100, Peter Zijlstra wrote:
> Now, AUTOGROUP depends on CGROUP, so we can make autogroup_move_group()
> also use cgroup_threadgroup_rwsem, such that the autogroup and cgroup
> logic stays the same?
cgroup_threadgroup_rwsem is a global percpu rwsem and taking it for
write on a regular basis can be really expensive.
> I mean, yes we can move sched_core_fork() into the siglock region, but
> duplicating most of sched_cgroup_fork() in there just to fix an
> autogroup thingy seems weird and inconsistent.
Either way, AFAICS, autogroup doesn't need cgroup_threadgroup_rwsem. The
cgroup side has to be settled early in fork, but the autogroup side
doesn't. Can't we just move the autogroup assignment later in fork, to a
point where it can't race against setsid()?
Thanks.
--
tejun