================================================================== BUG: KASAN: use-after-free in dx_insert_block+0xd9/0x240 fs/ext4/namei.c:1387 Read of size 157024 at addr ffff888137694028 by task syz.7.388/1562 CPU: 0 PID: 1562 Comm: syz.7.388 Not tainted 6.1.138-syzkaller-1169863-gdb710ea87c32 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: __dump_stack+0x21/0x24 lib/dump_stack.c:88 dump_stack_lvl+0xee/0x150 lib/dump_stack.c:106 print_address_description+0x71/0x210 mm/kasan/report.c:316 print_report+0x4a/0x60 mm/kasan/report.c:427 kasan_report+0x122/0x150 mm/kasan/report.c:531 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x280/0x290 mm/kasan/generic.c:189 memmove+0x2d/0x70 mm/kasan/shadow.c:54 dx_insert_block+0xd9/0x240 fs/ext4/namei.c:1387 do_split+0x19f0/0x1d90 fs/ext4/namei.c:2080 make_indexed_dir+0xe06/0x14a0 fs/ext4/namei.c:2392 ext4_add_entry+0xb45/0xd70 fs/ext4/namei.c:2504 __ext4_link+0x4d7/0x770 fs/ext4/namei.c:3522 ext4_link+0x1de/0x270 fs/ext4/namei.c:3563 vfs_link+0x64b/0x800 fs/namei.c:4598 do_linkat+0x1e7/0x730 fs/namei.c:4669 __do_sys_link fs/namei.c:4703 [inline] __se_sys_link fs/namei.c:4701 [inline] __x64_sys_link+0x86/0x90 fs/namei.c:4701 x64_sys_call+0x266/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:87 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 RIP: 0033:0x7fd3b798cde9 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:00007fd3b8796038 EFLAGS: 00000246 ORIG_RAX: 0000000000000056 RAX: ffffffffffffffda RBX: 00007fd3b7ba5fa0 RCX: 00007fd3b798cde9 RDX: 0000000000000000 RSI: 0000400000000bc0 RDI: 0000400000001240 RBP: 00007fd3b7a0e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fd3b7ba5fa0 R15: 00007ffe4bbbe5a8 The buggy address belongs to the physical page: page:ffffea0004dda500 refcount:3 mapcount:1 mapping:ffff88810054d0d0 index:0x1 pfn:0x137694 memcg:ffff888121f86000 aops:def_blk_aops ino:700007 flags: 0x460000000032205e(referenced|uptodate|dirty|lru|workingset|private|mappedtodisk|unevictable|mlocked|zone=1) raw: 460000000032205e dead000000000100 dead000000000001 ffff88810054d0d0 raw: 0000000000000001 ffff88810fdc3690 0000000300000000 ffff888121f86000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Movable, gfp_mask 0x148c48(GFP_NOFS|__GFP_NOFAIL|__GFP_COMP|__GFP_HARDWALL|__GFP_MOVABLE), pid 1562, tgid 1561 (syz.7.388), ts 168715299762, free_ts 168714243952 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x1f5/0x210 mm/page_alloc.c:2637 prep_new_page+0x1c/0x110 mm/page_alloc.c:2644 get_page_from_freelist+0x2c6e/0x2ce0 mm/page_alloc.c:4539 __alloc_pages+0x19e/0x3a0 mm/page_alloc.c:5842 __folio_alloc+0x12/0x40 mm/page_alloc.c:5874 __folio_alloc_node include/linux/gfp.h:245 [inline] folio_alloc include/linux/gfp.h:274 [inline] filemap_alloc_folio include/linux/pagemap.h:513 [inline] __filemap_get_folio+0x6ec/0x980 mm/filemap.c:2018 pagecache_get_page+0x2b/0x110 mm/folio-compat.c:110 find_or_create_page include/linux/pagemap.h:654 [inline] grow_dev_page fs/buffer.c:989 [inline] grow_buffers fs/buffer.c:1054 [inline] __getblk_slow fs/buffer.c:1081 [inline] __getblk_gfp+0x217/0x7d0 fs/buffer.c:1376 sb_getblk include/linux/buffer_head.h:356 [inline] ext4_getblk+0x26c/0x6d0 fs/ext4/inode.c:900 ext4_bread_batch+0x66/0x490 fs/ext4/inode.c:967 __ext4_find_entry+0xf83/0x1a70 fs/ext4/namei.c:1671 ext4_lookup_entry fs/ext4/namei.c:1774 [inline] ext4_lookup+0x144/0x6d0 fs/ext4/namei.c:1842 lookup_open fs/namei.c:3459 [inline] open_last_lookups fs/namei.c:3549 [inline] path_openat+0xff3/0x2f50 fs/namei.c:3779 do_filp_open+0x1c1/0x3c0 fs/namei.c:3809 do_sys_openat2+0x185/0x7e0 fs/open.c:1341 do_sys_open fs/open.c:1357 [inline] __do_sys_creat fs/open.c:1435 [inline] __se_sys_creat fs/open.c:1429 [inline] __x64_sys_creat+0x8e/0xb0 fs/open.c:1429 page last free stack trace: reset_page_owner include/linux/page_owner.h:26 [inline] free_pages_prepare mm/page_alloc.c:1545 [inline] free_pcp_prepare mm/page_alloc.c:1619 [inline] free_unref_page_prepare+0x742/0x750 mm/page_alloc.c:3581 free_unref_page_list+0xba/0x7c0 mm/page_alloc.c:3729 release_pages+0xad1/0xb20 mm/swap.c:1043 free_pages_and_swap_cache+0x86/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 mm/mmu_gather.c:261 [inline] tlb_finish_mmu+0x1aa/0x370 mm/mmu_gather.c:361 unmap_region+0x28d/0x2e0 mm/mmap.c:2402 do_mas_align_munmap+0xb94/0x11b0 mm/mmap.c:2668 do_mas_munmap+0x241/0x2b0 mm/mmap.c:2726 __vm_munmap+0x19f/0x2f0 mm/mmap.c:3025 __do_sys_munmap mm/mmap.c:3051 [inline] __se_sys_munmap mm/mmap.c:3047 [inline] __x64_sys_munmap+0x6b/0x80 mm/mmap.c:3047 x64_sys_call+0x8a/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:12 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:81 entry_SYSCALL_64_after_hwframe+0x68/0xd2 Memory state around the buggy address: ffff888137694f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888137694f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888137695000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888137695080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888137695100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop7): ext4_dx_csum_set:531: inode #2: comm syz.7.388: dir seems corrupt? Run e2fsck -D.