CVE-2024-35944: VMCI: Fix memcpy() run-time warning in dg_dispatch_as_host()
In the Linux kernel, the following vulnerability has been resolved:
VMCI: Fix memcpy() run-time warning in dgdispatchashost()
Syzkaller hit 'WARNING in dgdispatchashost' bug.
memcpy: detected field-spanning write (size 56) of single field "&dginfo->msg" at drivers/misc/vmwvmci/vmcidatagram.c:237 (size 24)
WARNING: CPU: 0 PID: 1555 at drivers/misc/vmwvmci/vmcidatagram.c:237 dgdispatchashost+0x88e/0xa60 drivers/misc/vmwvmci/vmcidatagram.c:237
Some code commentry, based on my understanding:
544 #define VMCIDGSIZE(dg) (VMCIDGHEADERSIZE + (sizet)(dg)->payloadsize) /// This is 24 + payloadsize
memcpy(&dginfo->msg, dg, dgsize); Destination = dginfo->msg ---> this is a 24 byte structure(struct vmcidatagram) Source = dg --> this is a 24 byte structure (struct vmcidatagram) Size = dgsize = 24 + payloadsize
{payloadsize = 56-24 =32} -- Syzkaller managed to set payloadsize to 32.
35 struct delayeddatagraminfo { 36 struct datagramentry entry; 37 struct workstruct work; 38 bool indghostqueue; 39 / msg and msgpayload must be together. / 40 struct vmcidatagram msg; 41 u8 msgpayload[]; 42 };
So those extra bytes of payload are copied into msgpayload[], a run time warning is seen while fuzzing with Syzkaller.
One possible way to fix the warning is to split the memcpy() into two parts -- one -- direct assignment of msg and second taking care of payload.
Gustavo quoted: "Under FORTIFYSOURCE we should not copy data across multiple members in a structure."
Other sources
In the Linux kernel, the following vulnerability has been resolved:
VMCI: Fix memcpy() run-time warning in dgdispatchashost()
The Linux kernel CVE team has assigned CVE-2024-35944 to this issue.
Upstream advisory: https://lore.kernel.org/linux-cve-announce/2024051920-CVE-2024-35944-a860@gregkh/T
— Red Hat
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-35944?
CVE-2024-35944 has been categorized with a severity that may lead to runtime warnings affecting the Linux kernel's VMCI subsystem.
How do I fix CVE-2024-35944?
To remediate CVE-2024-35944, update the Linux kernel to versions 4.19.312, 5.4.274, 5.10.215, 5.15.155, 6.1.86, 6.6.27, 6.8.6, or 6.9 as specified.
Which systems are affected by CVE-2024-35944?
CVE-2024-35944 impacts certain versions of the Linux kernel across various distributions such as Red Hat and Debian.
What does the fix for CVE-2024-35944 address?
The fix for CVE-2024-35944 addresses a memcpy runtime warning in the dg_dispatch_as_host function in the Linux kernel.
Is it safe to continue using vulnerable versions related to CVE-2024-35944?
It is not safe to continue using vulnerable versions associated with CVE-2024-35944 due to potential runtime warnings and instability issues.