public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 0/2] btrfs-progs: mkfs: extent-tree-v2 related fixes
Date: Mon, 10 Oct 2022 16:34:08 +0200	[thread overview]
Message-ID: <20221010143408.GE13389@twin.jikos.cz> (raw)
In-Reply-To: <cover.1665143843.git.wqu@suse.com>

On Fri, Oct 07, 2022 at 08:02:59PM +0800, Qu Wenruo wrote:
> Although recently we still have some uncertainty around the on-disk
> format for extent-tree-v2, related to how to determine the number
> of global roots, most of the on-disk format is fixed.
> 
> And even with the uncertain part involved, mkfs.btrfs should not crash
> for extent-tree-v2 feature (hidden behind the experimental builds).
> 
> There are two bugs involved:
> 
> - A crash caused by incorrectly set chunk_objectid for block group item
>   As extent-tree-v2 feature reuse that member to indicate which extent
>   tree a block group belongs to.
> 
>   But the regular fs uses a fixed 256 for that chunk_objectid, and no
>   extent-tree-v2 btrfs would have that many global roots.
> 
>   This leads to btrfs_extent_root() to return NULL, and cause later
>   segfault.
> 
>   Fix it by properly setting chunk_objectid.
>   This is a regression caused by 1430b41427b5 ("btrfs-progs: separate
>   block group tree from extent tree v2").
> 
> - A stack-over-flow caused by too long feature string
>   With extent-tree-v2 enabled, we have at least 84 bytes long feature
>   string (unified features, including compat_ro features likle fst).
> 
>   This is beyond the hard-coded 64 bytes limit.
> 
>   Fix it by introducing a new macro to indicate a minimal safe buf size,
>   and a sanity check to make sure that macro is really large enough.
> 
> Qu Wenruo (2):
>   btrfs-progs: mkfs: fix a crash when enabling extent-tree-v2
>   btrfs-progs: mkfs: fix a stack over-flow when features string are too
>     long

Added to devel, thanks.

      parent reply	other threads:[~2022-10-10 14:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-07 12:02 [PATCH 0/2] btrfs-progs: mkfs: extent-tree-v2 related fixes Qu Wenruo
2022-10-07 12:03 ` [PATCH 1/2] btrfs-progs: mkfs: fix a crash when enabling extent-tree-v2 Qu Wenruo
2022-10-08 11:51   ` Anand Jain
2022-10-07 12:03 ` [PATCH 2/2] btrfs-progs: mkfs: fix a stack over-flow when features string are too long Qu Wenruo
2022-10-08 11:52   ` Anand Jain
2022-10-10 14:34 ` David Sterba [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=20221010143408.GE13389@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=wqu@suse.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