Re: [PATCH v2] vsock/vmci: reject datagram binds in local network namespaces
From: Stefano Garzarella
Date: Thu Nov 19 2026 - 04:10:54 EST
On Tue, Nov 17, 2026 at 08:01:52PM +0100, Sergio Lopez wrote:
VMCI already rejects datagram sends from local network namespaces, but a
datagram bind still creates a receive handle in VMCI's global port space.
A VMCI sender outside the namespace can therefore deliver to the local
socket. Its handle also prevents a global-namespace socket from binding
the same port.
Reject VMCI datagram binds in local namespaces. No namespace-local
datagram transport exists, so EOPNOTSUPP reflects the available receive
paths. Unbound datagram connect() and sendmsg() also return EOPNOTSUPP
because both call vsock_auto_bind(). The receive callback rejects any
local-mode socket as a defensive check.
In a KASAN/lockdep QEMU guest, a reproducer observed cross-namespace
delivery and the global port collision before the fix. After the fix,
local bind returns EOPNOTSUPP, the global bind succeeds, and a global
VMCI datagram still reaches the global socket.
Fixes: eafb64f40ca4 ("vsock: add netns to vsock core")
Cc: stable@xxxxxxxxxxxxxxx
Link: https://lore.kernel.org/all/sashiko-outbox-212907@xxxxxxxxxx/
Acked-by: Bobby Eshleman <bobbyeshleman@xxxxxxxx>
Signed-off-by: Sergio Lopez <slp@xxxxxxxxxx>
---
Changes in v2:
- Combine the VMCI receive checks and clarify the auto-bind effects on
datagram connect() and sendmsg() (thanks to Stefano Garzarella).
- Carry Bobby Eshleman's Acked-by.
- Link to v1: https://lore.kernel.org/r/20261113-vsock-vmci-netns-isolation-v1-1-ced02054ea61@xxxxxxxxxx
---
net/vmw_vsock/vmci_transport.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
Reviewed-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>