In the Linux kernel, the following vulnerability has been resolved:
VMCI: Fix memcpy() run-time warning in dgdispatchas_host()
Syzkaller hit 'WARNING in dgdispatchas_host' bug.
memcpy: detected field-spanning write (size 56) of single field "&dginfo->msg" at drivers/misc/vmwvmci/vmci_datagram.c:237 (size 24)
WARNING: CPU: 0 PID: 1555 at drivers/misc/vmwvmci/vmcidatagram.c:237 dgdispatchashost+0x88e/0xa60 drivers/misc/vmwvmci/vmci_datagram.c:237
Some code commentry, based on my understanding:
544 #define VMCIDGSIZE(dg) (VMCIDGHEADERSIZE + (sizet)(dg)->payloadsize) /// This is 24 + payload_size
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 + payload_size
{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 msg_payload[], 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 FORTIFY_SOURCE we should not copy data across multiple members in a structure."
[
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@491a1eb07c2bd8841d63cb5263455e185be5866f",
"id": "CVE-2024-35944-010bacf9",
"target": {
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"310146753561345813753102631521826636595",
"265111345993100202593193839895589492565",
"4897091661942331569215850796881492145",
"78242023956565262299314400560971290738"
]
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@dae70a57565686f16089737adb8ac64471570f73",
"id": "CVE-2024-35944-04610739",
"target": {
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"310146753561345813753102631521826636595",
"265111345993100202593193839895589492565",
"4897091661942331569215850796881492145",
"78242023956565262299314400560971290738"
]
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@130b0cd064874e0d0f58e18fb00e6f3993e90c74",
"id": "CVE-2024-35944-070492c1",
"target": {
"function": "dg_dispatch_as_host",
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Function",
"digest": {
"length": 2610.0,
"function_hash": "134537960896954537066180762355968797556"
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@19b070fefd0d024af3daa7329cbc0d00de5302ec",
"id": "CVE-2024-35944-1d4c3435",
"target": {
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"310146753561345813753102631521826636595",
"265111345993100202593193839895589492565",
"4897091661942331569215850796881492145",
"78242023956565262299314400560971290738"
]
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ad78c5047dc4076d0b3c4fad4f42ffe9c86e8100",
"id": "CVE-2024-35944-230473ae",
"target": {
"function": "dg_dispatch_as_host",
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Function",
"digest": {
"length": 2610.0,
"function_hash": "134537960896954537066180762355968797556"
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e87bb99d2df6512d8ee37a5d63d2ca9a39a8c051",
"id": "CVE-2024-35944-2ca073f8",
"target": {
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"310146753561345813753102631521826636595",
"265111345993100202593193839895589492565",
"4897091661942331569215850796881492145",
"78242023956565262299314400560971290738"
]
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f15eca95138b3d4ec17b63c3c1937b0aa0d3624b",
"id": "CVE-2024-35944-47a2b31e",
"target": {
"function": "dg_dispatch_as_host",
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Function",
"digest": {
"length": 2610.0,
"function_hash": "134537960896954537066180762355968797556"
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e87bb99d2df6512d8ee37a5d63d2ca9a39a8c051",
"id": "CVE-2024-35944-59ee46f7",
"target": {
"function": "dg_dispatch_as_host",
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Function",
"digest": {
"length": 2610.0,
"function_hash": "134537960896954537066180762355968797556"
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@491a1eb07c2bd8841d63cb5263455e185be5866f",
"id": "CVE-2024-35944-73711cdb",
"target": {
"function": "dg_dispatch_as_host",
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Function",
"digest": {
"length": 2610.0,
"function_hash": "134537960896954537066180762355968797556"
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ad78c5047dc4076d0b3c4fad4f42ffe9c86e8100",
"id": "CVE-2024-35944-90fa061a",
"target": {
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"310146753561345813753102631521826636595",
"265111345993100202593193839895589492565",
"4897091661942331569215850796881492145",
"78242023956565262299314400560971290738"
]
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@130b0cd064874e0d0f58e18fb00e6f3993e90c74",
"id": "CVE-2024-35944-b0987917",
"target": {
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"310146753561345813753102631521826636595",
"265111345993100202593193839895589492565",
"4897091661942331569215850796881492145",
"78242023956565262299314400560971290738"
]
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f15eca95138b3d4ec17b63c3c1937b0aa0d3624b",
"id": "CVE-2024-35944-ea8d1b06",
"target": {
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Line",
"digest": {
"threshold": 0.9,
"line_hashes": [
"310146753561345813753102631521826636595",
"265111345993100202593193839895589492565",
"4897091661942331569215850796881492145",
"78242023956565262299314400560971290738"
]
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@19b070fefd0d024af3daa7329cbc0d00de5302ec",
"id": "CVE-2024-35944-f246234a",
"target": {
"function": "dg_dispatch_as_host",
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Function",
"digest": {
"length": 2614.0,
"function_hash": "308924403127134651440833256615013599307"
},
"deprecated": false
},
{
"signature_version": "v1",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@dae70a57565686f16089737adb8ac64471570f73",
"id": "CVE-2024-35944-fcc8ed94",
"target": {
"function": "dg_dispatch_as_host",
"file": "drivers/misc/vmw_vmci/vmci_datagram.c"
},
"signature_type": "Function",
"digest": {
"length": 2610.0,
"function_hash": "134537960896954537066180762355968797556"
},
"deprecated": false
}
]