From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eastern.birch.relay.mailchannels.net (eastern.birch.relay.mailchannels.net [23.83.209.55]) by sourceware.org (Postfix) with ESMTPS id 4D4493870844 for ; Wed, 10 Mar 2021 10:14:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4D4493870844 X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 44378703059; Wed, 10 Mar 2021 10:14:24 +0000 (UTC) Received: from pdx1-sub0-mail-a30.g.dreamhost.com (100-105-161-82.trex.outbound.svc.cluster.local [100.105.161.82]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id DA5B6702E52; Wed, 10 Mar 2021 10:14:23 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from pdx1-sub0-mail-a30.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384) by 100.105.161.82 (trex/6.0.2); Wed, 10 Mar 2021 10:14:24 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Name-Sponge: 60b8a74a33a6422c_1615371264115_2327830437 X-MC-Loop-Signature: 1615371264115:3141664231 X-MC-Ingress-Time: 1615371264114 Received: from pdx1-sub0-mail-a30.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a30.g.dreamhost.com (Postfix) with ESMTP id A474A7E6B7; Wed, 10 Mar 2021 02:14:23 -0800 (PST) Received: from rhbox.intra.reserved-bit.com (unknown [1.186.101.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a30.g.dreamhost.com (Postfix) with ESMTPSA id 201F17E6BA; Wed, 10 Mar 2021 02:14:21 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a30 From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Cc: fweimer@redhat.com Subject: [PATCH 2/3] Build get-cpuid-feature-leaf.c without stack-protector [BZ #27555] Date: Wed, 10 Mar 2021 15:43:59 +0530 Message-Id: <20210310101400.3904724-3-siddhesh@sourceware.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210310101400.3904724-1-siddhesh@sourceware.org> References: <20210310101400.3904724-1-siddhesh@sourceware.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3495.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Mar 2021 10:14:29 -0000 __x86_get_cpuid_feature_leaf is called during early startup, before the stack check guard is initialized and is hence not safe to build with stack-protector. Additionally, IFUNC resolvers for static tst-ifunc-isa tests get called too early for stack protector to be useful, so fix them to disable stack protector for the resolver functions. This fixes all failures seen with --enable-stack-protector=3Dall configuration. --- sysdeps/x86/Makefile | 2 ++ sysdeps/x86/tst-ifunc-isa.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sysdeps/x86/Makefile b/sysdeps/x86/Makefile index e1f9379fd8..8ccdef2534 100644 --- a/sysdeps/x86/Makefile +++ b/sysdeps/x86/Makefile @@ -7,6 +7,8 @@ sysdep_routines +=3D get-cpuid-feature-leaf sysdep-dl-routines +=3D dl-get-cpu-features sysdep_headers +=3D sys/platform/x86.h =20 +CFLAGS-get-cpuid-feature-leaf.o +=3D $(no-stack-protector) + tests +=3D tst-get-cpu-features tst-get-cpu-features-static \ tst-cpu-features-cpuinfo tst-cpu-features-cpuinfo-static \ tst-cpu-features-supports tst-cpu-features-supports-static diff --git a/sysdeps/x86/tst-ifunc-isa.h b/sysdeps/x86/tst-ifunc-isa.h index 60aa1cea6a..6d906966a7 100644 --- a/sysdeps/x86/tst-ifunc-isa.h +++ b/sysdeps/x86/tst-ifunc-isa.h @@ -29,6 +29,7 @@ enum isa }; =20 enum isa +__attribute__ ((__optimize__ ("-fno-stack-protector"))) get_isa (void) { if (CPU_FEATURE_USABLE (AVX512F)) @@ -83,6 +84,7 @@ isa_none (void) int foo (void) __attribute__ ((ifunc ("foo_ifunc"))); =20 void * +__attribute__ ((__optimize__ ("-fno-stack-protector"))) foo_ifunc (void) { switch (get_isa ()) --=20 2.29.2