================================================================== BUG: KASAN: use-after-free in sanity_check_extent_cache+0x28a/0x350 fs/f2fs/extent_cache.c:35 Read of size 4 at addr ffff8881221dce48 by task syz.6.16/576 CPU: 1 PID: 576 Comm: syz.6.16 Not tainted 6.1.138-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: __dump_stack+0x21/0x24 lib/dump_stack.c:88 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106 print_address_description+0x71/0x210 mm/kasan/report.c:316 print_report+0x4a/0x60 mm/kasan/report.c:427 kasan_report+0x122/0x150 mm/kasan/report.c:531 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:350 sanity_check_extent_cache+0x28a/0x350 fs/f2fs/extent_cache.c:35 do_read_inode fs/f2fs/inode.c:454 [inline] f2fs_iget+0x3400/0x4c60 fs/f2fs/inode.c:505 f2fs_lookup+0x366/0xab0 fs/f2fs/namei.c:487 lookup_open fs/namei.c:3460 [inline] open_last_lookups fs/namei.c:3550 [inline] path_openat+0xff3/0x2f50 fs/namei.c:3780 do_filp_open+0x1c1/0x3c0 fs/namei.c:3810 do_sys_openat2+0x142/0x490 fs/open.c:1318 do_sys_open fs/open.c:1334 [inline] __do_sys_openat fs/open.c:1350 [inline] __se_sys_openat fs/open.c:1345 [inline] __x64_sys_openat+0x136/0x160 fs/open.c:1345 x64_sys_call+0x783/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:258 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7ff1a6b8e929 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ff1a7a22038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007ff1a6db6080 RCX: 00007ff1a6b8e929 RDX: 0000000000101000 RSI: 0000200000000080 RDI: ffffffffffffff9c RBP: 00007ff1a6c10b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000001 R14: 00007ff1a6db6080 R15: 00007fff1b8e2de8 Allocated by task 560: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_alloc_info+0x25/0x30 mm/kasan/generic.c:505 __kasan_slab_alloc+0x72/0x80 mm/kasan/common.c:328 kasan_slab_alloc include/linux/kasan.h:201 [inline] slab_post_alloc_hook+0x4f/0x2d0 mm/slab.h:737 slab_alloc_node mm/slub.c:3398 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x16e/0x2d0 mm/slub.c:3422 f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:-1 [inline] __grab_extent_tree+0x198/0x400 fs/f2fs/extent_cache.c:384 f2fs_init_read_extent_tree+0x292/0x770 fs/f2fs/extent_cache.c:455 do_read_inode fs/f2fs/inode.c:452 [inline] f2fs_iget+0x33f8/0x4c60 fs/f2fs/inode.c:505 f2fs_lookup+0x366/0xab0 fs/f2fs/namei.c:487 __lookup_slow+0x2c7/0x3f0 fs/namei.c:1690 lookup_slow+0x57/0x70 fs/namei.c:1707 walk_component+0x2f4/0x420 fs/namei.c:1998 lookup_last fs/namei.c:2455 [inline] path_lookupat+0x180/0x490 fs/namei.c:2479 filename_lookup+0x1f0/0x500 fs/namei.c:2508 user_path_at_empty+0x46/0x60 fs/namei.c:2905 user_path_at include/linux/namei.h:57 [inline] do_sys_truncate+0xa3/0x190 fs/open.c:132 __do_sys_truncate fs/open.c:146 [inline] __se_sys_truncate fs/open.c:144 [inline] __x64_sys_truncate+0x5b/0x70 fs/open.c:144 x64_sys_call+0x679/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:77 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Freed by task 560: kasan_save_stack mm/kasan/common.c:45 [inline] kasan_set_track+0x4b/0x70 mm/kasan/common.c:52 kasan_save_free_info+0x31/0x50 mm/kasan/generic.c:516 ____kasan_slab_free+0x132/0x180 mm/kasan/common.c:236 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1724 [inline] slab_free_freelist_hook+0xc2/0x190 mm/slub.c:1750 slab_free mm/slub.c:3661 [inline] kmem_cache_free+0x12d/0x2a0 mm/slub.c:3683 __destroy_extent_tree fs/f2fs/extent_cache.c:1011 [inline] f2fs_destroy_extent_tree+0x2c0/0x4b0 fs/f2fs/extent_cache.c:1022 f2fs_evict_inode+0x442/0x1460 fs/f2fs/inode.c:774 evict+0x493/0x890 fs/inode.c:705 iput_final fs/inode.c:1834 [inline] iput+0x639/0x840 fs/inode.c:1860 iget_failed+0x17a/0x1c0 fs/bad_inode.c:250 f2fs_iget+0x218c/0x4c60 fs/f2fs/inode.c:558 f2fs_lookup+0x366/0xab0 fs/f2fs/namei.c:487 __lookup_slow+0x2c7/0x3f0 fs/namei.c:1690 lookup_slow+0x57/0x70 fs/namei.c:1707 walk_component+0x2f4/0x420 fs/namei.c:1998 lookup_last fs/namei.c:2455 [inline] path_lookupat+0x180/0x490 fs/namei.c:2479 filename_lookup+0x1f0/0x500 fs/namei.c:2508 user_path_at_empty+0x46/0x60 fs/namei.c:2905 user_path_at include/linux/namei.h:57 [inline] do_sys_truncate+0xa3/0x190 fs/open.c:132 __do_sys_truncate fs/open.c:146 [inline] __se_sys_truncate fs/open.c:144 [inline] __x64_sys_truncate+0x5b/0x70 fs/open.c:144 x64_sys_call+0x679/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:77 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 The buggy address belongs to the object at ffff8881221dce00 which belongs to the cache f2fs_extent_tree of size 80 The buggy address is located 72 bytes inside of 80-byte region [ffff8881221dce00, ffff8881221dce50) The buggy address belongs to the physical page: page:ffffea0004887700 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1221dc flags: 0x4000000000000200(slab|zone=1) raw: 4000000000000200 0000000000000000 dead000000000122 ffff88810ad21a00 raw: 0000000000000000 0000000080240024 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Reclaimable, gfp_mask 0x112c50(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_HARDWALL|__GFP_RECLAIMABLE), pid 560, tgid 557 (syz.6.16), ts 59565249227, free_ts 58944536214 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1d0/0x1f0 mm/page_alloc.c:2532 prep_new_page mm/page_alloc.c:2539 [inline] get_page_from_freelist+0x2e63/0x2ef0 mm/page_alloc.c:4328 __alloc_pages+0x235/0x4b0 mm/page_alloc.c:5606 alloc_slab_page include/linux/gfp.h:-1 [inline] allocate_slab mm/slub.c:1939 [inline] new_slab+0xec/0x4b0 mm/slub.c:1992 ___slab_alloc+0x6f6/0xb50 mm/slub.c:3180 __slab_alloc+0x5e/0xa0 mm/slub.c:3279 slab_alloc_node mm/slub.c:3364 [inline] slab_alloc mm/slub.c:3406 [inline] __kmem_cache_alloc_lru mm/slub.c:3413 [inline] kmem_cache_alloc+0x1ab/0x2d0 mm/slub.c:3422 f2fs_kmem_cache_alloc fs/f2fs/f2fs.h:-1 [inline] __grab_extent_tree+0x198/0x400 fs/f2fs/extent_cache.c:384 f2fs_init_read_extent_tree+0x292/0x770 fs/f2fs/extent_cache.c:455 do_read_inode fs/f2fs/inode.c:452 [inline] f2fs_iget+0x33f8/0x4c60 fs/f2fs/inode.c:505 f2fs_lookup+0x366/0xab0 fs/f2fs/namei.c:487 __lookup_slow+0x2c7/0x3f0 fs/namei.c:1690 lookup_slow+0x57/0x70 fs/namei.c:1707 walk_component+0x2f4/0x420 fs/namei.c:1998 lookup_last fs/namei.c:2455 [inline] path_lookupat+0x180/0x490 fs/namei.c:2479 filename_lookup+0x1f0/0x500 fs/namei.c:2508 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1459 [inline] free_pcp_prepare mm/page_alloc.c:1532 [inline] free_unref_page_prepare+0x742/0x750 mm/page_alloc.c:3384 free_unref_page+0x33/0x390 mm/page_alloc.c:3479 free_the_page mm/page_alloc.c:754 [inline] __free_pages+0x67/0x100 mm/page_alloc.c:5695 __free_slab+0xca/0x1a0 mm/slub.c:2016 free_slab mm/slub.c:2031 [inline] discard_slab mm/slub.c:2037 [inline] __unfreeze_partials+0x160/0x190 mm/slub.c:2586 put_cpu_partial+0xa9/0x100 mm/slub.c:2662 __slab_free+0x1c4/0x280 mm/slub.c:3538 do_slab_free mm/slub.c:3615 [inline] ___cache_free+0xbf/0xd0 mm/slub.c:3668 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0xc6/0x140 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x14a/0x170 mm/kasan/quarantine.c:294 ____kasan_kmalloc mm/kasan/common.c:340 [inline] __kasan_kmalloc+0x24/0xb0 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:936 [inline] __kmalloc+0xb1/0x1e0 mm/slab_common.c:949 kmalloc include/linux/slab.h:568 [inline] kernfs_fop_write_iter+0x153/0x410 fs/kernfs/file.c:311 call_write_iter include/linux/fs.h:2265 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x580/0xc00 fs/read_write.c:584 ksys_write+0x140/0x240 fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:646 Memory state around the buggy address: ffff8881221dcd00: fc fc fc fc 00 00 00 00 00 00 00 00 00 00 fc fc ffff8881221dcd80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff8881221dce00: fa fb fb fb fb fb fb fb fb fb fc fc fc fc fc fc ^ ffff8881221dce80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff8881221dcf00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ================================================================== F2FS-fs (loop6): sanity_check_extent_cache: inode (ino=8) extent info [14338, 0, 2147549187] is incorrect, run fsck to fix