From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36261) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bN1W6-0004gC-Qu for qemu-devel@nongnu.org; Tue, 12 Jul 2016 13:30:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bN1W2-0001GU-FN for qemu-devel@nongnu.org; Tue, 12 Jul 2016 13:30:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41176) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bN1W1-0001GO-UB for qemu-devel@nongnu.org; Tue, 12 Jul 2016 13:30:38 -0400 References: <1468340586-19304-1-git-send-email-pl@kamp.de> <1468340586-19304-2-git-send-email-pl@kamp.de> From: Eric Blake Message-ID: <5785293C.8080205@redhat.com> Date: Tue, 12 Jul 2016 11:30:36 -0600 MIME-Version: 1.0 In-Reply-To: <1468340586-19304-2-git-send-email-pl@kamp.de> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kTkBOwrGRgENm4RgJeF0785sxp8o14FbN" Subject: Re: [Qemu-devel] [PATCH V5 1/6] oslib-posix: add helpers for stack alloc and free List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven , qemu-devel@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, mst@redhat.com, dgilbert@redhat.com, peter.maydell@linaro.org, rth@twiddle.net, armbru@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --kTkBOwrGRgENm4RgJeF0785sxp8o14FbN From: Eric Blake To: Peter Lieven , qemu-devel@nongnu.org Cc: kwolf@redhat.com, mreitz@redhat.com, pbonzini@redhat.com, mst@redhat.com, dgilbert@redhat.com, peter.maydell@linaro.org, rth@twiddle.net, armbru@redhat.com Message-ID: <5785293C.8080205@redhat.com> Subject: Re: [PATCH V5 1/6] oslib-posix: add helpers for stack alloc and free References: <1468340586-19304-1-git-send-email-pl@kamp.de> <1468340586-19304-2-git-send-email-pl@kamp.de> In-Reply-To: <1468340586-19304-2-git-send-email-pl@kamp.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 07/12/2016 10:23 AM, Peter Lieven wrote: > the allocated stack will be adjusted to the minimum supported stack siz= e > by the OS and rounded up to be a multiple of the system pagesize. > Additionally an architecture dependent guard page is added to the stack= > to catch stack overflows. >=20 > Signed-off-by: Peter Lieven > --- > include/sysemu/os-posix.h | 23 +++++++++++++++++++++++ > util/oslib-posix.c | 46 +++++++++++++++++++++++++++++++++++++++= +++++++ > 2 files changed, 69 insertions(+) >=20 > +static size_t adjust_stack_size(size_t sz) > +{ > +#ifdef _SC_THREAD_STACK_MIN > + /* avoid stacks smaller than _SC_THREAD_STACK_MIN */ > + sz =3D MAX(MAX(sysconf(_SC_THREAD_STACK_MIN), 0), sz); MAX(MAX(int, int), unsigned) is not transitive, but does the job. I won't request a rewrite. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --kTkBOwrGRgENm4RgJeF0785sxp8o14FbN Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXhSk8AAoJEKeha0olJ0NqvD4H/iy+fCrjlVN8yTcXM19J87zR 0+ATH64Qhazkb+xztiLiloUfDzVciv7ep3PXF8WOp/5eif40VdAQEClW05BWpenF ieDY3LfKrdbO+q8HdB5KS4MonriJzJCt814f+0ES8MubUJd3g+1mcAXM0fbJiNT8 D6QLSbsmD7bcue6Uy9Y4I/wh0sw8EQAz/JZQ6k+6P5YI1rpxmhvTrSy66vz5okRp yDeTIFhtcwUZchwD8ZeSiCIKtEDsvq2fCSZyksFDy53RRYyo/NfmMVzj/nOFqCNz EzqVfvO6iQZpDZOlGYLnnoPUkSxJiN/MrMQeDoTkeNNIqid+LHfwG+phnynf7m4= =MgHk -----END PGP SIGNATURE----- --kTkBOwrGRgENm4RgJeF0785sxp8o14FbN--