syzbot


KASAN: slab-out-of-bounds Read in kernfs_find_ns

Status: upstream: reported on 2025/10/12 09:24
Reported-by: syzbot+1cf51b6632b24303a322@syzkaller.appspotmail.com
First crash: 6d11h, last: 6d11h
Similar bugs (5)
Kernel Title Rank 🛈 Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream general protection fault in kernfs_find_ns kernfs 2 2 1419d 1414d 0/29 auto-closed as invalid on 2022/03/29 00:22
android-54 general protection fault in kernfs_find_ns 2 1 1611d 1611d 0/2 auto-closed as invalid on 2021/09/18 09:16
android-5-10 general protection fault in kernfs_find_ns 2 C error 13 44d 770d 0/2 upstream: reported C repro on 2023/09/09 18:30
linux-5.15 KASAN: global-out-of-bounds Read in kernfs_find_ns 17 1 140d 140d 0/3 auto-obsoleted due to no activity on 2025/09/08 00:48
android-54 general protection fault in kernfs_find_ns (2) 2 C 21 200d 1455d 0/2 upstream: reported C repro on 2021/10/24 20:02

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in kernfs_name_compare fs/kernfs/dir.c:326 [inline]
BUG: KASAN: slab-out-of-bounds in kernfs_find_ns+0x473/0x510 fs/kernfs/dir.c:827
Read of size 4 at addr ffff88805570afe0 by task syz.1.3130/16047

CPU: 1 PID: 16047 Comm: syz.1.3130 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/18/2025
Call Trace:
 <TASK>
 dump_stack_lvl+0x168/0x230 lib/dump_stack.c:106
 print_address_description+0x60/0x2d0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:434 [inline]
 kasan_report+0xdf/0x130 mm/kasan/report.c:451
 kernfs_name_compare fs/kernfs/dir.c:326 [inline]
 kernfs_find_ns+0x473/0x510 fs/kernfs/dir.c:827
 kernfs_remove_by_name_ns+0x37/0x100 fs/kernfs/dir.c:1563
 remove_bind_files drivers/base/bus.c:550 [inline]
 bus_remove_driver+0x89/0x230 drivers/base/bus.c:674
 comedi_device_detach_locked+0x16e/0x710 drivers/comedi/drivers.c:207
 do_devconfig_ioctl drivers/comedi/comedi_fops.c:844 [inline]
 comedi_unlocked_ioctl+0xd0b/0x1050 drivers/comedi/comedi_fops.c:2173
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl+0xfa/0x170 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7fa0b13f9ec9
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:00007fa0af661038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007fa0b1650fa0 RCX: 00007fa0b13f9ec9
RDX: 0000000000000000 RSI: 0000000040946400 RDI: 0000000000000003
RBP: 00007fa0b147cf91 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fa0b1651038 R14: 00007fa0b1650fa0 R15: 00007fff1c5b88e8
 </TASK>

Allocated by task 15631:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 __kasan_kmalloc+0xb5/0xf0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:604 [inline]
 kzalloc include/linux/slab.h:735 [inline]
 uevent_net_init+0xc3/0x2b0 lib/kobject_uevent.c:781
 ops_init+0x357/0x600 net/core/net_namespace.c:138
 setup_net+0x38d/0x9f0 net/core/net_namespace.c:333
 copy_net_ns+0x348/0x5b0 net/core/net_namespace.c:503
 create_new_namespaces+0x3d3/0x6f0 kernel/nsproxy.c:110
 unshare_nsproxy_namespaces+0x116/0x160 kernel/nsproxy.c:226
 ksys_unshare+0x4bc/0x890 kernel/fork.c:3175
 __do_sys_unshare kernel/fork.c:3249 [inline]
 __se_sys_unshare kernel/fork.c:3247 [inline]
 __x64_sys_unshare+0x34/0x40 kernel/fork.c:3247
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

The buggy address belongs to the object at ffff88805570afc0
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes to the right of
 32-byte region [ffff88805570afc0, ffff88805570afe0)
The buggy address belongs to the page:
page:ffffea000155c280 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88805570ab40 pfn:0x5570a
flags: 0xfff00000000200(slab|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000000200 ffffea0000a8ac08 ffffea000092eec8 ffff888016841500
raw: ffff88805570ab40 000000000040003f 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x112cc0(GFP_USER|__GFP_NOWARN|__GFP_NORETRY), pid 8908, ts 403272410893, free_ts 403155659506
 prep_new_page mm/page_alloc.c:2426 [inline]
 get_page_from_freelist+0x1b77/0x1c60 mm/page_alloc.c:4192
 __alloc_pages+0x1e1/0x470 mm/page_alloc.c:5487
 alloc_slab_page mm/slub.c:1780 [inline]
 allocate_slab mm/slub.c:1917 [inline]
 new_slab+0xc0/0x4b0 mm/slub.c:1980
 ___slab_alloc+0x81e/0xdf0 mm/slub.c:3013
 __slab_alloc mm/slub.c:3100 [inline]
 slab_alloc_node mm/slub.c:3191 [inline]
 slab_alloc mm/slub.c:3233 [inline]
 kmem_cache_alloc_trace+0x1a5/0x2a0 mm/slub.c:3250
 kmalloc include/linux/slab.h:604 [inline]
 __memcg_init_list_lru_node mm/list_lru.c:339 [inline]
 memcg_init_list_lru_node mm/list_lru.c:362 [inline]
 memcg_init_list_lru mm/list_lru.c:440 [inline]
 __list_lru_init+0x50a/0xa50 mm/list_lru.c:607
 alloc_super+0x76c/0x950 fs/super.c:272
 sget+0x1ca/0x440 fs/super.c:637
 mount_bdev+0xec/0x3c0 fs/super.c:1373
 legacy_get_tree+0xe6/0x180 fs/fs_context.c:611
 vfs_get_tree+0x88/0x270 fs/super.c:1530
 do_new_mount+0x24a/0xa40 fs/namespace.c:3025
 do_mount fs/namespace.c:3368 [inline]
 __do_sys_mount fs/namespace.c:3576 [inline]
 __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3553
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1340 [inline]
 free_pcp_prepare mm/page_alloc.c:1391 [inline]
 free_unref_page_prepare+0x637/0x6c0 mm/page_alloc.c:3317
 free_unref_page+0x94/0x280 mm/page_alloc.c:3396
 put_page include/linux/mm.h:1258 [inline]
 af_alg_free_areq_sgls crypto/af_alg.c:685 [inline]
 af_alg_free_resources+0x3cd/0x650 crypto/af_alg.c:1057
 _skcipher_recvmsg crypto/algif_skcipher.c:144 [inline]
 skcipher_recvmsg+0xa65/0xd40 crypto/algif_skcipher.c:157
 ____sys_recvmsg+0x291/0x580 net/socket.c:-1
 ___sys_recvmsg+0x1af/0x4f0 net/socket.c:2697
 __sys_recvmsg net/socket.c:2727 [inline]
 __do_sys_recvmsg net/socket.c:2737 [inline]
 __se_sys_recvmsg net/socket.c:2734 [inline]
 __x64_sys_recvmsg+0x1dd/0x2a0 net/socket.c:2734
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x4c/0xa0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x66/0xd0

Memory state around the buggy address:
 ffff88805570ae80: fa fb fb fb fc fc fc fc fa fb fb fb fc fc fc fc
 ffff88805570af00: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
>ffff88805570af80: fa fb fb fb fc fc fc fc 00 00 00 fc fc fc fc fc
                                                       ^
 ffff88805570b000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88805570b080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2025/10/12 09:23 linux-5.15.y 29e53a5b1c4f ff1712fe .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan KASAN: slab-out-of-bounds Read in kernfs_find_ns
* Struck through repros no longer work on HEAD.