================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:840 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xb92/0xd80 fs/ext4/extents.c:955 Read of size 4 at addr ffff8880508788e8 by task syz.2.173/6799 CPU: 1 UID: 0 PID: 6799 Comm: syz.2.173 Not tainted 6.15.0-rc2-syzkaller-00042-g1a1d569a75f3 #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0x16e/0x5b0 mm/kasan/report.c:521 kasan_report+0x143/0x180 mm/kasan/report.c:634 ext4_ext_binsearch fs/ext4/extents.c:840 [inline] ext4_find_extent+0xb92/0xd80 fs/ext4/extents.c:955 ext4_ext_map_blocks+0x2e6/0x7d80 fs/ext4/extents.c:4205 ext4_map_query_blocks+0x97/0x2c0 fs/ext4/inode.c:472 ext4_map_blocks+0x3e3/0x1920 fs/ext4/inode.c:670 _ext4_get_block+0x23b/0x6b0 fs/ext4/inode.c:785 ext4_get_block_unwritten+0x2f/0x100 fs/ext4/inode.c:818 ext4_block_write_begin+0x4da/0x1520 fs/ext4/inode.c:1067 ext4_write_begin+0x786/0x1330 fs/ext4/ext4_jbd2.h:-1 ext4_da_write_begin+0x4aa/0xb20 fs/ext4/inode.c:2932 generic_perform_write+0x32b/0xa10 mm/filemap.c:4102 ext4_buffered_write_iter+0xc7/0x390 fs/ext4/file.c:299 ext4_file_write_iter+0x97f/0x1da0 fs/ext4/file.c:-1 new_sync_write fs/read_write.c:591 [inline] vfs_write+0x711/0xd10 fs/read_write.c:684 ksys_write+0x19d/0x2d0 fs/read_write.c:736 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f6b7878e169 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:00007f6b7960a038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f6b789b5fa0 RCX: 00007f6b7878e169 RDX: 0000000000010010 RSI: 0000200000000080 RDI: 000000000000000f RBP: 00007f6b78810a68 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f6b789b5fa0 R15: 00007ffc6ba94ec8 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0xee8 pfn:0x50878 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000 raw: 0000000000000ee8 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Movable, gfp_mask 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 6741, tgid 6740 (syz.4.164), ts 189819316346, free_ts 190890327877 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f4/0x240 mm/page_alloc.c:1717 prep_new_page mm/page_alloc.c:1725 [inline] get_page_from_freelist+0x352b/0x36c0 mm/page_alloc.c:3652 __alloc_frozen_pages_noprof+0x211/0x5b0 mm/page_alloc.c:4934 alloc_pages_mpol+0x339/0x690 mm/mempolicy.c:2301 folio_alloc_mpol_noprof+0x36/0x70 mm/mempolicy.c:2320 shmem_alloc_folio mm/shmem.c:1854 [inline] shmem_alloc_and_add_folio+0x490/0x1070 mm/shmem.c:1893 shmem_get_folio_gfp+0x655/0x1800 mm/shmem.c:2533 shmem_get_folio mm/shmem.c:2639 [inline] shmem_write_begin+0x17e/0x3a0 mm/shmem.c:3289 generic_perform_write+0x32b/0xa10 mm/filemap.c:4102 shmem_file_write_iter+0xf9/0x120 mm/shmem.c:3464 new_sync_write fs/read_write.c:591 [inline] vfs_write+0x711/0xd10 fs/read_write.c:684 ksys_write+0x19d/0x2d0 fs/read_write.c:736 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 5843 tgid 5843 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1262 [inline] free_unref_folios+0xe0e/0x17f0 mm/page_alloc.c:2737 folios_put_refs+0x70a/0x800 mm/swap.c:992 folio_batch_release include/linux/pagevec.h:101 [inline] shmem_undo_range+0x595/0x1820 mm/shmem.c:1125 shmem_truncate_range mm/shmem.c:1237 [inline] shmem_evict_inode+0x29d/0xa80 mm/shmem.c:1365 evict+0x4fb/0x9b0 fs/inode.c:810 __dentry_kill+0x20d/0x630 fs/dcache.c:660 dput+0x19f/0x2b0 fs/dcache.c:902 __fput+0x60b/0x9f0 fs/file_table.c:473 task_work_run+0x253/0x310 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop kernel/entry/common.c:114 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x13f/0x340 kernel/entry/common.c:218 do_syscall_64+0x100/0x230 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888050878780: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888050878800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888050878880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888050878900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888050878980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================