From: Coly Li <colyli@suse.de>
To: Matthew Mirvish <matthew@mm12.xyz>
Cc: Bcache Linux <linux-bcache@vger.kernel.org>, stable@vger.kernel.org
Subject: Re: [PATCH] bcache: fix variable length array abuse in btree_iter
Date: Sat, 16 Mar 2024 00:52:26 +0800 [thread overview]
Message-ID: <ABEE9BD9-9807-4D6F-AD4C-549A123109DE@suse.de> (raw)
In-Reply-To: <20240315002129.18827-1-matthew@mm12.xyz>
> 2024年3月15日 08:21,Matthew Mirvish <matthew@mm12.xyz> 写道:
>
> btree_iter is used in two ways: either allocated on the stack with a
> fixed size MAX_BSETS, or from a mempool with a dynamic size based on the
> specific cache set. Previously, the struct had a fixed-length array of
> size MAX_BSETS which was indexed out-of-bounds for the dynamically-sized
> iterators, which causes UBSAN to complain.
>
> This patch uses the same approach as in bcachefs's sort_iter and splits
> the iterator into a btree_iter with a flexible array member and a
> btree_iter_stack which embeds a btree_iter as well as a fixed-length
> data array.
>
> Cc: stable@vger.kernel.org
> Closes: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2039368
> Signed-off-by: Matthew Mirvish <matthew@mm12.xyz>
This patch is overall good to me.
Let me take it and test for a while, and submit it to next merge window if the testing goes well.
Thanks.
Coly Li
> ---
> drivers/md/bcache/bset.c | 44 +++++++++++++++++------------------
> drivers/md/bcache/bset.h | 28 ++++++++++++++--------
> drivers/md/bcache/btree.c | 40 ++++++++++++++++---------------
> drivers/md/bcache/super.c | 5 ++--
> drivers/md/bcache/sysfs.c | 2 +-
> drivers/md/bcache/writeback.c | 10 ++++----
> 6 files changed, 70 insertions(+), 59 deletions(-)
>
[snipped]
prev parent reply other threads:[~2024-03-15 16:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-15 0:21 [PATCH] bcache: fix variable length array abuse in btree_iter Matthew Mirvish
2024-03-15 16:52 ` Coly Li [this message]
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=ABEE9BD9-9807-4D6F-AD4C-549A123109DE@suse.de \
--to=colyli@suse.de \
--cc=linux-bcache@vger.kernel.org \
--cc=matthew@mm12.xyz \
--cc=stable@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).