From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by sourceware.org (Postfix) with ESMTPS id A8B70385BF99 for ; Mon, 15 Mar 2021 13:59:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A8B70385BF99 Received: by mail-qt1-x834.google.com with SMTP id g24so9109442qts.6 for ; Mon, 15 Mar 2021 06:59:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=xOqT4UF0m4m3sdrCB5b/3OCRdl/O7+IoMWlkEBLvaKI=; b=tQLIHEYypqwo3FYTZR246cYsAT+mjhAznT6YPs1KVIAbfulFjbDWVL/P1DlI/+gHF8 LzhDt3LfF75cPZj6aHdNFn0enG3YmZtR3OYLIGEWXR7zjC+IIn+ldDtkdMRnixgr0oGA R1JgsjGdFtVp1xqng8omZ2XrT45SP3OKcfnN80Ho4vuo8DQgxQs9gBvJjhpwEUz30P5D /aEjRINbl5gy4KbLZJWl6OC0Lt9YJF1jFkIdmuS31wUdc2tLaWgsFEURC1wtLkVxdTZ+ GVf3zAYcc4lcCj8PvhuZgKhPkjAoS5+CLnzy+CWzadT55OiIJNXzCcO8LO29uLOvewEQ 3ItA== X-Gm-Message-State: AOAM531crZyr/JhP+jzzwwRqA0GRtp1M1KJS0cJ+/KoLuhpgU1j8vZXq V6nO4g0NeOXX9UI44JqK0A17pQ== X-Google-Smtp-Source: ABdhPJwZfE7kCy4q+jxfpjQHpYKrK6EvDCdK3leUUigJzogrRcQhje2t3jJNfCf9CZJ4xWS45N7YgA== X-Received: by 2002:ac8:6bd9:: with SMTP id b25mr22562240qtt.70.1615816768280; Mon, 15 Mar 2021 06:59:28 -0700 (PDT) Received: from [192.168.1.4] ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id q2sm12287425qkq.59.2021.03.15.06.59.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 15 Mar 2021 06:59:28 -0700 (PDT) Subject: Re: [PATCH 2/3] Build get-cpuid-feature-leaf.c without stack-protector [BZ #27555] To: Siddhesh Poyarekar , libc-alpha@sourceware.org Cc: fweimer@redhat.com References: <20210310101400.3904724-1-siddhesh@sourceware.org> <20210310101400.3904724-3-siddhesh@sourceware.org> From: Adhemerval Zanella Message-ID: <9dee9f54-50b3-1142-932c-f05c43653d00@linaro.org> Date: Mon, 15 Mar 2021 10:59:25 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210310101400.3904724-3-siddhesh@sourceware.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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: Mon, 15 Mar 2021 13:59:30 -0000 On 10/03/2021 07:13, Siddhesh Poyarekar via Libc-alpha wrote: > __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=all > configuration. LGTM, thanks. Reviewed-by: Adhemerval Zanella > --- > 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 += get-cpuid-feature-leaf > sysdep-dl-routines += dl-get-cpu-features > sysdep_headers += sys/platform/x86.h > > +CFLAGS-get-cpuid-feature-leaf.o += $(no-stack-protector) > + > tests += 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 > }; > > 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"))); > > void * > +__attribute__ ((__optimize__ ("-fno-stack-protector"))) > foo_ifunc (void) > { > switch (get_isa ()) >