EXT4-fs error (device loop1): ext4_truncate:4292: inode #19: comm syz-executor.1: mark_inode_dirty error ================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:827 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:946 Read of size 4 at addr ffff88811ecd7a58 by task syz-executor.1/409 CPU: 1 PID: 409 Comm: syz-executor.1 Not tainted 5.15.153-syzkaller-1069977-ge787d6ac4af0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description+0x87/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:427 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:444 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 ext4_ext_binsearch fs/ext4/extents.c:827 [inline] ext4_find_extent+0xbab/0xdb0 fs/ext4/extents.c:946 ext4_ext_map_blocks+0x269/0x74a0 fs/ext4/extents.c:4142 ext4_map_blocks+0xaa7/0x1e00 fs/ext4/inode.c:646 mpage_map_one_extent fs/ext4/inode.c:2409 [inline] mpage_map_and_submit_extent fs/ext4/inode.c:2462 [inline] ext4_writepages+0x1628/0x4000 fs/ext4/inode.c:2830 do_writepages+0x40e/0x670 mm/page-writeback.c:2366 filemap_fdatawrite_wbc+0x248/0x2a0 mm/filemap.c:404 __filemap_fdatawrite_range mm/filemap.c:437 [inline] file_write_and_wait_range+0x1cb/0x2b0 mm/filemap.c:814 ext4_sync_file+0x1a2/0xa50 fs/ext4/fsync.c:151 vfs_fsync_range+0x17b/0x190 fs/sync.c:188 generic_write_sync include/linux/fs.h:3025 [inline] ext4_buffered_write_iter+0x568/0x610 fs/ext4/file.c:277 ext4_file_write_iter+0x443/0x1c80 call_write_iter include/linux/fs.h:2204 [inline] new_sync_write fs/read_write.c:507 [inline] vfs_write+0xd5d/0x1110 fs/read_write.c:594 ksys_write+0x199/0x2c0 fs/read_write.c:647 __do_sys_write fs/read_write.c:659 [inline] __se_sys_write fs/read_write.c:656 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:656 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+0x61/0xcb RIP: 0033:0x7f3a10515859 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f3a100980c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f3a10634f80 RCX: 00007f3a10515859 RDX: 000000000208e24b RSI: 0000000020000040 RDI: 0000000000000007 RBP: 00007f3a10571ad0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f3a10634f80 R15: 00007ffcab8bd378 The buggy address belongs to the page: page:ffffea00047b35c0 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x11ecd7 flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea00047b38c8 ffffea00047b17c8 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 0x100cca(GFP_HIGHUSER_MOVABLE), pid 290, ts 24340389431, free_ts 25477737015 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2605 prep_new_page+0x1b/0x110 mm/page_alloc.c:2611 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4485 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5777 __alloc_pages_node include/linux/gfp.h:591 [inline] alloc_pages_node include/linux/gfp.h:605 [inline] alloc_pages include/linux/gfp.h:618 [inline] do_cow_fault mm/memory.c:4540 [inline] do_fault mm/memory.c:4658 [inline] handle_pte_fault+0xa0c/0x24d0 mm/memory.c:4871 do_handle_mm_fault+0x20bc/0x2400 mm/memory.c:5293 do_user_addr_fault arch/x86/mm/fault.c:1356 [inline] handle_page_fault arch/x86/mm/fault.c:1540 [inline] exc_page_fault+0x26f/0x830 arch/x86/mm/fault.c:1596 asm_exc_page_fault+0x27/0x30 arch/x86/include/asm/idtentry.h:568 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1472 [inline] free_pcp_prepare mm/page_alloc.c:1544 [inline] free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3534 free_unref_page_list+0x14b/0xa60 mm/page_alloc.c:3671 release_pages+0x1310/0x1370 mm/swap.c:1009 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:320 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:240 [inline] tlb_flush_mmu+0xd0/0x180 mm/mmu_gather.c:247 zap_pte_range mm/memory.c:1510 [inline] zap_pmd_range mm/memory.c:1559 [inline] zap_pud_range mm/memory.c:1588 [inline] zap_p4d_range mm/memory.c:1609 [inline] unmap_page_range+0x1c70/0x1ed0 mm/memory.c:1630 unmap_single_vma mm/memory.c:1675 [inline] unmap_vmas+0x389/0x560 mm/memory.c:1707 exit_mmap+0x3e4/0x940 mm/mmap.c:3215 __mmput+0x95/0x310 kernel/fork.c:1179 mmput+0x5b/0x170 kernel/fork.c:1202 exit_mm kernel/exit.c:552 [inline] do_exit+0xb9c/0x2ca0 kernel/exit.c:865 do_group_exit+0x141/0x310 kernel/exit.c:1000 get_signal+0x7a3/0x1630 kernel/signal.c:2896 arch_do_signal_or_restart+0xbd/0x1680 arch/x86/kernel/signal.c:867 handle_signal_work kernel/entry/common.c:148 [inline] exit_to_user_mode_loop+0xa0/0xe0 kernel/entry/common.c:172 exit_to_user_mode_prepare+0x5a/0xa0 kernel/entry/common.c:208 Memory state around the buggy address: ffff88811ecd7900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88811ecd7980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88811ecd7a00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88811ecd7a80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88811ecd7b00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop1): ext4_map_blocks:716: inode #19: comm syz-executor.1: lblock 0 mapped to illegal pblock 0 (length 3) EXT4-fs (loop1): Delayed block allocation failed for inode 19 at logical offset 0 with max blocks 3 with error 117 EXT4-fs (loop1): This should not happen!! Data will be lost