================================================================== BUG: KASAN: use-after-free in ext4_search_dir+0xf7/0x1b0 fs/ext4/namei.c:1543 Read of size 1 at addr ffff888132d9b900 by task syz.0.245/1003 CPU: 1 PID: 1003 Comm: syz.0.245 Not tainted 6.1.93-syzkaller-00002-gd02968a02321 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/06/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:316 [inline] print_report+0x158/0x4e0 mm/kasan/report.c:427 kasan_report+0x13c/0x170 mm/kasan/report.c:531 __asan_report_load1_noabort+0x14/0x20 mm/kasan/report_generic.c:348 ext4_search_dir+0xf7/0x1b0 fs/ext4/namei.c:1543 ext4_find_inline_entry+0x4b6/0x5e0 fs/ext4/inline.c:1722 __ext4_find_entry+0x2b0/0x1af0 fs/ext4/namei.c:1616 ext4_lookup_entry fs/ext4/namei.c:1771 [inline] ext4_lookup+0x176/0x740 fs/ext4/namei.c:1839 lookup_one_qstr_excl+0x143/0x290 fs/namei.c:1604 filename_create+0x28e/0x530 fs/namei.c:3878 do_mkdirat+0xbd/0x450 fs/namei.c:4122 __do_sys_mkdirat fs/namei.c:4147 [inline] __se_sys_mkdirat fs/namei.c:4145 [inline] __x64_sys_mkdirat+0x89/0xa0 fs/namei.c:4145 x64_sys_call+0x6c6/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:259 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7ffb2937c797 Code: 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 02 01 00 00 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:00007ffb2a0d7e68 EFLAGS: 00000246 ORIG_RAX: 0000000000000102 RAX: ffffffffffffffda RBX: 00007ffb2a0d7ef0 RCX: 00007ffb2937c797 RDX: 00000000000001ff RSI: 0000000020000080 RDI: 00000000ffffff9c RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000020000080 R13: 00007ffb2a0d7eb0 R14: 0000000000000000 R15: 0000000000000000 The buggy address belongs to the physical page: page:ffffea0004cb66c0 refcount:0 mapcount:-128 mapping:0000000000000000 index:0x1 pfn:0x132d9b flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea0004cb6748 ffffea0004cb7548 0000000000000000 raw: 0000000000000001 0000000000000000 00000000ffffff7f 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 929, tgid 928 (syz.4.224), ts 50686059196, free_ts 50842690612 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x213/0x220 mm/page_alloc.c:2590 prep_new_page+0x1b/0x110 mm/page_alloc.c:2597 get_page_from_freelist+0x27ea/0x2870 mm/page_alloc.c:4425 __alloc_pages+0x3a1/0x780 mm/page_alloc.c:5714 __folio_alloc+0x15/0x40 mm/page_alloc.c:5746 __folio_alloc_node include/linux/gfp.h:245 [inline] folio_alloc include/linux/gfp.h:274 [inline] alloc_page_vma include/linux/gfp.h:283 [inline] do_cow_fault mm/memory.c:4721 [inline] do_fault+0x4d8/0x1bf0 mm/memory.c:4837 handle_pte_fault mm/memory.c:5132 [inline] __handle_mm_fault mm/memory.c:5274 [inline] handle_mm_fault+0x189f/0x30e0 mm/memory.c:5414 faultin_page mm/gup.c:1009 [inline] __get_user_pages+0x377/0xf20 mm/gup.c:1233 populate_vma_page_range mm/gup.c:1590 [inline] __mm_populate+0x375/0x570 mm/gup.c:1704 mm_populate include/linux/mm.h:3052 [inline] vm_mmap_pgoff+0x290/0x430 mm/util.c:530 ksys_mmap_pgoff+0x15d/0x1e0 mm/mmap.c:1521 __do_sys_mmap arch/x86/kernel/sys_x86_64.c:93 [inline] __se_sys_mmap arch/x86/kernel/sys_x86_64.c:86 [inline] __x64_sys_mmap+0x103/0x120 arch/x86/kernel/sys_x86_64.c:86 x64_sys_call+0x67/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:10 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1498 [inline] free_pcp_prepare mm/page_alloc.c:1572 [inline] free_unref_page_prepare+0x83d/0x850 mm/page_alloc.c:3498 free_unref_page_list+0xf1/0x7b0 mm/page_alloc.c:3646 release_pages+0xf7f/0xfe0 mm/swap.c:1063 free_pages_and_swap_cache+0x8a/0xa0 mm/swap_state.c:315 tlb_batch_pages_flush mm/mmu_gather.c:59 [inline] tlb_flush_mmu_free mm/mmu_gather.c:254 [inline] tlb_flush_mmu+0xfe/0x1d0 mm/mmu_gather.c:261 zap_pte_range mm/memory.c:1545 [inline] zap_pmd_range mm/memory.c:1594 [inline] zap_pud_range mm/memory.c:1623 [inline] zap_p4d_range mm/memory.c:1644 [inline] unmap_page_range+0x22d1/0x2620 mm/memory.c:1665 unmap_single_vma mm/memory.c:1711 [inline] unmap_vmas+0x4e4/0x660 mm/memory.c:1751 exit_mmap+0x2e7/0xbe0 mm/mmap.c:3335 __mmput+0x95/0x310 kernel/fork.c:1298 mmput+0x56/0x170 kernel/fork.c:1321 exit_mm kernel/exit.c:566 [inline] do_exit+0xb29/0x2b80 kernel/exit.c:862 do_group_exit+0x21a/0x2d0 kernel/exit.c:1025 __do_sys_exit_group kernel/exit.c:1036 [inline] __se_sys_exit_group kernel/exit.c:1034 [inline] __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1034 x64_sys_call+0x610/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:232 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff888132d9b800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888132d9b880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888132d9b900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888132d9b980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888132d9ba00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop0): ext4_find_dest_de:2112: inode #12: block 7: comm syz.0.245: bad entry in directory: directory entry overrun - offset=0, inode=1793120026, rec_len=34652, size=56 fake=0 EXT4-fs (loop0): unmounting filesystem.