node offset 8/40 bset u64s 375: checksum error, type chacha20_poly1305_128: got eb21ae8bf0ac3fa53472f8290f6e6780 should be 61ec379a8789477e76ff1a5280fd6dbd, fixing ================================================================== BUG: KASAN: slab-out-of-bounds in poly1305_update include/crypto/poly1305.h:83 [inline] BUG: KASAN: slab-out-of-bounds in bch2_checksum+0x209/0x490 fs/bcachefs/checksum.c:157 Read of size 8 at addr ffff888055e55af0 by task syz-executor116/5434 CPU: 0 UID: 0 PID: 5434 Comm: syz-executor116 Not tainted 6.15.0-rc5-syzkaller-00043-gd76bb1ebb558 #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 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x29a/0x2b0 mm/kasan/generic.c:189 __asan_memcpy+0x29/0x70 mm/kasan/shadow.c:105 poly1305_update include/crypto/poly1305.h:83 [inline] bch2_checksum+0x209/0x490 fs/bcachefs/checksum.c:157 bch2_btree_node_read_done+0x1003/0x5470 fs/bcachefs/btree_io.c:1132 btree_node_read_work+0x565/0xef0 fs/bcachefs/btree_io.c:1366 bch2_btree_node_read+0x2151/0x27a0 fs/bcachefs/btree_io.c:-1 __bch2_btree_root_read fs/bcachefs/btree_io.c:1797 [inline] bch2_btree_root_read+0x5e7/0x750 fs/bcachefs/btree_io.c:1819 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:1091 bch2_fs_get_tree+0xd99/0x13a0 fs/bcachefs/fs.c:2570 vfs_get_tree+0x8f/0x2b0 fs/super.c:1759 do_new_mount+0x24a/0xa40 fs/namespace.c:3884 do_mount fs/namespace.c:4224 [inline] __do_sys_mount fs/namespace.c:4435 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4412 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:0x7f42d81f79aa Code: d8 64 89 02 48 c7 c0 ff ff ff ff eb a6 e8 7e 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:00007f42d7999fd8 EFLAGS: 00000282 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 00007f42d7999ff0 RCX: 00007f42d81f79aa RDX: 000020000000f640 RSI: 0000200000000080 RDI: 00007f42d7999ff0 RBP: 0000200000000080 R08: 00007f42d799a030 R09: 000000000000f5fe R10: 0000000000010000 R11: 0000000000000282 R12: 000020000000f640 R13: 00007f42d799a030 R14: 0000000000000003 R15: 0000000000010000 The buggy address belongs to the object at ffff888055e55928 which belongs to the cache ext4_inode_cache of size 2408 The buggy address is located 456 bytes inside of allocated 2408-byte region [ffff888055e55928, ffff888055e56290) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x55e50 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff88805306dc01 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff888032ff8a00 dead000000000122 0000000000000000 raw: 0000000000000000 00000000800c000c 00000000f5000000 ffff88805306dc01 head: 04fff00000000040 ffff888032ff8a00 dead000000000122 0000000000000000 head: 0000000000000000 00000000800c000c 00000000f5000000 ffff88805306dc01 head: 04fff00000000003 ffffea0001579401 00000000ffffffff 00000000ffffffff head: ffffffffffffffff 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd2050(__GFP_RECLAIMABLE|__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5315, tgid 5315 (syz-executor116), ts 90636846285, free_ts 90512770751 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1d8/0x230 mm/page_alloc.c:1718 prep_new_page mm/page_alloc.c:1726 [inline] get_page_from_freelist+0x21ce/0x22b0 mm/page_alloc.c:3688 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4970 alloc_pages_mpol+0x232/0x4a0 mm/mempolicy.c:2301 alloc_slab_page mm/slub.c:2450 [inline] allocate_slab+0x8a/0x3b0 mm/slub.c:2618 new_slab mm/slub.c:2672 [inline] ___slab_alloc+0xbfc/0x1480 mm/slub.c:3858 __slab_alloc mm/slub.c:3948 [inline] __slab_alloc_node mm/slub.c:4023 [inline] slab_alloc_node mm/slub.c:4184 [inline] kmem_cache_alloc_lru_noprof+0x288/0x3d0 mm/slub.c:4215 ext4_alloc_inode+0x2e/0x530 fs/ext4/super.c:1388 alloc_inode+0x67/0x1b0 fs/inode.c:346 new_inode+0x22/0x170 fs/inode.c:1145 __ext4_new_inode+0x323/0x3bd0 fs/ext4/ialloc.c:961 ext4_mkdir+0x3cb/0xc50 fs/ext4/namei.c:3007 vfs_mkdir+0x303/0x510 fs/namei.c:4359 do_mkdirat+0x247/0x590 fs/namei.c:4392 __do_sys_mkdir fs/namei.c:4414 [inline] __se_sys_mkdir fs/namei.c:4412 [inline] __x64_sys_mkdir+0x6c/0x80 fs/namei.c:4412 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 5434 tgid 5433 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1262 [inline] __free_pages_ok+0x916/0xac0 mm/page_alloc.c:1438 __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:112 [inline] bch2_btree_node_read_done+0x3450/0x5470 fs/bcachefs/btree_io.c:1245 btree_node_read_work+0x565/0xef0 fs/bcachefs/btree_io.c:1366 bch2_btree_node_read+0x2151/0x27a0 fs/bcachefs/btree_io.c:-1 __bch2_btree_root_read fs/bcachefs/btree_io.c:1797 [inline] bch2_btree_root_read+0x5e7/0x750 fs/bcachefs/btree_io.c:1819 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:1091 bch2_fs_get_tree+0xd99/0x13a0 fs/bcachefs/fs.c:2570 vfs_get_tree+0x8f/0x2b0 fs/super.c:1759 do_new_mount+0x24a/0xa40 fs/namespace.c:3884 do_mount fs/namespace.c:4224 [inline] __do_sys_mount fs/namespace.c:4435 [inline] __se_sys_mount+0x317/0x410 fs/namespace.c:4412 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: ffff888055e55980: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888055e55a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc >ffff888055e55a80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff888055e55b00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888055e55b80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================