================================================================== BUG: KASAN: use-after-free in __xfs_iflags_test fs/xfs/xfs_inode.h:146 [inline] BUG: KASAN: use-after-free in xfs_iflush_cluster+0xec/0x12a0 fs/xfs/xfs_inode.c:3650 Read of size 8 at addr ffff88805d862e68 by task xfsaild/loop7/5086 CPU: 1 PID: 5086 Comm: xfsaild/loop7 Not tainted 5.15.173-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106 print_address_description+0x63/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:434 [inline] kasan_report+0x16b/0x1c0 mm/kasan/report.c:451 __xfs_iflags_test fs/xfs/xfs_inode.h:146 [inline] xfs_iflush_cluster+0xec/0x12a0 fs/xfs/xfs_inode.c:3650 xfs_inode_item_push+0x1cd/0x2c0 fs/xfs/xfs_inode_item.c:567 xfsaild_push_item fs/xfs/xfs_trans_ail.c:414 [inline] xfsaild_push fs/xfs/xfs_trans_ail.c:472 [inline] xfsaild+0xd6d/0x2970 fs/xfs/xfs_trans_ail.c:657 kthread+0x3f6/0x4f0 kernel/kthread.c:334 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Allocated by task 5009: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track mm/kasan/common.c:46 [inline] set_alloc_info mm/kasan/common.c:434 [inline] __kasan_slab_alloc+0x8e/0xc0 mm/kasan/common.c:467 kasan_slab_alloc include/linux/kasan.h:254 [inline] slab_post_alloc_hook+0x53/0x380 mm/slab.h:519 slab_alloc_node mm/slub.c:3220 [inline] slab_alloc mm/slub.c:3228 [inline] kmem_cache_alloc+0xf3/0x280 mm/slub.c:3233 xfs_inode_alloc+0x4f/0x580 fs/xfs/xfs_icache.c:80 xfs_iget_cache_miss fs/xfs/xfs_icache.c:601 [inline] xfs_iget+0xaf7/0x2ec0 fs/xfs/xfs_icache.c:767 xfs_init_new_inode+0x1d4/0x1100 fs/xfs/xfs_inode.c:830 xfs_create+0x9b1/0x1370 fs/xfs/xfs_inode.c:1044 xfs_generic_create+0x426/0xd00 fs/xfs/xfs_iops.c:197 vfs_mknod+0x444/0x4d0 fs/namei.c:3944 do_mknodat+0x392/0x690 __do_sys_mknod fs/namei.c:4027 [inline] __se_sys_mknod fs/namei.c:4025 [inline] __x64_sys_mknod+0x8a/0xa0 fs/namei.c:4025 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 Freed by task 5109: kasan_save_stack mm/kasan/common.c:38 [inline] kasan_set_track+0x4b/0x80 mm/kasan/common.c:46 kasan_set_free_info+0x1f/0x40 mm/kasan/generic.c:360 ____kasan_slab_free+0xd8/0x120 mm/kasan/common.c:366 kasan_slab_free include/linux/kasan.h:230 [inline] slab_free_hook mm/slub.c:1705 [inline] slab_free_freelist_hook+0xdd/0x160 mm/slub.c:1731 slab_free mm/slub.c:3499 [inline] kmem_cache_free+0x91/0x1f0 mm/slub.c:3515 rcu_do_batch kernel/rcu/tree.c:2523 [inline] rcu_core+0xa15/0x1650 kernel/rcu/tree.c:2763 handle_softirqs+0x3a7/0x930 kernel/softirq.c:558 __do_softirq kernel/softirq.c:592 [inline] invoke_softirq kernel/softirq.c:432 [inline] __irq_exit_rcu+0x157/0x240 kernel/softirq.c:641 irq_exit_rcu+0x5/0x20 kernel/softirq.c:653 instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1108 [inline] sysvec_apic_timer_interrupt+0xa0/0xc0 arch/x86/kernel/apic/apic.c:1108 asm_sysvec_apic_timer_interrupt+0x16/0x20 arch/x86/include/asm/idtentry.h:676 Last potentially related work creation: kasan_save_stack+0x36/0x60 mm/kasan/common.c:38 kasan_record_aux_stack+0xba/0x100 mm/kasan/generic.c:348 __call_rcu kernel/rcu/tree.c:3007 [inline] call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3087 __xfs_inode_free fs/xfs/xfs_icache.c:158 [inline] xfs_reclaim_inode fs/xfs/xfs_icache.c:960 [inline] xfs_icwalk_process_inode fs/xfs/xfs_icache.c:1642 [inline] xfs_icwalk_ag+0x1329/0x1a10 fs/xfs/xfs_icache.c:1724 xfs_icwalk fs/xfs/xfs_icache.c:1773 [inline] xfs_reclaim_inodes+0x1f3/0x300 fs/xfs/xfs_icache.c:993 xfs_unmount_flush_inodes fs/xfs/xfs_mount.c:554 [inline] xfs_unmountfs+0x14f/0x270 fs/xfs/xfs_mount.c:1016 xfs_fs_put_super+0x65/0x2b0 fs/xfs/xfs_super.c:1096 generic_shutdown_super+0x130/0x310 fs/super.c:475 kill_block_super+0x7a/0xe0 fs/super.c:1427 deactivate_locked_super+0xa0/0x110 fs/super.c:335 cleanup_mnt+0x44e/0x500 fs/namespace.c:1143 task_work_run+0x129/0x1a0 kernel/task_work.c:188 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:181 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:214 __syscall_exit_to_user_mode_work kernel/entry/common.c:296 [inline] syscall_exit_to_user_mode+0x5d/0x240 kernel/entry/common.c:307 do_syscall_64+0x47/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x66/0xd0 The buggy address belongs to the object at ffff88805d862d00 which belongs to the cache xfs_inode of size 1752 The buggy address is located 360 bytes inside of 1752-byte region [ffff88805d862d00, ffff88805d8633d8) The buggy address belongs to the page: page:ffffea0001761800 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88805d860000 pfn:0x5d860 head:ffffea0001761800 order:3 compound_mapcount:0 compound_pincount:0 memcg:ffff888022cb7c01 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff88801e3a3000 raw: ffff88805d860000 0000000080110010 00000001ffffffff ffff888022cb7c01 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Reclaimable, gfp_mask 0x1d20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 4528, ts 76171597238, free_ts 18488022104 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0x3b78/0x3d40 mm/page_alloc.c:4192 __alloc_pages+0x272/0x700 mm/page_alloc.c:5464 alloc_slab_page mm/slub.c:1775 [inline] allocate_slab mm/slub.c:1912 [inline] new_slab+0xbb/0x4b0 mm/slub.c:1975 ___slab_alloc+0x6f6/0xe10 mm/slub.c:3008 __slab_alloc mm/slub.c:3095 [inline] slab_alloc_node mm/slub.c:3186 [inline] slab_alloc mm/slub.c:3228 [inline] kmem_cache_alloc+0x18e/0x280 mm/slub.c:3233 xfs_inode_alloc+0x4f/0x580 fs/xfs/xfs_icache.c:80 xfs_iget_cache_miss fs/xfs/xfs_icache.c:601 [inline] xfs_iget+0xaf7/0x2ec0 fs/xfs/xfs_icache.c:767 xfs_mountfs+0xeb3/0x1ce0 fs/xfs/xfs_mount.c:798 xfs_fs_fill_super+0x11b4/0x1400 fs/xfs/xfs_super.c:1676 get_tree_bdev+0x3fe/0x620 fs/super.c:1325 vfs_get_tree+0x88/0x270 fs/super.c:1530 do_new_mount+0x2ba/0xb40 fs/namespace.c:3012 do_mount fs/namespace.c:3355 [inline] __do_sys_mount fs/namespace.c:3563 [inline] __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3540 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x66/0xd0 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1340 [inline] free_pcp_prepare mm/page_alloc.c:1391 [inline] free_unref_page_prepare+0xc34/0xcf0 mm/page_alloc.c:3317 free_unref_page+0x95/0x2d0 mm/page_alloc.c:3396 free_contig_range+0x95/0xf0 mm/page_alloc.c:9383 destroy_args+0xfe/0x980 mm/debug_vm_pgtable.c:1018 debug_vm_pgtable+0x40d/0x470 mm/debug_vm_pgtable.c:1331 do_one_initcall+0x22b/0x7a0 init/main.c:1302 do_initcall_level+0x157/0x210 init/main.c:1375 do_initcalls+0x49/0x90 init/main.c:1391 kernel_init_freeable+0x425/0x5c0 init/main.c:1615 kernel_init+0x19/0x290 init/main.c:1506 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:287 Memory state around the buggy address: ffff88805d862d00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805d862d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88805d862e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88805d862e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88805d862f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================