mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v3 0/8] vsock: fix connect() races
@ 2026-09-22 13:14 Michal Luczaj
  2026-09-22 13:14 ` [PATCH net v3 1/8] vhost/vsock: Fix socket state constant Michal Luczaj
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Michal Luczaj @ 2026-09-22 13:14 UTC (permalink / raw)
  To: Stefan Hajnoczi, Stefano Garzarella, Michael S. Tsirkin,
	Jason Wang, Eugenio Pérez, David S. Miller, Xuan Zhuo,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman
  Cc: kvm, virtualization, netdev, linux-kernel, Michal Luczaj, Hyunwoo Kim

Handle racy socket changes in connect().

v3 is taking a different approach by turning transport assignment on its
head: instead of trying to preserve the transport between failed
connect()s, drop it from an _unconnected_ socket as soon as possible, i.e.
when something goes wrong with the init or binding, connection fails, time
outs or is interrupted by a signal. IOW, route the failure paths of
vsock_connect() and vsock_connect_timeout() through one point, replacing
the open coded state rollback. Starting from there, corner cases are
handled, invariant enforced.

What's perhaps more important, the bug fixes themselves do not touch the
driver code and do not introduce lockless writes.

---
Changes in v3:
- Change the transport assignment life cycle (Stafano)
- Expand comments (Stafano)
- CC: drop bouncing address
- Link to v2: https://patch.msgid.link/20260915-vsock-connect-reset-closing-v2-0-a1d9abb472f7@rbox.co

Changes in v2:
- CC: drop bouncing addresses
- Add more related fixes
- Handle ENOBUFS (Bobby)
- Consume sk_err (Stefano)
- Link to v1: https://patch.msgid.link/20260909-vsock-connect-reset-closing-v1-1-50298b9ccfbf@rbox.co

---
Michal Luczaj (8):
      vhost/vsock: Fix socket state constant
      vsock: simplify error check condition
      vsock: do not preserve transport assignment
      vsock: drop the re-assignment logic
      vsock: treat TCP_CLOSING as once-established
      vsock: handle socket bricking due to transport event
      vsock: handle listen() racing connect()
      vsock: enforce no-transport invariant for TCP_LISTEN sockets

 drivers/vhost/vsock.c    |   2 +-
 net/vmw_vsock/af_vsock.c | 142 +++++++++++++++++++++++++++--------------------
 2 files changed, 82 insertions(+), 62 deletions(-)
---
base-commit: 23d42b9a3bcd55b17d3b371544fedc708c2397e9
change-id: 20260820-vsock-connect-reset-closing-98dd28769d7f

Best regards,
--  
Michal Luczaj <mhal@rbox.co>


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

end of thread, other threads:[~2026-09-24 21:29 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-22 13:14 [PATCH net v3 0/8] vsock: fix connect() races Michal Luczaj
2026-09-22 13:14 ` [PATCH net v3 1/8] vhost/vsock: Fix socket state constant Michal Luczaj
2026-09-22 13:14 ` [PATCH net v3 2/8] vsock: simplify error check condition Michal Luczaj
2026-09-22 13:14 ` [PATCH net v3 3/8] vsock: do not preserve transport assignment Michal Luczaj
2026-09-24 13:15   ` netdev-bot+sashiko
2026-09-24 21:27     ` Michal Luczaj
2026-09-22 13:14 ` [PATCH net v3 4/8] vsock: drop the re-assignment logic Michal Luczaj
2026-09-24 13:15   ` netdev-bot+sashiko
2026-09-24 21:27     ` Michal Luczaj
2026-09-22 13:14 ` [PATCH net v3 5/8] vsock: treat TCP_CLOSING as once-established Michal Luczaj
2026-09-24 13:15   ` netdev-bot+sashiko
2026-09-24 21:27     ` Michal Luczaj
2026-09-22 13:15 ` [PATCH net v3 6/8] vsock: handle socket bricking due to transport event Michal Luczaj
2026-09-24 13:15   ` netdev-bot+sashiko
2026-09-24 21:28     ` Michal Luczaj
2026-09-22 13:15 ` [PATCH net v3 7/8] vsock: handle listen() racing connect() Michal Luczaj
2026-09-24 13:15   ` netdev-bot+sashiko
2026-09-24 21:28     ` Michal Luczaj
2026-09-22 13:15 ` [PATCH net v3 8/8] vsock: enforce no-transport invariant for TCP_LISTEN sockets Michal Luczaj

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®