From: Daehyeon Ko <4ncienth@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sched/autogroup: Fix task_group UAF during thread creation
Date: Fri, 30 Oct 2026 12:45:34 +0900 [thread overview]
Message-ID: <20261030034540.2074077-1-4ncienth@gmail.com> (raw)
In-Reply-To: <20261026115707.GF2668200@noisy.programming.kicks-ass.net>
On Mon, Oct 26, 2026 at 12:57:07PM +0100, Peter Zijlstra wrote:
> I'm not sure this works; afaict this will result in a NULL deref
> instead.
Thanks for taking a look.
The NULL previous cfs_rq should be handled by the existing set_task_rq()
contract. __sched_fork() initializes p->se.cfs_rq to NULL, and the normal
sched_cgroup_fork() path reaches set_task_rq() through __set_task_cpu().
set_task_rq_fair() returns when prev is NULL, before
cfs_rq_last_update_time(prev), and set_task_rq() then installs the new
cfs_rq, parent, and depth.
> Can't we make ksys_setsid() more complicated instead? Have it create the
> autogroup in advance, move under the tasklist_lock and destroy on
> failure or something?
I don't think moving the autogroup move under tasklist_lock alone closes
the window, because sched_cgroup_fork() runs before copy_process() takes
tasklist_lock:
clone(CLONE_THREAD) setsid()
------------------- --------
sched_cgroup_fork() -> old tg
create new autogroup
lock(tasklist_lock)
move listed threads; child is absent
unlock(tasklist_lock)
drop old autogroup reference
lock(tasklist_lock)
publish child with old tg
The ordering trace hit this pre-publication sequence seven times. The
final revalidation is intended to cover precisely this interval.
Am I missing another ordering which excludes this interleaving?
next prev parent reply other threads:[~2026-10-30 3:45 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-23 1:36 [PATCH] sched/autogroup: Fix task_group UAF during thread creation Daehyeon Ko
2026-10-26 11:57 ` Peter Zijlstra
2026-10-30 3:45 ` Daehyeon Ko [this message]
2026-10-30 15:49 ` Peter Zijlstra
2026-10-31 2:28 ` Tejun Heo
2026-11-02 10:17 ` Peter Zijlstra
2026-11-02 19:21 ` Tejun Heo
2026-11-03 11:45 ` Peter Zijlstra
2026-11-03 17:42 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261030034540.2074077-1-4ncienth@gmail.com \
--to=4ncienth@gmail.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=vincent.guittot@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.