[moderation] [btrfs?] KASAN: slab-use-after-free Read in close_fs_devices

3 views
Skip to first unread message

syzbot

unread,
Jun 25, 2025, 1:40:23 AM6/25/25
to syzkaller-upst...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 5d4809e25903 Add linux-next specific files for 20250620
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=17c0cdd4580000
kernel config: https://syzkaller.appspot.com/x/.config?x=58afc4b78b52b7e3
dashboard link: https://syzkaller.appspot.com/bug?extid=90862b8bbd839c11b4d0
compiler: Debian clang version 20.1.6 (++20250514063057+1e4d39e07757-1~exp1~20250514183223.118), Debian LLD 20.1.6
CC: [c...@fb.com dst...@suse.com jo...@toxicpanda.com linux...@vger.kernel.org linux-...@vger.kernel.org]

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/16492bf6b788/disk-5d4809e2.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/7be284ded1de/vmlinux-5d4809e2.xz
kernel image: https://storage.googleapis.com/syzbot-assets/467d717f0d9c/bzImage-5d4809e2.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+90862b...@syzkaller.appspotmail.com

loop9: detected capacity change from 0 to 32768
BTRFS: device fsid 395ef67a-297e-477c-816d-cd80a5b93e5d devid 1 transid 8 /dev/loop9 (7:9) scanned by syz.9.431 (8064)
==================================================================
BUG: KASAN: slab-use-after-free in close_fs_devices+0x81f/0x870 fs/btrfs/volumes.c:1181
Read of size 4 at addr ffff888053226d30 by task syz.9.431/8064

CPU: 0 UID: 0 PID: 8064 Comm: syz.9.431 Not tainted 6.16.0-rc2-next-20250620-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:1181
btrfs_close_devices+0xc5/0x500 fs/btrfs/volumes.c:1200
btrfs_free_fs_info+0x4f/0x3c0 fs/btrfs/disk-io.c:1250
deactivate_locked_super+0xb9/0x130 fs/super.c:474
btrfs_get_tree_super fs/btrfs/super.c:-1 [inline]
btrfs_get_tree_subvol fs/btrfs/super.c:2059 [inline]
btrfs_get_tree+0xa61/0x12d0 fs/btrfs/super.c:2093
vfs_get_tree+0x8f/0x2b0 fs/super.c:1804
do_new_mount+0x24a/0xa40 fs/namespace.c:3902
do_mount fs/namespace.c:4239 [inline]
__do_sys_mount fs/namespace.c:4450 [inline]
__se_sys_mount+0x317/0x410 fs/namespace.c:4427
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f
RIP: 0033:0x7f237ad900ca
Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f237bcb3e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007f237bcb3ef0 RCX: 00007f237ad900ca
RDX: 00002000000004c0 RSI: 00002000000015c0 RDI: 00007f237bcb3eb0
RBP: 00002000000004c0 R08: 00007f237bcb3ef0 R09: 0000000002000000
R10: 0000000002000000 R11: 0000000000000246 R12: 00002000000015c0
R13: 00007f237bcb3eb0 R14: 000000000000559e R15: 0000200000000100
</TASK>

Allocated by task 8064:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:377 [inline]
__kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394
kasan_kmalloc include/linux/kasan.h:260 [inline]
__kmalloc_cache_noprof+0x230/0x3d0 mm/slub.c:4395
kmalloc_noprof include/linux/slab.h:905 [inline]
kzalloc_noprof include/linux/slab.h:1039 [inline]
alloc_fs_devices+0x4f/0x1d0 fs/btrfs/volumes.c:384
device_list_add+0x6b7/0x20b0 fs/btrfs/volumes.c:812
btrfs_scan_one_device+0x3fe/0x5b0 fs/btrfs/volumes.c:1486
btrfs_get_tree_super fs/btrfs/super.c:1857 [inline]
btrfs_get_tree_subvol fs/btrfs/super.c:2059 [inline]
btrfs_get_tree+0x441/0x12d0 fs/btrfs/super.c:2093
vfs_get_tree+0x8f/0x2b0 fs/super.c:1804
do_new_mount+0x24a/0xa40 fs/namespace.c:3902
do_mount fs/namespace.c:4239 [inline]
__do_sys_mount fs/namespace.c:4450 [inline]
__se_sys_mount+0x317/0x410 fs/namespace.c:4427
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

Freed by task 5890:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3e/0x80 mm/kasan/common.c:68
kasan_save_free_info+0x46/0x50 mm/kasan/generic.c:576
poison_slab_object mm/kasan/common.c:247 [inline]
__kasan_slab_free+0x62/0x70 mm/kasan/common.c:264
kasan_slab_free include/linux/kasan.h:233 [inline]
slab_free_hook mm/slub.c:2416 [inline]
slab_free mm/slub.c:4679 [inline]
kfree+0x18e/0x440 mm/slub.c:4878
btrfs_free_stale_devices+0x561/0x5e0 fs/btrfs/volumes.c:563
btrfs_scan_one_device+0x3d6/0x5b0 fs/btrfs/volumes.c:1480
btrfs_control_ioctl+0x128/0x370 fs/btrfs/super.c:2242
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:907 [inline]
__se_sys_ioctl+0xfc/0x170 fs/ioctl.c:893
do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline]
do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94
entry_SYSCALL_64_after_hwframe+0x77/0x7f

The buggy address belongs to the object at ffff888053226c00
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 304 bytes inside of
freed 512-byte region [ffff888053226c00, ffff888053226e00)

The buggy address belongs to the physical page:
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x53224
head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0
anon flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff)
page_type: f5(slab)
raw: 00fff00000000040 ffff88801a441c80 0000000000000000 dead000000000001
raw: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 00fff00000000040 ffff88801a441c80 0000000000000000 dead000000000001
head: 0000000000000000 0000000000100010 00000000f5000000 0000000000000000
head: 00fff00000000002 ffffea00014c8901 00000000ffffffff 00000000ffffffff
head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000004
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5834, tgid 5834 (syz-executor), ts 85603103430, free_ts 26787364106
set_page_owner include/linux/page_owner.h:32 [inline]
post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1704
prep_new_page mm/page_alloc.c:1712 [inline]
get_page_from_freelist+0x21e4/0x22c0 mm/page_alloc.c:3669
__alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4959
alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2419
alloc_slab_page mm/slub.c:2486 [inline]
allocate_slab+0x8a/0x370 mm/slub.c:2654
new_slab mm/slub.c:2708 [inline]
___slab_alloc+0xbeb/0x1410 mm/slub.c:3890
__slab_alloc mm/slub.c:3980 [inline]
__slab_alloc_node mm/slub.c:4055 [inline]
slab_alloc_node mm/slub.c:4216 [inline]
__kmalloc_cache_noprof+0x296/0x3d0 mm/slub.c:4390
kmalloc_noprof include/linux/slab.h:905 [inline]
kzalloc_noprof include/linux/slab.h:1039 [inline]
inetdev_init+0x7d/0x500 net/ipv4/devinet.c:273
inetdev_event+0x301/0x15b0 net/ipv4/devinet.c:1591
notifier_call_chain+0x1b3/0x3e0 kernel/notifier.c:85
call_netdevice_notifiers_extack net/core/dev.c:2268 [inline]
call_netdevice_notifiers net/core/dev.c:2282 [inline]
register_netdevice+0x1608/0x1ae0 net/core/dev.c:11184
veth_newlink+0x5cc/0xa50 drivers/net/veth.c:1884
rtnl_newlink_create+0x310/0xb00 net/core/rtnetlink.c:3823
__rtnl_newlink net/core/rtnetlink.c:3940 [inline]
rtnl_newlink+0x16d6/0x1c70 net/core/rtnetlink.c:4055
rtnetlink_rcv_msg+0x7cf/0xb70 net/core/rtnetlink.c:6944
netlink_rcv_skb+0x205/0x470 net/netlink/af_netlink.c:2534
page last free pid 1 tgid 1 stack trace:
reset_page_owner include/linux/page_owner.h:25 [inline]
free_pages_prepare mm/page_alloc.c:1248 [inline]
__free_frozen_pages+0xc71/0xe70 mm/page_alloc.c:2706
__free_pages mm/page_alloc.c:5071 [inline]
free_contig_range+0x1bd/0x4a0 mm/page_alloc.c:6927
destroy_args+0x7e/0x5d0 mm/debug_vm_pgtable.c:1009
debug_vm_pgtable+0x412/0x450 mm/debug_vm_pgtable.c:1389
do_one_initcall+0x233/0x820 init/main.c:1274
do_initcall_level+0x137/0x1f0 init/main.c:1336
do_initcalls+0x69/0xd0 init/main.c:1352
kernel_init_freeable+0x3d9/0x570 init/main.c:1584
kernel_init+0x1d/0x1d0 init/main.c:1474
ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

Memory state around the buggy address:
ffff888053226c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888053226c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888053226d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888053226d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888053226e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

syzbot

unread,
Jun 26, 2025, 1:35:22 PM6/26/25
to syzkaller-upst...@googlegroups.com
Sending this report to the next reporting stage.
Reply all
Reply to author
Forward
0 new messages