In the Linux kernel, the following vulnerability has been resolved:
iouring/net: always initialize kmsg->msg.msginq upfront
syzbot reports that ->msg_inq may get used uinitialized from the following path:
BUG: KMSAN: uninit-value in iorecvbufselect iouring/net.c:1094 [inline] BUG: KMSAN: uninit-value in iorecv+0x930/0x1f90 iouring/net.c:1158 iorecvbufselect iouring/net.c:1094 [inline] iorecv+0x930/0x1f90 iouring/net.c:1158 ioissuesqe+0x420/0x2130 iouring/iouring.c:1740 ioqueuesqe iouring/iouring.c:1950 [inline] ioreqtasksubmit+0xfa/0x1d0 iouring/iouring.c:1374 iohandletwlist+0x55f/0x5c0 iouring/iouring.c:1057 tctxtaskworkrun+0x109/0x3e0 iouring/iouring.c:1121 tctxtaskwork+0x6d/0xc0 iouring/iouring.c:1139 taskworkrun+0x268/0x310 kernel/taskwork.c:239 ioruntaskwork+0x43a/0x4a0 iouring/iouring.h:343 iocqringwait iouring/iouring.c:2527 [inline] _dosysiouringenter iouring/iouring.c:3439 [inline] _sesysiouringenter+0x204f/0x4ce0 iouring/iouring.c:3330 _x64sysiouringenter+0x11f/0x1a0 iouring/iouring.c:3330 x64syscall+0xce5/0x3c30 arch/x86/include/generated/asm/syscalls64.h:427 dosyscallx64 arch/x86/entry/common.c:52 [inline] dosyscall64+0xcd/0x1e0 arch/x86/entry/common.c:83 entrySYSCALL64after_hwframe+0x77/0x7f
and it is correct, as it's never initialized upfront. Hence the first submission can end up using it uninitialized, if the recv wasn't successful and the networking stack didn't honor ->msggetinq being set and filling in the output value of ->msg_inq as requested.
Set it to 0 upfront when it's allocated, just to silence this KMSAN warning. There's no side effect of using it uninitialized, it'll just potentially cause the next receive to use a recv value hint that's not accurate.