upstream test error: KCSAN: data-race in osq_lock / osq_lock

Status: moderation: reported on 2026/11/17 16:58
Subsystems: kernfs
[Documentation on labels]
Reported-by: syzbot+9d443fd2cf00df86657b@syzkaller.appspotmail.com
First crash: 43m, last: 43m

Sample crash report:
==================================================================
BUG: KCSAN: data-race in osq_lock / osq_lock

write to 0xffff888237d2cd94 of 4 bytes by task 4019 on cpu 1:
 osq_lock+0x63/0x250 kernel/locking/osq_lock.c:145
 rwsem_optimistic_spin kernel/locking/rwsem.c:848 [inline]
 rwsem_down_write_slowpath+0xf7/0xcc0 kernel/locking/rwsem.c:1145
 __down_write_common kernel/locking/rwsem.c:1347 [inline]
 __down_write kernel/locking/rwsem.c:1356 [inline]
 down_write+0xd3/0xf0 kernel/locking/rwsem.c:1632
 kernfs_add_one+0x5a/0x310 fs/kernfs/dir.c:833
 __kernfs_create_file+0x145/0x180 fs/kernfs/file.c:1100
 sysfs_add_file_mode_ns+0x132/0x1b0 fs/sysfs/file.c:316
 create_files fs/sysfs/group.c:82 [inline]
 internal_create_group+0x43e/0x9e0 fs/sysfs/group.c:189
 internal_create_groups fs/sysfs/group.c:229 [inline]
 sysfs_create_groups+0x3f/0xf0 fs/sysfs/group.c:255
 setup_port drivers/infiniband/core/sysfs.c:1207 [inline]
 ib_setup_port_attrs+0xa15/0x14a0 drivers/infiniband/core/sysfs.c:1393
 add_one_compat_dev+0x25c/0x360 drivers/infiniband/core/device.c:1002
 rdma_dev_init_net+0x17d/0x210 drivers/infiniband/core/device.c:1227
 ops_init+0x22a/0x2e0 net/core/net_namespace.c:137
 setup_net+0x8e/0x220 net/core/net_namespace.c:448
 copy_net_ns+0x379/0x4e0 net/core/net_namespace.c:589
 create_new_namespaces+0x208/0x440 kernel/nsproxy.c:132
 unshare_nsproxy_namespaces+0x115/0x150 kernel/nsproxy.c:234
 ksys_unshare+0x39b/0x670 kernel/fork.c:3306
 __do_sys_unshare kernel/fork.c:3372 [inline]
 __se_sys_unshare kernel/fork.c:3370 [inline]
 __x64_sys_unshare+0x1f/0x30 kernel/fork.c:3370
 x64_sys_call+0x1e33/0x2550 arch/x86/include/generated/asm/syscalls_64.h:273
 do_syscall_x64 arch/x86/entry/syscall_64.c:61 [inline]
 do_syscall_64+0x11e/0x3a0 arch/x86/entry/syscall_64.c:89
 entry_SYSCALL_64_after_hwframe+0x77/0x7f

read to 0xffff888237d2cd94 of 4 bytes by task 13 on cpu 0:
 node_cpu kernel/locking/osq_lock.c:34 [inline]
 osq_lock+0x11c/0x250 kernel/locking/osq_lock.c:177
 rwsem_optimistic_spin kernel/locking/rwsem.c:848 [inline]
 rwsem_down_write_slowpath+0xf7/0xcc0 kernel/locking/rwsem.c:1145
 __down_write_common kernel/locking/rwsem.c:1347 [inline]
 __down_write kernel/locking/rwsem.c:1356 [inline]
 down_write+0xd3/0xf0 kernel/locking/rwsem.c:1632
 kernfs_remove_by_name_ns+0x6b/0x130 fs/kernfs/dir.c:1791
 kernfs_remove_by_name include/linux/kernfs.h:644 [inline]
 remove_files fs/sysfs/group.c:28 [inline]
 sysfs_remove_group+0xa5/0x170 fs/sysfs/group.c:328
 sysfs_remove_groups+0x3a/0x80 fs/sysfs/group.c:352
 destroy_gid_attrs drivers/infiniband/core/sysfs.c:1143 [inline]
 ib_free_port_attrs+0x8e/0x250 drivers/infiniband/core/sysfs.c:1367
 remove_one_compat_dev drivers/infiniband/core/device.c:1035 [inline]
 rdma_dev_exit_net+0x1aa/0x330 drivers/infiniband/core/device.c:1173
 ops_exit_list net/core/net_namespace.c:200 [inline]
 ops_undo_list+0x285/0x410 net/core/net_namespace.c:253
 cleanup_net+0x38d/0x5e0 net/core/net_namespace.c:713
 process_one_work kernel/workqueue.c:3495 [inline]
 process_scheduled_works+0x582/0xab0 kernel/workqueue.c:3578
 worker_thread+0x56c/0x770 kernel/workqueue.c:3659
 kthread+0x248/0x2a0 kernel/kthread.c:436
 ret_from_fork+0x146/0x330 arch/x86/kernel/process.c:158
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:245

Reported by Kernel Concurrency Sanitizer on:
CPU: 0 UID: 0 PID: 13 Comm: kworker/u8:0 Not tainted syzkaller #0 PREEMPT(lazy) 
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/06/2026
Workqueue: netns cleanup_net
==================================================================
bond0 (unregistering): Released all slaves

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2026/11/17 16:58 upstream 666539eecdf4 122f94d5 .config console log report [disk image] [vmlinux] [kernel image] ci2-upstream-kcsan-gce upstream test error: KCSAN: data-race in osq_lock / osq_lock
* Struck through repros no longer work on HEAD.