================================================================== BUG: KASAN: use-after-free in dx_insert_block+0xe8/0x260 fs/ext4/namei.c:1387 Read of size 157024 at addr ffff888131ffc028 by task syz.5.1132/3883 CPU: 0 PID: 3883 Comm: syz.5.1132 Not tainted 6.1.124-syzkaller-00008-gccc915784332 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/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 mm/kasan/report.c:316 [inline] print_report+0x158/0x4e0 mm/kasan/report.c:427 kasan_report+0x13c/0x170 mm/kasan/report.c:531 kasan_check_range+0x294/0x2a0 mm/kasan/generic.c:189 memmove+0x2d/0x70 mm/kasan/shadow.c:54 dx_insert_block+0xe8/0x260 fs/ext4/namei.c:1387 do_split+0x1e0e/0x2250 fs/ext4/namei.c:2080 make_indexed_dir+0xeaf/0x1590 fs/ext4/namei.c:2392 ext4_add_entry+0xbbf/0xed0 fs/ext4/namei.c:2504 __ext4_link+0x4e9/0x790 fs/ext4/namei.c:3522 ext4_link+0x1f3/0x290 fs/ext4/namei.c:3563 vfs_link+0x645/0x7f0 fs/namei.c:4598 do_linkat+0x34d/0x9f0 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+0x282/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:87 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:0x7f83b318cde9 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:00007f83b4040038 EFLAGS: 00000246 ORIG_RAX: 0000000000000056 RAX: ffffffffffffffda RBX: 00007f83b33a5fa0 RCX: 00007f83b318cde9 RDX: 0000000000000000 RSI: 0000400000000bc0 RDI: 0000400000001240 RBP: 00007f83b320e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f83b33a5fa0 R15: 00007ffcbdae1a38 The buggy address belongs to the physical page: page:ffffea0004c7ff00 refcount:3 mapcount:1 mapping:ffff88810b98f650 index:0x1 pfn:0x131ffc memcg:ffff888100334000 aops:def_blk_aops ino:700005 flags: 0x460000000032205e(referenced|uptodate|dirty|lru|workingset|private|mappedtodisk|unevictable|mlocked|zone=1) raw: 460000000032205e dead000000000100 dead000000000001 ffff88810b98f650 raw: 0000000000000001 ffff888117dd1a80 0000000300000000 ffff888100334000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x152c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_HARDWALL), pid 441, tgid 441 (udevd), ts 359033760519, free_ts 359029887409 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x213/0x220 mm/page_alloc.c:2637 prep_new_page+0x1b/0x110 mm/page_alloc.c:2644 get_page_from_freelist+0x3a98/0x3b10 mm/page_alloc.c:4539 __alloc_pages+0x234/0x610 mm/page_alloc.c:5837 __folio_alloc+0x15/0x40 mm/page_alloc.c:5869 __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] page_cache_ra_unbounded+0x2cb/0x800 mm/readahead.c:260 do_page_cache_ra mm/readahead.c:312 [inline] force_page_cache_ra mm/readahead.c:343 [inline] page_cache_sync_ra+0x394/0x450 mm/readahead.c:727 page_cache_sync_readahead include/linux/pagemap.h:1257 [inline] filemap_get_pages mm/filemap.c:2688 [inline] filemap_read+0x7fa/0x2600 mm/filemap.c:2783 blkdev_read_iter+0x3de/0x530 block/fops.c:613 call_read_iter include/linux/fs.h:2268 [inline] new_sync_read fs/read_write.c:389 [inline] vfs_read+0x801/0xae0 fs/read_write.c:470 ksys_read+0x199/0x2c0 fs/read_write.c:613 __do_sys_read fs/read_write.c:623 [inline] __se_sys_read fs/read_write.c:621 [inline] __x64_sys_read+0x7b/0x90 fs/read_write.c:621 x64_sys_call+0x28/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:1 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:1545 [inline] free_pcp_prepare mm/page_alloc.c:1619 [inline] free_unref_page_prepare+0x9f1/0xa00 mm/page_alloc.c:3581 free_unref_page+0xb2/0x5c0 mm/page_alloc.c:3677 free_the_page mm/page_alloc.c:830 [inline] __free_pages+0x61/0xf0 mm/page_alloc.c:5926 __free_slab+0xce/0x1a0 mm/slub.c:2039 free_slab mm/slub.c:2054 [inline] discard_slab+0x29/0x40 mm/slub.c:2060 __slab_free+0x205/0x280 mm/slub.c:3599 do_slab_free mm/slub.c:3640 [inline] ___cache_free+0xc6/0xd0 mm/slub.c:3696 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0xc5/0x140 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x15a/0x180 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x24/0x80 mm/kasan/common.c:310 kasan_slab_alloc include/linux/kasan.h:202 [inline] slab_post_alloc_hook+0x53/0x2c0 mm/slab.h:768 slab_alloc_node mm/slub.c:3421 [inline] slab_alloc mm/slub.c:3431 [inline] __kmem_cache_alloc_lru mm/slub.c:3438 [inline] kmem_cache_alloc+0x175/0x320 mm/slub.c:3447 getname_flags+0xba/0x520 fs/namei.c:139 getname fs/namei.c:218 [inline] __do_sys_rename fs/namei.c:5072 [inline] __se_sys_rename fs/namei.c:5070 [inline] __x64_sys_rename+0x5f/0x90 fs/namei.c:5070 x64_sys_call+0x266/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:83 do_syscall_x64 arch/x86/entry/common.c:51 [inline] do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:81 Memory state around the buggy address: ffff888131ffcf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888131ffcf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888131ffd000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888131ffd080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888131ffd100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs error (device loop5): ext4_dx_csum_set:531: inode #2: comm syz.5.1132: dir seems corrupt? Run e2fsck -D.