================================================================== BUG: KASAN: use-after-free in __ext4_check_dir_entry+0x708/0x880 fs/ext4/dir.c:85 Read of size 2 at addr ffff888121ae0003 by task syz.0.15/466 CPU: 0 PID: 466 Comm: syz.0.15 Not tainted 6.10.0-rc5-syzkaller-00200-g5bbd9b249880 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x188/0x200 lib/dump_stack.c:114 print_address_description mm/kasan/report.c:377 [inline] print_report+0x163/0x550 mm/kasan/report.c:488 kasan_report+0x14f/0x190 mm/kasan/report.c:601 __asan_report_load2_noabort+0x18/0x20 mm/kasan/report_generic.c:379 __ext4_check_dir_entry+0x708/0x880 fs/ext4/dir.c:85 ext4_readdir+0x131f/0x3e00 fs/ext4/dir.c:258 iterate_dir+0x1f6/0x5d0 fs/readdir.c:110 __do_sys_getdents64 fs/readdir.c:409 [inline] __se_sys_getdents64+0x1c5/0x470 fs/readdir.c:394 __x64_sys_getdents64+0x7f/0x90 fs/readdir.c:394 x64_sys_call+0x2939/0x2d00 arch/x86/include/generated/asm/syscalls_64.h:218 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x54/0xf0 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7ff5acd75b29 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:00007ff5adbb4048 EFLAGS: 00000246 ORIG_RAX: 00000000000000d9 RAX: ffffffffffffffda RBX: 00007ff5acf03fa0 RCX: 00007ff5acd75b29 RDX: 0000000000000010 RSI: 0000000000000000 RDI: 0000000000000005 RBP: 00007ff5acdf6756 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007ff5acf03fa0 R15: 00007ffe7dd111b8 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x27d pfn:0x121ae0 flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea000486b848 ffffea000487e9c8 0000000000000000 raw: 000000000000027d 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 450, tgid 450 (syz-executor), ts 49221071881, free_ts 49339194307 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x234/0x260 mm/page_alloc.c:1473 prep_new_page mm/page_alloc.c:1481 [inline] get_page_from_freelist+0x21f5/0x2280 mm/page_alloc.c:3425 __alloc_pages_noprof+0x3e6/0x8a0 mm/page_alloc.c:4683 __folio_alloc_noprof+0x14/0x80 mm/page_alloc.c:4715 do_cow_fault mm/memory.c:4945 [inline] do_fault mm/memory.c:5053 [inline] do_pte_missing+0x54f/0x4360 mm/memory.c:3897 handle_pte_fault mm/memory.c:5381 [inline] __handle_mm_fault mm/memory.c:5524 [inline] handle_mm_fault+0x1551/0x2180 mm/memory.c:5689 do_user_addr_fault arch/x86/mm/fault.c:1338 [inline] handle_page_fault arch/x86/mm/fault.c:1481 [inline] exc_page_fault+0x40e/0x720 arch/x86/mm/fault.c:1539 asm_exc_page_fault+0x2b/0x30 arch/x86/include/asm/idtentry.h:623 page last free pid 451 tgid 451 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1093 [inline] free_unref_folios+0x7b9/0x11e0 mm/page_alloc.c:2637 folios_put_refs+0x500/0x600 mm/swap.c:1024 free_pages_and_swap_cache+0x2e6/0x620 mm/swap_state.c:329 __tlb_batch_free_encoded_pages mm/mmu_gather.c:136 [inline] tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:366 [inline] tlb_flush_mmu+0x435/0x720 mm/mmu_gather.c:373 tlb_finish_mmu+0xdb/0x200 mm/mmu_gather.c:465 exit_mmap+0x48e/0xb30 mm/mmap.c:3354 __mmput+0x95/0x310 kernel/fork.c:1346 mmput+0x63/0x80 kernel/fork.c:1368 exit_mm kernel/exit.c:565 [inline] do_exit+0xa8e/0x29d0 kernel/exit.c:861 do_group_exit+0x21f/0x2e0 kernel/exit.c:1023 get_signal+0x162b/0x1770 kernel/signal.c:2909 arch_do_signal_or_restart+0x96/0x790 arch/x86/kernel/signal.c:310 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:328 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0x56/0x120 kernel/entry/common.c:218 do_syscall_64+0x60/0xf0 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x76/0x7e Memory state around the buggy address: ffff888121adff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888121adff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888121ae0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888121ae0080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888121ae0100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop0): ext4_readdir:260: inode #2: block 255: comm syz.0.15: path /root/syzkaller.IninUP/0/file0: bad entry in directory: rec_len is smaller than minimal - offset=1023, inode=0, rec_len=0, size=1024 fake=0