loop0: detected capacity change from 0 to 32768 bcachefs (loop0): starting version 1.7: mi_btree_bitmap opts=metadata_checksum=none,data_checksum=none,compression=lz4,nojournal_transaction_names invalid bkey u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 4e0410879b0c2f04 written 16 min_key POS_MIN durability: 1 ptr: 0:27:0 gen 0 size == 0: delete?, fixing bcachefs (loop0): recovering from clean shutdown, journal seq 13 bcachefs (loop0): Version upgrade required: Version upgrade from 0.19: freespace to 1.7: mi_btree_bitmap incomplete Doing incompatible version upgrade from 0.19: freespace to 1.13: inode_has_child_snapshots 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 ================================================================== BUG: KASAN: use-after-free in poly1305_update_arch+0x259/0x7d0 arch/x86/crypto/poly1305_glue.c:198 Read of size 8 at addr ffff888054660090 by task syz.0.0/5330 CPU: 0 UID: 0 PID: 5330 Comm: syz.0.0 Not tainted 6.12.0-syzkaller-08446-g228a1157fb9f #0 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 lib/dump_stack.c:94 [inline] dump_stack_lvl+0x241/0x360 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 kasan_check_range+0x282/0x290 mm/kasan/generic.c:189 __asan_memcpy+0x29/0x70 mm/kasan/shadow.c:105 poly1305_update_arch+0x259/0x7d0 arch/x86/crypto/poly1305_glue.c:198 crypto_poly1305_update+0x28/0x40 arch/x86/crypto/poly1305_glue.c:230 bch2_checksum+0x5e9/0x770 fs/bcachefs/checksum.c:238 bch2_btree_node_read_done+0x1995/0x5e90 fs/bcachefs/btree_io.c:1056 btree_node_read_work+0x68b/0x1260 fs/bcachefs/btree_io.c:1323 bch2_btree_node_read+0x2433/0x2a10 __bch2_btree_root_read fs/bcachefs/btree_io.c:1749 [inline] bch2_btree_root_read+0x617/0x7a0 fs/bcachefs/btree_io.c:1771 read_btree_roots+0x296/0x840 fs/bcachefs/recovery.c:523 bch2_fs_recovery+0x2585/0x39d0 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:2170 vfs_get_tree+0x90/0x2b0 fs/super.c:1814 do_new_mount+0x2be/0xb40 fs/namespace.c:3507 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4057 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4034 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:0x7fcc8d17ffba 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:00007fcc8decae68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fcc8decaef0 RCX: 00007fcc8d17ffba RDX: 000000002000f640 RSI: 000000002000f680 RDI: 00007fcc8decaeb0 RBP: 000000002000f640 R08: 00007fcc8decaef0 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000002000f680 R13: 00007fcc8decaeb0 R14: 000000000000f630 R15: 000000002000f6c0 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x54660 flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000000000 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 5, migratetype Reclaimable, gfp_mask 0x452cd0(GFP_KERNEL_ACCOUNT|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_RECLAIMABLE), pid 5330, tgid 5329 (syz.0.0), ts 68963702363, free_ts 69138250515 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1556 prep_new_page mm/page_alloc.c:1564 [inline] get_page_from_freelist+0x3649/0x3790 mm/page_alloc.c:3474 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4751 __alloc_pages_node_noprof include/linux/gfp.h:269 [inline] alloc_pages_node_noprof include/linux/gfp.h:296 [inline] ___kmalloc_large_node+0x8b/0x1d0 mm/slub.c:4209 __kmalloc_large_node_noprof+0x1a/0x80 mm/slub.c:4236 __do_kmalloc_node mm/slub.c:4252 [inline] __kmalloc_node_noprof+0x2d2/0x440 mm/slub.c:4270 __kvmalloc_node_noprof+0x72/0x190 mm/util.c:658 btree_node_data_alloc+0xdb/0x260 fs/bcachefs/btree_cache.c:153 __bch2_btree_node_mem_alloc+0x1d8/0x3e0 fs/bcachefs/btree_cache.c:198 bch2_fs_btree_cache_init+0x26f/0x630 fs/bcachefs/btree_cache.c:653 bch2_fs_alloc fs/bcachefs/super.c:917 [inline] bch2_fs_open+0x2aa4/0x2f80 fs/bcachefs/super.c:2065 bch2_fs_get_tree+0x738/0x1710 fs/bcachefs/fs.c:2157 vfs_get_tree+0x90/0x2b0 fs/super.c:1814 do_new_mount+0x2be/0xb40 fs/namespace.c:3507 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4057 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4034 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 page last free pid 5330 tgid 5329 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] __free_pages_ok+0xc99/0xf90 mm/page_alloc.c:1269 __folio_put+0x2c7/0x440 mm/swap.c:112 folio_put include/linux/mm.h:1490 [inline] free_large_kmalloc+0x105/0x1c0 mm/slub.c:4698 kfree+0x21c/0x440 mm/slub.c:4721 btree_bounce_free fs/bcachefs/btree_io.c:112 [inline] bch2_btree_node_read_done+0x3c8a/0x5e90 fs/bcachefs/btree_io.c:1209 btree_node_read_work+0x68b/0x1260 fs/bcachefs/btree_io.c:1323 bch2_btree_node_read+0x2433/0x2a10 __bch2_btree_root_read fs/bcachefs/btree_io.c:1749 [inline] bch2_btree_root_read+0x617/0x7a0 fs/bcachefs/btree_io.c:1771 read_btree_roots+0x296/0x840 fs/bcachefs/recovery.c:523 bch2_fs_recovery+0x2585/0x39d0 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:2170 vfs_get_tree+0x90/0x2b0 fs/super.c:1814 do_new_mount+0x2be/0xb40 fs/namespace.c:3507 do_mount fs/namespace.c:3847 [inline] __do_sys_mount fs/namespace.c:4057 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:4034 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 Memory state around the buggy address: ffff88805465ff80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888054660000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888054660080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888054660100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888054660180: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================