[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bpm2jqi4qv5mkzikcazchdpzb2ztqhwldpyi6wyfowqsqsaobj@pltf2mfrbf7a>
Date: Tue, 5 Aug 2025 09:22:10 +0200
From: Stefano Garzarella <sgarzare@...hat.com>
To: Wang Liang <wangliang74@...wei.com>
Cc: bsdhenrymartin@...il.com, huntazhang@...cent.com, jitxie@...cent.com,
landonsun@...cent.com, bryan-bt.tan@...adcom.com, vishnu.dasa@...adcom.com,
bcm-kernel-feedback-list@...adcom.com, davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, horms@...nel.org, linux-kernel@...r.kernel.org,
virtualization@...ts.linux.dev, netdev@...r.kernel.org, Henry Martin <bsdhenryma@...cent.com>,
TCS Robot <tcs_robot@...cent.com>
Subject: Re: [PATCH] VSOCK: fix Integer Overflow in
vmci_transport_recv_dgram_cb()
On Tue, Aug 05, 2025 at 03:07:38PM +0800, Wang Liang wrote:
>
>在 2025/8/5 12:17, bsdhenrymartin@...il.com 写道:
>>From: Henry Martin <bsdhenryma@...cent.com>
>>
>>The vulnerability is triggered when processing a malicious VMCI datagram
>>with an extremely large `payload_size` value. The attack path is:
>>
>>1. Attacker crafts a malicious `vmci_datagram` with `payload_size` set
>> to a value near `SIZE_MAX` (e.g., `SIZE_MAX - offsetof(struct
>> vmci_datagram, payload) + 1`)
>>2. The function calculates: `size = VMCI_DG_SIZE(dg)` Where
>> `VMCI_DG_SIZE(dg)` expands to `offsetof(struct vmci_datagram,
>> payload) + dg->payload_size`
>>3. Integer overflow occurs during this addition, making `size` smaller
>> than the actual datagram size
>>
>>Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
>>Reported-by: TCS Robot <tcs_robot@...cent.com>
>>Signed-off-by: Henry Martin <bsdhenryma@...cent.com>
>>---
>> net/vmw_vsock/vmci_transport.c | 4 ++++
>> 1 file changed, 4 insertions(+)
>>
>>diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c
>>index 7eccd6708d66..07079669dd09 100644
>>--- a/net/vmw_vsock/vmci_transport.c
>>+++ b/net/vmw_vsock/vmci_transport.c
>>@@ -630,6 +630,10 @@ static int vmci_transport_recv_dgram_cb(void *data, struct vmci_datagram *dg)
>> if (!vmci_transport_allow_dgram(vsk, dg->src.context))
>> return VMCI_ERROR_NO_ACCESS;
>>+ /* Validate payload size to prevent integer overflow */
>>+ if (dg->payload_size > SIZE_MAX - offsetof(struct vmci_datagram, payload))
>>+ return VMCI_ERROR_INVALID_ARGS;
>>+
>
>
>The struct vmci_datagram has no member 'payload'. Your patch may
>trigger compile error.
@Wang thanks for the highlight!
mmm, so this is the 3rd no-sense patch from the same author!
Last advice for the author, please fix your bot and try your patches
before submitting it!
Stefano
>
>> size = VMCI_DG_SIZE(dg);
>> /* Attach the packet to the socket's receive queue as an sk_buff. */
>
Powered by blists - more mailing lists