From patchwork Tue Dec 10 20:47:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1207279 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-107928-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="MBvBWRD8"; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="OoiwM3Pn"; 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 47XXFJ4jpyz9sPc for ; Wed, 11 Dec 2019 07:47:48 +1100 (AEDT) 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:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; q=dns; s= default; b=p1xgkL3peJfqQqNbDu9eTlutgUxCt5/O1hp2RwI8XIOT9QmwdIVGU i79rp9GH3tVkAQsX49MsK6ltaiMxW7LYaVTDTPh+MLWrXK3qrdD8Yh64p+t2VOBb IZxNJ+MWaBN/ANxsbCvLXIERC76Ik9JJsCv4oaSEz6ni4baiSxyA94= 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:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; s=default; bh=EvtDp54WbxjZC4Lvf7xYuACZDXg=; b=MBvBWRD8oWReWy7bNydwN5r4StAI j5U6vVXX7y68Z5EJLuJTx3SQ/xRItsv2hmMhy2FoaLTdZWlkR2hwRugwUMjWQTxt 6O4vQrhrLFiLSz/Bt11waFRpYtFt3u123P22IN706uMEcey6XkKimmaGudG8cH36 cGGmviZTASDXuzY= Received: (qmail 123129 invoked by alias); 10 Dec 2019 20:47:19 -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 123043 invoked by uid 89); 10 Dec 2019 20:47:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-22.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=HContent-Transfer-Encoding:8bit X-HELO: mail-pf1-f193.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=0B2lfqWdhswYuLMrBrb/uhP+z5fi1sKJUAIM/BVO+98=; b=OoiwM3PnvxMjRiRxJbdGulbnbCtMD1mBtzJPcJTJMYb6cumiTYMPe8HGSFOZvTZjXH mtv5WsS2j9lCB1EbInHDTMuacL3oNbJFNwNqlf1ebNwyPj6ti1ci5DTIGLtOLXmC6yNj lR1++XPkVtfrsbLMDrMPtry7g5yQhAMsSwGR3atavNhlHj/sNtOBsUqxtAbsmrCmOQRy 2wiyZnm33G8+mvNbx4OGN33T5HBbi3/MaIKq0ls+aWirE0HHNA4LZDsT1FxDwrTZtAxO R4KmdSAIJ0L9ez54k13VE483E8Pdz8QkakoqQ8QwPUyU6qIvR7ZtC0k0LSFFg5zEewS3 xqBQ== From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH 3/4] i386: Add _CET_ENDBR to assembly files without ENTRY Date: Tue, 10 Dec 2019 12:47:09 -0800 Message-Id: <20191210204710.4832-4-hjl.tools@gmail.com> In-Reply-To: <20191210204710.4832-1-hjl.tools@gmail.com> References: <20191210204710.4832-1-hjl.tools@gmail.com> MIME-Version: 1.0 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 ++ sysdeps/unix/sysv/linux/i386/_exit.S | 1 + 5 files changed, 10 insertions(+) diff --git a/sysdeps/i386/i386-mcount.S b/sysdeps/i386/i386-mcount.S index 32b2a5f0bf..6575b84a1b 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 diff --git a/sysdeps/i386/nptl/pthread_spin_lock.S b/sysdeps/i386/nptl/pthread_spin_lock.S index 62c72b9063..2876a8b1cf 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) diff --git a/sysdeps/i386/nptl/pthread_spin_unlock.S b/sysdeps/i386/nptl/pthread_spin_unlock.S index d190ca562d..dc412190ae 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 diff --git a/sysdeps/i386/pthread_spin_trylock.S b/sysdeps/i386/pthread_spin_trylock.S index 0ec09d8b64..c7f94375a7 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 diff --git a/sysdeps/unix/sysv/linux/i386/_exit.S b/sysdeps/unix/sysv/linux/i386/_exit.S index d59c127501..a21d5f69b3 100644 --- a/sysdeps/unix/sysv/linux/i386/_exit.S +++ b/sysdeps/unix/sysv/linux/i386/_exit.S @@ -21,6 +21,7 @@ .type _exit,@function .global _exit _exit: + _CET_ENDBR movl 4(%esp), %ebx /* Try the new syscall first. */