================================================================== BUG: KASAN: use-after-free in ext4_ext_binsearch fs/ext4/extents.c:826 [inline] BUG: KASAN: use-after-free in ext4_find_extent+0xbea/0xe30 fs/ext4/extents.c:945 Read of size 4 at addr ffff88812f3b9418 by task syz.0.33/522 CPU: 0 PID: 522 Comm: syz.0.33 Not tainted 5.10.234-syzkaller-00031-gfc9aa81462ee #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:452 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:308 ext4_ext_binsearch fs/ext4/extents.c:826 [inline] ext4_find_extent+0xbea/0xe30 fs/ext4/extents.c:945 ext4_ext_map_blocks+0x26a/0x6ee0 fs/ext4/extents.c:4159 ext4_map_blocks+0xa65/0x1d10 fs/ext4/inode.c:673 _ext4_get_block+0x21b/0x610 fs/ext4/inode.c:816 ext4_get_block+0x39/0x50 fs/ext4/inode.c:833 ext4_block_write_begin+0x61e/0x13b0 fs/ext4/inode.c:1100 ext4_write_begin+0x6fa/0x1730 ext4_da_write_begin+0x49d/0xf60 fs/ext4/inode.c:3032 generic_perform_write+0x2cd/0x570 mm/filemap.c:3509 ext4_buffered_write_iter+0x482/0x610 fs/ext4/file.c:271 ext4_file_write_iter+0x193/0x1c80 fs/ext4/file.c:685 call_write_iter include/linux/fs.h:2058 [inline] new_sync_write fs/read_write.c:518 [inline] vfs_write+0xb4c/0xe70 fs/read_write.c:605 ksys_write+0x199/0x2c0 fs/read_write.c:658 __do_sys_write fs/read_write.c:670 [inline] __se_sys_write fs/read_write.c:667 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:667 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7f864d7e3169 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:00007f864d234038 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 RAX: ffffffffffffffda RBX: 00007f864d9fc080 RCX: 00007f864d7e3169 RDX: 0000000000040010 RSI: 0000400000000180 RDI: 0000000000000006 RBP: 00007f864d8642a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f864d9fc080 R15: 00007fff12239298 The buggy address belongs to the page: page:ffffea0004bcee40 refcount:1 mapcount:1 mapping:0000000000000000 index:0x400000a80 pfn:0x12f3b9 anon flags: 0x4000000000080014(uptodate|lru|swapbacked) raw: 4000000000080014 ffffea0004bcee08 ffffea0004bcee88 ffff88810ea44959 raw: 0000000400000a80 0000000000000000 0000000100000000 ffff88811b10e000 page dumped because: kasan: bad access detected page->mem_cgroup:ffff88811b10e000 page_owner tracks the page as allocated page last allocated via order 0, migratetype Movable, gfp_mask 0x8100dca(GFP_HIGHUSER_MOVABLE|__GFP_ZERO|0x8000000), pid 513, ts 31872067369, free_ts 31746022014 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x166/0x180 mm/page_alloc.c:2462 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348 __alloc_pages include/linux/gfp.h:544 [inline] __alloc_pages_node include/linux/gfp.h:557 [inline] alloc_pages_node include/linux/gfp.h:571 [inline] alloc_pages include/linux/gfp.h:590 [inline] do_anonymous_page mm/memory.c:3963 [inline] handle_pte_fault+0x175a/0x3e10 mm/memory.c:4786 __handle_mm_fault mm/memory.c:4944 [inline] handle_mm_fault+0x11d6/0x1a10 mm/memory.c:5358 do_user_addr_fault arch/x86/mm/fault.c:1362 [inline] handle_page_fault arch/x86/mm/fault.c:1428 [inline] exc_page_fault+0x2a6/0x5b0 arch/x86/mm/fault.c:1484 asm_exc_page_fault+0x1e/0x30 arch/x86/include/asm/idtentry.h:571 page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1349 [inline] free_pcp_prepare mm/page_alloc.c:1421 [inline] free_unref_page_prepare+0x2ae/0x2d0 mm/page_alloc.c:3336 free_unref_page_list+0x122/0xb20 mm/page_alloc.c:3443 release_pages+0xea0/0xef0 mm/swap.c:1103 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:356 tlb_batch_pages_flush mm/mmu_gather.c:49 [inline] tlb_flush_mmu_free mm/mmu_gather.c:240 [inline] tlb_flush_mmu mm/mmu_gather.c:247 [inline] tlb_finish_mmu+0x177/0x320 mm/mmu_gather.c:326 exit_mmap+0x306/0x560 mm/mmap.c:3375 __mmput+0x95/0x2d0 kernel/fork.c:1153 mmput+0x59/0x170 kernel/fork.c:1176 exit_mm kernel/exit.c:539 [inline] do_exit+0xbda/0x2a50 kernel/exit.c:850 do_group_exit+0x141/0x310 kernel/exit.c:985 get_signal+0x10a0/0x1410 kernel/signal.c:2793 arch_do_signal_or_restart+0xbd/0x17c0 arch/x86/kernel/signal.c:805 handle_signal_work kernel/entry/common.c:145 [inline] exit_to_user_mode_loop+0x9b/0xd0 kernel/entry/common.c:169 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline] syscall_exit_to_user_mode+0xa2/0x1a0 kernel/entry/common.c:274 do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56 entry_SYSCALL_64_after_hwframe+0x61/0xcb Memory state around the buggy address: ffff88812f3b9300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88812f3b9380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88812f3b9400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ ffff88812f3b9480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88812f3b9500: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ================================================================== EXT4-fs error (device loop0): ext4_map_blocks:739: inode #17: block 20160431034200: comm syz.0.33: lblock 185 mapped to illegal pblock 20160431034200 (length 1) EXT4-fs error (device loop0): ext4_free_blocks:5685: comm syz.0.33: Freeing blocks not in datazone - block = 261595830173744, count = 24896 EXT4-fs error (device loop0): ext4_free_blocks:5685: comm syz.0.33: Freeing blocks not in datazone - block = 249459571690696, count = 14814 EXT4-fs error (device loop0): ext4_free_blocks:5685: comm syz.0.33: Freeing blocks not in datazone - block = 213103721506572, count = 13745 EXT4-fs error (device loop0): ext4_free_blocks:5685: comm syz.0.33: Freeing blocks not in datazone - block = 214287580924089, count = 18059 EXT4-fs error (device loop0): ext4_free_blocks:5685: comm syz.0.33: Freeing blocks not in datazone - block = 66876865059082, count = 17830 EXT4-fs error (device loop0): ext4_free_blocks:5685: comm syz.0.33: Freeing blocks not in datazone - block = 87168216802914, count = 24112 EXT4-fs error (device loop0): ext4_free_blocks:5685: comm syz.0.33: Freeing blocks not in datazone - block = 113736314809909, count = 11085 EXT4-fs error (device loop0): ext4_free_blocks:5685: comm syz.0.33: Freeing blocks not in datazone - block = 231341432843332, count = 20919 EXT4-fs error (device loop0): ext4_free_blocks:5685: comm syz.0.33: Freeing blocks not in datazone - block = 48882834303042, count = 17611