lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <nbwte2cebsfbmdzuthcber446ytqkz7zwophbgxfrgxxaeo2xp@22si4coigduk>
Date: Thu, 23 Jan 2025 12:42:08 +0100
From: Luigi Leonardi <leonardi@...hat.com>
To: Michal Luczaj <mhal@...x.co>
Cc: 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>, 
	netdev@...r.kernel.org
Subject: Re: [PATCH net v2 2/6] vsock: Allow retrying on connect() failure

On Wed, Jan 22, 2025 at 10:06:51PM +0100, Michal Luczaj wrote:
>On 1/22/25 17:28, Luigi Leonardi wrote:
>> On Tue, Jan 21, 2025 at 03:44:03PM +0100, Michal Luczaj wrote:
>>> 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-by: Stefano Garzarella <sgarzare@...hat.com>
>>> Signed-off-by: Michal Luczaj <mhal@...x.co>
>>> ---
>>> net/vmw_vsock/af_vsock.c | 5 +++++
>>> 1 file changed, 5 insertions(+)
>>>
>>> diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
>>> index cfe18bc8fdbe7ced073c6b3644d635fdbfa02610..075695173648d3a4ecbd04e908130efdbb393b41 100644
>>> --- a/net/vmw_vsock/af_vsock.c
>>> +++ b/net/vmw_vsock/af_vsock.c
>>> @@ -1523,6 +1523,11 @@ static int vsock_connect(struct socket *sock, struct sockaddr *addr,
>>> 		if (err < 0)
>>> 			goto out;
>>>
>>> +		/* sk_err might have been set as a result of an earlier
>>> +		 * (failed) connect attempt.
>>> +		 */
>>> +		sk->sk_err = 0;
>>
>> Just to understand: Why do you reset sk_error after calling to
>> transport->connect and not before?
>
>transport->connect() can fail. In such case, I thought, it would be better
>to keep the old value of sk_err. Otherwise we'd have an early failing
>vsock_connect() that clears sk_err.
That's a good point, transport->connect doesn't set sk_err if it fails.
Thanks for the clarification :)

Reviewed-by: Luigi Leonardi <leonardi@...hat.com>
>
>> My worry is that a transport might check this field and return an error.
>> IIUC with virtio-based transports this is not the case.
>
>Right, transport might check, but currently none of the transports do.
>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ