loop5: detected capacity change from 0 to 32768 BTRFS: device fsid 24c7a497-3402-47dd-bef8-82358f5f30e0 devid 1 transid 8 /dev/loop5 scanned by syz-executor.5 (11808) ================================================================== BUG: KASAN: use-after-free in btrfs_test_super+0x56/0x90 fs/btrfs/super.c:1348 Read of size 8 at addr ffff888010a6d110 by task syz-executor.5/11808 CPU: 0 PID: 11808 Comm: syz-executor.5 Not tainted 6.5.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/26/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x167/0x220 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0x163/0x540 mm/kasan/report.c:475 kasan_report+0x175/0x1b0 mm/kasan/report.c:588 btrfs_test_super+0x56/0x90 fs/btrfs/super.c:1348 sget+0x102/0x3a0 fs/super.c:861 btrfs_mount_root+0x4e8/0x770 fs/btrfs/super.c:1508 legacy_get_tree+0xe9/0x170 fs/fs_context.c:638 vfs_get_tree+0x7f/0x230 fs/super.c:1711 fc_mount fs/namespace.c:1112 [inline] vfs_kern_mount+0x63/0xf0 fs/namespace.c:1142 btrfs_mount+0x2fd/0xa30 fs/btrfs/super.c:1585 legacy_get_tree+0xe9/0x170 fs/fs_context.c:638 vfs_get_tree+0x7f/0x230 fs/super.c:1711 do_new_mount+0x1e5/0x940 fs/namespace.c:3335 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount+0x232/0x2c0 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f9c6267e1ea Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 09 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f9c6340eee8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f9c6340ef80 RCX: 00007f9c6267e1ea RDX: 0000000020005100 RSI: 0000000020000000 RDI: 00007f9c6340ef40 RBP: 0000000020005100 R08: 00007f9c6340ef80 R09: 0000000000000080 R10: 0000000000000080 R11: 0000000000000246 R12: 0000000020000000 R13: 00007f9c6340ef40 R14: 00000000000050ef R15: 0000000020000040 The buggy address belongs to the physical page: page:ffffea0000429b40 refcount:0 mapcount:0 mapping:0000000000000000 index:0x4 pfn:0x10a6d flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000000 0000000000000000 ffffffff00000201 0000000000000000 raw: 0000000000000004 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 2, migratetype Unmovable, gfp_mask 0x152dc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_ZERO), pid 11796, tgid 11795 (syz-executor.0), ts 436370330998, free_ts 437156036272 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0x31e8/0x3370 mm/page_alloc.c:3221 __alloc_pages+0x255/0x670 mm/page_alloc.c:4477 __alloc_pages_node include/linux/gfp.h:237 [inline] alloc_pages_node include/linux/gfp.h:260 [inline] __kmalloc_large_node+0x91/0x1d0 mm/slab_common.c:1126 __do_kmalloc_node mm/slab_common.c:973 [inline] __kmalloc_node+0x116/0x230 mm/slab_common.c:992 kmalloc_node include/linux/slab.h:602 [inline] kvmalloc_node+0x42/0xf0 mm/util.c:604 kvmalloc include/linux/slab.h:720 [inline] kvzalloc include/linux/slab.h:728 [inline] btrfs_mount_root+0xf1/0x770 fs/btrfs/super.c:1466 legacy_get_tree+0xe9/0x170 fs/fs_context.c:638 vfs_get_tree+0x7f/0x230 fs/super.c:1711 fc_mount fs/namespace.c:1112 [inline] vfs_kern_mount+0x63/0xf0 fs/namespace.c:1142 btrfs_mount+0x2fd/0xa30 fs/btrfs/super.c:1585 legacy_get_tree+0xe9/0x170 fs/fs_context.c:638 vfs_get_tree+0x7f/0x230 fs/super.c:1711 do_new_mount+0x1e5/0x940 fs/namespace.c:3335 do_mount fs/namespace.c:3675 [inline] __do_sys_mount fs/namespace.c:3884 [inline] __se_sys_mount+0x232/0x2c0 fs/namespace.c:3861 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2348 free_unref_page+0x37/0x3f0 mm/page_alloc.c:2443 free_large_kmalloc+0xff/0x190 mm/slab_common.c:962 deactivate_locked_super+0x80/0x1c0 fs/super.c:454 cleanup_mnt+0x358/0x3e0 fs/namespace.c:1254 task_work_run+0x20a/0x290 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xcd/0xe0 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xa9/0x130 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff888010a6d000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888010a6d080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888010a6d100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888010a6d180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888010a6d200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================