From: "Michal Koutný" <mkoutny@suse.com>
To: Vincent Guittot <vincent.guittot@linaro.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Odin Ugedal <odin@uged.al>
Subject: Re: [PATCH] sched/fair: Use rq->lock when checking cfs_rq list presence
Date: Wed, 13 Oct 2021 16:26:43 +0200 [thread overview]
Message-ID: <20211013142643.GA48428@blackbody.suse.cz> (raw)
In-Reply-To: <CAKfTPtAQmqgAiNGqk9xRmiB4_dzHxaKK68+fWwea25mZv0kT2w@mail.gmail.com>
On Wed, Oct 13, 2021 at 09:57:17AM +0200, Vincent Guittot <vincent.guittot@linaro.org> wrote:
> Furthermore, list_del_leaf_cfs_rq() starts with the same test on of
> cfs_rq->on_list.
Yes, the same check but synchronized with rq->lock.
> The problem is that the cfs_rq can be added during or
> after the test. Removing it should not be enough because we do the
> same test under rq lock which only ensures that both the test and the
> add on the list will not happen simultaneously.
This is what I overlooked when I was looking for explanation of the UAF
on the leaf list.
> This seems to closes the race window in your case but this could still
> happen AFAICT.
You seem to be right.
Hopefully, I'll be able to collect more data evaluating this.
> What about your patchset about adding a cfs in the list only when
> there is a runnable task ?
The patches I had sent previously [1] avoid adding cfs_rq to the list
when it's under a throttled ancestor (namely 4/5). The runnable
condition is rather orthogonal. (Not sure it's the patchset you were
referring to.)
> Wouldn't this fix the problem ?
FWIW, the "reliable" fix so far is a revert of the commit a7b359fc6a37
("sched/fair: Correctly insert cfs_rq's to list on
unthrottle"). Therefore my hypothesis about racy adding from
tg_unthrottle_up(), so I think the other patches won't affect the issue.
Thanks for your feedback. Let me examine the problem some more before
continuing with this patch.
Michal
[1] https://lore.kernel.org/all/20210819175034.4577-1-mkoutny@suse.com/
next prev parent reply other threads:[~2021-10-13 14:26 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-11 17:22 Michal Koutný
2021-10-11 19:12 ` Odin Ugedal
2021-10-12 18:32 ` Tao Zhou
2021-10-13 18:52 ` Odin Ugedal
2021-10-13 14:39 ` Michal Koutný
2021-10-13 18:45 ` Odin Ugedal
2021-10-13 7:57 ` Vincent Guittot
2021-10-13 14:26 ` Michal Koutný [this message]
2021-11-02 16:02 ` task_group unthrottling and removal race (was Re: [PATCH] sched/fair: Use rq->lock when checking cfs_rq list) presence Michal Koutný
2021-11-02 20:20 ` Odin Ugedal
2021-11-03 9:51 ` Mathias Krause
2021-11-03 10:51 ` Mathias Krause
2021-11-03 11:10 ` Michal Koutný
2021-11-03 14:16 ` Mathias Krause
2021-11-03 19:06 ` [PATCH] sched/fair: Prevent dead task groups from regaining cfs_rq's Mathias Krause
2021-11-03 22:03 ` Benjamin Segall
2021-11-04 8:50 ` Vincent Guittot
2021-11-04 15:13 ` Mathias Krause
2021-11-04 16:49 ` Vincent Guittot
2021-11-04 17:37 ` Mathias Krause
2021-11-05 14:25 ` Vincent Guittot
2021-11-05 14:44 ` Mathias Krause
2021-11-05 16:29 ` Mathias Krause
2021-11-05 16:58 ` Peter Zijlstra
2021-11-05 17:14 ` Mathias Krause
2021-11-05 17:27 ` Peter Zijlstra
2021-11-05 17:40 ` Mathias Krause
2021-11-06 10:48 ` Peter Zijlstra
2021-11-08 10:27 ` Mathias Krause
2021-11-08 11:40 ` Peter Zijlstra
2021-11-08 15:06 ` Mathias Krause
2021-11-10 15:14 ` Vincent Guittot
2021-11-09 18:47 ` Michal Koutný
2021-11-10 15:17 ` Vincent Guittot
2021-11-04 20:46 ` Benjamin Segall
2021-11-04 18:49 ` Michal Koutný
2021-11-05 14:55 ` Mathias Krause
2021-11-05 14:58 ` Peter Zijlstra
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=20211013142643.GA48428@blackbody.suse.cz \
--to=mkoutny@suse.com \
--cc=bristot@redhat.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=odin@uged.al \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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®