================================================================== 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 ffff8880514a9c18 by task syz.0.137/7196 CPU: 1 UID: 0 PID: 7196 Comm: syz.0.137 Not tainted 6.16.0-rc1-syzkaller-00203-g4774cfe3543a #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xd2/0x2b0 mm/kasan/report.c:521 kasan_report+0x118/0x150 mm/kasan/report.c:634 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+0x9bb/0x1100 fs/ext4/inode.c:4574 ext4_setattr+0x1015/0x1bc0 fs/ext4/inode.c:5959 notify_change+0xb33/0xe40 fs/attr.c:552 do_truncate+0x1a4/0x220 fs/open.c:68 vfs_truncate+0x493/0x520 fs/open.c:118 do_sys_truncate+0xdb/0x190 fs/open.c:141 __do_sys_truncate fs/open.c:153 [inline] __se_sys_truncate fs/open.c:151 [inline] __x64_sys_truncate+0x5b/0x70 fs/open.c:151 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:0x7f69e918e929 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:00007f69e9fb2038 EFLAGS: 00000246 ORIG_RAX: 000000000000004c RAX: ffffffffffffffda RBX: 00007f69e93b5fa0 RCX: 00007f69e918e929 RDX: 0000000000000000 RSI: 0000000000008008 RDI: 00002000000000c0 RBP: 00007f69e9210b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f69e93b5fa0 R15: 00007fffc75e6088 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x514a9 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 dead000000000100 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2cc2(GFP_KERNEL|__GFP_HIGHMEM|__GFP_NOWARN), pid 6933, tgid 6932 (syz.8.105), ts 169159642587, free_ts 170855683712 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1704 prep_new_page mm/page_alloc.c:1712 [inline] get_page_from_freelist+0x21d5/0x22b0 mm/page_alloc.c:3669 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4959 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2419 alloc_frozen_pages_noprof mm/mempolicy.c:2490 [inline] alloc_pages_noprof+0xa9/0x190 mm/mempolicy.c:2510 vm_area_alloc_pages mm/vmalloc.c:3634 [inline] __vmalloc_area_node mm/vmalloc.c:3712 [inline] __vmalloc_node_range_noprof+0x97d/0x12f0 mm/vmalloc.c:3885 __kvmalloc_node_noprof+0x3b8/0x5f0 mm/slub.c:5037 bch2_fs_journal_start+0x480/0x1510 fs/bcachefs/journal.c:1519 bch2_fs_recovery+0x2237/0x3950 fs/bcachefs/recovery.c:968 bch2_fs_start+0xa99/0xd90 fs/bcachefs/super.c:1203 bch2_fs_get_tree+0xb02/0x14f0 fs/bcachefs/fs.c:2489 vfs_get_tree+0x92/0x2b0 fs/super.c:1802 do_new_mount+0x24a/0xa40 fs/namespace.c:3885 do_mount fs/namespace.c:4222 [inline] __do_sys_mount fs/namespace.c:4433 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4410 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 6454 tgid 6454 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1248 [inline] __free_frozen_pages+0xc65/0xe60 mm/page_alloc.c:2706 vfree+0x25a/0x400 mm/vmalloc.c:3426 bch2_fs_journal_exit+0x337/0x360 fs/bcachefs/journal.c:1675 __bch2_fs_free fs/bcachefs/super.c:603 [inline] bch2_fs_release+0x224/0x830 fs/bcachefs/super.c:668 kobject_cleanup lib/kobject.c:689 [inline] kobject_release lib/kobject.c:720 [inline] kref_put include/linux/kref.h:65 [inline] kobject_put+0x22b/0x480 lib/kobject.c:737 deactivate_locked_super+0xb9/0x130 fs/super.c:474 cleanup_mnt+0x425/0x4c0 fs/namespace.c:1417 task_work_run+0x1d1/0x260 kernel/task_work.c:227 resume_user_mode_work include/linux/resume_user_mode.h:50 [inline] exit_to_user_mode_loop+0xec/0x110 kernel/entry/common.c:114 exit_to_user_mode_prepare include/linux/entry-common.h:330 [inline] syscall_exit_to_user_mode_work include/linux/entry-common.h:414 [inline] syscall_exit_to_user_mode include/linux/entry-common.h:449 [inline] do_syscall_64+0x2bd/0x3b0 arch/x86/entry/syscall_64.c:100 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff8880514a9b00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880514a9b80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff8880514a9c00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff8880514a9c80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff8880514a9d00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================