------------[ cut here ]------------ truncate spotted in mem i_size < btree i_size: 10 < 1048576 WARNING: CPU: 1 PID: 8511 at fs/bcachefs/fs-io.c:428 bchfs_truncate+0x998/0xa88 fs/bcachefs/fs-io.c:425 Modules linked in: CPU: 1 UID: 0 PID: 8511 Comm: syz.3.357 Not tainted 6.12.0-syzkaller-g7b1d1d4cfac0 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : bchfs_truncate+0x998/0xa88 fs/bcachefs/fs-io.c:425 lr : bchfs_truncate+0x998/0xa88 fs/bcachefs/fs-io.c:425 sp : ffff80009c1172e0 x29: ffff80009c117500 x28: ffff0000f6980000 x27: ffff0000dd6c8490 x26: ffff0000dd6c8498 x25: dfff800000000000 x24: ffff700013822e70 x23: 0000000000100000 x22: ffff0000dd6c8558 x21: 000000000000000a x20: ffff800092b74000 x19: ffff0000dd6c8000 x18: ffff80009c116b20 x17: 0000000000045da5 x16: ffff800080355c58 x15: 0000000000000001 x14: 1ffff0001203e08e x13: ffff80009c118000 x12: 0000000000000003 x11: 0000000000080000 x10: 0000000000000003 x9 : f9a621e09739f600 x8 : f9a621e09739f600 x7 : ffff80008005e120 x6 : ffff80008005e31c x5 : ffff0000f09b48a8 x4 : ffff80009c116c78 x3 : 0000000000000000 x2 : 0000000000000006 x1 : ffff80008b6c4000 x0 : ffff800123e21000 Call trace: bchfs_truncate+0x998/0xa88 fs/bcachefs/fs-io.c:425 (P) bchfs_truncate+0x998/0xa88 fs/bcachefs/fs-io.c:425 (L) bch2_setattr+0x1a0/0x214 fs/bcachefs/fs.c:1163 notify_change+0x9f0/0xca0 fs/attr.c:503 do_truncate+0x1c0/0x28c fs/open.c:65 handle_truncate fs/namei.c:3395 [inline] do_open fs/namei.c:3778 [inline] path_openat+0x2494/0x2b14 fs/namei.c:3933 do_filp_open+0x1bc/0x3cc fs/namei.c:3960 do_sys_openat2+0x124/0x1b8 fs/open.c:1415 do_sys_open fs/open.c:1430 [inline] __do_sys_openat fs/open.c:1446 [inline] __se_sys_openat fs/open.c:1441 [inline] __arm64_sys_openat+0x1f0/0x240 fs/open.c:1441 __invoke_syscall arch/arm64/kernel/syscall.c:35 [inline] invoke_syscall+0x98/0x2b8 arch/arm64/kernel/syscall.c:49 el0_svc_common+0x130/0x23c arch/arm64/kernel/syscall.c:132 do_el0_svc+0x48/0x58 arch/arm64/kernel/syscall.c:151 el0_svc+0x54/0x168 arch/arm64/kernel/entry-common.c:744 el0t_64_sync_handler+0x84/0x108 arch/arm64/kernel/entry-common.c:762 el0t_64_sync+0x198/0x19c arch/arm64/kernel/entry.S:600 irq event stamp: 162 hardirqs last enabled at (161): [] __call_rcu_common kernel/rcu/tree.c:3108 [inline] hardirqs last enabled at (161): [] call_rcu+0x640/0xb00 kernel/rcu/tree.c:3190 hardirqs last disabled at (162): [] el1_dbg+0x24/0x80 arch/arm64/kernel/entry-common.c:488 softirqs last enabled at (144): [] softirq_handle_end kernel/softirq.c:400 [inline] softirqs last enabled at (144): [] handle_softirqs+0xa38/0xbf8 kernel/softirq.c:582 softirqs last disabled at (135): [] __do_softirq+0x14/0x20 kernel/softirq.c:588 ---[ end trace 0000000000000000 ]---