Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Josef Bacik <josef@toxicpanda.com>
To: Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] btrfs-progs: print-tree: do sanity checks for dir items
Date: Tue, 4 Jun 2024 11:58:13 -0400	[thread overview]
Message-ID: <20240604155813.GC3413@localhost.localdomain> (raw)
In-Reply-To: <0279bccaf02bbc09d6ac685b37e36aacb60bf9b0.1717476533.git.wqu@suse.com>

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?  If that's the case then I'd manually call
check_leaf to make sure the pointers are all correct before calling print tree,
otherwise if it's from a different tool we need to make sure the strict checking
is happening for that tool, we should only be bypassing the strict checking for
repair.  Thanks,

Josef

  reply	other threads:[~2024-06-04 15:58 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 [this message]
2024-06-04 22:16   ` Qu Wenruo
2024-06-05 15:24     ` Josef Bacik

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=20240604155813.GC3413@localhost.localdomain \
    --to=josef@toxicpanda.com \
    --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