bcachefs (loop0): recovering from clean shutdown, journal seq 13 bcachefs (loop0): Doing compatible version upgrade from 1.7: mi_btree_bitmap to 1.13: inode_has_child_snapshots running recovery passes: check_allocations,check_inodes ================================================================== BUG: KASAN: use-after-free in memcpy_dir crypto/scatterwalk.c:23 [inline] BUG: KASAN: use-after-free in scatterwalk_copychunks+0x1cc/0x460 crypto/scatterwalk.c:38 Read of size 32 at addr ffff88806aa80000 by task syz-executor.0/6195 CPU: 1 UID: 0 PID: 6195 Comm: syz-executor.0 Not tainted 6.12.0-rc6-next-20241108-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/30/2024 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 memcpy_dir crypto/scatterwalk.c:23 [inline] scatterwalk_copychunks+0x1cc/0x460 crypto/scatterwalk.c:38 skcipher_next_slow+0x39d/0x480 crypto/skcipher.c:276 skcipher_walk_next+0x634/0xba0 crypto/skcipher.c:361 chacha_simd_stream_xor+0x67f/0xd10 arch/x86/crypto/chacha_glue.c:192 do_encrypt_sg fs/bcachefs/checksum.c:108 [inline] do_encrypt+0x992/0xd70 fs/bcachefs/checksum.c:124 bset_encrypt fs/bcachefs/btree_io.h:118 [inline] bch2_btree_node_read_done+0x1d84/0x5e30 fs/bcachefs/btree_io.c:1073 btree_node_read_work+0x64e/0x11e0 fs/bcachefs/btree_io.c:1326 bch2_btree_node_read+0x2433/0x2a10 __bch2_btree_root_read fs/bcachefs/btree_io.c:1754 [inline] bch2_btree_root_read+0x617/0x7a0 fs/bcachefs/btree_io.c:1776 read_btree_roots+0x441/0xa80 fs/bcachefs/recovery.c:566 bch2_fs_recovery+0x2585/0x39b0 fs/bcachefs/recovery.c:885 bch2_fs_start+0x37c/0x610 fs/bcachefs/super.c:1037 bch2_fs_get_tree+0xd68/0x1710 fs/bcachefs/fs.c:2184 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:0x7f4611c7f3aa Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 de 09 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 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f46129a6ef8 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f46129a6f80 RCX: 00007f4611c7f3aa RDX: 000000002000f640 RSI: 000000002000f680 RDI: 00007f46129a6f40 RBP: 000000002000f640 R08: 00007f46129a6f80 R09: 0000000000010400 R10: 0000000000010400 R11: 0000000000000246 R12: 000000002000f680 R13: 00007f46129a6f40 R14: 000000000000f631 R15: 00000000200000c0 The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6aa80 flags: 0xfff00000000000(node=0|zone=1|lastcpupid=0x7ff) page_type: f0(buddy) raw: 00fff00000000000 ffff88813fffc0f8 ffff88813fffc0f8 0000000000000000 raw: 0000000000000000 0000000000000007 00000000f0000000 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 6195, tgid 6193 (syz-executor.0), ts 86797733225, free_ts 86929161608 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+0x3725/0x3870 mm/page_alloc.c:3510 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4786 __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:4228 __kmalloc_large_node_noprof+0x1a/0x80 mm/slub.c:4255 __do_kmalloc_node mm/slub.c:4271 [inline] __kmalloc_node_noprof+0x33a/0x4d0 mm/slub.c:4289 __kvmalloc_node_noprof+0x72/0x190 mm/util.c:650 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:916 [inline] bch2_fs_open+0x2a51/0x2f20 fs/bcachefs/super.c:2067 bch2_fs_get_tree+0x738/0x1710 fs/bcachefs/fs.c:2171 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 6195 tgid 6193 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:1488 [inline] free_large_kmalloc+0x105/0x1c0 mm/slub.c:4717 kfree+0x212/0x420 mm/slub.c:4740 btree_bounce_free fs/bcachefs/btree_io.c:111 [inline] bch2_btree_node_read_done+0x3bef/0x5e30 fs/bcachefs/btree_io.c:1212 btree_node_read_work+0x64e/0x11e0 fs/bcachefs/btree_io.c:1326 bch2_btree_node_read+0x2433/0x2a10 __bch2_btree_root_read fs/bcachefs/btree_io.c:1754 [inline] bch2_btree_root_read+0x617/0x7a0 fs/bcachefs/btree_io.c:1776 read_btree_roots+0x441/0xa80 fs/bcachefs/recovery.c:566 bch2_fs_recovery+0x2585/0x39b0 fs/bcachefs/recovery.c:885 bch2_fs_start+0x37c/0x610 fs/bcachefs/super.c:1037 bch2_fs_get_tree+0xd68/0x1710 fs/bcachefs/fs.c:2184 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: ffff88806aa7ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88806aa7ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88806aa80000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ^ ffff88806aa80080: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ffff88806aa80100: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ==================================================================