lkml.org 
[lkml]   [2021]   [Aug]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kernel/sched: Fix sched_fork() access an invalid sched_task_group
Hello,

On Tue, Aug 31, 2021 at 03:58:42PM +0800, Zhang Qiao wrote:
> > 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,
>
> But it still seems possible that it accessed an invalid sched_task_group?
> because the child process does not update its sched_task_group util
> cgroup_post_fork().

Between cgroup_can_fork() and cgroup_post_fork(), the cgroup membership and
thus sched_task_group can't change, so if the child sets it to the parent's
inbetween, the sched_task_group can't go away.

Thanks.

--
tejun

\
 
 \ /
  Last update: 2021-09-01 01:01    [W:0.080 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site