netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 0/5] vsock: some fixes due to transport de-assignment
@ 2025-01-10  8:35 Stefano Garzarella
  2025-01-10  8:35 ` [PATCH net v2 1/5] vsock/virtio: discard packets if the transport changes Stefano Garzarella
                   ` (5 more replies)
  0 siblings, 6 replies; 26+ messages in thread
From: Stefano Garzarella @ 2025-01-10  8:35 UTC (permalink / raw)
  To: netdev
  Cc: Xuan Zhuo, bpf, linux-kernel, Luigi Leonardi, David S. Miller,
	Wongi Lee, Stefano Garzarella, Eugenio Pérez,
	Michael S. Tsirkin, Eric Dumazet, kvm, Paolo Abeni,
	Stefan Hajnoczi, Jason Wang, Simon Horman, Hyunwoo Kim,
	Jakub Kicinski, Michal Luczaj, virtualization, Bobby Eshleman

v1: https://lore.kernel.org/netdev/20250108180617.154053-1-sgarzare@redhat.com/
v2:
- Added patch 3 to cancel the virtio close delayed work when de-assigning
  the transport
- Added patch 4 to clean the socket state after de-assigning the transport
- Added patch 5 as suggested by Michael and Hyunwoo Kim. It's based on
  Hyunwoo Kim and Wongi Lee patch [1] but using WARN_ON and covering more
  functions
- Added R-b/T-b tags

This series includes two patches discussed in the thread started by
Hyunwoo Kim a few weeks ago [1], plus 3 more patches added after some
discussions on v1 (see changelog). All related to the case where a vsock
socket is de-assigned from a transport (e.g., because the connect fails
or is interrupted by a signal) and then assigned to another transport
or to no-one (NULL).

I tested with usual vsock test suite, plus Michal repro [2]. (Note: the repo
works only if a G2H transport is not loaded, e.g. virtio-vsock driver).

The first patch is a fix more appropriate to the problem reported in
that thread, the second patch on the other hand is a related fix but
of a different problem highlighted by Michal Luczaj. It's present only
in vsock_bpf and already handled in af_vsock.c
The third patch is to cancel the virtio close delayed work when de-assigning
the transport, the fourth patch is to clean the socket state after de-assigning
the transport, the last patch adds warnings and prevents null-ptr-deref in
vsock_*[has_data|has_space].

Hyunwoo Kim, Michal, if you can test and report your Tested-by that
would be great!

[1] https://lore.kernel.org/netdev/Z2K%2FI4nlHdfMRTZC@v4bel-B760M-AORUS-ELITE-AX/
[2] https://lore.kernel.org/netdev/2b3062e3-bdaa-4c94-a3c0-2930595b9670@rbox.co/

Stefano Garzarella (5):
  vsock/virtio: discard packets if the transport changes
  vsock/bpf: return early if transport is not assigned
  vsock/virtio: cancel close work in the destructor
  vsock: reset socket state when de-assigning the transport
  vsock: prevent null-ptr-deref in vsock_*[has_data|has_space]

 net/vmw_vsock/af_vsock.c                | 18 +++++++++++++
 net/vmw_vsock/virtio_transport_common.c | 36 ++++++++++++++++++-------
 net/vmw_vsock/vsock_bpf.c               |  9 +++++++
 3 files changed, 53 insertions(+), 10 deletions(-)


base-commit: fbfd64d25c7af3b8695201ebc85efe90be28c5a3
-- 
2.47.1


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

end of thread, other threads:[~2025-01-17 22:03 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-10  8:35 [PATCH net v2 0/5] vsock: some fixes due to transport de-assignment Stefano Garzarella
2025-01-10  8:35 ` [PATCH net v2 1/5] vsock/virtio: discard packets if the transport changes Stefano Garzarella
2025-01-10 22:46   ` Hyunwoo Kim
2025-01-12 22:42   ` Michal Luczaj
2025-01-13  8:57     ` Stefano Garzarella
2025-01-13  9:07       ` Stefano Garzarella
2025-01-13 10:12         ` Michal Luczaj
2025-01-13 11:05           ` Stefano Garzarella
2025-01-13 13:51             ` Michal Luczaj
2025-01-13 15:01               ` Stefano Garzarella
2025-01-14  0:09                 ` Michal Luczaj
2025-01-14 10:16                   ` Stefano Garzarella
2025-01-14 16:31                     ` Michal Luczaj
2025-01-16  8:57                       ` Stefano Garzarella
2025-01-17 22:02                         ` Michal Luczaj
2025-01-10  8:35 ` [PATCH net v2 2/5] vsock/bpf: return early if transport is not assigned Stefano Garzarella
2025-01-10  8:35 ` [PATCH net v2 3/5] vsock/virtio: cancel close work in the destructor Stefano Garzarella
2025-01-10 10:57   ` Luigi Leonardi
2025-01-10 22:48   ` Hyunwoo Kim
2025-01-10  8:35 ` [PATCH net v2 4/5] vsock: reset socket state when de-assigning the transport Stefano Garzarella
2025-01-10 10:56   ` Luigi Leonardi
2025-01-10 11:25     ` Stefano Garzarella
2025-01-10  8:35 ` [PATCH net v2 5/5] vsock: prevent null-ptr-deref in vsock_*[has_data|has_space] Stefano Garzarella
2025-01-10  9:49   ` Luigi Leonardi
2025-01-10 22:52   ` Hyunwoo Kim
2025-01-14 11:50 ` [PATCH net v2 0/5] vsock: some fixes due to transport de-assignment patchwork-bot+netdevbpf

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).