================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:841 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xae6/0xcc0 fs/ext4/extents.c:956 Read of size 4 at addr ffff88804ac04e18 by task syz.0.101/6531 CPU: 1 UID: 0 PID: 6531 Comm: syz.0.101 Not tainted 6.16.0-rc3-syzkaller-00072-gee88bddf7f2f #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xd2/0x2b0 mm/kasan/report.c:521 kasan_report+0x118/0x150 mm/kasan/report.c:634 ext4_ext_binsearch fs/ext4/extents.c:841 [inline] ext4_find_extent+0xae6/0xcc0 fs/ext4/extents.c:956 ext4_ext_map_blocks+0x288/0x6ac0 fs/ext4/extents.c:4208 ext4_map_create_blocks fs/ext4/inode.c:609 [inline] ext4_map_blocks+0x931/0x18d0 fs/ext4/inode.c:813 _ext4_get_block+0x200/0x4c0 fs/ext4/inode.c:892 ext4_get_block_unwritten+0x2e/0x100 fs/ext4/inode.c:925 ext4_block_write_begin+0x6f8/0x14b0 fs/ext4/inode.c:1178 ext4_write_begin+0xa4f/0x1680 fs/ext4/ext4_jbd2.h:-1 ext4_da_write_begin+0x449/0xd20 fs/ext4/inode.c:3057 generic_perform_write+0x2c7/0x910 mm/filemap.c:4112 ext4_buffered_write_iter+0xce/0x3a0 fs/ext4/file.c:299 ext4_file_write_iter+0x298/0x1bc0 fs/ext4/file.c:-1 do_iter_readv_writev+0x56e/0x7f0 fs/read_write.c:-1 vfs_writev+0x31a/0x960 fs/read_write.c:1057 do_writev+0x14d/0x2d0 fs/read_write.c:1103 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f715338e929 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:00007f71541e7038 EFLAGS: 00000246 ORIG_RAX: 0000000000000014 RAX: ffffffffffffffda RBX: 00007f71535b5fa0 RCX: 00007f715338e929 RDX: 0000000000000001 RSI: 0000200000000140 RDI: 0000000000000004 RBP: 00007f7153410b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f71535b5fa0 R15: 00007ffe123a6bb8 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4ac04 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 0000000000000000 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 9, migratetype Movable, gfp_mask 0x153c4a(GFP_NOFS|__GFP_HIGHMEM|__GFP_MOVABLE|__GFP_WRITE|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 6398, tgid 6397 (syz.0.82), ts 127552604214, free_ts 129013349284 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1704 prep_new_page mm/page_alloc.c:1712 [inline] get_page_from_freelist+0x21d5/0x22b0 mm/page_alloc.c:3669 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4959 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2419 alloc_frozen_pages_noprof mm/mempolicy.c:2490 [inline] alloc_pages_noprof+0xa9/0x190 mm/mempolicy.c:2510 folio_alloc_noprof+0x1e/0x30 mm/mempolicy.c:2520 filemap_alloc_folio_noprof+0xdf/0x470 mm/filemap.c:1007 __filemap_get_folio+0x3f2/0xaf0 mm/filemap.c:1980 iomap_get_folio fs/iomap/buffered-io.c:606 [inline] __iomap_get_folio fs/iomap/buffered-io.c:756 [inline] iomap_write_begin+0x660/0x1bc0 fs/iomap/buffered-io.c:821 iomap_write_iter fs/iomap/buffered-io.c:979 [inline] iomap_file_buffered_write+0x438/0x980 fs/iomap/buffered-io.c:1058 xfs_file_buffered_write+0x201/0x890 fs/xfs/xfs_file.c:981 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x54b/0xa90 fs/read_write.c:686 ksys_pwrite64 fs/read_write.c:793 [inline] __do_sys_pwrite64 fs/read_write.c:801 [inline] __se_sys_pwrite64 fs/read_write.c:798 [inline] __x64_sys_pwrite64+0x193/0x220 fs/read_write.c:798 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 5822 tgid 5822 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1248 [inline] free_unref_folios+0xcd2/0x1570 mm/page_alloc.c:2763 folios_put_refs+0x559/0x640 mm/swap.c:992 folio_batch_release include/linux/pagevec.h:101 [inline] truncate_inode_pages_range+0x346/0xda0 mm/truncate.c:383 xfs_fs_evict_inode+0x67/0x90 fs/xfs/xfs_super.c:791 evict+0x504/0x9c0 fs/inode.c:810 dispose_list fs/inode.c:852 [inline] evict_inodes+0x636/0x6c0 fs/inode.c:906 generic_shutdown_super+0x9a/0x2c0 fs/super.c:628 kill_block_super+0x44/0x90 fs/super.c:1755 xfs_kill_sb+0x15/0x50 fs/xfs/xfs_super.c:2318 deactivate_locked_super+0xbc/0x130 fs/super.c:474 cleanup_mnt+0x425/0x4c0 fs/namespace.c:1417 task_work_run+0x1d1/0x260 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xec/0x110 kernel/entry/common.c:114 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline] do_syscall_64+0x2bd/0x3b0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88804ac04d00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88804ac04d80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88804ac04e00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88804ac04e80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88804ac04f00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================