Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Bobby Eshleman <bobbyeshleman@gmail.com>
To: sashiko-reviews@lists.linux.dev
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH net-next 2/6] vsock: add IOCTL_VM_SOCKETS_ASSIGN_G2H_NETNS
Date: Fri, 4 Sep 2026 16:49:23 -0700	[thread overview]
Message-ID: <aptZA/uA/6Cwi/Ne@devvm29614.prn0.facebook.com> (raw)
In-Reply-To: <20260903230146.DD5351F000E9@smtp.kernel.org>

On Thu, Sep 03, 2026 at 11:01:46PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Unreachable connections are forcefully closed without notifying the transport, causing zombie connections on the remote host.
> --
> 
> commit f3fdca73a2fc67941333bcc7521ccf2e755bdfaf
> Author: Bobby Eshleman <bobbyeshleman@meta.com>
> 
> vsock: add IOCTL_VM_SOCKETS_ASSIGN_G2H_NETNS
> 
> This commit introduces an ioctl to assign a guest's vsock device to a
> specific network namespace. When the device moves to a disallowed namespace,
> existing sockets are reset to prevent unauthorized reachability.
> 
> Link: https://lore.kernel.org/all/20200427142518.uwssa6dtasrp3bfc@steredhat/
> 
> > diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
> > index 29cde17e08f31..ad11f0f56eb8a 100644
> > --- a/net/vmw_vsock/af_vsock.c
> > +++ b/net/vmw_vsock/af_vsock.c
> [ ... ]
> > @@ -710,6 +751,140 @@ bool vsock_find_cid(unsigned int cid)
> [ ... ]
> > +static void vsock_reset_unreachable_sock(struct sock *sk)
> > +{
> > +	if (vsock_g2h_net_reachable(sock_net(sk)))
> > +		return;
> > +
> > +	sk->sk_state = TCP_CLOSE;
> > +	sk->sk_err = ECONNRESET;
> > +	sk_error_report(sk);
> > +}
> 
> [Severity: High]
> Does forcefully setting the socket state to TCP_CLOSE here prevent the
> transport from notifying the remote host?
> 
> When the state is set directly to TCP_CLOSE, a transport's release function
> (like virtio_transport_release()) may see the socket as already fully
> terminated and skip sending a reset message (like VIRTIO_VSOCK_OP_RST) to
> the host.
> 
> Since this ioctl can be triggered by a guest user with CAP_NET_ADMIN in the
> init user namespace, could this lead to zombie connections accumulating on
> the host hypervisor, potentially allowing a guest to exhaust host resources
> because the host is never informed of the dropped connections?

This only happens if the host-side socket is completely idle. The next
pkt will trigger virtio_transport_recv_pkt() to respond with RST. This
is the same thing that happens after VIRTIO_VSOCK_EVENT_TRANSPORT_RESET
or virtio_vsock_vqs_del().

Best,
Bobby

  reply	other threads:[~2026-09-04 23:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 23:00 [PATCH net-next 0/6] vsock: assign the guest vsock device to a network namespace Bobby Eshleman
2026-09-02 23:00 ` [PATCH net-next 1/6] vsock: constify the transport in vsock_for_each_connected_socket() Bobby Eshleman
2026-09-02 23:00 ` [PATCH net-next 2/6] vsock: add IOCTL_VM_SOCKETS_ASSIGN_G2H_NETNS Bobby Eshleman
2026-09-02 23:35   ` Randy Dunlap
2026-09-02 23:58     ` Bobby Eshleman
2026-09-03 23:01   ` sashiko-bot
2026-09-04 23:49     ` Bobby Eshleman [this message]
2026-09-02 23:00 ` [PATCH net-next 3/6] vsock/virtio: support guest device network namespace Bobby Eshleman
2026-09-02 23:00 ` [PATCH net-next 4/6] selftests/vsock: add a helper to assign the g2h device to a netns Bobby Eshleman
2026-09-02 23:00 ` [PATCH net-next 5/6] selftests/vsock: test the guest vsock device network namespace Bobby Eshleman
2026-09-02 23:00 ` [PATCH net-next 6/6] selftests/vsock: test the assign ioctl privilege checks Bobby Eshleman
2026-09-03 23:01   ` sashiko-bot
2026-09-04 17:33     ` Bobby Eshleman
2026-09-04  8:55 ` [PATCH net-next 0/6] vsock: assign the guest vsock device to a network namespace Stefano Garzarella
2026-09-04 17:30   ` Bobby Eshleman

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=aptZA/uA/6Cwi/Ne@devvm29614.prn0.facebook.com \
    --to=bobbyeshleman@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