================================================================== BUG: KASAN: use-after-free in ext4_ext_rm_leaf fs/ext4/extents.c:2602 [inline] BUG: KASAN: use-after-free in ext4_ext_remove_space+0x2f43/0x3fb0 fs/ext4/extents.c:2940 Read of size 4 at addr ffff88813034ddb8 by task syz-executor/462 CPU: 1 PID: 462 Comm: syz-executor Not tainted 6.1.145-syzkaller-1169984-g3b4ff5af8d36 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/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 __asan_report_load4_noabort+0x14/0x20 mm/kasan/report_generic.c:350 ext4_ext_rm_leaf fs/ext4/extents.c:2602 [inline] ext4_ext_remove_space+0x2f43/0x3fb0 fs/ext4/extents.c:2940 ext4_ext_truncate+0x200/0x320 fs/ext4/extents.c:4470 ext4_truncate+0x9a6/0xf90 fs/ext4/inode.c:4291 ext4_evict_inode+0xcc3/0x1460 fs/ext4/inode.c:286 evict+0x493/0x890 fs/inode.c:705 iput_final fs/inode.c:1834 [inline] iput+0x620/0x670 fs/inode.c:1860 do_unlinkat+0x375/0x6b0 fs/namei.c:4396 __do_sys_unlink fs/namei.c:4437 [inline] __se_sys_unlink fs/namei.c:4435 [inline] __x64_sys_unlink+0x49/0x50 fs/namei.c:4435 x64_sys_call+0x958/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:88 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:0x7f5e3a18df57 Code: 73 01 c3 48 c7 c1 a8 ff ff ff f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 b8 57 00 00 00 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:00007ffe115d7118 EFLAGS: 00000206 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f5e3a18df57 RDX: 00007ffe115d7140 RSI: 00007ffe115d71d0 RDI: 00007ffe115d71d0 RBP: 00007ffe115d71d0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000100 R11: 0000000000000206 R12: 00007ffe115d82c0 R13: 00007f5e3a210b55 R14: 000000000000d2da R15: 00007ffe115d9390 The buggy address belongs to the physical page: page:ffffea0004c0d340 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x13034d flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea0004c0d388 ffffea0004c0d308 0000000000000000 raw: 0000000000000001 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Movable, gfp_mask 0x141cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP|__GFP_WRITE), pid 474, tgid 473 (syz.2.16), ts 53604442408, free_ts 53672419685 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+0x2c7b/0x2cf0 mm/page_alloc.c:4544 __alloc_pages+0x1c3/0x450 mm/page_alloc.c:5858 __folio_alloc+0x12/0x40 mm/page_alloc.c:5890 __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 grab_cache_page_write_begin+0x43/0x60 mm/folio-compat.c:122 ext4_write_begin+0x24b/0xf70 fs/ext4/inode.c:1221 ext4_da_write_begin+0x3e1/0x8b0 fs/ext4/inode.c:3001 generic_perform_write+0x2f6/0x6d0 mm/filemap.c:3882 ext4_buffered_write_iter+0x36f/0x660 fs/ext4/file.c:285 ext4_file_write_iter+0x18f/0x13d0 fs/ext4/file.c:-1 call_write_iter include/linux/fs.h:2282 [inline] new_sync_write fs/read_write.c:491 [inline] vfs_write+0x5db/0xca0 fs/read_write.c:584 ksys_write+0x140/0x240 fs/read_write.c:637 __do_sys_write fs/read_write.c:649 [inline] __se_sys_write fs/read_write.c:646 [inline] __x64_sys_write+0x7b/0x90 fs/read_write.c:646 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+0x112/0x8b0 mm/page_alloc.c:3730 release_pages+0xad1/0xb20 mm/swap.c:1043 __pagevec_release+0x71/0xe0 mm/swap.c:1063 pagevec_release include/linux/pagevec.h:71 [inline] folio_batch_release include/linux/pagevec.h:135 [inline] truncate_inode_pages_range+0x309/0xcc0 mm/truncate.c:374 truncate_inode_pages mm/truncate.c:456 [inline] truncate_pagecache+0x6c/0x90 mm/truncate.c:762 ext4_setattr+0xf9b/0x1a50 fs/ext4/inode.c:5627 notify_change+0xcc3/0xf80 fs/attr.c:499 do_truncate fs/open.c:66 [inline] do_sys_ftruncate+0x58f/0x7f0 fs/open.c:194 __do_sys_ftruncate fs/open.c:205 [inline] __se_sys_ftruncate fs/open.c:203 [inline] __x64_sys_ftruncate+0x60/0x70 fs/open.c:203 x64_sys_call+0x2f9/0x9a0 arch/x86/include/generated/asm/syscalls_64.h:78 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: ffff88813034dc80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88813034dd00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88813034dd80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88813034de00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88813034de80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 16106144, count = 0 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 16106144, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 657129996480, count = 27344 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 192 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 1 EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs (loop2): unmounting filesystem. EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 16109280, count = 0 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 16109280, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 2430951489728, count = 12880 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 1, count = 192 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 1 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 37106192, count = 0 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 37106192, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 4294967408, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 4294967295, count = 127 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 192 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 2388001837760, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 2388001816576, count = 21192 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 71748523491968, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 71748523475265, count = 16705 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 71748523475264, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 71748523491968, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 71748523475265, count = 16705 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 71748523475264, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 71748523491968, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 71748523475265, count = 16705 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 2210361712, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 2210339683, count = 22044 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 144856362031856, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 144856362024847, count = 7010 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 144856362024832, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 4082153472, count = 32655 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 4082153472, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 267529217934416, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 79393853440928, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 79393853427064, count = 13873 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 79393853427056, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 91720695127952, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 91720695113263, count = 14701 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 91720695113248, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 127746155180992, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 127746155164250, count = 16758 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 16106816, count = 0 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 16106816, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 2482491097280, count = 15376 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 192 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 1 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 38036256, count = 0 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 1 EXT4-fs error (device loop2): mb_free_blocks:1815: group 0, inode 18: block 257:freeing already freed block (bit 16); block bitmap corrupt. EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 2388001816576, count = 20992 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 1, count = 192 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 2491081031872, count = 27056 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 0 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 0, count = 4 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 1331632, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 1331456, count = 192