================================================================== 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 ffff888128c8cdb8 by task syz-executor/464 CPU: 1 PID: 464 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:0x7f9686d8df57 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:00007ffd6f88bc38 EFLAGS: 00000206 ORIG_RAX: 0000000000000057 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f9686d8df57 RDX: 00007ffd6f88bc60 RSI: 00007ffd6f88bcf0 RDI: 00007ffd6f88bcf0 RBP: 00007ffd6f88bcf0 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000100 R11: 0000000000000206 R12: 00007ffd6f88cde0 R13: 00007f9686e10b55 R14: 000000000000d2de R15: 00007ffd6f88deb0 The buggy address belongs to the physical page: page:ffffea0004a32300 refcount:0 mapcount:0 mapping:0000000000000000 index:0x1 pfn:0x128c8c flags: 0x4000000000000000(zone=1) raw: 4000000000000000 ffffea0004a32708 ffffea00049e7948 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 476, tgid 475 (syz.2.16), ts 54010886193, free_ts 54112265537 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: ffff888128c8cc80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888128c8cd00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888128c8cd80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888128c8ce00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888128c8ce80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ================================================================== EXT4-fs (loop2): unmounting filesystem. 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 = 217020402538592, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 217020402532322, count = 6273 EXT4-fs (loop2): unmounting filesystem. EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472857139712, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472857106949, count = 32767 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856221616, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856188865, count = 32767 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856237584, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856204825, count = 32767 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856221456, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 281472856188703, count = 32767 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 = 0, count = 192 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 2388001816576, count = 20992 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 = 129052818136272, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 129052818106478, count = 29797 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 129052818106464, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 35546867138432, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 35546867130207, count = 8240 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 35546867130192, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 112589098203238, count = 26214 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 112589098203232, count = 16 EXT4-fs error: 36492 callbacks suppressed EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 112589990710464, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 112589990684262, count = 26214 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 112589990684256, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 126853710864832, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 126853710836069, count = 28769 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 126853710836064, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 126853494004448, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 126853493976948, count = 27507 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 126853493976944, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 112567342367888, count = 16 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 = 112589098503360, count = 16 EXT4-fs error (device loop2): ext4_free_blocks:6210: comm syz-executor: Freeing blocks not in datazone - block = 112589098477158, count = 26214