================================================================== BUG: KASAN: slab-out-of-bounds in bch2_dirent_init_name+0x396/0x8b0 fs/bcachefs/dirent.c:276 Write of size 1985 at addr ffff88804a955041 by task syz.3.142/6815 CPU: 1 UID: 0 PID: 6815 Comm: syz.3.142 Tainted: G W 6.16.0-syzkaller-03556-g0919a5b3b11c #0 PREEMPT_{RT,(full)} Tainted: [W]=WARN Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/12/2025 Call Trace: dump_stack_lvl+0x189/0x250 lib/dump_stack.c:120 print_address_description mm/kasan/report.c:378 [inline] print_report+0xca/0x240 mm/kasan/report.c:482 kasan_report+0x118/0x150 mm/kasan/report.c:595 check_region_inline mm/kasan/generic.c:-1 [inline] kasan_check_range+0x2b0/0x2c0 mm/kasan/generic.c:189 __asan_memset+0x22/0x50 mm/kasan/shadow.c:84 bch2_dirent_init_name+0x396/0x8b0 fs/bcachefs/dirent.c:276 bch2_dirent_create_key+0x2a1/0x5f0 fs/bcachefs/dirent.c:319 bch2_dirent_create+0xc5/0xc80 fs/bcachefs/dirent.c:362 bch2_link_trans+0x39e/0x560 fs/bcachefs/namei.c:241 __bch2_link+0x231/0x3f0 fs/bcachefs/fs.c:776 bch2_symlink+0x183/0x240 fs/bcachefs/fs.c:892 vfs_symlink+0x140/0x2f0 fs/namei.c:4730 do_symlinkat+0x1b1/0x3f0 fs/namei.c:4756 __do_sys_symlinkat fs/namei.c:4772 [inline] __se_sys_symlinkat fs/namei.c:4769 [inline] __x64_sys_symlinkat+0x95/0xb0 fs/namei.c:4769 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f RIP: 0033:0x7ff79baae9a9 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 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:00007ff799916038 EFLAGS: 00000246 ORIG_RAX: 000000000000010a RAX: ffffffffffffffda RBX: 00007ff79bcd5fa0 RCX: 00007ff79baae9a9 RDX: 0000200000000200 RSI: ffffffffffffff9c RDI: 00002000000001c0 RBP: 00007ff79bb30d69 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff79bcd5fa0 R15: 00007ffc2a1732e8 Allocated by task 6815: kasan_save_stack mm/kasan/common.c:47 [inline] kasan_save_track+0x3e/0x80 mm/kasan/common.c:68 poison_kmalloc_redzone mm/kasan/common.c:377 [inline] __kasan_kmalloc+0x93/0xb0 mm/kasan/common.c:394 kasan_kmalloc include/linux/kasan.h:260 [inline] __do_kmalloc_node mm/slub.c:4328 [inline] __kmalloc_noprof+0x1ef/0x430 mm/slub.c:4340 kmalloc_noprof include/linux/slab.h:909 [inline] __bch2_trans_kmalloc+0x395/0x9d0 fs/bcachefs/btree_iter.c:3242 bch2_trans_kmalloc_ip fs/bcachefs/btree_iter.h:604 [inline] bch2_trans_kmalloc fs/bcachefs/btree_iter.h:616 [inline] bch2_dirent_create_key+0x113/0x5f0 fs/bcachefs/dirent.c:302 bch2_dirent_create+0xc5/0xc80 fs/bcachefs/dirent.c:362 bch2_link_trans+0x39e/0x560 fs/bcachefs/namei.c:241 __bch2_link+0x231/0x3f0 fs/bcachefs/fs.c:776 bch2_symlink+0x183/0x240 fs/bcachefs/fs.c:892 vfs_symlink+0x140/0x2f0 fs/namei.c:4730 do_symlinkat+0x1b1/0x3f0 fs/namei.c:4756 __do_sys_symlinkat fs/namei.c:4772 [inline] __se_sys_symlinkat fs/namei.c:4769 [inline] __x64_sys_symlinkat+0x95/0xb0 fs/namei.c:4769 do_syscall_x64 arch/x86/entry/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f The buggy address belongs to the object at ffff88804a955000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 65 bytes inside of allocated 2048-byte region [ffff88804a955000, ffff88804a955800) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x4a950 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0x80000000000040(head|node=0|zone=1) page_type: f5(slab) raw: 0080000000000040 ffff888019842000 0000000000000000 dead000000000001 raw: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000 head: 0080000000000040 ffff888019842000 0000000000000000 dead000000000001 head: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000 head: 0080000000000003 ffffea00012a5401 00000000ffffffff 00000000ffffffff head: 00000007f9eac7bd 0000000000000000 00000000ffffffff 0000000000000008 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 9, tgid 9 (kworker/0:0), ts 116005101176, free_ts 100025102339 set_page_owner include/linux/page_owner.h:32 [inline] post_alloc_hook+0x240/0x2a0 mm/page_alloc.c:1704 prep_new_page mm/page_alloc.c:1712 [inline] get_page_from_freelist+0x2119/0x21b0 mm/page_alloc.c:3669 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4959 alloc_pages_mpol+0xd1/0x380 mm/mempolicy.c:2419 alloc_slab_page mm/slub.c:2451 [inline] allocate_slab+0x8a/0x3b0 mm/slub.c:2619 new_slab mm/slub.c:2673 [inline] ___slab_alloc+0x8e7/0xe20 mm/slub.c:3859 __slab_alloc mm/slub.c:3949 [inline] __slab_alloc_node mm/slub.c:4024 [inline] slab_alloc_node mm/slub.c:4185 [inline] __do_kmalloc_node mm/slub.c:4327 [inline] __kmalloc_node_track_caller_noprof+0x14c/0x450 mm/slub.c:4347 kmalloc_reserve+0x136/0x290 net/core/skbuff.c:601 __alloc_skb+0x142/0x2d0 net/core/skbuff.c:670 alloc_skb include/linux/skbuff.h:1336 [inline] mld_newpack+0x13c/0xc40 net/ipv6/mcast.c:1788 add_grhead+0x5a/0x2a0 net/ipv6/mcast.c:1899 add_grec+0x13b2/0x1670 net/ipv6/mcast.c:2037 mld_send_cr net/ipv6/mcast.c:2163 [inline] mld_ifc_work+0x6e6/0xde0 net/ipv6/mcast.c:2702 process_one_work kernel/workqueue.c:3238 [inline] process_scheduled_works+0xade/0x17b0 kernel/workqueue.c:3321 worker_thread+0x8a0/0xda0 kernel/workqueue.c:3402 kthread+0x70e/0x8a0 kernel/kthread.c:464 page last free pid 5802 tgid 5802 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1248 [inline] free_unref_folios+0xc8b/0x14e0 mm/page_alloc.c:2763 folios_put_refs+0x569/0x670 mm/swap.c:992 free_pages_and_swap_cache+0x277/0x520 mm/swap_state.c:264 __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:397 [inline] tlb_flush_mmu+0x3a0/0x680 mm/mmu_gather.c:404 tlb_finish_mmu+0xc3/0x1d0 mm/mmu_gather.c:497 vms_clear_ptes+0x42c/0x540 mm/vma.c:1230 vms_complete_munmap_vmas+0x206/0x8a0 mm/vma.c:1272 do_vmi_align_munmap+0x369/0x440 mm/vma.c:1531 do_vmi_munmap+0x253/0x2e0 mm/vma.c:1579 __vm_munmap+0x23b/0x3d0 mm/vma.c:3108 __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/syscall_64.c:63 [inline] do_syscall_64+0xfa/0x3b0 arch/x86/entry/syscall_64.c:94 entry_SYSCALL_64_after_hwframe+0x77/0x7f Memory state around the buggy address: ffff88804a955700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff88804a955780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff88804a955800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff88804a955880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff88804a955900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================