In the Linux kernel, the following vulnerability has been resolved:
packet: annotate data-races around ignore_outgoing
ignoreoutgoing is read locklessly from devqueuexmitnit() and packet_getsockopt()
Add appropriate READONCE()/WRITEONCE() annotations.
syzbot reported:
BUG: KCSAN: data-race in devqueuexmitnit / packetsetsockopt
write to 0xffff888107804542 of 1 bytes by task 22618 on cpu 0: packetsetsockopt+0xd83/0xfd0 net/packet/afpacket.c:4003 dosocksetsockopt net/socket.c:2311 [inline] _syssetsockopt+0x1d8/0x250 net/socket.c:2334 _dosyssetsockopt net/socket.c:2343 [inline] _sesyssetsockopt net/socket.c:2340 [inline] _x64syssetsockopt+0x66/0x80 net/socket.c:2340 dosyscall64+0xd3/0x1d0 entrySYSCALL64after_hwframe+0x6d/0x75
read to 0xffff888107804542 of 1 bytes by task 27 on cpu 1: devqueuexmitnit+0x82/0x620 net/core/dev.c:2248 xmitone net/core/dev.c:3527 [inline] devhardstartxmit+0xcc/0x3f0 net/core/dev.c:3547 _devqueuexmit+0xf24/0x1dd0 net/core/dev.c:4335 devqueuexmit include/linux/netdevice.h:3091 [inline] batadvsendskbpacket+0x264/0x300 net/batman-adv/send.c:108 batadvsendbroadcastskb+0x24/0x30 net/batman-adv/send.c:127 batadvivogmsendtoif net/batman-adv/bativogm.c:392 [inline] batadvivogmemit net/batman-adv/bativogm.c:420 [inline] batadvivsendoutstandingbatogmpacket+0x3f0/0x4b0 net/batman-adv/bativogm.c:1700 processonework kernel/workqueue.c:3254 [inline] processscheduledworks+0x465/0x990 kernel/workqueue.c:3335 workerthread+0x526/0x730 kernel/workqueue.c:3416 kthread+0x1d1/0x210 kernel/kthread.c:388 retfromfork+0x4b/0x60 arch/x86/kernel/process.c:147 retfromforkasm+0x1a/0x30 arch/x86/entry/entry_64.S:243
value changed: 0x00 -> 0x01
Reported by Kernel Concurrency Sanitizer on: CPU: 1 PID: 27 Comm: kworker/u8:1 Tainted: G W 6.8.0-syzkaller-08073-g480e035fc4c7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 02/29/2024 Workqueue: batevents batadvivsendoutstandingbatogm_packet