From: Tejun Heo <tj@kernel.org>
To: Z qiang <qiang.zhang1211@gmail.com>
Cc: jiangshanlai@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] workqueue: Fix UAF report by KASAN in pwq_release_workfn()
Date: Mon, 18 Sep 2023 08:06:21 -1000 [thread overview]
Message-ID: <ZQiRncEYCK3RYXA7@slm.duckdns.org> (raw)
In-Reply-To: <CALm+0cUytR3-0mcW3t24gcyP27UW3rpP5_+vpLVC3w70+0n6oQ@mail.gmail.com>
On Thu, Sep 07, 2023 at 10:13:23AM +0800, Z qiang wrote:
> >
> > On Wed, Sep 06, 2023 at 10:12:34AM +0800, Z qiang wrote:
> > > Flush the pwq_release_worker is insufficient, the call_rcu() is
> > > invoked to release wq
> > > in pwq_release_workfn(), this is also asynchronous.
> >
> > But rcu_free_pwq() doesn't access wq or anything. The last access is from
> > the work function.
>
> The rcu_free_wq() will access wq->cpu_pwq or unbound_attrs,
> but at this time, the kfree(wq) may have been called in alloc_workqueue().
I'm not following. The only way alloc_and_link fails is if
apply_wqattrs_prepare() fails and if prepare fails, none of the pwq's are
installed and pwq_unbound_release_workfn() won't try to free the wq as the
pwq's don't have any reference on it. So, if you flush the pwq release work
items, there can be no rcu_free_wq() in flight. Can you please try to see
whether the problem is reproducible with flushing?
Thanks.
--
tejun
next prev parent reply other threads:[~2023-09-18 18:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-02 11:50 [PATCH] workqueue: Fix UAF report by KASAN in pwq_release_workfn() Zqiang
2023-09-05 18:51 ` Tejun Heo
2023-09-06 2:12 ` Z qiang
2023-09-06 17:01 ` Tejun Heo
2023-09-07 2:13 ` Z qiang
2023-09-18 9:18 ` Z qiang
2023-09-18 18:06 ` Tejun Heo [this message]
2023-09-19 2:14 ` Z qiang
2023-12-08 7:32 ` Xuewen Yan
2023-12-08 8:18 ` Z qiang
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=ZQiRncEYCK3RYXA7@slm.duckdns.org \
--to=tj@kernel.org \
--cc=jiangshanlai@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=qiang.zhang1211@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