================================================================== BUG: KASAN: use-after-free in dx_insert_block+0xe8/0x260 fs/ext4/namei.c:1387 Read of size 157024 at addr ffff888132f1f028 by task syz.7.415/2017 CPU: 0 PID: 2017 Comm: syz.7.415 Not tainted 6.1.124-syzkaller-00006-gc93dcf3b5358 #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:0x7f2b2df8cde9 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:00007f2b2ed6c038 EFLAGS: 00000246 ORIG_RAX: 0000000000000056 RAX: ffffffffffffffda RBX: 00007f2b2e1a5fa0 RCX: 00007f2b2df8cde9 RDX: 0000000000000000 RSI: 0000400000000bc0 RDI: 0000400000001240 RBP: 00007f2b2e00e2a0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f2b2e1a5fa0 R15: 00007fffaf332818 The buggy address belongs to the physical page: page:ffffea0004cbc7c0 refcount:3 mapcount:1 mapping:ffff88810b976750 index:0x1 pfn:0x132f1f memcg:ffff88810e43c000 aops:def_blk_aops ino:700007 flags: 0x460000000032205e(referenced|uptodate|dirty|lru|workingset|private|mappedtodisk|unevictable|mlocked|zone=1) raw: 460000000032205e dead000000000100 dead000000000001 ffff88810b976750 raw: 0000000000000001 ffff8881234f4930 0000000300000000 ffff88810e43c000 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 2017, tgid 2016 (syz.7.415), ts 466569330988, free_ts 466445736936 set_page_owner include/linux/page_owner.h:33 [inline] post_alloc_hook+0x213/0x220 mm/page_alloc.c:2605 prep_new_page+0x1b/0x110 mm/page_alloc.c:2612 get_page_from_freelist+0x2f41/0x2fc0 mm/page_alloc.c:4477 __alloc_pages+0x234/0x610 mm/page_alloc.c:5775 __folio_alloc+0x15/0x40 mm/page_alloc.c:5807 __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+0x827/0xae0 mm/filemap.c:2017 pagecache_get_page+0x2f/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+0x205/0x7d0 fs/buffer.c:1376 sb_getblk include/linux/buffer_head.h:356 [inline] ext4_getblk+0x2a7/0x7b0 fs/ext4/inode.c:899 ext4_bread_batch+0x67/0x4c0 fs/ext4/inode.c:966 __ext4_find_entry+0xfb9/0x1af0 fs/ext4/namei.c:1671 ext4_lookup_entry fs/ext4/namei.c:1774 [inline] ext4_lookup+0x176/0x740 fs/ext4/namei.c:1842 lookup_open fs/namei.c:3459 [inline] open_last_lookups fs/namei.c:3549 [inline] path_openat+0x10fd/0x2d60 fs/namei.c:3779 do_filp_open+0x230/0x480 fs/namei.c:3809 do_sys_openat2+0x151/0x870 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+0x11f/0x160 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:1513 [inline] free_pcp_prepare mm/page_alloc.c:1587 [inline] free_unref_page_prepare+0x9f1/0xa00 mm/page_alloc.c:3526 free_unref_page_list+0xf1/0x7b0 mm/page_alloc.c:3674 release_pages+0xef9/0xf50 mm/swap.c:1043 __pagevec_release+0x84/0x100 mm/swap.c:1063 pagevec_release include/linux/pagevec.h:71 [inline] folio_batch_release include/linux/pagevec.h:135 [inline] shmem_undo_range+0x5fc/0x1660 mm/shmem.c:951 shmem_truncate_range mm/shmem.c:1067 [inline] shmem_evict_inode+0x25f/0xa30 mm/shmem.c:1176 evict+0x529/0x930 fs/inode.c:705 iput_final fs/inode.c:1834 [inline] iput+0x616/0x690 fs/inode.c:1860 dentry_unlink_inode+0x34e/0x430 fs/dcache.c:405 __dentry_kill+0x447/0x650 fs/dcache.c:611 dentry_kill+0xc0/0x2a0 dput+0x40/0x80 fs/dcache.c:918 do_renameat2+0xc5b/0x1480 fs/namei.c:5028 __do_sys_rename fs/namei.c:5072 [inline] __se_sys_rename fs/namei.c:5070 [inline] __x64_sys_rename+0x86/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: ffff888132f20f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888132f20f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888132f21000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888132f21080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888132f21100: 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.415: dir seems corrupt? Run e2fsck -D.