loop0: detected capacity change from 0 to 32768 bcachefs (loop0): starting version 1.7: mi_btree_bitmap opts=errors=continue,metadata_checksum=none,data_checksum=none,checksum_err_retry_nr=12,compression=lz4,foreground_target=invalid label 767,background_target=invalid device 7,degraded=yes,nojournal_transaction_names allowing incompatible features above 0.0: (unknown version) features: lz4,new_siphash,inline_data,new_extent_overwrite,btree_ptr_v2,new_varint,journal_no_flush,alloc_v2,extents_across_btree_nodes bcachefs (loop0): Using encoding defined by superblock: utf8-12.1.0 bcachefs (loop0): initializing new filesystem bcachefs (loop0): going read-write bcachefs (loop0): marking superblocks bcachefs (loop0): initializing freespace bcachefs (loop0): done initializing freespace bcachefs (loop0): reading snapshots table bcachefs (loop0): reading snapshots done bcachefs (loop0): done starting filesystem ================================================================== BUG: KASAN: slab-out-of-bounds in bch2_dirent_init_name+0x396/0x8b0 fs/bcachefs/dirent.c:273 Write of size 1985 at addr ffff888033392041 by task syz.0.0/5339 CPU: 0 UID: 0 PID: 5339 Comm: syz.0.0 Not tainted 6.16.0-rc5-syzkaller-00266-g3f31a806a62e #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: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_linkat fs/namei.c:4961 [inline] __se_sys_linkat fs/namei.c:4958 [inline] __x64_sys_linkat+0xd4/0xf0 fs/namei.c:4958 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:0x7f03ed18e929 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:00007f03edfc2038 EFLAGS: 00000246 ORIG_RAX: 0000000000000109 RAX: ffffffffffffffda RBX: 00007f03ed3b5fa0 RCX: 00007f03ed18e929 RDX: ffffffffffffff9c RSI: 0000200000000000 RDI: ffffffffffffff9c RBP: 00007f03ed210b39 R08: 0000000000000000 R09: 0000000000000000 R10: 00002000000006c0 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 00007f03ed3b5fa0 R15: 00007ffcc4060738 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_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_linkat fs/namei.c:4961 [inline] __se_sys_linkat fs/namei.c:4958 [inline] __x64_sys_linkat+0xd4/0xf0 fs/namei.c:4958 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 ffff888033392000 which belongs to the cache kmalloc-2k of size 2048 The buggy address is located 65 bytes inside of allocated 2048-byte region [ffff888033392000, ffff888033392800) The buggy address belongs to the physical page: page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x33390 head: order:3 mapcount:0 entire_mapcount:0 nr_pages_mapped:0 pincount:0 anon flags: 0x4fff00000000040(head|node=1|zone=1|lastcpupid=0x7ff) page_type: f5(slab) raw: 04fff00000000040 ffff88801a442000 0000000000000000 0000000000000001 raw: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000 head: 04fff00000000040 ffff88801a442000 0000000000000000 0000000000000001 head: 0000000000000000 0000000080080008 00000000f5000000 0000000000000000 head: 04fff00000000003 ffffea0000cce401 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 5318, tgid 5318 (syz-executor), ts 72038083626, free_ts 51147467493 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] rxrpc_alloc_connection+0x7b/0x590 net/rxrpc/conn_object.c:62 rxrpc_prealloc_service_connection+0x26/0x2e0 net/rxrpc/conn_service.c:123 rxrpc_service_prealloc_one+0x2f5/0xe20 net/rxrpc/call_accept.c:86 afs_charge_preallocation+0x394/0x4e0 fs/afs/rxrpc.c:758 afs_open_socket+0x302/0x3a0 fs/afs/rxrpc.c:112 afs_net_init+0x67d/0x880 fs/afs/main.c:116 ops_init+0x359/0x5c0 net/core/net_namespace.c:138 setup_net+0x219/0x4b0 net/core/net_namespace.c:442 copy_net_ns+0x31b/0x4d0 net/core/net_namespace.c:574 page last free pid 5135 tgid 5135 stack trace: reset_page_owner include/linux/page_owner.h:25 [inline] free_pages_prepare mm/page_alloc.c:1248 [inline] __free_frozen_pages+0xc71/0xe70 mm/page_alloc.c:2706 __slab_free+0x326/0x400 mm/slub.c:4554 qlink_free mm/kasan/quarantine.c:163 [inline] qlist_free_all+0x97/0x140 mm/kasan/quarantine.c:179 kasan_quarantine_reduce+0x148/0x160 mm/kasan/quarantine.c:286 __kasan_slab_alloc+0x22/0x80 mm/kasan/common.c:329 kasan_slab_alloc include/linux/kasan.h:250 [inline] slab_post_alloc_hook mm/slub.c:4148 [inline] slab_alloc_node mm/slub.c:4197 [inline] kmem_cache_alloc_node_noprof+0x1bb/0x3c0 mm/slub.c:4249 alloc_task_struct_node kernel/fork.c:183 [inline] dup_task_struct+0x52/0x860 kernel/fork.c:869 copy_process+0x544/0x3b80 kernel/fork.c:1999 kernel_clone+0x21e/0x870 kernel/fork.c:2599 __do_sys_clone kernel/fork.c:2742 [inline] __se_sys_clone kernel/fork.c:2726 [inline] __x64_sys_clone+0x18b/0x1e0 kernel/fork.c:2726 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: ffff888033392700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff888033392780: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff888033392800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff888033392880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff888033392900: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ==================================================================