From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 3059E5A026F for ; Tue, 1 Nov 2022 01:59:37 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4N1WrK5Xlxz4xN3; Tue, 1 Nov 2022 11:59:29 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1667264369; bh=3/EQ0s7m4x4rdcKw4DOduFJ5z3x/hWLrRd9ZrMEO7M4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mGWuAC4uolynSrZGQ9yQ/Gi3buxYHcSXNfXY5NmqfEA3cXactLQ037OngVmEVz6Fc PpJzjOPd1R01PU7uezjdQh+gHzVtAikRtMGAGn8GhDA4yUfSqiIaEmHzYQ1dpQrPC0 qzFd9ODfsNI8BYUXg4b6mQKium/6QzizqABkBZKo= Date: Tue, 1 Nov 2022 11:41:12 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH v2 2/5] tap: Support for detection of existing sockets on ramfs Message-ID: References: <20221031112059.170269-1-sbrivio@redhat.com> <20221031112059.170269-3-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Hc10dTj9RMesz5Qf" Content-Disposition: inline In-Reply-To: <20221031112059.170269-3-sbrivio@redhat.com> Message-ID-Hash: AMO265VNJPFH2KJKF3OWZWK6KVNO3TNZ X-Message-ID-Hash: AMO265VNJPFH2KJKF3OWZWK6KVNO3TNZ X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: <> Archived-At: List-Archive: <> List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --Hc10dTj9RMesz5Qf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 31, 2022 at 12:20:56PM +0100, Stefano Brivio wrote: > On ramfs, connecting to a non-existent UNIX domain socket yields > EACCESS, instead of ENOENT. This is visible if we use passt directly > on rootfs (a ramfs instance) from an initramfs image. >=20 > It's probably wrong for ramfs to return EACCES, but given the > simplicity of the filesystem, I doubt we should try to fix it there > at the possible cost of added complexity. Yeah, that's deeply weird. I'm not even sure how you'd get such a bug involving the intersection of filesystem and unix socket. > Also, this whole beauty should go away once qrap-less usage is > established, so just accept EACCES as indication that a conflicting > socket does not, in fact, exist. That's reasonable, in addition, another case that would give EACCES is if some other user has a passt instance running there, in which case this is still probably the right thing to do. > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > tap.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/tap.c b/tap.c > index 4dcff4f..0a3ccce 100644 > --- a/tap.c > +++ b/tap.c > @@ -912,7 +912,8 @@ static void tap_sock_unix_init(struct ctx *c) > } > =20 > ret =3D connect(ex, (const struct sockaddr *)&addr, sizeof(addr)); > - if (!ret || (errno !=3D ENOENT && errno !=3D ECONNREFUSED)) { > + if (!ret || (errno !=3D ENOENT && errno !=3D ECONNREFUSED && > + errno !=3D EACCES)) { > if (*c->sock_path) { > err("Socket path %s already in use", path); > exit(EXIT_FAILURE); --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --Hc10dTj9RMesz5Qf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoULxWu4/Ws0dB+XtgypY4gEwYSIFAmNgayEACgkQgypY4gEw YSKhlA//f8FeDRw0yrt+9nDGkWooABUljP2LjuVsWNcIPoj3dmW626LkeWdXI2Me EOHN8zOvNCrlhketVEmEtdCRJbub6CsRFx5tg1RKOQUNOB33swTn9hKV8BuuAV7I qU7b0T2STK/UUhHAYCJLughUauVa0/iHaONRMrh7qJyuYzIt5t/4nCrl9xAbFWs1 1l4CbbHhKZ5lxMQynu4+Mi8Uvgky0gMmLfbA3pPnYred916l+iVcTMq5b0QJreyb n+deGILRVBR/GqHbNBpOYcK7FSj9t67aQOkmXN2IlU498GGAgiZayIwXAcpvRSp5 tiIE2p8XFLCA7+V1NDpRkBYlyDZS0A3IFNeYRI/T/Khg7GwpNm8x4iYRn6Lon3XU LRRlXKVZYpWMTY3TUR1pYoAgzTswcy8OB6UbTyWAfu5+6Z6XXfOYBb/ut4cxYTcZ hxw8zgE/AlPLyHvTIRkMgfsT82OA3hD7cOqyO9aJ7VB4IVOVUJerN5jxEujcYr28 LedZcAP2p9Vix8Qhdvh/VuWkgCN/vnaYVBx0OCYPG2G+oJkmmIdveWhWIGtYCxf5 jYMfWwfQFqaV8dF+0hLQmxf5hl7nEYC3MGlEXy4q4+TCdXW0Zma9qhESNvbBkTM+ gOcF0kqFavQsB2NJKDKSdINAkkIszljpseYiIfV0neUfd96DML0= =d/UN -----END PGP SIGNATURE----- --Hc10dTj9RMesz5Qf--