loop0: detected capacity change from 0 to 32768 bcachefs (/dev/loop0): error validating superblock: Invalid superblock section crypt: bad kdf type 8 crypt (size 152): KFD: 8 scrypt n: 13058 scrypt r: 34750 scrypt p: 41954 bcachefs: bch2_fs_get_tree() error: invalid_sb_crypt loop0: detected capacity change from 0 to 32768 ======================================================= WARNING: The mand mount option has been deprecated and and is ignored by this kernel. Remove the mand option from the mount to silence this warning. ======================================================= bcachefs (da441363-bb6a-4ab9-999b-c1f40db4fee2): Using encoding defined by superblock: utf8-12.1.0 bcachefs (loop0): starting version 1.7: mi_btree_bitmap opts=errors=continue,metadata_checksum=none,data_checksum=none,compression=lz4,str_hash=crc64,fsck,nojournal_transaction_names,no_data_io allowing incompatible features above 0.0: (unknown version) bcachefs (loop0): recovering from clean shutdown, journal seq 10 bcachefs (loop0): Version upgrade required: Version upgrade from 0.24: unwritten_extents to 1.7: mi_btree_bitmap incomplete Doing incompatible version upgrade from 0.24: unwritten_extents to 1.25: extent_flags running recovery passes: check_allocations,check_alloc_info,check_lrus,check_btree_backpointers,check_backpointers_to_extents,check_extents_to_backpointers,check_alloc_to_lru_refs,bucket_gens_init,check_snapshot_trees,check_snapshots,check_subvols,check_subvol_children,delete_dead_snapshots,check_inodes,check_extents,check_indirect_extents,check_dirents,check_xattrs,check_root,check_unreachable_inodes,check_subvolume_structure,check_directory_structure,check_nlinks,set_fs_needs_rebalance bcachefs (loop0): bcachefs (loop0): error validating btree node at btree inodes level 0/0 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 648518346341351424: seq 7589ab5e0c11cc7a written 24 min_key POS_MIN durability: 1 ptr: 0:38:0 gen 0 node offset 16/24 bset u64s 110 bset byte offset 448: bad k->u64s 0 (min 3 max 253), exiting Unable to continue, halting bcachefs (loop0): flagging btree inodes lost data bcachefs (loop0): running explicit recovery pass check_topology (2), currently at recovery_pass_empty (0) bcachefs (loop0): running explicit recovery pass scan_for_btree_nodes (1), currently at recovery_pass_empty (0) bcachefs (loop0): error reading btree root btree=inodes level=0: btree_node_read_error, fixing bcachefs (loop0): bcachefs (loop0): error validating btree node on loop0 at btree dirents level 0/0 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 9aa2895aefce4bdf written 24 min_key POS_MIN durability: 1 ptr: 0:41:0 gen 0 node offset 0/24 bset u64s 0: incorrect max key U64_MAX:2251799813685247:U32_MAX, btree topology error: bcachefs (loop0): flagging btree dirents lost data bcachefs (loop0): error reading btree root btree=dirents level=0: btree_node_read_error, fixing bcachefs (loop0): bcachefs (loop0): error validating btree node on loop0 at btree alloc level 0/0 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq ac62141f8dc7e261 written 24 min_key POS_MIN durability: 1 ptr: 0:26:0 gen 0 node offset 8/24: btree node data missing: expected 24 sectors, found 8, fixing bcachefs (loop0): btree_node_read_work: rewriting btree node at due to error btree=alloc level=0 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq ac62141f8dc7e261 written 24 min_key POS_MIN durability: 1 ptr: 0:26:0 gen 0 ================================================================== BUG: KASAN: use-after-free in bch2_btree_node_read_done+0xd31/0x5470 fs/bcachefs/btree_io.c:1086 Read of size 8 at addr ffff888044264010 by task syz.0.0/5314 CPU: 0 UID: 0 PID: 5314 Comm: syz.0.0 Not tainted 6.15.0-rc7-syzkaller-00099-g94305e83eccb #0 PREEMPT(full) Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:408 [inline] print_report+0xb4/0x290 mm/kasan/report.c:521 kasan_report+0x118/0x150 mm/kasan/report.c:634 bch2_btree_node_read_done+0xd31/0x5470 fs/bcachefs/btree_io.c:1086 btree_node_read_work+0x565/0xef0 fs/bcachefs/btree_io.c:1367 bch2_btree_node_read+0x2151/0x27a0 fs/bcachefs/btree_io.c:-1 __bch2_btree_root_read fs/bcachefs/btree_io.c:1801 [inline] bch2_btree_root_read+0x5e7/0x750 fs/bcachefs/btree_io.c:1823 read_btree_roots+0x2cb/0x800 fs/bcachefs/recovery.c:582 bch2_fs_recovery+0x2356/0x37b0 fs/bcachefs/recovery.c:929 bch2_fs_start+0x70b/0xae0 fs/bcachefs/super.c:1096 bch2_fs_get_tree+0xad7/0x13b0 fs/bcachefs/fs.c:2507 vfs_get_tree+0x8f/0x2b0 fs/super.c:1759 do_new_mount+0x24a/0xa40 fs/namespace.c:3881 do_mount fs/namespace.c:4221 [inline] __do_sys_mount fs/namespace.c:4432 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4409 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7fcaacf9010a 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:00007fcaaddbae68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fcaaddbaef0 RCX: 00007fcaacf9010a RDX: 0000200000000040 RSI: 0000200000000080 RDI: 00007fcaaddbaeb0 RBP: 0000200000000040 R08: 00007fcaaddbaef0 R09: 0000000000804450 R10: 0000000000804450 R11: 0000000000000246 R12: 0000200000000080 R13: 00007fcaaddbaeb0 R14: 00000000000059b7 R15: 00002000000000c0 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x44264 flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000000000 ffffea0001109a08 ffff88801fe3f920 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 Reclaimable, gfp_mask 0x452cd0(GFP_KERNEL_ACCOUNT|__GFP_RECLAIMABLE|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP), pid 5314, tgid 5313 (syz.0.0), ts 74903526200, free_ts 75211587837 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1d8/0x230 mm/page_alloc.c:1714 prep_new_page mm/page_alloc.c:1722 [inline] get_page_from_freelist+0x21ce/0x22b0 mm/page_alloc.c:3684 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4966 __alloc_pages_noprof+0xa/0x30 mm/page_alloc.c:5000 __alloc_pages_node_noprof include/linux/gfp.h:284 [inline] alloc_pages_node_noprof include/linux/gfp.h:311 [inline] ___kmalloc_large_node+0x85/0x200 mm/slub.c:4271 __kmalloc_large_node_noprof+0x18/0x90 mm/slub.c:4299 __do_kmalloc_node mm/slub.c:4315 [inline] __kvmalloc_node_noprof+0x74/0x5e0 mm/slub.c:5012 btree_node_data_alloc+0xd5/0x260 fs/bcachefs/btree_cache.c:156 __bch2_btree_node_mem_alloc+0x1ed/0x410 fs/bcachefs/btree_cache.c:201 bch2_fs_btree_cache_init+0x2c9/0x680 fs/bcachefs/btree_cache.c:656 bch2_fs_alloc fs/bcachefs/super.c:914 [inline] bch2_fs_open+0x235e/0x2820 fs/bcachefs/super.c:2210 bch2_fs_get_tree+0x45d/0x13b0 fs/bcachefs/fs.c:2491 vfs_get_tree+0x8f/0x2b0 fs/super.c:1759 do_new_mount+0x24a/0xa40 fs/namespace.c:3881 do_mount fs/namespace.c:4221 [inline] __do_sys_mount fs/namespace.c:4432 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4409 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94 page last free pid 5314 tgid 5313 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1258 [inline] __free_frozen_pages+0xb0e/0xcd0 mm/page_alloc.c:2721 __folio_put+0x21b/0x2c0 mm/swap.c:112 folio_put include/linux/mm.h:1580 [inline] free_large_kmalloc+0x145/0x200 mm/slub.c:4767 btree_bounce_free fs/bcachefs/btree_io.c:113 [inline] bch2_btree_node_read_done+0x3450/0x5470 fs/bcachefs/btree_io.c:1246 btree_node_read_work+0x565/0xef0 fs/bcachefs/btree_io.c:1367 bch2_btree_node_read+0x2151/0x27a0 fs/bcachefs/btree_io.c:-1 __bch2_btree_root_read fs/bcachefs/btree_io.c:1801 [inline] bch2_btree_root_read+0x5e7/0x750 fs/bcachefs/btree_io.c:1823 read_btree_roots+0x2cb/0x800 fs/bcachefs/recovery.c:582 bch2_fs_recovery+0x2356/0x37b0 fs/bcachefs/recovery.c:929 bch2_fs_start+0x70b/0xae0 fs/bcachefs/super.c:1096 bch2_fs_get_tree+0xad7/0x13b0 fs/bcachefs/fs.c:2507 vfs_get_tree+0x8f/0x2b0 fs/super.c:1759 do_new_mount+0x24a/0xa40 fs/namespace.c:3881 do_mount fs/namespace.c:4221 [inline] __do_sys_mount fs/namespace.c:4432 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4409 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xf6/0x210 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff888044263f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888044263f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888044264000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888044264080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888044264100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================