================================================================== BUG: KASAN: use-after-free in btrfs_sb fs/btrfs/super.h:14 [inline] BUG: KASAN: use-after-free in wait_subpage_spinlock+0x1be/0x210 fs/btrfs/inode.c:8232 Read of size 8 at addr ffff888026932678 by task syz-fuzzer/5241 CPU: 0 PID: 5241 Comm: syz-fuzzer Not tainted 6.2.0-rc2-syzkaller-00010-g69b41ac87e4a #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x15e/0x461 mm/kasan/report.c:417 kasan_report+0xbf/0x1f0 mm/kasan/report.c:517 btrfs_sb fs/btrfs/super.h:14 [inline] wait_subpage_spinlock+0x1be/0x210 fs/btrfs/inode.c:8232 __btrfs_release_folio fs/btrfs/inode.c:8261 [inline] btrfs_release_folio+0x109/0x130 fs/btrfs/inode.c:8271 filemap_release_folio+0x13f/0x1b0 mm/filemap.c:3967 shrink_folio_list+0x1ea9/0x3a60 mm/vmscan.c:2000 shrink_inactive_list mm/vmscan.c:2526 [inline] shrink_list mm/vmscan.c:2767 [inline] shrink_lruvec+0xd0e/0x27a0 mm/vmscan.c:5951 shrink_node_memcgs mm/vmscan.c:6138 [inline] shrink_node+0x8f2/0x1f40 mm/vmscan.c:6169 shrink_zones mm/vmscan.c:6407 [inline] do_try_to_free_pages+0x3b4/0x17a0 mm/vmscan.c:6469 try_to_free_pages+0x2e5/0x960 mm/vmscan.c:6704 __perform_reclaim mm/page_alloc.c:4750 [inline] __alloc_pages_direct_reclaim mm/page_alloc.c:4772 [inline] __alloc_pages_slowpath.constprop.0+0x8b6/0x23d0 mm/page_alloc.c:5178 __alloc_pages+0x4aa/0x5b0 mm/page_alloc.c:5562 alloc_pages+0x1aa/0x270 mm/mempolicy.c:2286 folio_alloc+0x20/0x70 mm/mempolicy.c:2296 filemap_alloc_folio+0x362/0x450 mm/filemap.c:972 __filemap_get_folio+0x32c/0xd80 mm/filemap.c:1966 filemap_fault+0x1598/0x23f0 mm/filemap.c:3164 __do_fault+0x107/0x600 mm/memory.c:4163 do_read_fault mm/memory.c:4514 [inline] do_fault mm/memory.c:4643 [inline] handle_pte_fault mm/memory.c:4931 [inline] __handle_mm_fault+0x22f2/0x3c90 mm/memory.c:5073 handle_mm_fault+0x1b6/0x850 mm/memory.c:5219 do_user_addr_fault+0x475/0x1210 arch/x86/mm/fault.c:1428 handle_page_fault arch/x86/mm/fault.c:1519 [inline] exc_page_fault+0x98/0x170 arch/x86/mm/fault.c:1575 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0033:0x451d37 Code: 17 04 44 01 c2 48 8b b9 88 00 00 00 4c 8b 81 80 00 00 00 39 d7 77 04 48 8d 57 ff 89 d0 48 39 c7 0f 86 da 00 00 00 48 c1 e0 04 <4d> 8b 0c 00 0f 1f 44 00 00 49 39 f1 0f 87 87 00 00 00 eb 11 31 c0 RSP: 002b:000000c000df78e8 EFLAGS: 00010202 RAX: 0000000000004340 RBX: fffffffffffffffa RCX: 000000000117a760 RDX: 0000000000000434 RSI: 00000000004628c0 RDI: 000000000000386c RBP: 000000c000df78f8 R08: 0000000000f0ce60 R09: 0000000000000028 R10: 000000000000000a R11: 0000000000c95119 R12: 000000c000df79a0 R13: 0000000000000000 R14: 000000c00fddbba0 R15: 00007f0da6d919b0 The buggy address belongs to the physical page: page:ffffea00009a4c80 refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x26932 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000 raw: 0000000000000000 ffff888026932000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 1, migratetype Unmovable, gfp_mask 0x2c2220(__GFP_HIGH|__GFP_ATOMIC|__GFP_NOWARN|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_THISNODE), pid 9929, tgid 9929 (kworker/2:7), ts 1257648624895, free_ts 1260460718906 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0x119c/0x2ce0 mm/page_alloc.c:4283 __alloc_pages_slowpath.constprop.0+0x36b/0x23d0 mm/page_alloc.c:5084 __alloc_pages+0x4aa/0x5b0 mm/page_alloc.c:5562 __alloc_pages_node include/linux/gfp.h:237 [inline] kmem_getpages mm/slab.c:1363 [inline] cache_grow_begin+0x94/0x390 mm/slab.c:2574 cache_alloc_refill+0x27f/0x380 mm/slab.c:2947 ____cache_alloc mm/slab.c:3023 [inline] ____cache_alloc mm/slab.c:3006 [inline] __do_cache_alloc mm/slab.c:3206 [inline] slab_alloc_node mm/slab.c:3254 [inline] __kmem_cache_alloc_node+0x44f/0x510 mm/slab.c:3544 __do_kmalloc_node mm/slab_common.c:967 [inline] __kmalloc_node_track_caller+0x4b/0xc0 mm/slab_common.c:988 kmalloc_reserve net/core/skbuff.c:492 [inline] __alloc_skb+0xe9/0x310 net/core/skbuff.c:565 alloc_skb include/linux/skbuff.h:1270 [inline] nsim_dev_trap_skb_build drivers/net/netdevsim/dev.c:751 [inline] nsim_dev_trap_report drivers/net/netdevsim/dev.c:808 [inline] nsim_dev_trap_report_work+0x2b1/0xc80 drivers/net/netdevsim/dev.c:853 process_one_work+0x9bf/0x1710 kernel/workqueue.c:2289 worker_thread+0x669/0x1090 kernel/workqueue.c:2436 kthread+0x2e8/0x3a0 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:308 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1446 [inline] free_pcp_prepare+0x65c/0xc00 mm/page_alloc.c:1496 free_unref_page_prepare mm/page_alloc.c:3369 [inline] free_unref_page+0x1d/0x490 mm/page_alloc.c:3464 slab_destroy mm/slab.c:1619 [inline] slabs_destroy+0x85/0xc0 mm/slab.c:1639 cache_flusharray mm/slab.c:3365 [inline] ___cache_free+0x2ac/0x3d0 mm/slab.c:3428 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x4f/0x1a0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x192/0x220 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x63/0x90 mm/kasan/common.c:302 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook mm/slab.h:761 [inline] slab_alloc_node mm/slab.c:3261 [inline] __kmem_cache_alloc_node+0x26b/0x510 mm/slab.c:3544 __do_kmalloc_node mm/slab_common.c:967 [inline] __kmalloc+0x4a/0xd0 mm/slab_common.c:981 kmalloc include/linux/slab.h:584 [inline] tomoyo_realpath_from_path+0xc3/0x600 security/tomoyo/realpath.c:251 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_path_perm+0x22d/0x430 security/tomoyo/file.c:822 security_inode_getattr+0xd3/0x140 security/security.c:1375 vfs_getattr fs/stat.c:161 [inline] vfs_statx+0x16e/0x430 fs/stat.c:236 vfs_fstatat+0x90/0xb0 fs/stat.c:270 __do_sys_newfstatat+0x94/0x120 fs/stat.c:440 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80 Memory state around the buggy address: ffff888026932500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888026932580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888026932600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888026932680: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888026932700: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================