[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YS0WF0sxr0ysb6Za@mtj.duckdns.org>
Date: Mon, 30 Aug 2021 07:32:07 -1000
From: Tejun Heo <tj@...nel.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Zhang Qiao <zhangqiao22@...wei.com>, mingo@...hat.com,
juri.lelli@...hat.com, vincent.guittot@...aro.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernel/sched: Fix sched_fork() access an invalid
sched_task_group
Hello,
On Mon, Aug 30, 2021 at 04:39:54PM +0200, Peter Zijlstra wrote:
> > When a new process is forked, cgroup_post_fork() associates it
> > with the cgroup of its parent. Therefore this commit move the
> > __set_task_cpu() and task_fork() that access some cgroup-related
> > fields(sched_task_group and cfs_rq) to sched_post_fork() and
> > call sched_post_fork() after cgroup_post_fork().
I think this would allow cgroup migrations to take place before
sched_post_fork() is run, which likely will break stuff. The right
thing to do likely is taking sched_task_group (and whatever other
fields) after cgroup_can_fork(), which fixates the cgroup memberships,
is run. For other controllers, operations like this would be performed
from cgroup_subsys->fork() callback but it's tricky for sched due to
autogroup.
> > Fixes: 8323f26ce342 ("sched: Fix race in task_group")
> > Signed-off-by: Zhang Qiao <zhangqiao22@...wei.com>
>
> Hmm, I think you're right. Did something recently chagne in cgroup land
> to make this more visible? This code hasn't changed in like 9 years.
I can't think of any remotely recent change either. I guess ppl just
don't try to migrate the parent while fork is in progress.
Thanks.
--
tejun
Powered by blists - more mailing lists