================================================================== 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 ffff88803afa4c68 by task xfsaild/loop1/20287 CPU: 0 PID: 20287 Comm: xfsaild/loop1 Not tainted 5.15.110-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb 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:319 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298 Allocated by task 20288: 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:596 [inline] xfs_iget+0xb03/0x3000 fs/xfs/xfs_icache.c:762 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/0xd70 fs/xfs/xfs_iops.c:197 vfs_mkdir+0x419/0x640 fs/namei.c:3994 do_mkdirat+0x260/0x520 fs/namei.c:4019 __do_sys_mkdirat fs/namei.c:4034 [inline] __se_sys_mkdirat fs/namei.c:4032 [inline] __x64_sys_mkdirat+0x85/0x90 fs/namei.c:4032 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb Freed by task 20306: 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:2509 [inline] rcu_core+0xa15/0x1650 kernel/rcu/tree.c:2749 __do_softirq+0x3b3/0x93a kernel/softirq.c:558 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:2993 [inline] call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3073 __xfs_inode_free fs/xfs/xfs_icache.c:158 [inline] xfs_reclaim_inode fs/xfs/xfs_icache.c:955 [inline] xfs_icwalk_process_inode fs/xfs/xfs_icache.c:1637 [inline] xfs_icwalk_ag+0x1329/0x1a10 fs/xfs/xfs_icache.c:1719 xfs_icwalk fs/xfs/xfs_icache.c:1768 [inline] xfs_reclaim_inodes+0x1f3/0x300 fs/xfs/xfs_icache.c:988 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:1090 generic_shutdown_super+0x136/0x2c0 fs/super.c:475 kill_block_super+0x7a/0xe0 fs/super.c:1405 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:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:175 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:208 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline] syscall_exit_to_user_mode+0x5d/0x250 kernel/entry/common.c:301 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x61/0xcb Second to 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:2993 [inline] call_rcu+0x1c4/0xa70 kernel/rcu/tree.c:3073 __xfs_inode_free fs/xfs/xfs_icache.c:158 [inline] xfs_reclaim_inode fs/xfs/xfs_icache.c:955 [inline] xfs_icwalk_process_inode fs/xfs/xfs_icache.c:1637 [inline] xfs_icwalk_ag+0x1329/0x1a10 fs/xfs/xfs_icache.c:1719 xfs_icwalk fs/xfs/xfs_icache.c:1768 [inline] xfs_reclaim_inodes+0x1f3/0x300 fs/xfs/xfs_icache.c:988 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:1090 generic_shutdown_super+0x136/0x2c0 fs/super.c:475 kill_block_super+0x7a/0xe0 fs/super.c:1405 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:164 tracehook_notify_resume include/linux/tracehook.h:189 [inline] exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:175 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:208 __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline] syscall_exit_to_user_mode+0x5d/0x250 kernel/entry/common.c:301 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x61/0xcb The buggy address belongs to the object at ffff88803afa4b00 which belongs to the cache xfs_inode of size 1752 The buggy address is located 360 bytes inside of 1752-byte region [ffff88803afa4b00, ffff88803afa51d8) The buggy address belongs to the page: page:ffffea0000ebe800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x3afa0 head:ffffea0000ebe800 order:3 compound_mapcount:0 compound_pincount:0 memcg:ffff888070766d01 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0000c46200 0000000200000002 ffff888146517640 raw: 0000000000000000 0000000080110011 00000001ffffffff ffff888070766d01 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 8341, ts 643704408283, free_ts 643405433751 prep_new_page mm/page_alloc.c:2426 [inline] get_page_from_freelist+0x322a/0x33c0 mm/page_alloc.c:4159 __alloc_pages+0x272/0x700 mm/page_alloc.c:5421 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:596 [inline] xfs_iget+0xb03/0x3000 fs/xfs/xfs_icache.c:762 xfs_rtmount_inodes+0x4c/0x160 fs/xfs/xfs_rtalloc.c:1299 xfs_mountfs+0xf78/0x1ca0 fs/xfs/xfs_mount.c:823 xfs_fs_fill_super+0x100c/0x1240 fs/xfs/xfs_super.c:1658 get_tree_bdev+0x3fe/0x620 fs/super.c:1303 vfs_get_tree+0x88/0x270 fs/super.c:1508 do_new_mount+0x28b/0xad0 fs/namespace.c:2994 do_mount fs/namespace.c:3337 [inline] __do_sys_mount fs/namespace.c:3545 [inline] __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3522 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb 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 do_slab_free mm/slub.c:3487 [inline] ___cache_free+0xe3/0x100 mm/slub.c:3506 qlist_free_all+0x36/0x90 mm/kasan/quarantine.c:176 kasan_quarantine_reduce+0x162/0x180 mm/kasan/quarantine.c:283 __kasan_slab_alloc+0x2f/0xc0 mm/kasan/common.c:444 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] __kmalloc+0x120/0x300 mm/slub.c:4403 kmalloc include/linux/slab.h:596 [inline] kzalloc include/linux/slab.h:721 [inline] tomoyo_encode2 security/tomoyo/realpath.c:45 [inline] tomoyo_encode+0x26b/0x530 security/tomoyo/realpath.c:80 tomoyo_realpath_from_path+0x5a2/0x5e0 security/tomoyo/realpath.c:288 tomoyo_get_realpath security/tomoyo/file.c:151 [inline] tomoyo_check_open_permission+0x22c/0x490 security/tomoyo/file.c:771 security_file_open+0x5f/0xa0 security/security.c:1650 do_dentry_open+0x315/0xfb0 fs/open.c:813 do_open fs/namei.c:3538 [inline] path_openat+0x2702/0x2f20 fs/namei.c:3672 do_filp_open+0x21c/0x460 fs/namei.c:3699 do_sys_openat2+0x13b/0x500 fs/open.c:1211 Memory state around the buggy address: ffff88803afa4b00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803afa4b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88803afa4c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88803afa4c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88803afa4d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================