From patchwork Tue May 8 20:40:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 910472 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-92285-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (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="Ky8jhRqJ"; 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 40gWdC0gc9z9s37 for ; Wed, 9 May 2018 06:42:22 +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:in-reply-to :references; q=dns; s=default; b=fv7sds9b/a4ozqFstiwnvAaheuWBdnv TdrnrC5mXYfdTdyLfv9jwLa9rrLPe+BYCUd+8wxZYeBzzAHpkoGWyAzQ6MzhK2gJ NMGAiGH50rnO8ZGTCNDr7Ui/nfaj99zLiTA7ZkeEEN4oelWxWg89emfxWQ28egrb efzsJl7N2hAc= 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:in-reply-to :references; s=default; bh=eDPBp/6rRmxsriEvNzfjxrnwI+I=; b=Ky8jh RqJIL9u+344XsalqsMhXzkJlon+6UYmdtWvye29vkQJIG41L0MNspF/Xx4fb1EZ/ 10CnNOSof4CB2THMNVXISDVyffhNwmtKdvyszqnOjM9qKjUdyILNp0sjLH2PR79b 6RXgIh7cFU9BUxsW9wLwN6tLQKhMWSRTpE1tSU= Received: (qmail 77115 invoked by alias); 8 May 2018 20:40:36 -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 76254 invoked by uid 89); 8 May 2018 20:40:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.6 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_SOFTFAIL autolearn=ham version=3.3.2 spammy=Maintain, @function X-HELO: mga11.intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: Carlos O'Donell Subject: [PATCH 04/23] x86: Add _CET_ENDBR to functions in crti.S Date: Tue, 8 May 2018 13:40:02 -0700 Message-Id: <20180508204021.31845-5-hjl.tools@gmail.com> In-Reply-To: <20180508204021.31845-1-hjl.tools@gmail.com> References: <20180508204021.31845-1-hjl.tools@gmail.com> Add _CET_ENDBR to functions in crti.S, which are called indirectly, to support IBT. Tested on i686 and x86-64. * sysdeps/i386/crti.S (_init): Add _CET_ENDBR. (_fini): Likewise. * sysdeps/x86_64/crti.S (_init): Likewise. (_fini): Likewise. --- sysdeps/i386/crti.S | 2 ++ sysdeps/x86_64/crti.S | 2 ++ 2 files changed, 4 insertions(+) diff --git a/sysdeps/i386/crti.S b/sysdeps/i386/crti.S index c0422f9ce3..ad46d30a49 100644 --- a/sysdeps/i386/crti.S +++ b/sysdeps/i386/crti.S @@ -60,6 +60,7 @@ .globl _init .type _init, @function _init: + _CET_ENDBR pushl %ebx /* Maintain 16-byte stack alignment for called functions. */ subl $8, %esp @@ -79,6 +80,7 @@ _init: .globl _fini .type _fini, @function _fini: + _CET_ENDBR pushl %ebx subl $8, %esp LOAD_PIC_REG (bx) diff --git a/sysdeps/x86_64/crti.S b/sysdeps/x86_64/crti.S index 619effac3a..de0d87f1c9 100644 --- a/sysdeps/x86_64/crti.S +++ b/sysdeps/x86_64/crti.S @@ -60,6 +60,7 @@ .globl _init .type _init, @function _init: + _CET_ENDBR /* Maintain 16-byte stack alignment for called functions. */ subq $8, %rsp #if PREINIT_FUNCTION_WEAK @@ -77,4 +78,5 @@ _init: .globl _fini .type _fini, @function _fini: + _CET_ENDBR subq $8, %rsp