u64s 7 type inline_data 536870912:8:U32_MAX len 8 ver 0: datalen 16: 73797a6b616c6c657273000000000000, fixing key in missing inode: 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:54 [inline] BUG: KASAN: use-after-free in extent_entry_is_crc fs/bcachefs/extents.h:121 [inline] BUG: KASAN: use-after-free in check_extent_overbig+0x27b/0x7d0 fs/bcachefs/fsck.c:1630 Read of size 8 at addr ffff888067000188 by task syz.2.26/7281 CPU: 0 UID: 0 PID: 7281 Comm: syz.2.26 Not tainted 6.12.0-rc1-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x231/0x330 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:377 [inline] print_report+0x169/0x550 mm/kasan/report.c:488 kasan_report+0x143/0x180 mm/kasan/report.c:601 __extent_entry_type fs/bcachefs/extents.h:54 [inline] extent_entry_is_crc fs/bcachefs/extents.h:121 [inline] check_extent_overbig+0x27b/0x7d0 fs/bcachefs/fsck.c:1630 bch2_check_extents+0x9e0/0x7c20 fs/bcachefs/fsck.c:1764 bch2_run_recovery_pass fs/bcachefs/recovery_passes.c:185 [inline] bch2_run_recovery_passes+0x536/0x8a0 fs/bcachefs/recovery_passes.c:232 bch2_fs_recovery+0x55c8/0x7980 fs/bcachefs/recovery.c:861 bch2_fs_start+0x356/0x5b0 fs/bcachefs/super.c:1037 bch2_fs_get_tree+0xd68/0x1710 fs/bcachefs/fs.c:2080 vfs_get_tree+0x91/0x1e0 fs/super.c:1800 do_new_mount+0x2be/0xb40 fs/namespace.c:3507 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4055 [inline] __se_sys_mount+0x2c5/0x3b0 fs/namespace.c:4032 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0x8d/0x190 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7f650bb816ba 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:00007f650c96be88 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f650c96bf10 RCX: 00007f650bb816ba RDX: 00000000200000c0 RSI: 0000000020000000 RDI: 00007f650c96bed0 RBP: 00000000200000c0 R08: 00007f650c96bf10 R09: 0000000000800000 R10: 0000000000800000 R11: 0000000000000246 R12: 0000000020000000 R13: 00007f650c96bed0 R14: 0000000000005991 R15: 0000000020006a00 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x67000 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f0(buddy) raw: 00fff00000000000 ffffea0001a6e008 ffff88813fffc888 0000000000000000 raw: 0000000000000000 0000000000000005 00000000f0000000 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as freed page last allocated via order 5, migratetype Unmovable, gfp_mask 0x52800(GFP_NOWAIT|__GFP_NORETRY|__GFP_COMP), pid 7281, tgid 7280 (syz.2.26), ts 122961984547, free_ts 125160673071 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x10f/0x130 mm/page_alloc.c:1537 prep_new_page mm/page_alloc.c:1545 [inline] get_page_from_freelist+0x2d66/0x2eb0 mm/page_alloc.c:3457 __alloc_pages_noprof+0x256/0x670 mm/page_alloc.c:4733 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] ___kmalloc_large_node+0x8a/0x180 mm/slub.c:4210 __kmalloc_large_node_noprof+0x17/0xc0 mm/slub.c:4237 __do_kmalloc_node mm/slub.c:4253 [inline] __kmalloc_node_noprof+0x2ec/0x470 mm/slub.c:4271 __kvmalloc_node_noprof+0x72/0x160 mm/util.c:658 btree_bounce_alloc fs/bcachefs/btree_io.c:124 [inline] bch2_btree_node_read_done+0x3480/0x5870 fs/bcachefs/btree_io.c:1192 btree_node_read_work+0x6e4/0x1340 fs/bcachefs/btree_io.c:1327 bch2_btree_node_read+0x224f/0x2e20 fs/bcachefs/btree_io.c:1712 __bch2_btree_root_read fs/bcachefs/btree_io.c:1753 [inline] bch2_btree_root_read+0x617/0x7a0 fs/bcachefs/btree_io.c:1775 read_btree_roots+0x241/0x7a0 fs/bcachefs/recovery.c:523 bch2_fs_recovery+0x5577/0x7980 fs/bcachefs/recovery.c:853 bch2_fs_start+0x356/0x5b0 fs/bcachefs/super.c:1037 bch2_fs_get_tree+0xd68/0x1710 fs/bcachefs/fs.c:2080 vfs_get_tree+0x91/0x1e0 fs/super.c:1800 page last free pid 7281 tgid 7280 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1108 [inline] __free_pages_ok+0x87e/0xa10 mm/page_alloc.c:1250 __folio_put+0x2c7/0x440 mm/swap.c:126 folio_put include/linux/mm.h:1478 [inline] free_large_kmalloc+0xb5/0x170 mm/slub.c:4699 kfree+0x1f9/0x3e0 mm/slub.c:4722 btree_bounce_free fs/bcachefs/btree_io.c:112 [inline] btree_node_sort+0x14ca/0x1980 fs/bcachefs/btree_io.c:380 bch2_btree_post_write_cleanup+0x116/0x980 fs/bcachefs/btree_io.c:2251 bch2_btree_node_prep_for_write+0x275/0x490 fs/bcachefs/btree_trans_commit.c:93 bch2_trans_lock_write+0x579/0x950 fs/bcachefs/btree_trans_commit.c:129 do_bch2_trans_commit fs/bcachefs/btree_trans_commit.c:896 [inline] __bch2_trans_commit+0x2a94/0x9470 fs/bcachefs/btree_trans_commit.c:1121 bch2_trans_commit fs/bcachefs/btree_update.h:184 [inline] check_extent fs/bcachefs/fsck.c:1721 [inline] bch2_check_extents+0x5b4c/0x7c20 fs/bcachefs/fsck.c:1764 bch2_run_recovery_pass fs/bcachefs/recovery_passes.c:185 [inline] bch2_run_recovery_passes+0x536/0x8a0 fs/bcachefs/recovery_passes.c:232 bch2_fs_recovery+0x55c8/0x7980 fs/bcachefs/recovery.c:861 bch2_fs_start+0x356/0x5b0 fs/bcachefs/super.c:1037 bch2_fs_get_tree+0xd68/0x1710 fs/bcachefs/fs.c:2080 vfs_get_tree+0x91/0x1e0 fs/super.c:1800 do_new_mount+0x2be/0xb40 fs/namespace.c:3507 Memory state around the buggy address: ffff888067000080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888067000100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888067000180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888067000200: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888067000280: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================