inum: 536870914:4294967295 mode=100755 flags=(15300000) journal_seq=4 hash_seed=d483206f1ed95abf hash_type=siphash bi_size=100 bi_sectors=8 bi_version=1126999418470400 bi_atime=0 bi_ctime=0 bi_mtime=0 bi_otime=2780562352 bi_uid=2780562352 bi_gid=0 bi_nlink=2780562352 bi_generation=0 bi_dev=0 bi_data_checksum=0 bi_compression=0 bi_project=0 bi_background_compression=0 bi_data_replicas=0 bi_promote_target=0 bi_foreground_target=0 bi_background_target=0 bi_erasure_code=0 bi_fields_set=0 bi_dir=0 bi_dir_offset=0 bi_subvol=0 bi_parent_subvol=0 bi_nocow=0 bi_depth=0 bi_inodes_32bit=0 bi_casefold=0, fixing done bcachefs (loop0): check_subvolume_structure... done bcachefs (loop0): check_directory_structure... done bcachefs (loop0): check_nlinks... bcachefs (loop0): inode 536870913 type reg has wrong i_nlink (2, should be 1), fixing bcachefs (loop0): inode 536870914 type reg has wrong i_nlink (2780562353, should be 1), fixing done bcachefs (loop0): check_rebalance_work... done bcachefs (loop0): resume_logged_ops... done bcachefs (loop0): delete_dead_inodes... done bcachefs (loop0): set_fs_needs_rebalance... done bcachefs (loop0): done starting filesystem ================================================================== BUG: KASAN: slab-out-of-bounds in bch2_dirent_init_name+0x31d/0x7b0 fs/bcachefs/dirent.c:271 Write of size 1985 at addr ffff888052672233 by task syz.0.0/5339 CPU: 0 UID: 0 PID: 5339 Comm: syz.0.0 Not tainted 6.16.0-rc3-syzkaller-00057-g92ca6c498a5e #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+0xd2/0x2b0 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+0x2b0/0x2c0 mm/kasan/generic.c:189 __asan_memset+0x22/0x50 mm/kasan/shadow.c:84 bch2_dirent_init_name+0x31d/0x7b0 fs/bcachefs/dirent.c:271 bch2_dirent_create_key+0x263/0x5a0 fs/bcachefs/dirent.c:316 bch2_dirent_create+0xc5/0xc80 fs/bcachefs/dirent.c:359 bch2_link_trans+0x39e/0x560 fs/bcachefs/namei.c:241 __bch2_link+0x231/0x3f0 fs/bcachefs/fs.c:778 bch2_link+0x197/0x220 fs/bcachefs/fs.c:807 vfs_link+0x4ed/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:0x7efc9b18e929 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:00007efc9c07b038 EFLAGS: 00000246 ORIG_RAX: 0000000000000056 RAX: ffffffffffffffda RBX: 00007efc9b3b5fa0 RCX: 00007efc9b18e929 RDX: 0000000000000000 RSI: 0000200000000bc0 RDI: 0000200000001240 RBP: 00007efc9b210b39 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007efc9b3b5fa0 R15: 00007ffe634672d8 Allocated by task 5339: 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_node_track_caller_noprof+0x271/0x4e0 mm/slub.c:4347 __do_krealloc mm/slub.c:4905 [inline] krealloc_noprof+0x124/0x340 mm/slub.c:4958 __bch2_trans_kmalloc+0x26c/0xc80 fs/bcachefs/btree_iter.c:3187 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+0x112/0x5a0 fs/bcachefs/dirent.c:299 bch2_dirent_create+0xc5/0xc80 fs/bcachefs/dirent.c:359 bch2_link_trans+0x39e/0x560 fs/bcachefs/namei.c:241 __bch2_link+0x231/0x3f0 fs/bcachefs/fs.c:778 bch2_link+0x197/0x220 fs/bcachefs/fs.c:807 vfs_link+0x4ed/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 ffff888052672000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 563 bytes inside of allocated 2048-byte region [ffff888052672000, ffff888052672800) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x52670 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff88801a442000 ffffea0001497200 0000000000000002 raw: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000 head: 04fff00000000040 ffff88801a442000 ffffea0001497200 0000000000000002 head: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000 head: 04fff00000000003 ffffea0001499c01 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 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 5314, tgid 5314 (syz-executor), ts 105123746283, free_ts 0 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+0x21e4/0x22c0 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] __kmalloc_cache_noprof+0x296/0x3d0 mm/slub.c:4354 kmalloc_noprof include/linux/slab.h:905 [inline] kzalloc_noprof include/linux/slab.h:1039 [inline] device_create_groups_vargs drivers/base/core.c:4356 [inline] device_create+0x12f/0x2f0 drivers/base/core.c:4413 macvtap_device_event+0x2f1/0x410 drivers/net/macvtap.c:176 notifier_call_chain+0x1b3/0x3e0 kernel/notifier.c:85 call_netdevice_notifiers_extack net/core/dev.c:2268 [inline] call_netdevice_notifiers net/core/dev.c:2282 [inline] register_netdevice+0x1608/0x1ae0 net/core/dev.c:11143 macvlan_common_newlink+0x120a/0x1980 drivers/net/macvlan.c:1540 macvtap_newlink+0x13c/0x1b0 drivers/net/macvtap.c:108 rtnl_newlink_create+0x30d/0xb00 net/core/rtnetlink.c:3823 __rtnl_newlink net/core/rtnetlink.c:3940 [inline] rtnl_newlink+0x16d6/0x1c70 net/core/rtnetlink.c:4055 rtnetlink_rcv_msg+0x7cc/0xb70 net/core/rtnetlink.c:6944 page_owner free stack trace missing Memory state around the buggy address: ffff888052672700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888052672780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888052672800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff888052672880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888052672900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================