From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Josef Bacik <josef@toxicpanda.com>, 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: Wed, 5 Jun 2024 07:46:49 +0930 [thread overview]
Message-ID: <c53aad22-ed68-433b-9dcc-c52f1c2fc73f@gmx.com> (raw)
In-Reply-To: <20240604155813.GC3413@localhost.localdomain>
在 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.
Thanks,
Qu
> 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
>
next prev parent reply other threads:[~2024-06-04 22:16 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 [this message]
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=c53aad22-ed68-433b-9dcc-c52f1c2fc73f@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=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