[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3df62791-d123-db9b-ec9c-092c47a941cc@huawei.com>
Date: Thu, 2 Sep 2021 15:42:15 +0800
From: Zhang Qiao <zhangqiao22@...wei.com>
To: Tejun Heo <tj@...nel.org>
CC: <peterz@...radead.org>, <juri.lelli@...hat.com>,
<linux-kernel@...r.kernel.org>, <mingo@...hat.com>,
<vincent.guittot@...aro.org>
Subject: Re: [PATCH] kernel/sched: Fix sched_fork() access an invalid
sched_task_group
在 2021/9/2 0:45, Tejun Heo 写道:
> Hello,
>
> On Wed, Sep 01, 2021 at 03:43:00PM +0800, Zhang Qiao wrote:
>> 在 2021/9/1 6:59, Tejun Heo 写道:
>>> 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
>>
>> cgroup migrations? Do you mean child process set its cgroups at
>> cgroup_subsys->fork()?
>
> As soon as cgroup_post_fork() is complete, userspace can try moving the
> process to a different cgroup which can get confusing for sched_post_fork.
hello,tejun
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?
Does the child process will use the old sched_task_group at sched_post_fork()-->__set_task_cpu()?
Or there are other problems, Can you talk in more detail?
thanks!
---
Qiao Zhang
>
>>> 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.
>>
>> so the child just need to update its sched_task_group after cgroup_can_fork(),
>> then call sched_fork(), is it right?
>
> Yeah, the bug here is that a field which is dependent on cgroup membership
> is being read before the cgroup membership is fixated.
>
> Thanks.
>
Powered by blists - more mailing lists