================================================================== BUG: KASAN: use-after-free in dx_insert_block fs/ext4/namei.c:1358 [inline] BUG: KASAN: use-after-free in do_split+0x1dce/0x2320 fs/ext4/namei.c:2044 Read of size 157024 at addr ffff888125a80028 by task syz.5.18/451 CPU: 1 PID: 451 Comm: syz.5.18 Not tainted 5.10.233-syzkaller-00881-gfbe98d68b6b3 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack_lvl+0x1e2/0x24b lib/dump_stack.c:118 print_address_description+0x81/0x3b0 mm/kasan/report.c:248 __kasan_report mm/kasan/report.c:435 [inline] kasan_report+0x179/0x1c0 mm/kasan/report.c:452 kasan_check_range+0x293/0x2a0 mm/kasan/generic.c:189 memmove+0x2d/0x70 mm/kasan/shadow.c:54 dx_insert_block fs/ext4/namei.c:1358 [inline] do_split+0x1dce/0x2320 fs/ext4/namei.c:2044 make_indexed_dir+0xe3a/0x1500 fs/ext4/namei.c:2348 ext4_add_entry+0xdcf/0x1280 fs/ext4/namei.c:2460 __ext4_link+0x4e9/0x790 fs/ext4/namei.c:3647 ext4_link+0x1f3/0x290 fs/ext4/namei.c:3688 vfs_link+0x68f/0x890 fs/namei.c:4213 do_linkat+0x471/0x8b0 fs/namei.c:4281 __do_sys_link fs/namei.c:4310 [inline] __se_sys_link fs/namei.c:4308 [inline] __x64_sys_link+0x68/0x80 fs/namei.c:4308 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7f57d71c5d29 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:00007f57d6c3f038 EFLAGS: 00000246 ORIG_RAX: 0000000000000056 RAX: ffffffffffffffda RBX: 00007f57d73b5fa0 RCX: 00007f57d71c5d29 RDX: 0000000000000000 RSI: 0000000020000bc0 RDI: 0000000020001240 RBP: 00007f57d7241b08 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f57d73b5fa0 R15: 00007ffcd5b53408 The buggy address belongs to the page: page:ffffea000496a000 refcount:3 mapcount:1 mapping:ffff88810ff0f150 index:0x1 pfn:0x125a80 aops:def_blk_aops ino:0 flags: 0x400000000032201e(referenced|uptodate|dirty|lru|private|mappedtodisk|unevictable|mlocked) raw: 400000000032201e ffff888100197040 ffffea0004ad7208 ffff88810ff0f150 raw: 0000000000000001 ffff888120f37a80 0000000300000000 ffff888100138000 page dumped because: kasan: bad access detected page->mem_cgroup:ffff888100138000 page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 341, ts 51637611441, free_ts 49598915570 set_page_owner include/linux/page_owner.h:35 [inline] post_alloc_hook mm/page_alloc.c:2456 [inline] prep_new_page+0x166/0x180 mm/page_alloc.c:2462 get_page_from_freelist+0x2d8c/0x2f30 mm/page_alloc.c:4254 __alloc_pages_nodemask+0x435/0xaf0 mm/page_alloc.c:5348 __alloc_pages include/linux/gfp.h:544 [inline] __alloc_pages_node include/linux/gfp.h:557 [inline] alloc_pages_node include/linux/gfp.h:571 [inline] alloc_pages include/linux/gfp.h:590 [inline] __page_cache_alloc include/linux/pagemap.h:290 [inline] page_cache_ra_unbounded+0x363/0x890 mm/readahead.c:226 do_page_cache_ra mm/readahead.c:277 [inline] force_page_cache_ra+0x373/0x3e0 mm/readahead.c:308 page_cache_sync_ra+0x254/0x2c0 mm/readahead.c:582 page_cache_sync_readahead include/linux/pagemap.h:837 [inline] generic_file_buffered_read+0x6da/0x2ad0 mm/filemap.c:2250 generic_file_read_iter+0x107/0x6b0 mm/filemap.c:2568 blkdev_read_iter+0x135/0x190 fs/block_dev.c:1956 call_read_iter include/linux/fs.h:2052 [inline] new_sync_read fs/read_write.c:415 [inline] vfs_read+0x990/0xba0 fs/read_write.c:496 ksys_read+0x199/0x2c0 fs/read_write.c:634 __do_sys_read fs/read_write.c:644 [inline] __se_sys_read fs/read_write.c:642 [inline] __x64_sys_read+0x7b/0x90 fs/read_write.c:642 do_syscall_64+0x34/0x70 entry_SYSCALL_64_after_hwframe+0x61/0xcb page last free stack trace: reset_page_owner include/linux/page_owner.h:28 [inline] free_pages_prepare mm/page_alloc.c:1349 [inline] free_pcp_prepare mm/page_alloc.c:1421 [inline] free_unref_page_prepare+0x2ae/0x2d0 mm/page_alloc.c:3336 free_unref_page mm/page_alloc.c:3391 [inline] free_the_page+0x9e/0x370 mm/page_alloc.c:5407 __free_pages+0x67/0xc0 mm/page_alloc.c:5418 __vunmap+0x7bc/0x8f0 mm/vmalloc.c:2301 __vfree mm/vmalloc.c:2349 [inline] vfree+0x5c/0x80 mm/vmalloc.c:2380 kcov_put kernel/kcov.c:408 [inline] kcov_close+0x2b/0x50 kernel/kcov.c:510 __fput+0x33d/0x7b0 fs/file_table.c:281 ____fput+0x15/0x20 fs/file_table.c:314 task_work_run+0x129/0x190 kernel/task_work.c:189 exit_task_work include/linux/task_work.h:33 [inline] do_exit+0xc83/0x2a50 kernel/exit.c:863 do_group_exit+0x141/0x310 kernel/exit.c:985 get_signal+0x10a0/0x1410 kernel/signal.c:2793 arch_do_signal_or_restart+0xbd/0x17c0 arch/x86/kernel/signal.c:805 handle_signal_work kernel/entry/common.c:145 [inline] exit_to_user_mode_loop+0x9b/0xd0 kernel/entry/common.c:169 exit_to_user_mode_prepare kernel/entry/common.c:199 [inline] syscall_exit_to_user_mode+0xa2/0x1a0 kernel/entry/common.c:274 do_syscall_64+0x40/0x70 arch/x86/entry/common.c:56 Memory state around the buggy address: ffff888125a83f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888125a83f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888125a84000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888125a84080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc ffff888125a84100: fc fc fc fc fc fc fc fc fa fb fb fb fb fb fb fb ================================================================== EXT4-fs error (device loop5): ext4_dx_csum_set:529: inode #2: comm syz.5.18: dir seems corrupt? Run e2fsck -D.