From patchwork Fri Jul 20 01:59:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Thibault X-Patchwork-Id: 946684 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-94516-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ens-lyon.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="qDg9QOL4"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41WvG44HJwz9s3Z for ; Fri, 20 Jul 2018 11:59:40 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; q=dns; s= default; b=C3SJwC3MWiBxQN+ACFmK26hux8F2bfEN9p1jxPAqJpXVUcJhOrd6j rXHpNjEx7m7Ao6u0XEVFZXtUdF4KxzN34cfQK7aAIrr9YS6jKbxoevFxFe18fDPw 3Y586xTrLYY3bso1sZG1omSEcrajaiqsrpPt4zNRnwNaCqSh/khpFo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id; s=default; bh=XinRgzJ5A6muQb63iynX0WbkiIQ=; b=qDg9QOL4e8WlZlUHlTsz0fefjKIT zOawMW11t+w10xHQT+jDohrqxeKVwtqx93P5e1K9sLNGva4FGsNmKQrT5qwRFloe ydWdc4fiFrRUWJ2ULcRrwnykQREVRObCoRtXFfIOf/SY19oIqssRzyiX/KYdN45J 6OBt77+z63C7qpE= Received: (qmail 88870 invoked by alias); 20 Jul 2018 01:59:34 -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 88463 invoked by uid 89); 20 Jul 2018 01:59:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS, SPF_NEUTRAL autolearn=ham version=3.3.2 spammy=Permit, *rw X-HELO: hera.aquilenet.fr From: Samuel Thibault To: libc-alpha@sourceware.org Cc: Samuel Thibault Subject: [hurd,commited] check-execstack: Permit sysdeps to xfail some libs Date: Fri, 20 Jul 2018 03:59:27 +0200 Message-Id: <20180720015927.32309-1-samuel.thibault@ens-lyon.org> * scripts/check-execstack.awk: Consider `xfail' variable containing a list of libraries whose stack executability is expected. * elf/Makefile ($(objpfx)check-execstack.out): Pass $(check-execstack-xfail) to check-execstack.awk through `xfail' variable. * sysdeps/mach/hurd/i386/Makefile (check-execstack-xfail): Set to ld.so libc.so libpthread.so. --- ChangeLog | 7 +++++++ elf/Makefile | 2 +- scripts/check-execstack.awk | 27 ++++++++++++++++++++++----- sysdeps/mach/hurd/i386/Makefile | 6 ++++++ 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index ace34c0a81..b45c83ba2b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,13 @@ hidden prototypes. * sysdeps/mach/include/mach-shortcuts-hidden.h [!_ISOMAC]: Likewise. * sysdeps/mach/include/mach/mach_traps.h [!_ISOMAC]: Likewise. + * scripts/check-execstack.awk: Consider `xfail' variable containing a + list of libraries whose stack executability is expected. + * elf/Makefile ($(objpfx)check-execstack.out): Pass + $(check-execstack-xfail) to check-execstack.awk through `xfail' + variable. + * sysdeps/mach/hurd/i386/Makefile (check-execstack-xfail): Set to ld.so + libc.so libpthread.so. 2018-07-20 Thomas Schwinge diff --git a/elf/Makefile b/elf/Makefile index 84107f6dbb..cd0771307f 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -1103,7 +1103,7 @@ common-generated += $(all-built-dso:$(common-objpfx)%=%.phdr) $(objpfx)check-execstack.out: $(..)scripts/check-execstack.awk \ $(objpfx)execstack-default \ $(all-built-dso:=.phdr) - LC_ALL=C $(AWK) -f $^ > $@; \ + LC_ALL=C $(AWK) -v "xfail=$(check-execstack-xfail)" -f $^ > $@; \ $(evaluate-test) generated += check-execstack.out diff --git a/scripts/check-execstack.awk b/scripts/check-execstack.awk index 21d37e9f47..cd6b30ed3c 100644 --- a/scripts/check-execstack.awk +++ b/scripts/check-execstack.awk @@ -6,7 +6,12 @@ # It fails (1) if any did indicate executable stack. # It fails (2) if the input did not take the expected form. -BEGIN { result = sanity = 0; default_exec = -1 } +BEGIN { + result = sanity = 0; default_exec = -1; + split(xfail, xfails, " "); + for (x in xfails) + expected_fails[xfails[x] ".phdr"] = 1; +} /^execstack-no$/ { default_exec = 0; next } /^execstack-yes$/ { default_exec = 1; next } @@ -17,6 +22,10 @@ function check_one(name) { result = 2; } + n = split(name, parts, "/"); + basename = parts[n]; + expected_fail = basename in expected_fails; + if (!sanity) { print name ": *** input did not look like readelf -l output"; result = 2; @@ -24,12 +33,20 @@ function check_one(name) { if (stack_line ~ /^.*RW .*$/) { print name ": OK"; } else if (stack_line ~ /^.*E.*$/) { - print name ": *** executable stack signaled"; - result = result ? result : 1; + if (expected_fail) { + print name ": *** executable stack signaled, expected"; + } else { + print name ": *** executable stack signaled"; + result = result ? result : 1; + } } } else if (default_exec) { - print name ": *** no PT_GNU_STACK entry"; - result = result ? result : 1; + if (expected_fail) { + print name ": *** no PT_GNU_STACK entry, expected"; + } else { + print name ": *** no PT_GNU_STACK entry"; + result = result ? result : 1; + } } else { print name ": no PT_GNU_STACK but default is OK"; } diff --git a/sysdeps/mach/hurd/i386/Makefile b/sysdeps/mach/hurd/i386/Makefile index 0b509d9499..9a824fadf3 100644 --- a/sysdeps/mach/hurd/i386/Makefile +++ b/sysdeps/mach/hurd/i386/Makefile @@ -96,3 +96,9 @@ endif ifeq ($(subdir),mach) test-xfail-check-abi-libmachuser = yes endif + +ifeq ($(subdir),elf) +# We do use nested functions involving creation of trampolines, notably for +# callbacks whose parameters don't permit to get the context parameters. +check-execstack-xfail += ld.so libc.so libpthread.so +endif