On Tue, Jan 28, 2025 at 02:15:26PM +0100, Michal Luczaj wrote:
Series deals with two issues:
- socket reference count imbalance due to an unforgiving transport release
(triggered by transport reassignment);
- unintentional API feature, a failing connect() making the socket
impossible to use for
Preserve sockets bindings; this includes both resulting from an explicit
bind() and those implicitly bound through autobind during connect().
Prevents socket unbinding during a transport reassignment, which fixes a
use-after-free:
1. vsock_create() (refcnt=1) calls vsock_insert_unbound() (ref
Series deals with two issues:
- socket reference count imbalance due to an unforgiving transport release
(triggered by transport reassignment);
- unintentional API feature, a failing connect() making the socket
impossible to use for any subsequent connect() attempts.
Luigi, I took the opportun
Add a helper for socket()+bind(). Adapt callers.
Reviewed-by: Stefano Garzarella
Reviewed-by: Luigi Leonardi
Signed-off-by: Michal Luczaj
---
tools/testing/vsock/util.c | 57 +---
tools/testing/vsock/util.h | 1 +
tools/testing/vsock/vsock_test.
Fail the autobind, then trigger a transport reassign. Socket might get
unbound from unbound_sockets, which then leads to a reference count
underflow.
Reviewed-by: Stefano Garzarella
Signed-off-by: Michal Luczaj
---
tools/testing/vsock/vsock_test.c | 58
Deliberately fail a connect() attempt; expect error. Then verify that
subsequent attempt (using the same socket) can still succeed, rather than
fail outright.
Reviewed-by: Stefano Garzarella
Reviewed-by: Luigi Leonardi
Signed-off-by: Michal Luczaj
---
tools/testing/vsock/vsock_test.c | 47
Distill timeout-guarded vsock_connect_fd(). Adapt callers.
Suggested-by: Stefano Garzarella
Reviewed-by: Stefano Garzarella
Signed-off-by: Michal Luczaj
---
tools/testing/vsock/util.c | 45 +
tools/testing/vsock/util.h | 1 +
2 files changed, 18 ins
sk_err is set when a (connectible) connect() fails. Effectively, this makes
an otherwise still healthy SS_UNCONNECTED socket impossible to use for any
subsequent connection attempts.
Clear sk_err upon trying to establish a connection.
Fixes: d021c344051a ("VSOCK: Introduce VM Sockets")
Reviewed-b