All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bobby Eshleman <bobbyeshleman@meta.com>
To: Stefano Garzarella <sgarzare@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Simon Horman" <horms@kernel.org>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowangio@gmail.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Shuah Khan" <shuah@kernel.org>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Donald Hunter" <donald.hunter@gmail.com>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"George Zhang" <georgezhang@vmware.com>,
	"Andy King" <acking@vmware.com>,
	"Dmitry Torokhov" <dtor@vmware.com>,
	"Willem de Bruijn" <willemb@google.com>,
	virtualization@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	kvm@vger.kernel.org, linux-kselftest@vger.kernel.org,
	sargun@sargun.me, jlinbox@meta.com
Subject: Re: [PATCH net-next v8 0/7] vsock: assign the guest vsock device to a network namespace
Date: Wed, 2 Dec 2026 18:06:54 -0800	[thread overview]
Message-ID: <axDOvpwmS+mR6cyd@devvm29614.prn0.facebook.com> (raw)
In-Reply-To: <axBfZ6dAEoqFJVBY@sgarzare-redhat>

On Wed, Dec 02, 2026 at 07:15:14PM +0100, Stefano Garzarella wrote:
> On Mon, Nov 30, 2026 at 05:06:48PM -0800, Bobby Eshleman wrote:
> > vsock network namespaces let a host put each VM in a namespace of its
> > own. A guest has no equivalent yet. It has a single G2H device that
> > cannot be assigned to a network namespace.
> > 
> > This series lets a guest move that device into a network namespace. A
> > new generic netlink family, "vsock", supports the command
> > VSOCK_CMD_DEV_NETNS_SET which assigns the device to the namespace given
> > by fd or PID, or else to the namespace the request was sent from. The
> > namespace's existing ns_mode then decides who may use it: a "global"
> > namespace shares the device with every other global namespace, and a
> > "local" namespace keeps the host connection to itself. The device starts
> > out in the initial namespace, so until the command is issued global
> > namespaces see no change, and local namespaces still cannot use it.
> > There is no explicit unassign as assigning the device back to the
> > initial namespace is equivalent.
> > 
> > The command requires CAP_NET_ADMIN in the initial user namespace, so
> > that an unprivileged user namespace cannot claim the device.
> > 
> > Connections that can no longer reach the device after a move are reset,
> > so that a namespace which has lost access cannot keep using a socket it
> > opened while it still had access. They are reset the same way as when
> > the device is removed, so to the old namespace a move looks like an
> > unplug. The assignment holds a reference on the namespace, so deleting
> > that namespace does not move the device; only another assignment does.
> > 
> > Because a move looks like an unplug, swept sockets share two known
> > issues with unplug and replug: connect() can fail with ECONNRESET and
> > leave the socket SS_CONNECTED, and shutdown() and credit updates can
> > still be sent once the device is reachable again. These will be
> > addressed in a separate series.
> > 
> > A socket swept while connect() sleeps hits the same connect() vs reset
> > race as on unplug, which is fixed separately in net. This series builds
> > and applies without it:
> > https://lore.kernel.org/all/20261117-vsock-connect-close-v2-1-db5388323770@meta.com/
> > 
> > Transports opt in through a new netns_assign_allow flag. Only
> > virtio-vsock sets it here, because it is the only guest transport
> > that I am able to test against.
> > 
> > Based off of Stefano's original series:
> > https://lore.kernel.org/all/20200116172428.311437-1-sgarzare@redhat.com/
> > 
> > Suggested-by: Stefano Garzarella <sgarzare@redhat.com>
> > Link: https://lore.kernel.org/all/20200427142518.uwssa6dtasrp3bfc@steredhat/
> > Signed-off-by: Bobby Eshleman <bobbyeshleman@meta.com>
> > ---
> > Changes in v8:
> > - When the device moves to a netns that can no longer reach it, model
> >  the behavior after a device unplug instead of a peer RST. This
> >  simplifies the code by reusing vsock_for_each_connected_socket() and
> >  dropping the lock_sock() sweep, vsock_g2h_assign_mutex and the
> >  SOCK_DONE/peer_shutdown/TCP_CLOSING juggling
> > - Drop cancel_pkt() of swept sockets, so purged skbs no longer leave
> >  vvs->bytes_unsent elevated (Sashiko)
> > - Swept sockets now behave as after an unplug: recv() returns -ENOTCONN
> >  rather than EOF, and SIOCINQ may report bytes that recv() can no longer
> >  read (fixing that requires recvmsg() to drain regardless of socket
> >  state)
> > - Fix stale comments
> > - Rebased to latest net-next, the tap netns fix is now merged
> > - Link to v7: https://lore.kernel.org/r/20261117-vsock-guest-ns-v7-0-7e522ea9dd9b@meta.com
> > 
> 
> Aaaaa, I tried spending time today to review this, but I failed, sorry :-(
> 
> FYI I'll be travelling till Dec 8, so on Dec 9 this will be my priority.
> 
> Sorry about that!
> Stefano

No worries, safe travels!

Best,
Bobby

      reply	other threads:[~2026-12-03  2:07 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  1:06 [PATCH net-next v8 0/7] vsock: assign the guest vsock device to a network namespace Bobby Eshleman
2026-12-01  1:06 ` [PATCH net-next v8 1/7] vsock: constify the transport in vsock_for_each_connected_socket() Bobby Eshleman
2026-12-01  1:06 ` [PATCH net-next v8 2/7] vsock: rename the vsock pernet operations Bobby Eshleman
2026-12-01  1:06 ` [PATCH net-next v8 3/7] vsock: pass the netns to ->has_remote_cid() Bobby Eshleman
2026-12-01  1:06 ` [PATCH net-next v8 4/7] vsock: add a netlink command to assign the g2h device to a netns Bobby Eshleman
2026-12-01 16:19   ` Michal Luczaj
2026-12-01 21:05     ` Bobby Eshleman
2026-12-02 19:26       ` Michal Luczaj
2026-12-02  1:08   ` sashiko-bot
2026-12-02 19:07   ` netdev-bot+sashiko
2026-12-01  1:06 ` [PATCH net-next v8 5/7] vsock/virtio: support guest device network namespace Bobby Eshleman
2026-12-02  1:08   ` sashiko-bot
2026-12-02 19:07   ` netdev-bot+sashiko
2026-12-01  1:06 ` [PATCH net-next v8 6/7] selftests/vsock: test the guest vsock " Bobby Eshleman
2026-12-02 19:07   ` netdev-bot+sashiko
2026-12-01  1:06 ` [PATCH net-next v8 7/7] selftests/vsock: test the netns assign privilege checks Bobby Eshleman
2026-12-02 19:07   ` netdev-bot+sashiko
2026-12-02  1:08 ` [PATCH net-next v8 0/7] vsock: assign the guest vsock device to a network namespace sashiko-bot
2026-12-02 18:15 ` Stefano Garzarella
2026-12-03  2:06   ` Bobby Eshleman [this message]

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=axDOvpwmS+mR6cyd@devvm29614.prn0.facebook.com \
    --to=bobbyeshleman@meta.com \
    --cc=acking@vmware.com \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=dtor@vmware.com \
    --cc=edumazet@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=georgezhang@vmware.com \
    --cc=horms@kernel.org \
    --cc=jasowangio@gmail.com \
    --cc=jlinbox@meta.com \
    --cc=kuba@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=sargun@sargun.me \
    --cc=sgarzare@redhat.com \
    --cc=shuah@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux.dev \
    --cc=willemb@google.com \
    --cc=xuanzhuo@linux.alibaba.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.