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 120C45A0272 for ; Wed, 2 Aug 2023 05:15:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1690946145; bh=+NhuHsHIFt34C3Q2UveNJptNG229qU6MKUTeuBp+wg0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FSroRcqkunMB5Arkw7CMLM+DuLJ8BMois1muEP3g/HIQ/vlRnj/xFYbrHBhTXTMPn ZH7tIWPOtT3abGdx7lgBZE8mF9mbh8una47uvJcD2CKXKz2uqgUAyLNw/K7oZ5FvTU jD6Acyoej2Y/me6UB+N0FLqI/PKpD5Mz3qXmFwgU= Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4RFxv53F6Zz4yLW; Wed, 2 Aug 2023 13:15:45 +1000 (AEST) Date: Wed, 2 Aug 2023 11:39:17 +1000 From: David Gibson To: Paul Holzinger Subject: Re: [PATCH] tap: include errno in error when tap_ns_tun() fails Message-ID: References: <20230801115016.37118-2-pholzing@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VQb9XOCMcwkRVPI7" Content-Disposition: inline In-Reply-To: <20230801115016.37118-2-pholzing@redhat.com> Message-ID-Hash: HWQQD4WGJ67XP4QCJSYCQG2CDLLE6LF2 X-Message-ID-Hash: HWQQD4WGJ67XP4QCJSYCQG2CDLLE6LF2 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.8 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: --VQb9XOCMcwkRVPI7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 01, 2023 at 01:50:17PM +0200, Paul Holzinger wrote: > It is important to know why a syscall failed so pasta should include the > errno in the error message. This is still not perfect as we do not know > which of functions (open, ioctl, if_nametoindex) failed but it should at > least include more important context. Uh.. we certainly want this, but I don't think this implementation will quite do it. >=20 > This change was inspiered by a podman issue[1]. >=20 > [1] https://github.com/containers/podman/issues/19428 >=20 > Signed-off-by: Paul Holzinger > --- > tap.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) >=20 > diff --git a/tap.c b/tap.c > index a6a73d3..c212616 100644 > --- a/tap.c > +++ b/tap.c > @@ -1205,7 +1205,8 @@ static void tap_sock_tun_init(struct ctx *c) > =20 > NS_CALL(tap_ns_tun, c); NS_CALL means we're running the function in an ephemeral thread/process/thingy.. > if (tun_ns_fd =3D=3D -1) > - die("Failed to open tun socket in namespace"); > + die("Failed to open tun socket in namespace: %s", > + strerror(errno)); =2E.which means we can't rely on it actually setting errno in the original process. The ephemeral thread does share memory, but modern errno is a weird per-thread thingy, so I'm not entirely sure what will happen here, but I'm certainly not confident about it working as we'd like. I'll have a crack at a more robust approach today. > =20 > pasta_ns_conf(c); > =20 --=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 --VQb9XOCMcwkRVPI7 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmTJs7EACgkQzQJF27ox 2GdVtA/+LmBvV1pwvD12v6fHmauQ+uUvuG7cm6RsqlnQupGL1aDbZyg+vQcvbBWs SKCQOSzhoCzANxph5puB27E8olbr7osLPsVRP0Jx2F8Gi3yxYndh5tqAx341DYv6 ME0axMM9O+XLld/A/R8dAa5t/ytna1wrj5YpRrPxKLKwsTcnNy/aynJOGeQLiNLv kzadlQSZh0VIDZfzq9tmtn9APbkxKmMiumP951apmEShDLpVBy3UUX6SHBFj7Rg/ IVzSI4pVcy5WWUNc5Xrs5a2BYiZxta32szUEv2G+71JoWWqEuGmAaKAVm0uI/CGd XODqr+YV25VvZsC73qh0r9YrOviwBwM9aU2MpqepN+rK2cslakRYrb1J+hTBzu92 XrYW0NIq4TNLR/8O87jSl70E/hT2Bfof2rPT5fXcsFZOrRkut7FMtdaFmixn+Aqp F/sKBYf6fRVYHWsZ8TZNzoyHWrl8R6jBikTE5pBky1S3GuWT59RMp/4xPh9Mc9Bn 8+6Mrd7z0DEqQSSXBWt7kGV89RYSH+BKe9FBGPUuYQD8fd65iJlrgJmKniZwzbHv JYFOnWS74i9mzCxXCFxXnDkropCVuSiW6izfSNRav5Xl2u+qIkL6SplqV6oK2P3g pFi0Q7DFGVVzO5ylJPwZWSRX/RKKemlgf8LIcF4lhBaYMxl3z9A= =9M1L -----END PGP SIGNATURE----- --VQb9XOCMcwkRVPI7--