R10: 00000000ffffffff R11: 0000000000000246 R12: 00007ffc7dee5fc0 R13: 00007f4b8dac73b9 R14: 0000000000246abf R15: 0000000000000003 ---[ end trace 0000000000000000 ]--- ================================================================== BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:102 [inline] BUG: KASAN: use-after-free in atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:541 [inline] BUG: KASAN: use-after-free in queued_spin_lock include/asm-generic/qspinlock.h:111 [inline] BUG: KASAN: use-after-free in do_raw_spin_lock include/linux/spinlock.h:186 [inline] BUG: KASAN: use-after-free in __raw_spin_lock include/linux/spinlock_api_smp.h:134 [inline] BUG: KASAN: use-after-free in _raw_spin_lock+0x97/0x1b0 kernel/locking/spinlock.c:154 Write of size 4 at addr ffff8881005a0658 by task syz-executor.4/31102 CPU: 0 PID: 31102 Comm: syz-executor.4 Tainted: G W 6.1.25-syzkaller-00097-g3926cc6ef8cc #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2023 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0x158/0x4e0 mm/kasan/report.c:427 kasan_report+0x13c/0x170 mm/kasan/report.c:531 kasan_check_range+0x294/0x2a0 mm/kasan/generic.c:189 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37 instrument_atomic_read_write include/linux/instrumented.h:102 [inline] atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:541 [inline] queued_spin_lock include/asm-generic/qspinlock.h:111 [inline] do_raw_spin_lock include/linux/spinlock.h:186 [inline] __raw_spin_lock include/linux/spinlock_api_smp.h:134 [inline] _raw_spin_lock+0x97/0x1b0 kernel/locking/spinlock.c:154 spin_lock include/linux/spinlock.h:350 [inline] igrab+0x20/0xa0 fs/inode.c:1388 f2fs_sync_inode_meta fs/f2fs/checkpoint.c:1148 [inline] block_operations fs/f2fs/checkpoint.c:1256 [inline] f2fs_write_checkpoint+0xdab/0x2410 fs/f2fs/checkpoint.c:1648 f2fs_issue_checkpoint+0x2e5/0x4f0 fs/f2fs/checkpoint.c:1855 f2fs_sync_fs+0x186/0x2f0 fs/f2fs/super.c:1670 sync_filesystem+0x1cf/0x250 fs/sync.c:66 f2fs_quota_off_umount+0x20e/0x220 fs/f2fs/super.c:2945 f2fs_put_super+0xbe/0xce0 fs/f2fs/super.c:1559 generic_shutdown_super+0x14f/0x370 fs/super.c:503 kill_block_super+0x7e/0xe0 fs/super.c:1452 kill_f2fs_super+0x2f9/0x3c0 fs/f2fs/super.c:4705 deactivate_locked_super+0xad/0x110 fs/super.c:334 deactivate_super+0xbe/0xf0 fs/super.c:365 cleanup_mnt+0x485/0x510 fs/namespace.c:1186 __cleanup_mnt+0x19/0x20 fs/namespace.c:1193 task_work_run+0x24d/0x2e0 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x8b/0xa0 kernel/entry/common.c:171 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:297 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f4b8da7de17 Code: b0 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 0f 1f 44 00 00 31 f6 e9 09 00 00 00 66 0f 1f 84 00 00 00 00 00 b8 a6 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 01 c3 48 c7 c2 b0 ff ff ff f7 d8 64 89 02 b8 RSP: 002b:00007ffc7dee4e48 EFLAGS: 00000246 ORIG_RAX: 00000000000000a6 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00007f4b8da7de17 RDX: 0000000000000000 RSI: 000000000000000a RDI: 00007ffc7dee4f00 RBP: 00007ffc7dee4f00 R08: 0000000000000000 R09: 0000000000000000 R10: 00000000ffffffff R11: 0000000000000246 R12: 00007ffc7dee5fc0 R13: 00007f4b8dac73b9 R14: 0000000000246abf R15: 0000000000000003 Allocated by task 689: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_alloc_info+0x1f/0x30 mm/kasan/generic.c:505 __kasan_slab_alloc+0x6c/0x80 mm/kasan/common.c:333 kasan_slab_alloc include/linux/kasan.h:202 [inline] slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768 slab_alloc_node mm/slub.c:3418 [inline] slab_alloc mm/slub.c:3426 [inline] __kmem_cache_alloc_lru mm/slub.c:3433 [inline] kmem_cache_alloc_lru+0x102/0x220 mm/slub.c:3449 alloc_inode_sb include/linux/fs.h:3142 [inline] f2fs_alloc_inode+0x2d/0x350 fs/f2fs/super.c:1384 alloc_inode fs/inode.c:259 [inline] iget_locked+0x18c/0x7e0 fs/inode.c:1286 f2fs_iget+0x55/0x4df0 fs/f2fs/inode.c:503 f2fs_lookup+0x410/0xd80 fs/f2fs/namei.c:541 lookup_open fs/namei.c:3391 [inline] open_last_lookups fs/namei.c:3481 [inline] path_openat+0x10fd/0x2d60 fs/namei.c:3711 do_filp_open+0x230/0x480 fs/namei.c:3741 do_sys_openat2+0x13f/0x850 fs/open.c:1333 do_sys_open fs/open.c:1349 [inline] __do_sys_openat fs/open.c:1365 [inline] __se_sys_openat fs/open.c:1360 [inline] __x64_sys_openat+0x243/0x290 fs/open.c:1360 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+0x63/0xcd Freed by task 31102: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x2b/0x40 mm/kasan/generic.c:516 ____kasan_slab_free+0x131/0x180 mm/kasan/common.c:241 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:249 kasan_slab_free include/linux/kasan.h:178 [inline] slab_free_hook mm/slub.c:1744 [inline] slab_free_freelist_hook mm/slub.c:1770 [inline] slab_free mm/slub.c:3681 [inline] kmem_cache_free+0x291/0x510 mm/slub.c:3703 f2fs_free_inode+0x24/0x30 fs/f2fs/super.c:1527 i_callback+0x4b/0x70 fs/inode.c:248 rcu_do_batch+0x518/0xb60 kernel/rcu/tree.c:2250 rcu_core+0x4ee/0xf10 kernel/rcu/tree.c:2510 rcu_core_si+0x9/0x10 kernel/rcu/tree.c:2527 __do_softirq+0x1d8/0x661 kernel/softirq.c:613 Last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496 call_rcu+0xec/0x1230 kernel/rcu/tree.c:2798 destroy_inode fs/inode.c:314 [inline] evict+0x5df/0x630 fs/inode.c:679 dispose_list fs/inode.c:697 [inline] evict_inodes+0x5d1/0x650 fs/inode.c:747 generic_shutdown_super+0x97/0x370 fs/super.c:482 kill_block_super+0x7e/0xe0 fs/super.c:1452 kill_f2fs_super+0x2f9/0x3c0 fs/f2fs/super.c:4705 deactivate_locked_super+0xad/0x110 fs/super.c:334 deactivate_super+0xbe/0xf0 fs/super.c:365 cleanup_mnt+0x485/0x510 fs/namespace.c:1186 __cleanup_mnt+0x19/0x20 fs/namespace.c:1193 task_work_run+0x24d/0x2e0 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x8b/0xa0 kernel/entry/common.c:171 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:297 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd Second to last potentially related work creation: kasan_save_stack+0x3b/0x60 mm/kasan/common.c:45 __kasan_record_aux_stack+0xb4/0xc0 mm/kasan/generic.c:486 kasan_record_aux_stack_noalloc+0xb/0x10 mm/kasan/generic.c:496 call_rcu+0xec/0x1230 kernel/rcu/tree.c:2798 destroy_inode fs/inode.c:314 [inline] evict+0x5df/0x630 fs/inode.c:679 iput_final fs/inode.c:1747 [inline] iput+0x642/0x870 fs/inode.c:1773 f2fs_put_super+0x630/0xce0 fs/f2fs/super.c:1610 generic_shutdown_super+0x14f/0x370 fs/super.c:503 kill_block_super+0x7e/0xe0 fs/super.c:1452 kill_f2fs_super+0x2f9/0x3c0 fs/f2fs/super.c:4705 deactivate_locked_super+0xad/0x110 fs/super.c:334 deactivate_super+0xbe/0xf0 fs/super.c:365 cleanup_mnt+0x485/0x510 fs/namespace.c:1186 __cleanup_mnt+0x19/0x20 fs/namespace.c:1193 task_work_run+0x24d/0x2e0 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0x8b/0xa0 kernel/entry/common.c:171 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x26/0x130 kernel/entry/common.c:297 do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x63/0xcd The buggy address belongs to the object at ffff8881005a05d0 which belongs to the cache f2fs_inode_cache of size 1360 The buggy address is located 136 bytes inside of 1360-byte region [ffff8881005a05d0, ffff8881005a0b20) The buggy address belongs to the physical page: page:ffffea0004016800 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1005a0 head:ffffea0004016800 order:3 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head|zone=1) raw: 4000000000010200 ffffea00057af600 dead000000000003 ffff888100ba7980 raw: 0000000000000000 0000000080160016 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Reclaimable, gfp_mask 0x1d2050(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 2802, tgid 2801 (syz-executor.3), ts 281730822506, free_ts 274373991947 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x213/0x220 mm/page_alloc.c:2582 prep_new_page+0x1b/0x110 mm/page_alloc.c:2589 get_page_from_freelist+0x2762/0x27f0 mm/page_alloc.c:4387 __alloc_pages+0x3a1/0x780 mm/page_alloc.c:5664 allocate_slab mm/slub.c:1959 [inline] new_slab+0xce/0x4c0 mm/slub.c:2012 ___slab_alloc+0x6f9/0xb80 mm/slub.c:3200 __slab_alloc+0x5d/0xa0 mm/slub.c:3299 slab_alloc_node mm/slub.c:3384 [inline] slab_alloc mm/slub.c:3426 [inline] __kmem_cache_alloc_lru mm/slub.c:3433 [inline] kmem_cache_alloc_lru+0x144/0x220 mm/slub.c:3449 alloc_inode_sb include/linux/fs.h:3142 [inline] f2fs_alloc_inode+0x2d/0x350 fs/f2fs/super.c:1384 alloc_inode fs/inode.c:259 [inline] new_inode_pseudo+0x65/0x1d0 fs/inode.c:1018 new_inode+0x28/0x1c0 fs/inode.c:1046 f2fs_new_inode+0x118/0x1350 fs/f2fs/namei.c:217 f2fs_create+0x1f8/0x6e0 fs/f2fs/namei.c:353 lookup_open fs/namei.c:3413 [inline] open_last_lookups fs/namei.c:3481 [inline] path_openat+0x12ee/0x2d60 fs/namei.c:3711 do_filp_open+0x230/0x480 fs/namei.c:3741 do_sys_openat2+0x13f/0x850 fs/open.c:1333 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1494 [inline] free_pcp_prepare mm/page_alloc.c:1568 [inline] free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3486 free_unref_page+0x8d/0x480 mm/page_alloc.c:3582 free_the_page mm/page_alloc.c:794 [inline] __free_pages+0x61/0xf0 mm/page_alloc.c:5753 __free_slab+0xce/0x1a0 mm/slub.c:2036 free_slab mm/slub.c:2051 [inline] discard_slab+0x29/0x40 mm/slub.c:2057 __slab_free+0x205/0x280 mm/slub.c:3594 do_slab_free mm/slub.c:3635 [inline] ___cache_free+0xc6/0xd0 mm/slub.c:3688 qlink_free+0x4d/0x90 mm/kasan/quarantine.c:168 qlist_free_all+0x52/0xc0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x24/0x80 mm/kasan/common.c:310 kasan_slab_alloc include/linux/kasan.h:202 [inline] slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768 slab_alloc_node mm/slub.c:3418 [inline] slab_alloc mm/slub.c:3426 [inline] __kmem_cache_alloc_lru mm/slub.c:3433 [inline] kmem_cache_alloc+0x175/0x2c0 mm/slub.c:3442 getname_flags+0xba/0x520 fs/namei.c:139 vfs_fstatat fs/stat.c:266 [inline] __do_sys_newfstatat fs/stat.c:437 [inline] __se_sys_newfstatat+0xe2/0x7b0 fs/stat.c:431 __x64_sys_newfstatat+0x9b/0xb0 fs/stat.c:431 Memory state around the buggy address: ffff8881005a0500: fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc ffff8881005a0580: fc fc fc fc fc fc fc fc fc fc fa fb fb fb fb fb >ffff8881005a0600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff8881005a0680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff8881005a0700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================