u64s 13 type alloc_v4 0:34:0 len 0 ver 0: gen 0 oldest_gen 0 data_type user journal_seq_nonempty 5 journal_seq_empty 134217728 need_discard 1 need_inc_gen 1 dirty_sectors 8 stripe_sectors 0 cached_sectors 0 stripe 0 stripe_redundancy 0 io_time[READ] 1 io_time[WRITE] 512 fragmentation 67108864 bp_start 8 , fixing done bcachefs (loop0): bucket_gens_init... done bcachefs (loop0): check_snapshot_trees... done bcachefs (loop0): check_snapshots... snapshot points to missing/incorrect tree: u64s 8 type snapshot 0:4294967295:0 len 0 ver 0: is_subvol 1 deleted 0 parent 0 children 0 0 subvol 1 tree 0, fixing snapshot points to missing/incorrect tree: u64s 8 type snapshot 0:4294967295:0 len 0 ver 0: is_subvol 1 deleted 0 parent 0 children 0 0 subvol 1 tree 0, fixing done bcachefs (loop0): check_subvols... done bcachefs (loop0): check_subvol_children... done bcachefs (loop0): delete_dead_snapshots... done bcachefs (loop0): check_inodes... done bcachefs (loop0): check_extents... done bcachefs (loop0): check_indirect_extents... done bcachefs (loop0): check_dirents... dirent points to missing inode: u64s 7 type dirent 4096:189491840996961599:U32_MAX len 0 ver 0: file0 -> 4098 type dir, shutting down bcachefs (loop0): inconsistency detected - emergency read only at journal seq 23 bcachefs (loop0): check_dirent(): error fsck_errors_not_fixed bcachefs (loop0): bch2_check_dirents(): error fsck_errors_not_fixed bcachefs (loop0): bch2_fs_recovery(): error fsck_errors_not_fixed bcachefs (loop0): bch2_fs_start(): error starting filesystem fsck_errors_not_fixed bcachefs (loop0): shutting down bcachefs (loop0): shutdown complete bcachefs: bch2_fs_get_tree() error: fsck_errors_not_fixed 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,metadata_target=/dev/loop0,noinodes_use_key_cache,nojournal_transaction_names bcachefs (loop0): recovering from clean shutdown, journal seq 13 bcachefs (loop0): Version upgrade required: Version upgrade from 0.32: (unknown version) to 1.7: mi_btree_bitmap incomplete Doing incompatible version upgrade from 0.32: (unknown version) to 1.20: directory_size running recovery passes: check_allocations,check_extents_to_backpointers,check_snapshots,check_subvols,check_inodes,check_dirents,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 ffff888052bbef90 by task syz.0.0/5318 CPU: 0 UID: 0 PID: 5318 Comm: syz.0.0 Not tainted 6.13.0-syzkaller-09760-g69e858e0b8b2 #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:378 [inline] print_report+0x169/0x550 mm/kasan/report.c:489 kasan_report+0x143/0x180 mm/kasan/report.c:602 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:239 bch2_btree_node_read_done+0x145e/0x5f70 fs/bcachefs/btree_io.c:1100 btree_node_read_work+0x6dc/0x1380 fs/bcachefs/btree_io.c:1358 bch2_btree_node_read+0x2433/0x29f0 __bch2_btree_root_read fs/bcachefs/btree_io.c:1789 [inline] bch2_btree_root_read+0x617/0x7a0 fs/bcachefs/btree_io.c:1811 read_btree_roots+0x3d3/0xa70 fs/bcachefs/recovery.c:582 bch2_fs_recovery+0x260f/0x3de0 fs/bcachefs/recovery.c:929 bch2_fs_start+0x37c/0x610 fs/bcachefs/super.c:1030 bch2_fs_get_tree+0xd8d/0x1740 fs/bcachefs/fs.c:2203 vfs_get_tree+0x90/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:0x7fa7a098e54a 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:00007fa7a180de68 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007fa7a180def0 RCX: 00007fa7a098e54a RDX: 000000002000f640 RSI: 000000002000f680 RDI: 00007fa7a180deb0 RBP: 000000002000f640 R08: 00007fa7a180def0 R09: 0000000000000400 R10: 0000000000000400 R11: 0000000000000246 R12: 000000002000f680 R13: 00007fa7a180deb0 R14: 000000000000f640 R15: 0000000020000000 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x52bbe flags: 0x4fff00000000000(node=1|zone=1|lastcpupid=0x7ff) raw: 04fff00000000000 0000000000000000 ffffea00014aef88 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 5318, tgid 5317 (syz.0.0), ts 58081390831, free_ts 58299069734 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:4739 __alloc_pages_noprof+0xa/0x30 mm/page_alloc.c:4773 __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:662 btree_node_data_alloc+0xdb/0x260 fs/bcachefs/btree_cache.c:156 __bch2_btree_node_mem_alloc+0x1d8/0x3e0 fs/bcachefs/btree_cache.c:201 bch2_fs_btree_cache_init+0x27a/0x630 fs/bcachefs/btree_cache.c:655 bch2_fs_alloc fs/bcachefs/super.c:908 [inline] bch2_fs_open+0x2890/0x2d50 fs/bcachefs/super.c:2053 bch2_fs_get_tree+0x738/0x1740 fs/bcachefs/fs.c:2190 vfs_get_tree+0x90/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 page last free pid 5318 tgid 5317 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] __free_pages_ok+0xbbf/0xe40 mm/page_alloc.c:1271 __folio_put+0x2b3/0x360 mm/swap.c:112 folio_put include/linux/mm.h:1489 [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] bch2_btree_node_read_done+0x3b1f/0x5f70 fs/bcachefs/btree_io.c:1243 btree_node_read_work+0x6dc/0x1380 fs/bcachefs/btree_io.c:1358 bch2_btree_node_read+0x2433/0x29f0 __bch2_btree_root_read fs/bcachefs/btree_io.c:1789 [inline] bch2_btree_root_read+0x617/0x7a0 fs/bcachefs/btree_io.c:1811 read_btree_roots+0x3d3/0xa70 fs/bcachefs/recovery.c:582 bch2_fs_recovery+0x260f/0x3de0 fs/bcachefs/recovery.c:929 bch2_fs_start+0x37c/0x610 fs/bcachefs/super.c:1030 bch2_fs_get_tree+0xd8d/0x1740 fs/bcachefs/fs.c:2203 vfs_get_tree+0x90/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 Memory state around the buggy address: ffff888052bbee80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888052bbef00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff >ffff888052bbef80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff888052bbf000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff888052bbf080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================