[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250620-vsock-transports-toctou-v2-0-02ebd20b1d03@rbox.co>
Date: Fri, 20 Jun 2025 21:52:42 +0200
From: Michal Luczaj <mhal@...x.co>
To: Stefano Garzarella <sgarzare@...hat.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Simon Horman <horms@...nel.org>, Stefan Hajnoczi <stefanha@...hat.com>
Cc: virtualization@...ts.linux.dev, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Michal Luczaj <mhal@...x.co>
Subject: [PATCH RFC net v2 0/3] vsock: Fix transport_{h2g,g2h,dgram,local}
TOCTOU issues
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@...x.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@...x.co>
Powered by blists - more mailing lists