Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Qu Wenruo <wqu@suse.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: print-tree: do sanity checks for dir items
Date: Wed, 5 Jun 2024 11:24:01 -0400	[thread overview]
Message-ID: <20240605152401.GA21567@localhost.localdomain> (raw)
In-Reply-To: <c53aad22-ed68-433b-9dcc-c52f1c2fc73f@gmx.com>

On Wed, Jun 05, 2024 at 07:46:49AM +0930, Qu Wenruo wrote:
> 
> 
> 在 2024/6/5 01:28, Josef Bacik 写道:
> > On Tue, Jun 04, 2024 at 02:19:08PM +0930, Qu Wenruo wrote:
> > > There is a bug report that with UBSAN enabled, fuzz/006 test case would
> > > crash.
> > > 
> > > It turns out that the image bko-154021-invalid-drop-level.raw has
> > > invalid dir items, that the name/data len is beyond the item.
> > > 
> > > And if we try to read beyond the eb boundary, UBSAN got triggered.
> > > 
> > > Normally in kernel tree-checker would reject such metadata in the first
> > > place, but in btrfs-progs we can not go that strict or we can not do a
> > > lot of repair.
> > > 
> > > So here just enhance print_dir_item() to do extra sanity checks for
> > > data/name len before reading the contents.
> > > 
> > > Issue: #805
> > > Signed-off-by: Qu Wenruo <wqu@suse.com>
> > 
> > I'd rather not duplicate this check.
> > 
> > Is the print-tree coming from repair?
> 
> Nope, it's "inspect tree-stats" subcommand, it's just really printing
> the root of each tree.
> 
> Remember we still need to call "btrfs ins dump-tree" to analyze fuzzed
> images, if the print-tree is as strict as tree-checker, just image how
> miserable the life would be.
> 

Ugh good point, ok

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef

      reply	other threads:[~2024-06-05 15:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04  4:49 [PATCH] btrfs-progs: print-tree: do sanity checks for dir items Qu Wenruo
2024-06-04 15:58 ` Josef Bacik
2024-06-04 22:16   ` Qu Wenruo
2024-06-05 15:24     ` Josef Bacik [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=20240605152401.GA21567@localhost.localdomain \
    --to=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    --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