kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v4 0/2] vsock: validate packet sources after bound lookup fallback
@ 2026-08-26  0:39 Daehyeon Ko
  2026-08-26  0:39 ` [PATCH net v4 1/2] vsock/virtio: validate packet source for connected sockets Daehyeon Ko
  2026-08-26  0:39 ` [PATCH net v4 2/2] vsock/vmci: " Daehyeon Ko
  0 siblings, 2 replies; 3+ messages in thread
From: Daehyeon Ko @ 2026-08-26  0:39 UTC (permalink / raw)
  To: netdev
  Cc: sgarzare, stefanha, bobbyeshleman, davem, edumazet, kuba, pabeni,
	horms, mst, jasowangio, xuanzhuo, eperezma, bryan-bt.tan,
	vishnu.dasa, bcm-kernel-feedback-list, virtualization, kvm,
	linux-kernel

Both virtio and VMCI look up connected sockets by the full tuple before
falling back to a destination-only bound lookup. The fallback can select a
non-listening socket without validating the packet source.

V2 covered only the virtio path. Following Stefano's review, this series
moves the source and transport validation into a documented AF_VSOCK helper
and uses it for both virtio and VMCI. The VMCI patch checks both its
bottom-half and deferred workqueue receive paths.

V4 preserves VMCI's existing RST behavior when source validation fails.
The reset is addressed from the received packet so that a bound but
non-listening or concurrently closed socket still notifies the sender,
without directing the reset to a connected socket's stored peer.

The v3 regression was reproduced in three x86_64 KASAN boots: a REQUEST to
a bound but non-listening socket returned VMCI_ERROR_NO_ACCESS but no RST
arrived within one second. With v4, the sending context received the
expected RST in all three boots. The original VMCI source-validation oracle
also passed in three v4 boots: a matched RST reset the pending socket while
a mismatched-context RST left it pending. No KASAN report occurred.

Patch 1 is unchanged from v3 (identical stable patch-id) and carries
Bobby's Reviewed-by for that revision. Its v3 validation covered the
cross-UID injection oracle, local CID aliases, selected VSOCK selftests,
and W=1 changed-object builds under allmodconfig and allyesconfig.

The current-tree guest-CID vhost probe could not be rerun because the test
user lacks access to /dev/vhost-vsock.

---
Changes in v4:
- Preserve RST replies when VMCI source validation rejects a packet.
- Address those replies from the received packet rather than the socket's
  stored peer.
- Add a bound-but-not-listening VMCI regression oracle.
- Rebase to the current net tree.

Changes in v3:
- Move transport and source validation into vsock_check_source().
- Trust the internally generated source CID for the local transport.
- Add VMCI validation in the bottom-half and workqueue receive paths.
- Send the related virtio and VMCI fixes in one series.
- Do not carry Bobby's v2 Reviewed-by because the helper and loopback logic
  changed; renewed review is requested.

v3:
https://lore.kernel.org/r/20260823175858.351431-1-4ncienth@gmail.com
v2:
https://lore.kernel.org/r/20260820001517.2148196-1-4ncienth@gmail.com
v1:
https://lore.kernel.org/r/20260813121236.2328599-1-4ncienth@gmail.com

Daehyeon Ko (2):
  vsock/virtio: validate packet source for connected sockets
  vsock/vmci: validate packet source for connected sockets

 include/net/af_vsock.h                  |  3 +++
 net/vmw_vsock/af_vsock.c                | 32 +++++++++++++++++++++++
 net/vmw_vsock/virtio_transport_common.c |  3 ++-
 net/vmw_vsock/vmci_transport.c          | 34 ++++++++++++++++++++-----
 4 files changed, 65 insertions(+), 7 deletions(-)


base-commit: dc4b95b8fee95113587e93ca116356032d271371

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-26  0:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-26  0:39 [PATCH net v4 0/2] vsock: validate packet sources after bound lookup fallback Daehyeon Ko
2026-08-26  0:39 ` [PATCH net v4 1/2] vsock/virtio: validate packet source for connected sockets Daehyeon Ko
2026-08-26  0:39 ` [PATCH net v4 2/2] vsock/vmci: " Daehyeon Ko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).