EXT4-fs (loop3): mounted filesystem 00000007-0000-0000-0000-000000000000 r/w without journal. Quota mode: none. ================================================================== BUG: KASAN: use-after-free in ext4_insert_dentry+0x36a/0x6d0 fs/ext4/namei.c:2119 Write of size 250 at addr ffff88807a26ef18 by task syz.3.18/6027 CPU: 1 UID: 0 PID: 6027 Comm: syz.3.18 Not tainted 6.13.0-rc1-syzkaller-00001-ge70140ba0d2b #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c:602 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189 __asan_memcpy+0x40/0x70 mm/kasan/shadow.c:106 ext4_insert_dentry+0x36a/0x6d0 fs/ext4/namei.c:2119 add_dirent_to_buf+0x3d9/0x750 fs/ext4/namei.c:2164 make_indexed_dir+0xf98/0x1600 fs/ext4/namei.c:2361 ext4_add_entry+0xcf7/0xfa0 fs/ext4/namei.c:2462 ext4_mkdir+0x554/0xcf0 fs/ext4/namei.c:3039 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4311 do_mkdirat+0x264/0x3a0 fs/namei.c:4334 __do_sys_mkdirat fs/namei.c:4349 [inline] __se_sys_mkdirat fs/namei.c:4347 [inline] __x64_sys_mkdirat+0x87/0xa0 fs/namei.c:4347 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fe84b97ff19 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:00007fe84c73a058 EFLAGS: 00000246 ORIG_RAX: 0000000000000102 RAX: ffffffffffffffda RBX: 00007fe84bb45fa0 RCX: 00007fe84b97ff19 RDX: 0000000000000000 RSI: 00000000200005c0 RDI: ffffffffffffff9c RBP: 00007fe84b9f3986 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007fe84bb45fa0 R15: 00007ffe7c670898 The buggy address belongs to the physical page: page: refcount:3 mapcount:0 mapping:ffff888148d3eff8 index:0x3f pfn:0x7a26e memcg:ffff88807eec2000 aops:def_blk_aops ino:700003 dentry name(?):"" flags: 0xfff00000004114(referenced|dirty|active|private|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000004114 0000000000000000 dead000000000122 ffff888148d3eff8 raw: 000000000000003f ffff888078888828 00000003ffffffff ffff88807eec2000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x148c40(GFP_NOFS|__GFP_NOFAIL|__GFP_COMP|__GFP_HARDWALL), pid 6027, tgid 6026 (syz.3.18), ts 82252597474, free_ts 72117548812 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1556 prep_new_page mm/page_alloc.c:1564 [inline] get_page_from_freelist+0x3651/0x37a0 mm/page_alloc.c:3474 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4751 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2265 alloc_pages_noprof mm/mempolicy.c:2344 [inline] folio_alloc_noprof+0x128/0x180 mm/mempolicy.c:2351 filemap_alloc_folio_noprof+0xdf/0x500 mm/filemap.c:1009 __filemap_get_folio+0x446/0xbd0 mm/filemap.c:1951 grow_dev_folio fs/buffer.c:1039 [inline] grow_buffers fs/buffer.c:1105 [inline] __getblk_slow fs/buffer.c:1131 [inline] bdev_getblk+0x1d8/0x550 fs/buffer.c:1431 getblk_unmovable include/linux/buffer_head.h:369 [inline] ext4_getblk+0x31b/0x880 fs/ext4/inode.c:864 ext4_bread+0x2e/0x180 fs/ext4/inode.c:912 ext4_append+0x327/0x5c0 fs/ext4/namei.c:83 make_indexed_dir+0x523/0x1600 fs/ext4/namei.c:2282 ext4_add_entry+0xcf7/0xfa0 fs/ext4/namei.c:2462 ext4_mkdir+0x554/0xcf0 fs/ext4/namei.c:3039 vfs_mkdir+0x2f9/0x4f0 fs/namei.c:4311 do_mkdirat+0x264/0x3a0 fs/namei.c:4334 page last free pid 5866 tgid 5866 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_page+0xde3/0x1130 mm/page_alloc.c:2657 vfree+0x186/0x2e0 mm/vmalloc.c:3382 kcov_put kernel/kcov.c:439 [inline] kcov_close+0x28/0x50 kernel/kcov.c:535 __fput+0x23c/0xa50 fs/file_table.c:450 task_work_run+0x24f/0x310 kernel/task_work.c:239 exit_task_work include/linux/task_work.h:43 [inline] do_exit+0xa2f/0x28e0 kernel/exit.c:938 do_group_exit+0x207/0x2c0 kernel/exit.c:1087 get_signal+0x16b2/0x1750 kernel/signal.c:3017 arch_do_signal_or_restart+0x96/0x860 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:111 [inline] exit_to_user_mode_prepare include/linux/entry-common.h:329 [inline] __syscall_exit_to_user_mode_work kernel/entry/common.c:207 [inline] syscall_exit_to_user_mode+0xce/0x340 kernel/entry/common.c:218 do_syscall_64+0x100/0x230 arch/x86/entry/common.c:89 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88807a26ef00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88807a26ef80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88807a26f000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88807a26f080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88807a26f100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================