From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-2.5 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS,UNWANTED_LANGUAGE_BODY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 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 dcvr.yhbt.net (Postfix) with ESMTPS id C15141F880 for ; Thu, 9 Jan 2020 21:13:47 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:to:references:from:subject:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=KpE4z8Fn6F1E0v3g nZ7k0lfy8bThsPc/z8x+tJRB2JUY4S3TUjkukKVIIcBnzX3/mX1fAlEGIUXEcq2J x51bifqcEcjv3jFAYQaUuLIvHZDuUbfbycap1G+1Sjmr3YcG25psdWkldvyFiQv7 Pw8e7ex2/fSPJjiIpR/uPzV5eww= 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:to:references:from:subject:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=bhiOoT6ff+76wo3dgZPhX7 U5Gv4=; b=Fs+awRrgKQP6iEI/FG0KEzAyNleVzll99UnLAu2ZXvIUDOjQPxU7mt hlRBXmmhG/yyGxp0OGu75WtjwUQjS/7gPPzrLrQ0qvNGv7AG8gKfnjarKOj+Kio2 UhAJU85oKBJ/d0E0/Cj+zmk6O+lGYtkwczVhJh1Cme4E6LAiecSpU= Received: (qmail 125870 invoked by alias); 9 Jan 2020 21:13:44 -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 Received: (qmail 125857 invoked by uid 89); 9 Jan 2020 21:13:44 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-qt1-f169.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=to:references:from:autocrypt:subject:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=dEJokyikPb+DphbTFNqL59IEwlnxbJQpOT0CIg+Iu2I=; b=sFSeZB6iS+dsGtjvKDb54ALuks12+We+pHe3dXHDleZ6oetbz/qTAj3Yaih4KjG7yz IttXpXkv6WnLfj2mRclCESL/Ho6aOXRF55xB/I8J748zrRhiEwOhrD4HHK+92DhnA5GJ ixl3hQ7K/oCvoYvINK22BsPQAVyRrEExRPWe7Bz7wI3i3svGiLNA0QMzsmap9MjEWHE5 6Ndx+oI4Gz5i1S1wkGqRMxp2bfd4IdfY/QL9nhBHM5xCzcwrpr3sr+06gBOC4GAjkXr+ xYnMqDNLBpWmY6GZ50rzGnd2a+ENTQKRXnHvM56wlCOyS4yr6u+5tL8pgdJOsoIROfe8 SNNg== To: libc-alpha@sourceware.org References: <20200108161535.6141-1-hjl.tools@gmail.com> <20200108161535.6141-4-hjl.tools@gmail.com> From: Adhemerval Zanella Subject: Re: V2 [PATCH 3/5] i386: Add _CET_ENDBR to assembly files without ENTRY Message-ID: <5d8a8c7b-a6f1-f70f-9783-31672593c156@linaro.org> Date: Thu, 9 Jan 2020 18:13:36 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200108161535.6141-4-hjl.tools@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 08/01/2020 13:15, H.J. Lu wrote: > Add _CET_ENDBR to i386 assembly files which don't use ENTRY to add > ENDBR32 at function entries when CET is enabled. > --- > sysdeps/i386/i386-mcount.S | 2 ++ > sysdeps/i386/nptl/pthread_spin_lock.S | 2 ++ > sysdeps/i386/nptl/pthread_spin_unlock.S | 3 +++ > sysdeps/i386/pthread_spin_trylock.S | 2 ++ > 4 files changed, 9 insertions(+) > > diff --git a/sysdeps/i386/i386-mcount.S b/sysdeps/i386/i386-mcount.S > index 9516265bcb..8b60bd20fe 100644 > --- a/sysdeps/i386/i386-mcount.S > +++ b/sysdeps/i386/i386-mcount.S > @@ -30,6 +30,7 @@ > .type C_SYMBOL_NAME(_mcount), @function > .align ALIGNARG(4) > C_LABEL(_mcount) > + _CET_ENDBR > /* Save the caller-clobbered registers. */ > pushl %eax > pushl %ecx > @@ -58,6 +59,7 @@ weak_alias (_mcount, mcount) > .type C_SYMBOL_NAME(__fentry__), @function > .align ALIGNARG(4) > C_LABEL(__fentry__) > + _CET_ENDBR > /* Save the caller-clobbered registers. */ > pushl %eax > pushl %ecx Ok, ENTRY will issue CALL_MCOUNT itself. > diff --git a/sysdeps/i386/nptl/pthread_spin_lock.S b/sysdeps/i386/nptl/pthread_spin_lock.S > index 5736c82078..7eb8f0e069 100644 > --- a/sysdeps/i386/nptl/pthread_spin_lock.S > +++ b/sysdeps/i386/nptl/pthread_spin_lock.S > @@ -15,12 +15,14 @@ > License along with the GNU C Library; if not, see > . */ > > +#include > #include > > .globl pthread_spin_lock > .type pthread_spin_lock,@function > .align 16 > pthread_spin_lock: > + _CET_ENDBR > mov 4(%esp), %eax > 1: LOCK > decl 0(%eax) I think we can use ENTRY/END here instead. > diff --git a/sysdeps/i386/nptl/pthread_spin_unlock.S b/sysdeps/i386/nptl/pthread_spin_unlock.S > index e7757d0a03..dac730af1f 100644 > --- a/sysdeps/i386/nptl/pthread_spin_unlock.S > +++ b/sysdeps/i386/nptl/pthread_spin_unlock.S > @@ -16,10 +16,13 @@ > License along with the GNU C Library; if not, see > . */ > > +#include > + > .globl pthread_spin_unlock > .type pthread_spin_unlock,@function > .align 16 > pthread_spin_unlock: > + _CET_ENDBR > movl 4(%esp), %eax > movl $1, (%eax) > xorl %eax, %eax Ditto. > diff --git a/sysdeps/i386/pthread_spin_trylock.S b/sysdeps/i386/pthread_spin_trylock.S > index dd08d38f8d..b3965a150f 100644 > --- a/sysdeps/i386/pthread_spin_trylock.S > +++ b/sysdeps/i386/pthread_spin_trylock.S > @@ -16,6 +16,7 @@ > License along with the GNU C Library; if not, see > . */ > > +#include > #include > > > @@ -29,6 +30,7 @@ > .type pthread_spin_trylock,@function > .align 16 > pthread_spin_trylock: > + _CET_ENDBR > movl 4(%esp), %edx > movl $1, %eax > xorl %ecx, %ecx > Ditto.