================================================================== 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 ffff88803b52ec18 by task syz.5.1977/15687 CPU: 0 UID: 0 PID: 15687 Comm: syz.5.1977 Not tainted syzkaller #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/02/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+0xb4f/0x12e0 fs/ext4/inode.c:4614 ext4_setattr+0x1015/0x1bc0 fs/ext4/inode.c:6015 notify_change+0xc1a/0xf40 fs/attr.c:546 do_truncate+0x1a4/0x220 fs/open.c:68 handle_truncate fs/namei.c:3596 [inline] do_open fs/namei.c:3979 [inline] path_openat+0x306c/0x3830 fs/namei.c:4134 do_filp_open+0x1fa/0x410 fs/namei.c:4161 do_sys_openat2+0x121/0x1c0 fs/open.c:1437 do_sys_open fs/open.c:1452 [inline] __do_sys_openat fs/open.c:1468 [inline] __se_sys_openat fs/open.c:1463 [inline] __x64_sys_openat+0x138/0x170 fs/open.c:1463 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0xfa0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f65ec18eec9 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:00007f65ea3d5038 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 00007f65ec3e6090 RCX: 00007f65ec18eec9 RDX: 0000000000181242 RSI: 0000200000000180 RDI: ffffffffffffff9c RBP: 00007f65ec211f91 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000148 R11: 0000000000000246 R12: 0000000000000000 R13: 00007f65ec3e6128 R14: 00007f65ec3e6090 R15: 00007fff3ae5da48 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x4fd0 pfn:0x3b52e flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffffea0000ed4bc8 ffffea0000ed4b48 0000000000000000 raw: 0000000000004fd0 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 15619, tgid 15619 (syz.1.1964), ts 821964678077, free_ts 824207103585 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1850 prep_new_page mm/page_alloc.c:1858 [inline] get_page_from_freelist+0x2365/0x2440 mm/page_alloc.c:3884 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:5183 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2416 folio_alloc_mpol_noprof+0x39/0x70 mm/mempolicy.c:2435 shmem_alloc_folio mm/shmem.c:1871 [inline] shmem_alloc_and_add_folio+0x447/0xf60 mm/shmem.c:1910 shmem_get_folio_gfp+0x59d/0x1660 mm/shmem.c:2533 shmem_get_folio mm/shmem.c:2639 [inline] shmem_write_begin+0xf7/0x2b0 mm/shmem.c:3289 generic_perform_write+0x2c5/0x900 mm/filemap.c:4242 shmem_file_write_iter+0xf8/0x120 mm/shmem.c:3464 __kernel_write_iter+0x428/0x910 fs/read_write.c:619 dump_emit_page fs/coredump.c:1298 [inline] dump_user_range+0x8a0/0xc90 fs/coredump.c:1372 elf_core_dump+0x3369/0x3960 fs/binfmt_elf.c:2111 coredump_write+0x116c/0x1900 fs/coredump.c:1049 vfs_coredump+0x1db5/0x2a60 fs/coredump.c:1170 get_signal+0x1108/0x1340 kernel/signal.c:3019 page last free pid 15619 tgid 15619 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1394 [inline] free_unref_folios+0xdb3/0x14f0 mm/page_alloc.c:2963 folios_put_refs+0x584/0x670 mm/swap.c:1012 folio_batch_release include/linux/pagevec.h:101 [inline] shmem_undo_range+0x49e/0x14b0 mm/shmem.c:1120 shmem_truncate_range mm/shmem.c:1232 [inline] shmem_evict_inode+0x272/0xa70 mm/shmem.c:1360 evict+0x504/0x9c0 fs/inode.c:810 __dentry_kill+0x209/0x660 fs/dcache.c:669 dput+0x19f/0x2b0 fs/dcache.c:911 __fput+0x68e/0xa70 fs/file_table.c:476 task_work_run+0x1d4/0x260 kernel/task_work.c:227 exit_task_work include/linux/task_work.h:40 [inline] do_exit+0x6b5/0x2300 kernel/exit.c:966 do_group_exit+0x21c/0x2d0 kernel/exit.c:1107 get_signal+0x1285/0x1340 kernel/signal.c:3034 arch_do_signal_or_restart+0xa0/0x790 arch/x86/kernel/signal.c:337 exit_to_user_mode_loop kernel/entry/common.c:40 [inline] exit_to_user_mode_prepare include/linux/irq-entry-common.h:225 [inline] irqentry_exit_to_user_mode+0x7e/0x110 kernel/entry/common.c:73 exc_page_fault+0xab/0x100 arch/x86/mm/fault.c:1535 asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:618 Memory state around the buggy address: ffff88803b52eb00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88803b52eb80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff88803b52ec00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88803b52ec80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88803b52ed00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================