In the Linux kernel, the following vulnerability has been resolved: afunix: Fix data races around sk->skshutdown. KCSAN found a data race around sk->skshutdown where unixreleasesock() and unixshutdown() update it under unixstatelock(), OTOH unixpoll() and unixdgrampoll() read it locklessly. We need to annotate the writes and reads with WRITEONCE() and READONCE(). BUG: KCSAN: data-race in unixpoll / unixreleasesock write to 0xffff88800d0f8aec of 1 bytes by task 264 on cpu 0: unixreleasesock+0x75c/0x910 net/unix/afunix.c:631 unixrelease+0x59/0x80 net/unix/afunix.c:1042 sockrelease+0x7d/0x170 net/socket.c:653 sockclose+0x19/0x30 net/socket.c:1397 _fput+0x179/0x5e0 fs/filetable.c:321 _fput+0x15/0x20 fs/filetable.c:349 taskworkrun+0x116/0x1a0 kernel/taskwork.c:179 resumeusermodework include/linux/resumeusermode.h:49 [inline] exittousermodeloop kernel/entry/common.c:171 [inline] exittousermodeprepare+0x174/0x180 kernel/entry/common.c:204 _syscallexittousermodework kernel/entry/common.c:286 [inline] syscallexittousermode+0x1a/0x30 kernel/entry/common.c:297 dosyscall64+0x4b/0x90 arch/x86/entry/common.c:86 entrySYSCALL64afterhwframe+0x72/0xdc read to 0xffff88800d0f8aec of 1 bytes by task 222 on cpu 1: unixpoll+0xa3/0x2a0 net/unix/afunix.c:3170 sockpoll+0xcf/0x2b0 net/socket.c:1385 vfspoll include/linux/poll.h:88 [inline] epitempoll.isra.0+0x78/0xc0 fs/eventpoll.c:855 epsendevents fs/eventpoll.c:1694 [inline] eppoll fs/eventpoll.c:1823 [inline] doepollwait+0x6c4/0xea0 fs/eventpoll.c:2258 _dosysepollwait fs/eventpoll.c:2270 [inline] _sesysepollwait fs/eventpoll.c:2265 [inline] _x64sysepollwait+0xcc/0x190 fs/eventpoll.c:2265 dosyscallx64 arch/x86/entry/common.c:50 [inline] dosyscall64+0x3b/0x90 arch/x86/entry/common.c:80 entrySYSCALL64afterhwframe+0x72/0xdc value changed: 0x00 -> 0x03 Reported by Kernel Concurrency Sanitizer on: CPU: 1 PID: 222 Comm: dbus-broker Not tainted 6.3.0-rc7-02330-gca6270c12e20 #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014