Re: [PATCH] kernel/sched: Fix sched_fork() access an invalid sched_task_group

From: Tejun Heo
Date: Tue Sep 07 2021 - 13:01:11 EST


Hello,

On Thu, Sep 02, 2021 at 03:42:15PM +0800, Zhang Qiao wrote:
> I checked the code again.
> I don't quite understand what you said, if the child be moved between
> cgroup_post_fork() and sched_post_sched(), what problems might it cause?

cgroup_post_fork() is where the child's creation is committed from cgroup's
POV, so it'd be migrating cgroups before the initial creation is finished.
>From glancing, looks like it'll break css_set task counts to begin with.
This violates the basic assumptions and can cause critical failures in
subtle ways. The would replace one subtle race with a possibly worse one.

Thanks.

--
tejun