================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:837 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xbc8/0xde0 fs/ext4/extents.c:953 Read of size 4 at addr ffff88803fd9e500 by task syz-executor.4/6535 CPU: 0 PID: 6535 Comm: syz-executor.4 Not tainted 6.5.0-rc3-syzkaller-00275-gffabf7c73176 #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+0x1e7/0x2d0 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:364 [inline] print_report+0x163/0x540 mm/kasan/report.c:475 kasan_report+0x175/0x1b0 mm/kasan/report.c:588 ext4_ext_binsearch fs/ext4/extents.c:837 [inline] ext4_find_extent+0xbc8/0xde0 fs/ext4/extents.c:953 ext4_ext_map_blocks+0x2d1/0x71d0 fs/ext4/extents.c:4101 ext4_map_blocks+0xa2f/0x1cb0 fs/ext4/inode.c:621 _ext4_get_block+0x238/0x6a0 fs/ext4/inode.c:763 __block_write_begin_int+0x555/0x1a60 fs/buffer.c:2128 block_page_mkwrite+0x29d/0x4e0 fs/buffer.c:2651 ext4_page_mkwrite+0x500/0x1290 fs/ext4/inode.c:6116 do_page_mkwrite+0x1a4/0x600 mm/memory.c:2942 wp_page_shared mm/memory.c:3294 [inline] do_wp_page+0x559/0x3a70 mm/memory.c:3376 handle_pte_fault mm/memory.c:4955 [inline] __handle_mm_fault mm/memory.c:5079 [inline] handle_mm_fault+0x1c58/0x5410 mm/memory.c:5233 do_user_addr_fault arch/x86/mm/fault.c:1392 [inline] handle_page_fault arch/x86/mm/fault.c:1486 [inline] exc_page_fault+0x266/0x7c0 arch/x86/mm/fault.c:1542 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570 RIP: 0033:0x7f4a0c05dd07 Code: ce 48 ff c7 48 01 fe 48 8d 54 11 80 0f 1f 80 00 00 00 00 c5 fe 6f 0e c5 fe 6f 56 20 c5 fe 6f 5e 40 c5 fe 6f 66 60 48 83 ee 80 fd 7f 0f c5 fd 7f 57 20 c5 fd 7f 5f 40 c5 fd 7f 67 60 48 83 ef RSP: 002b:00007fff2b5426f8 EFLAGS: 00010203 RAX: 0000000020001b00 RBX: 00007fff2b542808 RCX: 0000000020001b00 RDX: 0000000020001f34 RSI: 00007f4a0bc209b0 RDI: 0000000020001b20 RBP: 0000000000000012 R08: 0000000000000000 R09: 00007f4a0c19c05c R10: 00007fff2b542830 R11: 0000000000000246 R12: 00007f4a0bc208f0 R13: fffffffffffffffe R14: 00007f4a0bc00000 R15: 00007f4a0bc208f8 The buggy address belongs to the physical page: page:ffffea0000ff6780 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x3fd9e flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: 0xffffffff() raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000 raw: 0000000000000001 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 6366, tgid 6364 (syz-executor.5), ts 215004536880, free_ts 216277732481 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0x1e6/0x210 mm/page_alloc.c:1570 prep_new_page mm/page_alloc.c:1577 [inline] get_page_from_freelist+0x31e8/0x3370 mm/page_alloc.c:3221 __alloc_pages+0x255/0x670 mm/page_alloc.c:4477 __folio_alloc+0x13/0x30 mm/page_alloc.c:4509 vma_alloc_folio+0x48a/0x9a0 mm/mempolicy.c:2253 shmem_alloc_folio mm/shmem.c:1579 [inline] shmem_alloc_and_acct_folio+0x5e7/0xe10 mm/shmem.c:1603 shmem_get_folio_gfp+0x120f/0x3470 mm/shmem.c:1948 shmem_get_folio mm/shmem.c:2079 [inline] shmem_write_begin+0x172/0x4e0 mm/shmem.c:2573 generic_perform_write+0x31b/0x630 mm/filemap.c:3923 generic_file_write_iter+0xaf/0x310 mm/filemap.c:4044 call_write_iter include/linux/fs.h:1871 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x782/0xaf0 fs/read_write.c:584 ksys_write+0x1a0/0x2c0 fs/read_write.c:637 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1161 [inline] free_unref_page_prepare+0x903/0xa30 mm/page_alloc.c:2348 free_unref_page_list+0x596/0x830 mm/page_alloc.c:2489 release_pages+0x2193/0x2470 mm/swap.c:1042 __folio_batch_release+0x84/0x100 mm/swap.c:1062 folio_batch_release include/linux/pagevec.h:83 [inline] shmem_undo_range+0x6af/0x1ba0 mm/shmem.c:954 shmem_truncate_range mm/shmem.c:1049 [inline] shmem_evict_inode+0x258/0x9f0 mm/shmem.c:1164 evict+0x2a4/0x620 fs/inode.c:665 __dentry_kill+0x436/0x650 fs/dcache.c:607 dentry_kill+0xbb/0x290 dput+0x1f3/0x420 fs/dcache.c:913 __fput+0x628/0x950 fs/file_table.c:392 task_work_run+0x24a/0x300 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171 exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:204 __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline] syscall_exit_to_user_mode+0x64/0x280 kernel/entry/common.c:297 do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86 Memory state around the buggy address: ffff88803fd9e400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88803fd9e480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88803fd9e500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88803fd9e580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88803fd9e600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================