From: Tejun Heo <tj@kernel.org>
To: Richard Clark <richard.xnu.clark@gmail.com>
Cc: jiangshanlai@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] workqueue: Prevent a new work item from queueing into a destruction wq
Date: Sun, 11 Dec 2022 20:23:49 -1000 [thread overview]
Message-ID: <Y5bI9ZbjpzNFpk/8@slm.duckdns.org> (raw)
In-Reply-To: <20221212061836.3620-1-richard.xnu.clark@gmail.com>
On Mon, Dec 12, 2022 at 02:18:36PM +0800, Richard Clark wrote:
> Currently the __WQ_DRAINING is used to prevent a new work item from queueing
> to a draining workqueue, but this flag will be cleared before the end of a
> RCU grace period. Because the workqueue instance is actually freed after
> the RCU grace period, this fact results in an opening window in which a new
> work item can be queued into a destorying workqueue and be scheduled
> consequently, for instance, the below code snippet demos this accident:
I mean, this is just use-after-free. The same scenario can happen with
non-RCU frees or if there happens to be an RCU grace period inbetween. I'm
not sure what's being protected here.
Thanks.
--
tejun
next prev parent reply other threads:[~2022-12-12 6:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-12 6:18 Richard Clark
2022-12-12 6:23 ` Tejun Heo [this message]
2022-12-12 6:48 ` Lai Jiangshan
2022-12-12 9:26 ` richard clark
2022-12-12 22:27 ` Tejun Heo
2022-12-13 1:09 ` richard clark
2022-12-12 9:17 ` richard clark
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=Y5bI9ZbjpzNFpk/8@slm.duckdns.org \
--to=tj@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=richard.xnu.clark@gmail.com \
/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®