From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id C37735A005E for ; Wed, 16 Nov 2022 06:19:49 +0100 (CET) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4NBrvl64m3z4xZl; Wed, 16 Nov 2022 16:19:47 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1668575987; bh=7WiZtgGLLoTlUfVKlbGvnu6FzJ1i4bong3tVvjO66yk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=hp95MMnIB5+E1vCPCu6Rb7SzFofs363x49jOmp3KmGHdG5oHj0yYX7ycr/bhc/mwp UHnxhCDucL0YRkDopQbBCjz6gHOZs0RkPOaeTpAacgurtrAXj8zqXCkC3j1ZwSs/wR yXuJ++vHKj9ObkfXUGNg+bn5Wo+rLGPsjb/zqHk8= Date: Wed, 16 Nov 2022 16:17:13 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 5/8] util, pasta: Use __clone2() instead of clone() on ia64 Message-ID: References: <20221115012349.2240096-1-sbrivio@redhat.com> <20221115012349.2240096-6-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ZrTPt0HVaF69OxBn" Content-Disposition: inline In-Reply-To: <20221115012349.2240096-6-sbrivio@redhat.com> Message-ID-Hash: NHN4QSSEBPO2VE6SD6W6N3SGAEHJJMR5 X-Message-ID-Hash: NHN4QSSEBPO2VE6SD6W6N3SGAEHJJMR5 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: --ZrTPt0HVaF69OxBn Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 15, 2022 at 02:23:46AM +0100, Stefano Brivio wrote: > On ia64, clone(2) is not available: the glibc wrapper is named > __clone2() and it takes, additionally, the size of the stack area > passed by the caller. >=20 > Spotted in Debian's buildd logs. >=20 > Signed-off-by: Stefano Brivio Urgh, I'd really prefer to make our own wrapper to reduce two ifdefs to one. > --- > pasta.c | 9 +++++++++ > util.h | 12 ++++++++++++ > 2 files changed, 21 insertions(+) >=20 > diff --git a/pasta.c b/pasta.c > index db86317..1f3afa1 100644 > --- a/pasta.c > +++ b/pasta.c > @@ -226,11 +226,20 @@ void pasta_start_ns(struct ctx *c, uid_t uid, gid_t= gid, > arg.argv =3D sh_argv; > } > =20 > +#ifdef __ia64__ > + pasta_child_pid =3D __clone2(pasta_spawn_cmd, > + ns_fn_stack + sizeof(ns_fn_stack) / 2, > + sizeof(ns_fn_stack) / 2, > + CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWNET | > + CLONE_NEWUTS, > + (void *)&arg); > +#else > pasta_child_pid =3D clone(pasta_spawn_cmd, > ns_fn_stack + sizeof(ns_fn_stack) / 2, > CLONE_NEWIPC | CLONE_NEWPID | CLONE_NEWNET | > CLONE_NEWUTS, > (void *)&arg); > +#endif > =20 > if (pasta_child_pid =3D=3D -1) { > perror("clone"); > diff --git a/util.h b/util.h > index 2d4e1ff..3c48992 100644 > --- a/util.h > +++ b/util.h > @@ -81,6 +81,17 @@ > (((struct in_addr *)(a))->s_addr =3D=3D ((struct in_addr *)b)->s_addr) > =20 > #define NS_FN_STACK_SIZE (RLIMIT_STACK_VAL * 1024 / 8) > +#ifdef __ia64__ > +#define NS_CALL(fn, arg) \ > + do { \ > + char ns_fn_stack[NS_FN_STACK_SIZE]; \ > + \ > + __clone2((fn), ns_fn_stack + sizeof(ns_fn_stack) / 2, \ > + sizeof(ns_fn_stack) / 2, \ > + CLONE_VM | CLONE_VFORK | CLONE_FILES | SIGCHLD,\ > + (void *)(arg)); \ > + } while (0) > +#else > #define NS_CALL(fn, arg) \ > do { \ > char ns_fn_stack[NS_FN_STACK_SIZE]; \ > @@ -89,6 +100,7 @@ > CLONE_VM | CLONE_VFORK | CLONE_FILES | SIGCHLD, \ > (void *)(arg)); \ > } while (0) > +#endif > =20 > #if __BYTE_ORDER =3D=3D __BIG_ENDIAN > #define L2_BUF_ETH_IP4_INIT \ --=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 --ZrTPt0HVaF69OxBn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoULxWu4/Ws0dB+XtgypY4gEwYSIFAmN0clMACgkQgypY4gEw YSJrdQ//fz98oyBsB2zTHJ9Wpkg/XmixT7IVpRIL9TgimHCz3TkWCkt+VtnLPfQ7 3aXCbXBdbrB3rkpVL4hqFqGaXXs9VWUN6n9pECOFd/dh6DvdBqNNnXGnaeTwNWJz 2iYOfj23s/OgxvtRD8lLTPCLHe1IspONBt7JsZu179bf+tFiySAiruvMjCZIvCph +GKRGC86+fDhIGzEj19DNjOmxOJRVW2UbsZu1xmXkDnpGNYrushy7IvOg7ySwHPj HBXq6kRGunH0Jzs9b/Uk8F4AbxniOmhkA26F+xgzEDP42tFENH8uNjHPSDsfndWf eiGznWUZe/c/kwdcXebjjKrBNUCYOCwbn9A17SlEF95z3wgn4tKeSElxwrPUV8AE kPaWz4JougcC5sEk8DCL2sMG0cTROSxDDKFjUNjL2oIKvtJdXk4/vhE+RFz9Mr3V IapoNnsfSySJ2hvkSXfutSsr9N+hZKERk9Nxd1RfKPRMA3UernO6jEvg6p6wfNeM rSWOf48IsRJ253g+RR9dMPEwUFR8IsN3571rzKYhCk3LARXXbRB2Nr2yUv/VsFMs NyFE8Ae3WMLaXyvf7LnzpMTYa1mNpRCof6CocbvbCGsSlciIYoFx7IY6pec83M/8 fCqVK+kY7g3Wl6icrnrEWx3MXoRE0tcV7KvjmjgeZ/QgQJ8NNnE= =p3NF -----END PGP SIGNATURE----- --ZrTPt0HVaF69OxBn--