From patchwork Tue Sep 19 13:46:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Myers X-Patchwork-Id: 22952 Received: (qmail 6068 invoked by alias); 19 Sep 2017 13:47:01 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 5822 invoked by uid 89); 19 Sep 2017 13:47:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS, URIBL_RED autolearn=ham version=3.3.2 spammy= X-HELO: relay1.mentorg.com Date: Tue, 19 Sep 2017 13:46:49 +0000 From: Joseph Myers To: CC: , , Subject: Fix hppa/ia64/microblaze executable stack default (bug 22156) Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) As per https://gcc.gnu.org/ml/gcc-patches/2017-09/msg01220.html hppa, ia64 and microblaze default to non-executable stacks in the Linux kernel. glibc however defines DEFAULT_STACK_PERMS to include PF_X for those architectures, meaning (a) elf/check-execstack fails and (b) (from code inspection, not tested, but this is why I think this is a user-visible bug) thread stacks are unnecessarily mapped with execute permission. This patch fixes the DEFAULT_STACK_PERMS definitions in question. Tested (compilation only) with build-many-glibcs.py for those configurations. This fixes the check-execstack failure (hppa still has a check-textrel failure as the only remaining issue stopping that architecture having clean build-many-glibcs.py results; hopefully architecture maintainers can help resolve that). 2017-09-19 Joseph Myers [BZ #22156] * sysdeps/hppa/stackinfo.h (DEFAULT_STACK_PERMS): Remove PF_X. * sysdeps/ia64/stackinfo.h (DEFAULT_STACK_PERMS): Likewise. * sysdeps/microblaze/stackinfo.h (DEFAULT_STACK_PERMS): Likewise. diff --git a/sysdeps/hppa/stackinfo.h b/sysdeps/hppa/stackinfo.h index 83b1da1..a3af38f 100644 --- a/sysdeps/hppa/stackinfo.h +++ b/sysdeps/hppa/stackinfo.h @@ -23,9 +23,8 @@ #include -/* Default to an executable stack. PF_X can be overridden if PT_GNU_STACK is - * present, but it is presumed absent. */ -#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X) +/* Default to a non-executable stack. */ +#define DEFAULT_STACK_PERMS (PF_R|PF_W) /* On PA the stack grows up. */ #define _STACK_GROWS_UP 1 diff --git a/sysdeps/ia64/stackinfo.h b/sysdeps/ia64/stackinfo.h index 87e1448..a50e727 100644 --- a/sysdeps/ia64/stackinfo.h +++ b/sysdeps/ia64/stackinfo.h @@ -27,8 +27,7 @@ here. */ #define _STACK_GROWS_DOWN 1 -/* Default to an executable stack. PF_X can be overridden if PT_GNU_STACK is - * present, but it is presumed absent. */ -#define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X) +/* Default to a non-executable stack. */ +#define DEFAULT_STACK_PERMS (PF_R|PF_W) #endif /* stackinfo.h */ diff --git a/sysdeps/microblaze/stackinfo.h b/sysdeps/microblaze/stackinfo.h index 3062b1e..05755c7 100644 --- a/sysdeps/microblaze/stackinfo.h +++ b/sysdeps/microblaze/stackinfo.h @@ -27,8 +27,7 @@ /* On MicroBlaze the stack grows down. */ # define _STACK_GROWS_DOWN 1 -/* Default to an executable stack. PF_X can be overridden if PT_GNU_STACK is - * present, but it is presumed absent. */ -# define DEFAULT_STACK_PERMS (PF_R|PF_W|PF_X) +/* Default to a non-executable stack. */ +# define DEFAULT_STACK_PERMS (PF_R|PF_W) #endif /* stackinfo.h. */