mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: syzbot <syzbot+772bdfe41846e057fa83@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: [syzbot] [btrfs?] KASAN: slab-use-after-free Read in close_fs_devices
Date: Fri, 27 Jun 2025 09:31:34 +0930	[thread overview]
Message-ID: <bfb89482-8c38-4e40-adb1-a7c60a335679@gmx.com> (raw)
In-Reply-To: <685d84e6.a00a0220.2e5631.02e4.GAE@google.com>



在 2025/6/27 03:05, syzbot 写道:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    ecb259c4f70d Add linux-next specific files for 20250626

This head already includes the latest v5 update, so it's not a goode 
news to me.

> git tree:       linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=11147182580000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=f0c48ed70f20d0d2
> dashboard link: https://syzkaller.appspot.com/bug?extid=772bdfe41846e057fa83
> compiler:       Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
> 
> Unfortunately, I don't have any reproducer for this issue yet.
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/a6a71f1563ce/disk-ecb259c4.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/914a0673e6a0/vmlinux-ecb259c4.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/87f7194e2a0e/bzImage-ecb259c4.xz
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+772bdfe41846e057fa83@syzkaller.appspotmail.com
> 
> BTRFS: device fsid a6a605fc-d5f1-4e66-8595-3726e2b761d6 devid 1 transid 8 /dev/loop4 (7:4) scanned by syz.4.616 (8589)
> ==================================================================
> BUG: KASAN: slab-use-after-free in close_fs_devices+0x81f/0x870 fs/btrfs/volumes.c:1182
> Read of size 4 at addr ffff88802fe14930 by task syz.4.616/8589
> 
> CPU: 0 UID: 0 PID: 8589 Comm: syz.4.616 Not tainted 6.16.0-rc3-next-20250626-syzkaller #0 PREEMPT(full)
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025
> Call Trace:
>   <TASK>
>   dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120
>   print_address_description mm/kasan/report.c:408 [inline]
>   print_report+0xd2/0x2b0 mm/kasan/report.c:521
>   kasan_report+0x118/0x150 mm/kasan/report.c:634
>   close_fs_devices+0x81f/0x870 fs/btrfs/volumes.c:1182
>   btrfs_close_devices+0xc5/0x560 fs/btrfs/volumes.c:1201
>   btrfs_free_fs_info+0x4f/0x3c0 fs/btrfs/disk-io.c:1250
>   deactivate_locked_super+0xbc/0x130 fs/super.c:474
>   btrfs_get_tree_super fs/btrfs/super.c:-1 [inline]

If syzbot can provide a better line number for inlined function, it will 
be very helpful.

But so far it looks that btrfs_open_devices() failed, thus 
deactive_locked_super() is called to free the whole fs_devices.

However since btrfs_open_fs_devices() failed, we are not holding the 
fs_devices opened, and after we release uuid_mutex, the fs_devices can 
be freed by someone else.

I believe we need extra error handling for this particular case.

Thanks a lot for catching this rare error path.

Thanks,
Qu


      reply	other threads:[~2025-06-27  0:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-26 17:35 syzbot
2025-06-27  0:01 ` Qu Wenruo [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=bfb89482-8c38-4e40-adb1-a7c60a335679@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+772bdfe41846e057fa83@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

all inboxes | Powered by JetHome®