u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 7589ab5e0c11cc7a written 1040 min_key POS_MIN durability: 1 ptr: 0:38:0 gen 0 node offset 16/1040 bset u64s 65529 bset byte offset 792: keys out of order: u64s 18 type inode_v3 1536:536870913:U32_MAX len 0 ver 0 > u64s 18 type inode_v3 0:536870914:U32_MAX len 0 ver 0, fixing bcachefs (loop3): error validating btree node at btree inodes level 0/0 u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq 7589ab5e0c11cc7a written 1040 min_key POS_MIN durability: 1 ptr: 0:38:0 gen 0 node offset 16/1040 bset u64s 65518 bset byte offset 792: bad k->u64s 0 (min 3 max 253), fixing ================================================================== BUG: KASAN: slab-out-of-bounds in bkey_packed_valid+0x3a8/0x4b0 fs/bcachefs/btree_io.c:847 Read of size 1 at addr ffff88805a0c1000 by task kworker/0:1H/43 CPU: 0 UID: 0 PID: 43 Comm: kworker/0:1H Not tainted 6.13.0-rc3-syzkaller-00301-gbcde95ce32b6 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 Workqueue: bcachefs_btree_read_complete btree_node_read_work 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 bkey_packed_valid+0x3a8/0x4b0 fs/bcachefs/btree_io.c:847 validate_bset_keys+0x98d/0x1610 fs/bcachefs/btree_io.c:955 bch2_btree_node_read_done+0x2402/0x5e90 fs/bcachefs/btree_io.c:1130 btree_node_read_work+0x68b/0x1260 fs/bcachefs/btree_io.c:1323 process_one_work kernel/workqueue.c:3229 [inline] process_scheduled_works+0xa66/0x1840 kernel/workqueue.c:3310 worker_thread+0x870/0xd30 kernel/workqueue.c:3391 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The buggy address belongs to the object at ffff88805a0c0000 which belongs to the cache kmalloc-rcl-4k of size 4096 The buggy address is located 0 bytes to the right of allocated 4096-byte region [ffff88805a0c0000, ffff88805a0c1000) The buggy address belongs to the physical page: page: refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5a0c0 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff888064c76201 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801ac4c280 dead000000000122 0000000000000000 raw: 0000000000000000 0000000000040004 00000001f5000000 ffff888064c76201 head: 00fff00000000040 ffff88801ac4c280 dead000000000122 0000000000000000 head: 0000000000000000 0000000000040004 00000001f5000000 ffff888064c76201 head: 00fff00000000003 ffffea0001683001 ffffffffffffffff 0000000000000000 head: 0000000000000008 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Reclaimable, gfp_mask 0xd20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE), pid 6065, tgid 6064 (syz.3.19), ts 80089948634, free_ts 16189106356 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x1f3/0x230 mm/page_alloc.c:1558 prep_new_page mm/page_alloc.c:1566 [inline] get_page_from_freelist+0x3651/0x37a0 mm/page_alloc.c:3476 __alloc_pages_noprof+0x292/0x710 mm/page_alloc.c:4753 alloc_pages_mpol_noprof+0x3e8/0x680 mm/mempolicy.c:2269 alloc_slab_page+0x6a/0x110 mm/slub.c:2423 allocate_slab+0x5a/0x2b0 mm/slub.c:2589 new_slab mm/slub.c:2642 [inline] ___slab_alloc+0xc27/0x14a0 mm/slub.c:3830 __slab_alloc+0x58/0xa0 mm/slub.c:3920 __slab_alloc_node mm/slub.c:3995 [inline] slab_alloc_node mm/slub.c:4156 [inline] __do_kmalloc_node mm/slub.c:4297 [inline] __kmalloc_node_noprof+0x2ee/0x4d0 mm/slub.c:4304 __kvmalloc_node_noprof+0x72/0x190 mm/util.c:650 btree_node_data_alloc+0x15a/0x260 fs/bcachefs/btree_cache.c:157 __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 page last free pid 1 tgid 1 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_page+0xd2c/0x1000 mm/page_alloc.c:2659 free_contig_range+0x14c/0x430 mm/page_alloc.c:6632 destroy_args+0x92/0x910 mm/debug_vm_pgtable.c:1017 debug_vm_pgtable+0x4be/0x550 mm/debug_vm_pgtable.c:1397 do_one_initcall+0x248/0x870 init/main.c:1266 do_initcall_level+0x157/0x210 init/main.c:1328 do_initcalls+0x3f/0x80 init/main.c:1344 kernel_init_freeable+0x435/0x5d0 init/main.c:1577 kernel_init+0x1d/0x2b0 init/main.c:1466 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 Memory state around the buggy address: ffff88805a0c0f00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88805a0c0f80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88805a0c1000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff88805a0c1080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88805a0c1100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================