EXT4-fs error (device loop1): ext4_mb_mark_diskspace_used:4183: comm syz.1.659: Allocating blocks 449-513 which overlap fs metadata ================================================================== BUG: KASAN: use-after-free in ext4_ext_rm_leaf fs/ext4/extents.c:2627 [inline] BUG: KASAN: use-after-free in ext4_ext_remove_space+0x3211/0x42f0 fs/ext4/extents.c:2965 Read of size 4 at addr ffff88804a34fc18 by task syz.1.659/12445 CPU: 1 UID: 0 PID: 12445 Comm: syz.1.659 Tainted: G W 6.17.0-rc1-syzkaller-00211-g90d970cade8e #0 PREEMPT_{RT,(full)} Tainted: [W]=WARN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 ext4_ext_rm_leaf fs/ext4/extents.c:2627 [inline] ext4_ext_remove_space+0x3211/0x42f0 fs/ext4/extents.c:2965 ext4_ext_truncate+0x17e/0x300 fs/ext4/extents.c:4484 ext4_truncate+0x9c1/0x1120 fs/ext4/inode.c:4643 ext4_truncate_failed_write fs/ext4/truncate.h:22 [inline] ext4_inode_extension_cleanup+0xdf/0x2f0 fs/ext4/file.c:341 ext4_dio_write_iter fs/ext4/file.c:592 [inline] ext4_file_write_iter+0x1719/0x1be0 fs/ext4/file.c:721 iter_file_splice_write+0x9cb/0x10b0 fs/splice.c:738 do_splice_from fs/splice.c:935 [inline] direct_splice_actor+0x104/0x160 fs/splice.c:1158 splice_direct_to_actor+0x5b3/0xcd0 fs/splice.c:1102 do_splice_direct_actor fs/splice.c:1201 [inline] do_splice_direct+0x187/0x270 fs/splice.c:1227 do_sendfile+0x4ec/0x7f0 fs/read_write.c:1370 __do_sys_sendfile64 fs/read_write.c:1431 [inline] __se_sys_sendfile64+0x13e/0x190 fs/read_write.c:1417 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fc7740debe9 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:00007fc772346038 EFLAGS: 00000246 ORIG_RAX: 0000000000000028 RAX: ffffffffffffffda RBX: 00007fc774305fa0 RCX: 00007fc7740debe9 RDX: 0000000000000000 RSI: 0000000000000008 RDI: 0000000000000007 RBP: 00007fc774161e19 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000020fffe82 R11: 0000000000000246 R12: 0000000000000000 R13: 00007fc774306038 R14: 00007fc774305fa0 R15: 00007ffe733447d8 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x8b6 pfn:0x4a34f flags: 0x80000000000000(node=0|zone=1) raw: 0080000000000000 ffffea000128d388 ffffea0001ddfa88 0000000000000000 raw: 00000000000008b6 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 0x140cca(GFP_HIGHUSER_MOVABLE|__GFP_COMP), pid 12402, tgid 12401 (syz.4.657), ts 422776216701, free_ts 423211531523 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1851 prep_new_page mm/page_alloc.c:1859 [inline] get_page_from_freelist+0x2119/0x21b0 mm/page_alloc.c:3858 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5148 alloc_pages_mpol+0xd1/0x380 mm/mempolicy.c:2416 folio_alloc_mpol_noprof+0x39/0xe0 mm/mempolicy.c:2435 shmem_alloc_folio mm/shmem.c:1908 [inline] shmem_alloc_and_add_folio mm/shmem.c:1947 [inline] shmem_get_folio_gfp+0x633/0x1a70 mm/shmem.c:2597 shmem_get_folio mm/shmem.c:2703 [inline] shmem_write_begin+0xef/0x2a0 mm/shmem.c:3353 generic_perform_write+0x29a/0x8c0 mm/filemap.c:4175 shmem_file_write_iter+0xfb/0x120 mm/shmem.c:3528 new_sync_write fs/read_write.c:593 [inline] vfs_write+0x5d2/0xb40 fs/read_write.c:686 ksys_write+0x14b/0x260 fs/read_write.c:738 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f page last free pid 12402 tgid 12401 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1395 [inline] free_unref_folios+0xd66/0x1460 mm/page_alloc.c:2952 folios_put_refs+0x569/0x670 mm/swap.c:997 folio_batch_release include/linux/pagevec.h:101 [inline] shmem_undo_range+0x49e/0x14b0 mm/shmem.c:1157 shmem_truncate_range mm/shmem.c:1269 [inline] shmem_evict_inode+0x272/0xa70 mm/shmem.c:1397 evict+0x504/0x9c0 fs/inode.c:810 __dentry_kill+0x209/0x660 fs/dcache.c:669 dput+0x19f/0x2b0 fs/dcache.c:911 __fput+0x69d/0xa80 fs/file_table.c:476 fput_close_sync+0x119/0x200 fs/file_table.c:573 __do_sys_close fs/open.c:1587 [inline] __se_sys_close fs/open.c:1572 [inline] __x64_sys_close+0x7f/0x110 fs/open.c:1572 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88804a34fb00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88804a34fb80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88804a34fc00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88804a34fc80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88804a34fd00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================