From mboxrd@z Thu Jan 1 00:00:00 1970 From: Efraim Flashner Subject: Re: [PATCH 3/6] daemon: On aarch64, use increments of 16 on the stack. Date: Sun, 6 Aug 2017 17:53:34 +0300 Message-ID: <20170806145334.GD2458@macbook42.flashner.co.il> References: <20170209184510.24200-1-efraim@flashner.co.il> <20170209184510.24200-4-efraim@flashner.co.il> <87r331xiot.fsf@gnu.org> <874ltm5ybg.fsf@netris.org> <20170805182401.GA2458@macbook42.flashner.co.il> <87r2wp4s6k.fsf@netris.org> <87mv7d4rq9.fsf@netris.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="W5WqUoFLvi1M7tJE" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36191) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1deMw0-0004lE-7a for guix-devel@gnu.org; Sun, 06 Aug 2017 10:53:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1deMvx-0007hK-5k for guix-devel@gnu.org; Sun, 06 Aug 2017 10:53:40 -0400 Received: from flashner.co.il ([178.62.234.194]:33542) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1deMvw-0007h6-UN for guix-devel@gnu.org; Sun, 06 Aug 2017 10:53:37 -0400 Content-Disposition: inline In-Reply-To: <87mv7d4rq9.fsf@netris.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Mark H Weaver Cc: guix-devel@gnu.org --W5WqUoFLvi1M7tJE Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Aug 05, 2017 at 05:41:50PM -0400, Mark H Weaver wrote: > I wrote: > > Can you try the following patch on aarch64 and report back? >=20 > Actually, the last patch was not quite right. C/C++ makes it rather > difficult to avoid edge cases in arithmetic. Can you try this one > instead? >=20 > Thanks, > Mark >=20 > --8<---------------cut here---------------start------------->8--- > diff --git a/nix/libstore/build.cc b/nix/libstore/build.cc > index 693fa70c8..63540ddfc 100644 > --- a/nix/libstore/build.cc > +++ b/nix/libstore/build.cc > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include > =20 > #include > #include > @@ -2008,11 +2009,11 @@ void DerivationGoal::startBuilder() > char stack[32 * 1024]; > int flags =3D CLONE_NEWPID | CLONE_NEWNS | CLONE_NEWIPC | CLONE_NEWUTS = | SIGCHLD; > if (!fixedOutput) flags |=3D CLONE_NEWNET; > -#ifdef __aarch64__ > - pid =3D clone(childEntry, stack + sizeof(stack) - 16, flags, this); > -#else > - pid =3D clone(childEntry, stack + sizeof(stack) - 8, flags, this); > -#endif > + /* Ensure proper alignment on the stack. On aarch64, it has to be 16 > + bytes. */ > + pid =3D clone(childEntry, > + (char *)(((uintptr_t)stack + sizeof(stack) - 8) & ~(uintptr_t)0xf), > + flags, this); > if (pid =3D=3D -1) > throw SysError("cloning builder process"); > } else > --8<---------------cut here---------------end--------------->8--- The aarch64 machine that I tested this on built packages without any problems. Looks good to me. --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --W5WqUoFLvi1M7tJE Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAlmHLWoACgkQQarn3Mo9 g1Gvog//Z+JYeqz/jD29BD5kdNdBMSgelG0NKCAY1d/0xSG5DRGi/84IaDo81ZDt SUC6jg8tJnWUEPzVk0/hMWi7esnFbhxL3yRm/yR4jyblWjzkjLURDJMULRcACfOS 7ioSJadyiLxJwMU4F61PHqSCDq5Dl19fLzwcGBBc12NKnXSEmIiIAM/Fwx229fiA zICPO3E/8Jawiml96+GBnVM9pEzaNf2EUY1SLV8ygUjWKtPTwjg8bAfeKfRAnwjS m4PJGxCiAVLf7Lbo2wfKM7BOXN9k/hV02ezT7YK4nPYPQCo77pQKEN1LMMD0pGZX oJySuGjtinUH3flmruKeTkLNVlzdQVkUKKr9Ue1R++UMr5NvuekFRt+X8U3FWob0 b8MzgvTiZOcisXMlzxjgJvb2rJR48eHVxVeDv6ECIqSCYKGjzqZfHQSy0q0OrzWU BEe88ODopLbXQBKgju3eWzhZTUl04AdYAYCZ3n01Rfy1M8AajsiJuCYnFzKQDoMS phBrdXWSrPRdrfc8TOgq8H+toFvbB+Kab/VXq6jkShziJ+8UYG81Y29/Vzlrfhk3 F3wUwdVV500+HX6v85tTlsahRTtNQkzSCOAujPLg4mxPHaOH5xkA4gmCtuKMDfV1 8a974oglDV5jdFjAB6ErEyL/nSvlZX3mPItBcLgepZl5e+FdyGE= =ga+P -----END PGP SIGNATURE----- --W5WqUoFLvi1M7tJE--