netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC net v2 0/3] vsock: Fix transport_{h2g,g2h,dgram,local} TOCTOU issues
@ 2025-06-20 19:52 Michal Luczaj
  2025-06-20 19:52 ` [PATCH RFC net v2 1/3] vsock: Fix transport_{g2h,h2g} TOCTOU Michal Luczaj
                   ` (2 more replies)
  0 siblings, 3 replies; 20+ messages in thread
From: Michal Luczaj @ 2025-06-20 19:52 UTC (permalink / raw)
  To: Stefano Garzarella, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Stefan Hajnoczi
  Cc: virtualization, netdev, linux-kernel, Michal Luczaj

transport_{h2g,g2h,dgram,local} may become NULL on vsock_core_unregister().
Make sure a poorly timed `rmmod transport` won't lead to a NULL/stale
pointer dereference.

Note that these oopses are pretty unlikely to happen in the wild. Splats
were collected after sprinkling kernel with mdelay()s.

Signed-off-by: Michal Luczaj <mhal@rbox.co>
---
Changes in v2:
- Introduce a helper function to get local CIDs safely [Stefano]
- Rename goto label to indicate an error path, explain why releasing
  vsock_register_mutex after try_module_get() is safe [Stefano]
- Link to v1: https://lore.kernel.org/r/20250618-vsock-transports-toctou-v1-0-dd2d2ede9052@rbox.co

---
Michal Luczaj (3):
      vsock: Fix transport_{g2h,h2g} TOCTOU
      vsock: Fix transport_* TOCTOU
      vsock: Fix IOCTL_VM_SOCKETS_GET_LOCAL_CID to check also `transport_local`

 net/vmw_vsock/af_vsock.c | 53 ++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 42 insertions(+), 11 deletions(-)
---
base-commit: e0fca6f2cebff539e9317a15a37dcf432e3b851a
change-id: 20250523-vsock-transports-toctou-4b75d9c2a805

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


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

end of thread, other threads:[~2025-07-02 13:44 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-20 19:52 [PATCH RFC net v2 0/3] vsock: Fix transport_{h2g,g2h,dgram,local} TOCTOU issues Michal Luczaj
2025-06-20 19:52 ` [PATCH RFC net v2 1/3] vsock: Fix transport_{g2h,h2g} TOCTOU Michal Luczaj
2025-06-25  8:43   ` Stefano Garzarella
2025-06-25 21:23     ` Michal Luczaj
2025-06-27  8:02       ` Stefano Garzarella
2025-06-29 21:26         ` Michal Luczaj
2025-06-30  9:05           ` Stefano Garzarella
2025-06-30 11:02             ` Michal Luczaj
2025-07-01 10:34               ` Stefano Garzarella
2025-07-02 13:44                 ` Michal Luczaj
2025-06-20 19:52 ` [PATCH RFC net v2 2/3] vsock: Fix transport_* TOCTOU Michal Luczaj
2025-06-25  8:46   ` Stefano Garzarella
2025-06-27  8:08   ` Stefano Garzarella
2025-06-29 21:26     ` Michal Luczaj
2025-06-30  9:47       ` Stefano Garzarella
2025-06-20 19:52 ` [PATCH RFC net v2 3/3] vsock: Fix IOCTL_VM_SOCKETS_GET_LOCAL_CID to check also `transport_local` Michal Luczaj
2025-06-25  8:54   ` Stefano Garzarella
2025-06-25 21:23     ` Michal Luczaj
2025-06-27  8:10       ` Stefano Garzarella
2025-06-29 21:26         ` Michal Luczaj

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