u64s 7 type extent 536870913:24:U32_MAX len 24 ver 0: durability: 1 crc: c_size 8 size 24 offset 0 nonce 0 csum none 0:0 compress lz4 ptr: 0:34:8 gen 0, fixing ================================================================== BUG: KASAN: use-after-free in __extent_entry_type fs/bcachefs/extents.h:53 [inline] BUG: KASAN: use-after-free in extent_entry_is_crc fs/bcachefs/extents.h:120 [inline] BUG: KASAN: use-after-free in check_extent_overbig+0x27b/0x7d0 fs/bcachefs/fsck.c:1773 Read of size 8 at addr ffff888052ae4188 by task syz.5.1103/10535 CPU: 1 UID: 0 PID: 10535 Comm: syz.5.1103 Not tainted 6.14.0-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 Call Trace: <TASK> __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0x16e/0x5b0 mm/kasan/report.c:521 kasan_report+0x143/0x180 mm/kasan/report.c:634 __extent_entry_type fs/bcachefs/extents.h:53 [inline] extent_entry_is_crc fs/bcachefs/extents.h:120 [inline] check_extent_overbig+0x27b/0x7d0 fs/bcachefs/fsck.c:1773 bch2_check_extents+0x9f1/0x6170 fs/bcachefs/fsck.c:1906 bch2_run_recovery_pass+0xf2/0x1e0 fs/bcachefs/recovery_passes.c:226 bch2_run_recovery_passes+0x2ad/0xa90 fs/bcachefs/recovery_passes.c:291 bch2_fs_recovery+0x265a/0x3de0 fs/bcachefs/recovery.c:936 bch2_fs_start+0x37c/0x610 fs/bcachefs/super.c:1041 bch2_fs_get_tree+0xdb7/0x17a0 fs/bcachefs/fs.c:2203 vfs_get_tree+0x92/0x2b0 fs/super.c:1814 do_new_mount+0x2be/0xb40 fs/namespace.c:3560 do_mount fs/namespace.c:3900 [inline] __do_sys_mount fs/namespace.c:4111 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4088 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f46d618e90a Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 1a 00 00 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 49 89 ca b8 a5 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:00007f46d6fc6e68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f46d6fc6ef0 RCX: 00007f46d618e90a RDX: 0000200000000000 RSI: 0000200000000180 RDI: 00007f46d6fc6eb0 RBP: 0000200000000000 R08: 00007f46d6fc6ef0 R09: 0000000000000c58 R10: 0000000000000c58 R11: 0000000000000246 R12: 0000200000000180 R13: 00007f46d6fc6eb0 R14: 0000000000005a3a R15: 00002000000001c0 </TASK> The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x52ae4 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000000000 ffff8880b8744a80 ffff8880b8744a80 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 2, migratetype Unmovable, gfp_mask 0x52800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP), pid 11, tgid 11 (kworker/0:0H), ts 614514786870, free_ts 640573136548 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f4/0x240 mm/page_alloc.c:1551 prep_new_page mm/page_alloc.c:1559 [inline] get_page_from_freelist+0x365c/0x37a0 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x292/0x710 mm/page_alloc.c:4740 __alloc_pages_noprof+0xa/0x30 mm/page_alloc.c:4774 __alloc_pages_node_noprof include/linux/gfp.h:265 [inline] alloc_pages_node_noprof include/linux/gfp.h:292 [inline] ___kmalloc_large_node+0x8b/0x1d0 mm/slub.c:4239 __kmalloc_large_node_noprof+0x1a/0x80 mm/slub.c:4266 __do_kmalloc_node mm/slub.c:4282 [inline] __kmalloc_node_noprof+0x33a/0x4d0 mm/slub.c:4300 __kvmalloc_node_noprof+0x72/0x190 mm/util.c:665 btree_bounce_alloc fs/bcachefs/btree_io.c:123 [inline] bch2_btree_node_read_done+0x3931/0x6270 fs/bcachefs/btree_io.c:1222 btree_node_read_work+0x6dc/0x1380 fs/bcachefs/btree_io.c:1358 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xac0/0x18e0 kernel/workqueue.c:3319 worker_thread+0x870/0xd30 kernel/workqueue.c:3400 kthread+0x7ab/0x920 kernel/kthread.c:464 ret_from_fork+0x4d/0x80 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 page last free pid 10535 tgid 10534 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_frozen_pages+0xe0d/0x10e0 mm/page_alloc.c:2660 __folio_put+0x2b3/0x360 mm/swap.c:112 folio_put include/linux/mm.h:1492 [inline] free_large_kmalloc+0xfe/0x180 mm/slub.c:4728 kfree+0x212/0x430 mm/slub.c:4751 btree_bounce_free fs/bcachefs/btree_io.c:111 [inline] btree_node_sort+0x1100/0x1830 fs/bcachefs/btree_io.c:379 bch2_btree_post_write_cleanup+0x11a/0xa70 fs/bcachefs/btree_io.c:2293 bch2_btree_node_prep_for_write+0x345/0x660 fs/bcachefs/btree_trans_commit.c:93 bch2_trans_lock_write+0x68e/0xc60 fs/bcachefs/btree_trans_commit.c:129 do_bch2_trans_commit fs/bcachefs/btree_trans_commit.c:862 [inline] __bch2_trans_commit+0x258c/0x9790 fs/bcachefs/btree_trans_commit.c:1070 bch2_trans_commit fs/bcachefs/btree_update.h:191 [inline] check_extent fs/bcachefs/fsck.c:1863 [inline] bch2_check_extents+0x41a7/0x6170 fs/bcachefs/fsck.c:1906 bch2_run_recovery_pass+0xf2/0x1e0 fs/bcachefs/recovery_passes.c:226 bch2_run_recovery_passes+0x2ad/0xa90 fs/bcachefs/recovery_passes.c:291 bch2_fs_recovery+0x265a/0x3de0 fs/bcachefs/recovery.c:936 bch2_fs_start+0x37c/0x610 fs/bcachefs/super.c:1041 bch2_fs_get_tree+0xdb7/0x17a0 fs/bcachefs/fs.c:2203 vfs_get_tree+0x92/0x2b0 fs/super.c:1814 Memory state around the buggy address: ffff888052ae4080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888052ae4100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888052ae4180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888052ae4200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888052ae4280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================