From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 37325 invoked by alias); 12 Aug 2017 18:54:47 -0000 Mailing-List: contact libc-stable-help@sourceware.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Subscribe: List-Archive: Sender: libc-stable-owner@sourceware.org Received: (qmail 37310 invoked by uid 89); 12 Aug 2017 18:54:46 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 spammy=H*c:sk:Apple-M X-Spam-Status: No, score=-26.9 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: torfep01.bell.net Received: from simcoe207srvr.owm.bell.net (HELO torfep01.bell.net) (184.150.200.207) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 12 Aug 2017 18:54:44 +0000 Received: from bell.net torfep01 184.150.200.158 by torfep01.bell.net with ESMTP id <20170812185443.TXVS14026.torfep01.bell.net@torspm01.bell.net> for ; Sat, 12 Aug 2017 14:54:43 -0400 Received: from [192.168.2.25] (really [174.91.88.229]) by torspm01.bell.net with ESMTP id <20170812185443.UPMG32108.torspm01.bell.net@[192.168.2.25]>; Sat, 12 Aug 2017 14:54:43 -0400 From: John David Anglin Content-Type: multipart/mixed; boundary=Apple-Mail-10-270872907 Date: Sun, 01 Jan 2017 00:00:00 -0000 Subject: [2.25 COMMITTED] hppa: Fix guard alignment in allocate_stack when stack grows up. To: Libc-stable Mailing List Message-Id: <85F5C657-4C84-467B-818B-B103AB635533@bell.net> Mime-Version: 1.0 (Apple Message framework v1085) X-Mailer: Apple Mail (2.1085) X-Cloudmark-Analysis: v=2.2 cv=AMu2Jzxw c=1 sm=0 tr=0 a=oYUKPKGZpIz3GNhAIUXLSA==:17 a=KeKAF7QvOSUA:10 a=FBHGMhGWAAAA:8 a=e4Vcfx4Ze9m_VFhqU44A:9 a=CjuIK1q_8ugA:10 a=ATlVsGG5QSsA:10 a=mDV3o1hIAAAA:8 a=aE74BNb_cHcJJOOnPd8A:9 a=Ld372NDzu18A:10 a=9gvnlMMaQFpL9xblJ6ne:22 a=_FVE-zBwftR9WsbkzFJk:22 X-SW-Source: 2017-08/txt/msg00023.txt.bz2 --Apple-Mail-10-270872907 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Content-length: 112 Back port of commit 075385f98af239ff5807a5c6ed17fec51e048454. Dave -- John David Anglin dave.anglin@bell.net --Apple-Mail-10-270872907 Content-Disposition: attachment; filename=allocatestack-v3-v2.25.d.txt Content-Type: text/plain; name="allocatestack-v3-v2.25.d.txt" Content-Transfer-Encoding: quoted-printable Content-length: 1021 2017-08-12 John David Anglin * nptl/allocatestack.c (allocate_stack): Align old and new guard addresses to page boundaries when the stack grows up. diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index 8a228ab254..368fe3c36b 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -683,8 +683,14 @@ allocate_stack (const struct pthread_attr *attr, struc= t pthread **pdp, prot) !=3D 0) goto mprot_error; #elif _STACK_GROWS_UP - if (mprotect ((char *) pd - pd->guardsize, - pd->guardsize - guardsize, prot) !=3D 0) + char *new_guard =3D (char *)(((uintptr_t) pd - guardsize) + & ~pagesize_m1); + char *old_guard =3D (char *)(((uintptr_t) pd - pd->guardsize) + & ~pagesize_m1); + /* The guard size difference might be > 0, but once rounded + to the nearest page the size difference might be zero. */ + if (new_guard > old_guard + && mprotect (old_guard, new_guard - old_guard, prot) !=3D 0) goto mprot_error; #endif =20 --Apple-Mail-10-270872907--