From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: Yufen Yu <yuyufen@huawei.com>
Cc: axboe@kernel.dk, linux-block@vger.kernel.org, tj@kernel.org,
jack@suse.cz, bvanassche@acm.org, gregkh@linuxfoundation.org,
hch@infradead.org
Subject: Re: [PATCH v4 0/6] bdi: fix use-after-free for bdi device
Date: Tue, 14 Apr 2020 10:44:48 -0400 [thread overview]
Message-ID: <20200414144448.GA317058@mit.edu> (raw)
In-Reply-To: <1a735dce-c72b-5b2e-66c5-b5db30f1139b@huawei.com>
On Thu, Apr 09, 2020 at 09:28:07PM +0800, Yufen Yu wrote:
> ping
ping**2
Can this go in as a bugfix during this cycle?
- Ted
>
> On 2020/3/25 20:38, Yufen Yu wrote:
> > Hi, all
> >
> > We have reported a use-after-free crash for bdi device in __blkg_prfill_rwstat().
> > The bug is caused by printing device kobj->name while the device and kobj->name
> > has been freed by bdi_unregister().
> >
> > In fact, commit 68f23b8906 "memcg: fix a crash in wb_workfn when a device disappears"
> > has tried to address the issue, but the code is till somewhat racy after that commit.
> >
> > In this patchset, we try to protect bdi->dev with spinlock and copy device name
> > into caller buffer, avoiding use-after-free.
> >
> > V4:
> > * Fix coding error in bdi_get_dev_name()
> > * Write one patch for each broken caller
> >
> > V3:
> > https://www.spinics.net/lists/linux-block/msg51111.html
> > Use spinlock to protect bdi->dev and copy device name into caller buffer
> >
> > V2:
> > https://www.spinics.net/lists/linux-fsdevel/msg163206.html
> > Try to protect device lifetime with RCU.
> >
> > V1:
> > https://www.spinics.net/lists/linux-block/msg49693.html
> > Add a new spinlock and copy kobj->name into caller buffer.
> > Or using synchronize_rcu() to wait until reader complete.
> >
> > Yufen Yu (6):
> > bdi: use bdi_dev_name() to get device name
> > bdi: protect bdi->dev with spinlock
> > bfq: fix potential kernel crash when print error info
> > memcg: fix crash in wb_workfn when bdi unregister
> > blk-wbt: replace bdi_dev_name() with bdi_get_dev_name()
> > blkcg: fix use-after-free for bdi->dev
> >
> > block/bfq-iosched.c | 6 +++--
> > block/blk-cgroup-rwstat.c | 6 +++--
> > block/blk-cgroup.c | 19 +++++-----------
> > block/blk-iocost.c | 14 +++++++-----
> > block/blk-iolatency.c | 5 +++--
> > block/blk-throttle.c | 6 +++--
> > fs/ceph/debugfs.c | 2 +-
> > fs/fs-writeback.c | 4 +++-
> > include/linux/backing-dev-defs.h | 1 +
> > include/linux/backing-dev.h | 26 ++++++++++++++++++++++
> > include/linux/blk-cgroup.h | 1 -
> > include/trace/events/wbt.h | 8 +++----
> > include/trace/events/writeback.h | 38 ++++++++++++++------------------
> > mm/backing-dev.c | 9 ++++++--
> > 14 files changed, 88 insertions(+), 57 deletions(-)
> >
next prev parent reply other threads:[~2020-04-14 14:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-25 12:38 [PATCH v4 0/6] bdi: fix use-after-free for bdi device Yufen Yu
2020-03-25 12:38 ` [PATCH v4 1/6] bdi: use bdi_dev_name() to get device name Yufen Yu
2020-03-25 12:38 ` [PATCH v4 2/6] bdi: protect bdi->dev with spinlock Yufen Yu
2020-03-25 12:38 ` [PATCH v4 3/6] bfq: fix potential kernel crash when print error info Yufen Yu
2020-03-25 12:38 ` [PATCH v4 4/6] memcg: fix crash in wb_workfn when bdi unregister Yufen Yu
2020-03-25 12:38 ` [PATCH v4 5/6] blk-wbt: replace bdi_dev_name() with bdi_get_dev_name() Yufen Yu
2020-03-25 12:38 ` [PATCH v4 6/6] blkcg: fix use-after-free for bdi->dev Yufen Yu
2020-04-09 13:28 ` [PATCH v4 0/6] bdi: fix use-after-free for bdi device Yufen Yu
2020-04-14 14:44 ` Theodore Y. Ts'o [this message]
2020-04-14 15:52 ` Christoph Hellwig
2020-04-15 9:34 ` Jan Kara
2020-04-16 5:36 ` Christoph Hellwig
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=20200414144448.GA317058@mit.edu \
--to=tytso@mit.edu \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=gregkh@linuxfoundation.org \
--cc=hch@infradead.org \
--cc=jack@suse.cz \
--cc=linux-block@vger.kernel.org \
--cc=tj@kernel.org \
--cc=yuyufen@huawei.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;
as well as URLs for NNTP newsgroup(s).