From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: dsterba@suse.cz
Cc: Lizhi Xu <lizhi.xu@windriver.com>,
syzbot+3030e17bd57a73d39bd7@syzkaller.appspotmail.com,
clm@fb.com, dsterba@suse.com, josef@toxicpanda.com,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] btrfs: add a sanity check for btrfs root
Date: Sat, 26 Oct 2024 07:33:59 +1030 [thread overview]
Message-ID: <e5bc8c4e-771f-4cc7-91e7-291018b9468c@gmx.com> (raw)
In-Reply-To: <20241025180315.GI31418@twin.jikos.cz>
在 2024/10/26 04:33, David Sterba 写道:
> On Fri, Oct 25, 2024 at 08:23:07PM +1030, Qu Wenruo wrote:
>>
>>
>> 在 2024/10/25 15:25, Lizhi Xu 写道:
>>> Syzbot report a null-ptr-deref in btrfs_search_slot.
>>> It use the input logical can't find the extent root in extent_from_logical,
>>> and triger the null-ptr-deref in btrfs_search_slot.
>>> Add sanity check for btrfs root before using it in btrfs_search_slot.
>>
>> Although I'd prefer to explain a little more about why the NULL root
>> pointer can happen (caused by the rescue=all mount option), which can
>> cause NULL root pointer for non-critical tree roots, like
>> uuid/csum/extent or even device trees.
>>
>> You don't need to bother sending an update.
>> I can add such info when pushing to the maintainer's tree.
>>
>>>
>>> Reported-by: syzbot+3030e17bd57a73d39bd7@syzkaller.appspotmail.com
>>> Closes: https://syzkaller.appspot.com/bug?extid=3030e17bd57a73d39bd7
>>> Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
>>
>> Reviewed-by: Qu Wenruo <wqu@suse.com>
>
>>> @@ -2023,6 +2023,10 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
>>> int min_write_lock_level;
>>> int prev_cmp;
>>>
>>> + if (!root)
>>> + return -EINVAL;
>
> The function returns errors indirectly so it's not clear which could be
> ultimately returned. I did a quick search over the calls starting in
> btrfs_search_slot() and it seems that EINVAL is not used so we'd know if
> it ends up in some error report. The ones I found: EAGAIN, EIO, EUCLEAN,
> ENOMEM.
>
If you want, I can add extra (ratelimited though) error/warning message
for such cases.
Considering this is only possible for rescue=all cases, extra error
messages should be fine.
Or do you prefer some more rare return values?
Thanks,
Qu
next prev parent reply other threads:[~2024-10-25 21:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-24 3:50 [syzbot] [btrfs?] general protection fault in btrfs_search_slot syzbot
2024-10-25 2:23 ` Lizhi Xu
2024-10-25 2:44 ` syzbot
2024-10-25 4:19 ` Qu Wenruo
2024-10-25 4:38 ` [syzbot] [bcachefs?] KASAN: slab-use-after-free Read in bch2_reconstruct_alloc Lizhi Xu
2024-10-25 4:44 ` Qu Wenruo
2024-10-25 4:59 ` [syzbot] [btrfs?] general protection fault in btrfs_search_slot syzbot
2024-10-25 4:55 ` [PATCH] btrfs: add a sanity check for btrfs root Lizhi Xu
2024-10-25 9:53 ` Qu Wenruo
2024-10-25 18:03 ` David Sterba
2024-10-25 21:03 ` Qu Wenruo [this message]
2024-10-25 22:22 ` David Sterba
2024-11-03 21:44 ` [syzbot] [btrfs?] general protection fault in btrfs_search_slot syzbot
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=e5bc8c4e-771f-4cc7-91e7-291018b9468c@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=clm@fb.com \
--cc=dsterba@suse.com \
--cc=dsterba@suse.cz \
--cc=josef@toxicpanda.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.xu@windriver.com \
--cc=syzbot+3030e17bd57a73d39bd7@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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