From: sashiko-bot@kernel.org
To: "Daehyeon Ko" <4ncienth@gmail.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH net] vsock/virtio: validate packet source for connected sockets
Date: Fri, 14 Aug 2026 12:12:54 +0000 [thread overview]
Message-ID: <20260814121255.6B5001F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260813121236.2328599-1-4ncienth@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The identical destination-only fallback vulnerability fixed in `virtio_transport` exists unpatched in `vmci_transport.c`.
--
--- Patch [1]: [PATCH net] vsock/virtio: validate packet source for connected sockets ---
commit cb88c0daae92eec924188a4684efd077dd9df9cd
Author: Daehyeon Ko <4ncienth@gmail.com>
Subject: vsock/virtio: validate packet source for connected sockets
This commit fixes a vulnerability in the virtio socket transport where
packets from an unrelated source could be incorrectly dispatched to a
non-listening socket via a destination-only fallback lookup.
> diff --git a/net/vmw_vsock/virtio_transport_common.c b/net/vmw_vsock/virtio_transport_common.c
> index 8becad81279c8..f73e0406a790a 100644
> --- a/net/vmw_vsock/virtio_transport_common.c
> +++ b/net/vmw_vsock/virtio_transport_common.c
[ ... ]
> @@ -1822,11 +1822,15 @@ void virtio_transport_recv_pkt(struct virtio_transport *t,
>
> lock_sock(sk);
>
> - /* Check if sk has been closed or assigned to another transport before
> - * lock_sock (note: listener sockets are not assigned to any transport)
> + /* Check if sk has been closed, assigned to another transport, or if the
> + * packet is from a different peer than the one connected to sk. These
> + * properties could have changed before lock_sock. Listener sockets are
> + * not assigned to any transport and accept packets from any peer.
> */
> if (sock_flag(sk, SOCK_DONE) ||
> - (sk->sk_state != TCP_LISTEN && vsk->transport != &t->transport)) {
> + (sk->sk_state != TCP_LISTEN &&
> + (vsk->transport != &t->transport ||
> + !vsock_addr_equals_addr(&src, &vsk->remote_addr)))) {
[Severity: High]
This isn't a bug introduced by this patch, but does the same vulnerability
exist unpatched in the VMCI transport?
Looking at net/vmw_vsock/vmci_transport.c:vmci_transport_recv_stream_cb(),
it appears to use the same fallback logic where it can return an established
socket if the connected socket lookup misses:
net/vmw_vsock/vmci_transport.c:vmci_transport_recv_stream_cb() {
...
sk = vsock_find_bound_socket(&dst);
...
}
The packet is then processed by vmci_transport_recv_pkt_work() which
calls vmci_transport_recv_connected() for TCP_ESTABLISHED sockets:
net/vmw_vsock/vmci_transport.c:vmci_transport_recv_pkt_work() {
...
case TCP_ESTABLISHED:
vmci_transport_recv_connected(sk, pkt);
break;
...
}
Neither of these functions appears to verify that the packet's source
address matches the socket's remote_addr before processing it.
Could this allow an attacker to inject control packets into an established
connection and cause a denial of service?
net/vmw_vsock/vmci_transport.c:vmci_transport_recv_connected() {
...
case VMCI_TRANSPORT_PACKET_TYPE_RST:
vsk = vsock_sk(sk);
sock_set_flag(sk, SOCK_DONE);
WRITE_ONCE(vsk->peer_shutdown, SHUTDOWN_MASK);
...
}
Should a similar validation be added to vmci_transport_recv_pkt_work() or
the VMCI handlers?
> (void)virtio_transport_reset_no_sock(t, skb, net);
> release_sock(sk);
> sock_put(sk);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260813121236.2328599-1-4ncienth@gmail.com?part=1
next prev parent reply other threads:[~2026-08-14 12:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 12:12 [PATCH net] vsock/virtio: validate packet source for connected sockets Daehyeon Ko
2026-08-14 12:12 ` sashiko-bot [this message]
2026-08-14 12:23 ` Stefano Garzarella
2026-08-17 17:56 ` Bobby Eshleman
2026-08-18 18:37 ` Daehyeon Ko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260814121255.6B5001F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=4ncienth@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox