mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Tejun Heo <tj@kernel.org>
Cc: Daehyeon Ko <4ncienth@gmail.com>, 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: Mon, 2 Nov 2026 11:17:59 +0100	[thread overview]
Message-ID: <20261102101759.GF1813469@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <36ce43428e53d1d6e47dddb43697ccf2@kernel.org>

On Fri, Oct 30, 2026 at 04:28:54PM -1000, Tejun Heo wrote:
> 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.

Yeah, but setsid() isn't more critical than moving tasks between
cgroups. Also, AFAIK nearly nobody is using autogroups these days,
because systemd does the cgroup thing.

> > 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()?

That is more or less the proposal, but it rather creates more complexity
rather than reducing it.

Having two different rules for p->sched_task_group, depending on cgroup
or autogroup isn't at all appealing. Not to mention adding even more
fork callbacks.

  reply	other threads:[~2026-11-02 10:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23  1:36 Daehyeon Ko
2026-10-26 11:57 ` Peter Zijlstra
2026-10-30  3:45   ` Daehyeon Ko
2026-10-30 15:49     ` Peter Zijlstra
2026-10-31  2:28       ` Tejun Heo
2026-11-02 10:17         ` Peter Zijlstra [this message]
2026-11-02 19:21           ` 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=20261102101759.GF1813469@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=4ncienth@gmail.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tj@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®