u64s 11 type btree_ptr_v2 SPOS_MAX len 0 ver 0: seq c6c25c03258c59c5 written 48 min_key 0:36028797018963968:0 durability: 1 ptr: 0:27:0 gen 0 node offset 8/48 bset u64s 2088 bset byte offset 360: bad k->u64s 0 (min 3 max 253), fixing ================================================================== BUG: KASAN: slab-use-after-free in bkey_packed_valid+0x488/0x6c0 fs/bcachefs/btree_io.c:865 Read of size 1 at addr ffff88806da40000 by task kworker/0:1H/40 CPU: 0 UID: 0 PID: 40 Comm: kworker/0:1H Not tainted 6.14.0-rc4-syzkaller-00295-gb91872c56940 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/12/2025 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:408 [inline] print_report+0x16e/0x5b0 mm/kasan/report.c:521 kasan_report+0x143/0x180 mm/kasan/report.c:634 bkey_packed_valid+0x488/0x6c0 fs/bcachefs/btree_io.c:865 validate_bset_keys+0xeb5/0x1af0 fs/bcachefs/btree_io.c:987 bch2_btree_node_read_done+0x2298/0x6180 fs/bcachefs/btree_io.c:1164 btree_node_read_work+0x6dc/0x1380 fs/bcachefs/btree_io.c:1358 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xabe/0x18e0 kernel/workqueue.c:3319 worker_thread+0x870/0xd30 kernel/workqueue.c:3400 kthread+0x7a9/0x920 kernel/kthread.c:464 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 The buggy address belongs to the object at ffff88806da40000 which belongs to the cache debugfs_inode_cache of size 1176 The buggy address is located 0 bytes inside of freed 1176-byte region [ffff88806da40000, ffff88806da40498) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x6da40 head: order:2 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 memcg:ffff88803371a401 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff8881412cf640 dead000000000122 0000000000000000 raw: 0000000000000000 00000000000c000c 00000000f5000000 ffff88803371a401 head: 00fff00000000040 ffff8881412cf640 dead000000000122 0000000000000000 head: 0000000000000000 00000000000c000c 00000000f5000000 ffff88803371a401 head: 00fff00000000002 ffffea0001b69001 ffffffffffffffff 0000000000000000 head: 0000000700000004 0000000000000000 00000000ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Reclaimable, gfp_mask 0xd20d0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_RECLAIMABLE), pid 5915, tgid 5915 (syz-executor), ts 77812742478, free_ts 70162460130 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+0x3651/0x37a0 mm/page_alloc.c:3477 __alloc_frozen_pages_noprof+0x292/0x710 mm/page_alloc.c:4739 alloc_pages_mpol+0x311/0x660 mm/mempolicy.c:2270 alloc_slab_page mm/slub.c:2423 [inline] allocate_slab+0x8f/0x3a0 mm/slub.c:2587 new_slab mm/slub.c:2640 [inline] ___slab_alloc+0xc27/0x14a0 mm/slub.c:3826 __slab_alloc+0x58/0xa0 mm/slub.c:3916 __slab_alloc_node mm/slub.c:3991 [inline] slab_alloc_node mm/slub.c:4152 [inline] kmem_cache_alloc_lru_noprof+0x26c/0x390 mm/slub.c:4183 alloc_inode+0x65/0x1a0 fs/inode.c:336 new_inode_pseudo fs/inode.c:1174 [inline] new_inode+0x22/0x1d0 fs/inode.c:1193 debugfs_get_inode fs/debugfs/inode.c:72 [inline] __debugfs_create_file+0x14c/0x500 fs/debugfs/inode.c:447 debugfs_create_file_short+0x40/0x60 fs/debugfs/inode.c:485 add_common_files net/mac80211/debugfs_netdev.c:824 [inline] add_files net/mac80211/debugfs_netdev.c:947 [inline] ieee80211_debugfs_add_netdev net/mac80211/debugfs_netdev.c:1011 [inline] ieee80211_debugfs_recreate_netdev+0x33b/0x14d0 net/mac80211/debugfs_netdev.c:1035 ieee80211_if_add+0xef9/0x1780 net/mac80211/iface.c:2188 ieee80211_register_hw+0x3708/0x42e0 net/mac80211/main.c:1604 mac80211_hwsim_new_radio+0x2ae8/0x4a40 drivers/net/wireless/virtual/mac80211_hwsim.c:5558 page last free pid 5826 tgid 5826 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1127 [inline] free_unref_folios+0xe2f/0x18a0 mm/page_alloc.c:2707 folios_put_refs+0x76c/0x860 mm/swap.c:994 free_pages_and_swap_cache+0x2e5/0x690 mm/swap_state.c:331 __tlb_batch_free_encoded_pages mm/mmu_gather.c:136 [inline] tlb_batch_pages_flush mm/mmu_gather.c:149 [inline] tlb_flush_mmu_free mm/mmu_gather.c:389 [inline] tlb_flush_mmu+0x3a3/0x680 mm/mmu_gather.c:396 tlb_finish_mmu+0xd4/0x200 mm/mmu_gather.c:488 vms_clear_ptes+0x432/0x530 mm/vma.c:1144 vms_complete_munmap_vmas+0x210/0x8f0 mm/vma.c:1186 do_vmi_align_munmap+0x5ef/0x6f0 mm/vma.c:1445 do_vmi_munmap+0x24e/0x2d0 mm/vma.c:1493 __vm_munmap+0x372/0x510 mm/vma.c:2951 __do_sys_munmap mm/mmap.c:1084 [inline] __se_sys_munmap mm/mmap.c:1081 [inline] __x64_sys_munmap+0x60/0x70 mm/mmap.c:1081 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 Memory state around the buggy address: ffff88806da3ff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88806da3ff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88806da40000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88806da40080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88806da40100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================