All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 0/3] btrfs-progs: make convert to generate chunks aligned to stripe boundary
Date: Tue, 16 Jan 2024 14:01:23 +1030	[thread overview]
Message-ID: <cover.1705375819.git.wqu@suse.com> (raw)

There is a recent report about scrub use-after-free, which is caused by
unaligned chunk length (only aligned to sectorsize, but not to
BTRFS_STRIPE_LEN).

Although the bug would soon be fixed in kernel, there is no hard to make
convert to generate data chunks with both start and length aligned to
BTRFS_STRIPE_LEN.

Thankfully the start bytenr is already aligned to 64K, we only need to
make the length aligned.

Furthermore, allow "btrfs check" to detect such unaligned chunks and
gives a warning (but not consider it as an error).
For selftests, we would utilize the debug environment variable,
BTRFS_PROGS_DEBUG_STRICT_CHUNK_ALIGNMENT, to convert the warning to an
error.

Qu Wenruo (3):
  btrfs-progs: convert: make sure the length of data chunks are also
    stripe aligned
  btrfs-progs: add extra chunk alignment checks
  btrfs-progs: tests: enable strict chunk alignment check

 check/common.h       |  1 +
 check/main.c         | 20 ++++++++++++++++++++
 check/mode-lowmem.c  | 11 +++++++++++
 common/utils.c       | 19 +++++++++++++++++++
 common/utils.h       |  1 +
 convert/main.c       |  3 ++-
 tests/common         |  2 ++
 tests/common.convert |  2 ++
 8 files changed, 58 insertions(+), 1 deletion(-)

--
2.43.0


             reply	other threads:[~2024-01-16  3:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16  3:31 Qu Wenruo [this message]
2024-01-16  3:31 ` [PATCH 1/3] btrfs-progs: convert: make sure the length of data chunks are also stripe aligned Qu Wenruo
2024-01-16  3:31 ` [PATCH 2/3] btrfs-progs: add extra chunk alignment checks Qu Wenruo
2024-01-16  3:31 ` [PATCH 3/3] btrfs-progs: tests: enable strict chunk alignment check Qu Wenruo
2024-01-16 18:16 ` [PATCH 0/3] btrfs-progs: make convert to generate chunks aligned to stripe boundary David Sterba

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=cover.1705375819.git.wqu@suse.com \
    --to=wqu@suse.com \
    --cc=linux-btrfs@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.