From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202502 header.b=glSLscGp; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 0E0295A0274 for ; Fri, 07 Feb 2025 05:43:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1738903391; bh=dUh7H9klhmRJAz8NK7sJfqHIAlxPc8/nMUDQeSnGyFo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=glSLscGpW7xNlo67J+6gOaMoQoX2eOkKMISpiP7d1AlrRJAktedPBwxnNZjS0Xl0G 0IUwR1olSmVSJhgPU843aItsztUTRz4TYnhmUodpS3iOZwtnxYFflaB9On5nZi8ykX unPwXTJNOXWgH8lV0d6Dhgh9PRTA4Sl6WqLaDjZLn6mnwugNtET/q4r8K0MzHNo3FQ Re1e8UTIFc3QQvU2fBxI0XLVfcwartFmSas1edTlz75dfz1LjwoxIVOfYOXh8Sk7XP YKE4A1Ax/bcKE43wFeLx1b8ZNrSQOyzlU51hQBhQObTX0sHfI8yj5CagafZnhag19S d/IGV2b5TvRcQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Yq1Yq5Fv4z4wnp; Fri, 7 Feb 2025 15:43:11 +1100 (AEDT) Date: Fri, 7 Feb 2025 13:38:10 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] passt-repair: Don't use perror(), accept ECONNRESET as termination Message-ID: References: <20250207005439.3117473-1-sbrivio@redhat.com> <20250207022923.74b29ed5@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="x/LQYY9hAz0jFZv6" Content-Disposition: inline In-Reply-To: <20250207022923.74b29ed5@elisabeth> Message-ID-Hash: YAEBUQXMXSTC3PSPU4IPYNOU6UWTJVC3 X-Message-ID-Hash: YAEBUQXMXSTC3PSPU4IPYNOU6UWTJVC3 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: --x/LQYY9hAz0jFZv6 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Feb 07, 2025 at 02:29:23AM +0100, Stefano Brivio wrote: > On Fri, 7 Feb 2025 12:15:35 +1100 > David Gibson wrote: >=20 > > On Fri, Feb 07, 2025 at 01:54:39AM +0100, Stefano Brivio wrote: > > > If we use glibc's perror(), we need to allow dup() and fcntl() in our > > > seccomp profiles, which are a bit too much for this simple helper. On > > > top of that, we would probably need a wrapper to avoid allocation for > > > translated messages. > > >=20 > > > While at it: ECONNRESET is just a close() from passt, treat it like > > > EOF. > > >=20 > > > Signed-off-by: Stefano Brivio =20 > >=20 > > Reviewed-by: David Gibson > >=20 > > > --- > > > passt-repair.c | 10 +++++++--- > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > >=20 > > > diff --git a/passt-repair.c b/passt-repair.c > > > index 3c3247b..d137a18 100644 > > > --- a/passt-repair.c > > > +++ b/passt-repair.c > > > @@ -95,7 +95,7 @@ int main(int argc, char **argv) > > > } > > > =20 > > > if ((s =3D socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { > > > - perror("Failed to create AF_UNIX socket"); > > > + fprintf(stderr, "Failed to create AF_UNIX socket: > > > %i\n", errno); =20 > >=20 > > We could use strerror_() here, couldn't we? >=20 > We would need to link that, which is quite some code (the whole=20 > strerrordesc_np())... I mean, this runs privileged. Hrm, is the non-locale one really that much code though? Shouldn't it be about 5 lines of code and a table of strings? But then.. glibc is really good at making things complicated. --=20 David Gibson (he or they) | 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 --x/LQYY9hAz0jFZv6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmelcg4ACgkQzQJF27ox 2GfljA//Y0V+2c/q6K2LwaYxmdjFEY5dTRyerVoZi9IXnZquTSfpP0H3X2hTOYD0 2qbgyoGoAYnNw29cV+iD7kBiuLb7gYhXhvwxdg1AKpj2QKkf5UbNxjGuLv2oYRX0 CZRRRoAwYIb74XjcnGSSfn9cafO8aHOz79k4xKDDc6Ex0U4SVPAyjJqEbEPF26Kn ri/z9M3dVgE8ZS3eyJD/DKX2JvIn37ZtoNJG6FZ+2h3a34qTrcOnEFVy6Ed7kwRo WrPPUKKEqdGd44Pv7SuDxQGxx77PzWy3dEpfWTel1nHBZmiNF3WrNhOuHPn5cZY7 wqwBMsf6IVGJhnEVyZiYvxyZtncrH32dXN2QmdMXvhcfQADtUEE2qkA54H10H541 hPCpgFcvXu51Uh7RTqRbVhL8hNv0Puy0ODUWuBce756mp/fzqfkU34GwwkQiX1c3 STr3P3yIjEGsHoRbjDpWSJcj20GbZI2Dj/qTzlDgDGmDpokpVDNoQdRm6qRbE5hO FeJMV4m0BNK9wD+l1lH89D/HwLupS80Mk77joNYxbWLIwGnUrpZ8MOmc4Bhgz5I7 Ex0pMEXcc/cojZvtNj/sNwUOxU6qTEyVO/AHE/YtQxj01gtQiFVjjXX0fSMhSfYw uGkyKKi5ZojFKmis2wIZIM79LDeGzCXeCdnM8/jIy/Qi8RXx97M= =OIZ7 -----END PGP SIGNATURE----- --x/LQYY9hAz0jFZv6--