================================================================== BUG: KASAN: slab-out-of-bounds in bch2_dirent_init_name+0x396/0x8b0 fs/bcachefs/dirent.c:273 Write of size 1985 at addr ffff888059e82233 by task syz.4.65/6365 CPU: 0 UID: 0 PID: 6365 Comm: syz.4.65 Not tainted 6.16.0-rc6-syzkaller-00002-g155a3c003e55 #0 PREEMPT(full) Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/07/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/0x230 mm/kasan/report.c:480 kasan_report+0x118/0x150 mm/kasan/report.c:593 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:273 bch2_dirent_create_key+0x2a1/0x5f0 fs/bcachefs/dirent.c:315 bch2_dirent_create+0xc5/0xc80 fs/bcachefs/dirent.c:358 bch2_link_trans+0x39e/0x560 fs/bcachefs/namei.c:241 __bch2_link+0x231/0x3f0 fs/bcachefs/fs.c:776 bch2_link+0x197/0x220 fs/bcachefs/fs.c:805 vfs_link+0x4ea/0x6e0 fs/namei.c:4863 do_linkat+0x272/0x560 fs/namei.c:4933 __do_sys_link fs/namei.c:4967 [inline] __se_sys_link fs/namei.c:4965 [inline] __x64_sys_link+0x82/0x90 fs/namei.c:4965 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:0x7ff2be38e929 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:00007ff2bf29b038 EFLAGS: 00000246 ORIG_RAX: 0000000000000056 RAX: ffffffffffffffda RBX: 00007ff2be5b5fa0 RCX: 00007ff2be38e929 RDX: 0000000000000000 RSI: 0000200000000bc0 RDI: 0000200000001240 RBP: 00007ff2be410b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007ff2be5b5fa0 R15: 00007ffc0eb4a0f8 Allocated by task 6365: 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+0x27a/0x4f0 mm/slub.c:4340 kmalloc_noprof include/linux/slab.h:909 [inline] __bch2_trans_kmalloc+0x396/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:298 bch2_dirent_create+0xc5/0xc80 fs/bcachefs/dirent.c:358 bch2_link_trans+0x39e/0x560 fs/bcachefs/namei.c:241 __bch2_link+0x231/0x3f0 fs/bcachefs/fs.c:776 bch2_link+0x197/0x220 fs/bcachefs/fs.c:805 vfs_link+0x4ea/0x6e0 fs/namei.c:4863 do_linkat+0x272/0x560 fs/namei.c:4933 __do_sys_link fs/namei.c:4967 [inline] __se_sys_link fs/namei.c:4965 [inline] __x64_sys_link+0x82/0x90 fs/namei.c:4965 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 ffff888059e82000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 563 bytes inside of allocated 2048-byte region [ffff888059e82000, ffff888059e82800) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x59e80 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0xfff00000000040(head|node=0|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 00fff00000000040 ffff88801a442000 dead000000000100 dead000000000122 raw: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000 head: 00fff00000000040 ffff88801a442000 dead000000000100 dead000000000122 head: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000 head: 00fff00000000003 ffffea000167a001 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 Unmovable, gfp_mask 0xd2820(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5844, tgid 5844 (syz-executor), ts 79045987263, free_ts 24687312615 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+0x21d5/0x22b0 mm/page_alloc.c:3669 __alloc_frozen_pages_noprof+0x181/0x370 mm/page_alloc.c:4959 alloc_pages_mpol+0x232/0x4a0 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+0xbfc/0x1480 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+0x2f8/0x4e0 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] nlmsg_new include/net/netlink.h:1041 [inline] inet6_ifinfo_notify+0x70/0x120 net/ipv6/addrconf.c:6177 addrconf_notify+0xc4e/0x1010 net/ipv6/addrconf.c:3759 notifier_call_chain+0x1b6/0x3e0 kernel/notifier.c:85 call_netdevice_notifiers_extack net/core/dev.c:2268 [inline] call_netdevice_notifiers net/core/dev.c:2282 [inline] __dev_notify_flags+0x18d/0x2e0 net/core/dev.c:-1 netif_change_flags+0xe8/0x1a0 net/core/dev.c:9526 do_setlink+0xc55/0x41c0 net/core/rtnetlink.c:3141 rtnl_changelink net/core/rtnetlink.c:3759 [inline] __rtnl_newlink net/core/rtnetlink.c:3918 [inline] rtnl_newlink+0x160b/0x1c70 net/core/rtnetlink.c:4055 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:1248 [inline] __free_frozen_pages+0xc65/0xe60 mm/page_alloc.c:2706 __free_pages mm/page_alloc.c:5071 [inline] free_contig_range+0x1bd/0x4a0 mm/page_alloc.c:6927 destroy_args+0x7e/0x5d0 mm/debug_vm_pgtable.c:1009 debug_vm_pgtable+0x412/0x450 mm/debug_vm_pgtable.c:1389 do_one_initcall+0x233/0x820 init/main.c:1274 do_initcall_level+0x137/0x1f0 init/main.c:1336 do_initcalls+0x69/0xd0 init/main.c:1352 kernel_init_freeable+0x3d9/0x570 init/main.c:1584 kernel_init+0x1d/0x1d0 init/main.c:1474 ret_from_fork+0x3fc/0x770 arch/x86/kernel/process.c:148 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245 Memory state around the buggy address: ffff888059e82700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888059e82780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888059e82800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff888059e82880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888059e82900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================