Message ID | 20200430174204.GB29015@arm.com |
---|---|
State | Superseded |
Headers |
Return-Path: <libc-alpha-bounces@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5539C396E865; Thu, 30 Apr 2020 17:42:18 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-eopbgr40087.outbound.protection.outlook.com [40.107.4.87]) by sourceware.org (Postfix) with ESMTPS id C1EA0395383D for <libc-alpha@sourceware.org>; Thu, 30 Apr 2020 17:42:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org C1EA0395383D Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=Szabolcs.Nagy@arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=49mUwnhaBNB6il3ew2N8yCyN1Wh2wEwqrWsfcHkk11M=; b=zNG8eYAikq0g+aVfNJ9IZl1ObbRkgdI+yZRUn4YUdxHMTYK662ZA9wIhSAlCWX944BnURvQtzkdKKmPBq7b8yt/DCUzp9d82bWsBXnA1LXc4y1FEut8KbjirWziFvK/5TPXA/UGiPLaoP9IPg1Iyqog/BseETQdnFRM8JSJOn8o= Received: from DB8PR06CA0024.eurprd06.prod.outlook.com (2603:10a6:10:100::37) by VI1PR0802MB2605.eurprd08.prod.outlook.com (2603:10a6:800:b0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20; Thu, 30 Apr 2020 17:42:13 +0000 Received: from DB5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:100:cafe::9e) by DB8PR06CA0024.outlook.office365.com (2603:10a6:10:100::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Thu, 30 Apr 2020 17:42:13 +0000 Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; sourceware.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; sourceware.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT059.mail.protection.outlook.com (10.152.21.175) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Thu, 30 Apr 2020 17:42:13 +0000 Received: ("Tessian outbound 11763d234d54:v54"); Thu, 30 Apr 2020 17:42:13 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ae007e1b1215dfe1 X-CR-MTA-TID: 64aa7808 Received: from a88f4b467cbc.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4479B062-C640-42F6-98B2-15D1C27E6CE5.1; Thu, 30 Apr 2020 17:42:07 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a88f4b467cbc.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:42:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gyhnca04E20XNluusYQwMWA4iGzDTEUXwfSzPoC7TXN2uJfswC+1Hd6BhpQmGVjTbxaC4WoPTGMxd6yjheLKirgY4imIMYe6i1Ib197WIFoztaOPfJdEbSziTyBeUPPXYnuov3bowh0CO96/lLjny+CTPjj7gyGzNPkLo9LltC5jI67d/pvUbEDbDaxDZdDjbFyn3Dp9EP4Gi4kIVA3GC7hHQdNiCbGwFz3SHJ+59NsPkaimNMDeOwkBWQwmDvpDI+0W22K/la2FgbBC6ErCWHYUsNskwsISK9MEteonCrF52qe2cIzUi91qBMwcPjlzqA+6QEu5H64AjjpjUIIT9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=49mUwnhaBNB6il3ew2N8yCyN1Wh2wEwqrWsfcHkk11M=; b=Vz2jkrYlmToAaeaPW86MMT6KvA/J4LQqn7JyOSqiSS2F0dKOJZ9qtEijy1t0Ejk7OKQt8U1I5T79YsroQoIOi6MpWqtySD843t7Czq3rH6TaV2ifpPfl2ZTY0eontrayfekvOa4ipXbQwMF16eGgomkqZm+uFV4PeQuN+S7dvHrT4b9LQhJJqA4oPqZ5XXxHu+jl9CoM/ZdQprbjrOMXFrVNkc4I7KFWqjIOTpSMiSiKDEt39jF+6LTsZw+G0tuwZIgGvs6jkrmWX64mLJTSJCzYO4KYRR91O1hS2DXUW/zeVaAdAjDtVKWNn6MpfrGQeLJKUF0vQlVBPlPDB6AJQQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=49mUwnhaBNB6il3ew2N8yCyN1Wh2wEwqrWsfcHkk11M=; b=zNG8eYAikq0g+aVfNJ9IZl1ObbRkgdI+yZRUn4YUdxHMTYK662ZA9wIhSAlCWX944BnURvQtzkdKKmPBq7b8yt/DCUzp9d82bWsBXnA1LXc4y1FEut8KbjirWziFvK/5TPXA/UGiPLaoP9IPg1Iyqog/BseETQdnFRM8JSJOn8o= Authentication-Results-Original: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com; Received: from AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) by AM6PR08MB3224.eurprd08.prod.outlook.com (2603:10a6:209:47::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19; Thu, 30 Apr 2020 17:42:07 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::49fd:6ded:4da7:8862%7]) with mapi id 15.20.2958.020; Thu, 30 Apr 2020 17:42:07 +0000 Date: Thu, 30 Apr 2020 18:42:05 +0100 From: Szabolcs Nagy <szabolcs.nagy@arm.com> To: libc-alpha@sourceware.org Subject: [PATCH 06/12] aarch64: fix RTLD_START for BTI Message-ID: <20200430174204.GB29015@arm.com> References: <20200430173458.GV29015@arm.com> In-Reply-To: <20200430173458.GV29015@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: LO2P265CA0358.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:d::34) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from arm.com (217.140.106.55) by LO2P265CA0358.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:d::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.20 via Frontend Transport; Thu, 30 Apr 2020 17:42:06 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 23f46353-77ea-47e0-244e-08d7ed2dd10a X-MS-TrafficTypeDiagnostic: AM6PR08MB3224:|AM6PR08MB3224:|VI1PR0802MB2605: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: <VI1PR0802MB2605A70A559624A329F42453EDAA0@VI1PR0802MB2605.eurprd08.prod.outlook.com> x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Jxm8y1uAf3UwcUDil0WnRMBGqHv2QtDOiBUXtY/4b5MMFSBfX7peRpDg+TCfBep6srfKIDaCsAp0KYC4edcbv9qYpvh0UAchyFhtZNh2wGTsbqcHGsSPMk46DRVQwwhi7vW82RxzLuFyIofMiunWaoKtruXIjqjyiHrfZgwrQ+z96UYt4JkQdp3/lrC3gEoKa42Fj9TNwEzQMo5sWLYaB6PZCA21wL9nBEiWPYBWYhJAegkVzE8Zgmy8RpO6f1TxMc/i5jPvCmn6lRNY3Hm8/EQv/6lvMf2YqsFV+uwGPyxOfr5xec4wBPW+9xanG7r+yLlGHb7FY3c4NRCdrZC/JCTT+v+tAZpfgjNyOLkCyStCe56iZV1ZN1BRQCeI96DU X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR08MB3047.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(346002)(376002)(366004)(396003)(136003)(39860400002)(1076003)(86362001)(33656002)(36756003)(66946007)(235185007)(66476007)(8886007)(55016002)(66556008)(66616009)(564344004)(478600001)(16526019)(26005)(186003)(52116002)(6916009)(44832011)(7696005)(33964004)(2906002)(4326008)(8676002)(8936002)(44144004)(956004)(2616005)(316002)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: mO8I0nU1CYBhSdu3aaq86UVPCuIlhKSxNF+p9yqbXtYAyroXZ9/FtfObEcqZlmZqI1mdOjs733r8o4fpc+JGpUvnStPxFBGWPM2EzkVzEgGkSEwB2B132e69cXVz863zGOe4VDyR2vtg/60CE8R8jcCq50ARHMUGerXCftXcX1bDh1iqsYfLX197Ky52zVGwcbYzjQ8lKc2Nj3CCKbrA3g8zvcnqvGBbv5v5WosBMAocTaUJaPi4a7Yv48qYB/TVCTz8xwNzvcbcR40ru7/G5STWI1kJfKL3mI/U3xnHeZlOsaGVKY2IwdqEvUatZXFMQl5KJMC5PSY90IEw3J1sv1v0wwnt3nPIyoICwzc8a1Gh8DUrhYZdbJsToqprRkH6LtJgdAkrUNMl66AsID83Yic87EbzPS52/Z5kMSUaGy4lj0kGg7M2dKPm+fdhwS2BCqlmuWrdkulvMxI4a7sK9qvkOar80eH1lQhanva7PODU4rp555fRdEBGzcXkIP610dcfVy5lJZ7g24+GPcUmdskRWyFjQ5ukxYFGIkvsogiJ9sjVUz8BhC/beUk1Y8Dr8lS8AKesACLm6/0qROeiu5XW8GvmExAmciwbsNBTPnXysguc3uNc9gnphBI0mes41AnEd/avdSULW47qgkgjWpwr3kW9c/ZX0TOyR81FeaxxSzRuBHKQcp+vtaANtF3R6qcC93syldVbfyrpJ9f1AY4HYVDDJh1s69vA4BNZLMeMEu4WwD1Qo54Mdmvi3Hn2JZwm+u0aLwKL0CSpzU3wRmI81AeK3m8DTWx25bY9RqU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3224 Original-Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(396003)(39860400002)(136003)(376002)(346002)(46966005)(7696005)(44144004)(44832011)(564344004)(2616005)(956004)(316002)(336012)(47076004)(2906002)(478600001)(4326008)(70586007)(86362001)(70206006)(66616009)(36756003)(8886007)(33964004)(55016002)(16526019)(186003)(26005)(33656002)(8936002)(8676002)(235185007)(1076003)(82740400003)(356005)(6916009)(81166007)(82310400002)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: f0888670-c355-4344-bfae-08d7ed2dcd28 X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1IFlZ0IeZ3q1G9F5OViRbIXQ6OXTkWoSvpVdlvzo9ckq5MqwM31mf1i7S3q0jhBJ8shrZdcU+51D+Dg6eqghjoNk1xQXw/8QEtcpNbnKok6lgA8XsaWskBKLzKV2uijkX4g8Pef183iCKNLdFwtbzIwEGTLFwO9p9UojmzHkMjkYtlL49nMXwvWQ4eLCdlUjA11XfuzfZcLUmanwtvEUo4pPKDQfb+SRRQrolOOXfpQII1PFU3d0RlyaaAiof/sZVKoud9xT+k4n5SMUO/hEu7YjPfpw+ltYrfwrQ1hMy8LAdeXZDB3C52/44sUKOCBPkkMqm5XGC2T2m42LTMwGJT+7BzRhVmqLftFpUdHlSblyQ5+eGsFy+QIo6ke+19J4ZKb72vT9fniA0YPjlE1wO0vHQaKJ9KXpU+lxnSwDAqk= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:42:13.2563 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 23f46353-77ea-47e0-244e-08d7ed2dd10a X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0802MB2605 X-Spam-Status: No, score=-28.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, MSGID_FROM_MTA_HEADER, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0006-aarch64-fix-RTLD_START-for-BTI.patch" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <http://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <http://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> Cc: Sudakshina Das <Sudi.Das@arm.com> Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces@sourceware.org> |
Series |
aarch64: branch protection support
|
|
Commit Message
Szabolcs Nagy
April 30, 2020, 5:42 p.m. UTC
Comments
On 30/04/2020 14:42, Szabolcs Nagy wrote: > From 1e8662264c07e69d807761882e8d77f0916ae562 Mon Sep 17 00:00:00 2001 > From: Szabolcs Nagy <szabolcs.nagy@arm.com> > Date: Tue, 31 Mar 2020 17:32:14 +0100 > Subject: [PATCH 06/12] aarch64: fix RTLD_START for BTI > > Tailcalls must use x16 or x17 for the indirect branch instruction > to be compatible with code that uses BTI c at function entries. > (Other forms of indirect branches can only land on BTI j.) > > Also added a BTI c at the ELF entry point of rtld, this is not > strictly necessary since the kernel does not use indirect branch > to get there, but it seems safest once building glibc itself with > BTI is supported. LGTM, thanks. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> > --- > sysdeps/aarch64/dl-machine.h | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h > index db3335e5ad..70b9ed3925 100644 > --- a/sysdeps/aarch64/dl-machine.h > +++ b/sysdeps/aarch64/dl-machine.h > @@ -125,6 +125,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) > .globl _dl_start_user \n\ > .type _dl_start_user, %function \n\ > _start: \n\ > + // bti c \n\ > + hint 34 \n\ This is the BTI_C defined at sysdeps/aarch64/sysdep.h, why can't you use it here? > mov " PTR "0, " PTR_SP " \n\ > bl _dl_start \n\ > // returns user entry point in x0 \n\ > @@ -178,7 +180,8 @@ _dl_start_user: \n\ > adrp x0, _dl_fini \n\ > add " PTR "0, " PTR "0, #:lo12:_dl_fini \n\ > // jump to the user_s entry point \n\ > - br x21 \n\ > + mov x16, x21 \n\ > + br x16 \n\ > "); > > #define elf_machine_type_class(type) \ > -- > 2.17.1
The 05/07/2020 15:49, Adhemerval Zanella wrote: > On 30/04/2020 14:42, Szabolcs Nagy wrote: > > From 1e8662264c07e69d807761882e8d77f0916ae562 Mon Sep 17 00:00:00 2001 > > From: Szabolcs Nagy <szabolcs.nagy@arm.com> > > Date: Tue, 31 Mar 2020 17:32:14 +0100 > > Subject: [PATCH 06/12] aarch64: fix RTLD_START for BTI > > > > Tailcalls must use x16 or x17 for the indirect branch instruction > > to be compatible with code that uses BTI c at function entries. > > (Other forms of indirect branches can only land on BTI j.) > > > > Also added a BTI c at the ELF entry point of rtld, this is not > > strictly necessary since the kernel does not use indirect branch > > to get there, but it seems safest once building glibc itself with > > BTI is supported. > > LGTM, thanks. > > Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> > > > --- > > sysdeps/aarch64/dl-machine.h | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h > > index db3335e5ad..70b9ed3925 100644 > > --- a/sysdeps/aarch64/dl-machine.h > > +++ b/sysdeps/aarch64/dl-machine.h > > @@ -125,6 +125,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) > > .globl _dl_start_user \n\ > > .type _dl_start_user, %function \n\ > > _start: \n\ > > + // bti c \n\ > > + hint 34 \n\ > > This is the BTI_C defined at sysdeps/aarch64/sysdep.h, why can't you use > it here? BTI_C is only defined for asm files, but this is inline asm in c. thanks for the reviews so far, i'm working on a v2 of the patchset (changing configury bits and how all this is enabled) will post it when the tests finish running.
On 07/05/2020 16:24, Szabolcs Nagy wrote: > The 05/07/2020 15:49, Adhemerval Zanella wrote: >> On 30/04/2020 14:42, Szabolcs Nagy wrote: >>> From 1e8662264c07e69d807761882e8d77f0916ae562 Mon Sep 17 00:00:00 2001 >>> From: Szabolcs Nagy <szabolcs.nagy@arm.com> >>> Date: Tue, 31 Mar 2020 17:32:14 +0100 >>> Subject: [PATCH 06/12] aarch64: fix RTLD_START for BTI >>> >>> Tailcalls must use x16 or x17 for the indirect branch instruction >>> to be compatible with code that uses BTI c at function entries. >>> (Other forms of indirect branches can only land on BTI j.) >>> >>> Also added a BTI c at the ELF entry point of rtld, this is not >>> strictly necessary since the kernel does not use indirect branch >>> to get there, but it seems safest once building glibc itself with >>> BTI is supported. >> >> LGTM, thanks. >> >> Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org> >> >>> --- >>> sysdeps/aarch64/dl-machine.h | 5 ++++- >>> 1 file changed, 4 insertions(+), 1 deletion(-) >>> >>> diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h >>> index db3335e5ad..70b9ed3925 100644 >>> --- a/sysdeps/aarch64/dl-machine.h >>> +++ b/sysdeps/aarch64/dl-machine.h >>> @@ -125,6 +125,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) >>> .globl _dl_start_user \n\ >>> .type _dl_start_user, %function \n\ >>> _start: \n\ >>> + // bti c \n\ >>> + hint 34 \n\ >> >> This is the BTI_C defined at sysdeps/aarch64/sysdep.h, why can't you use >> it here? > > BTI_C is only defined for asm files, but this is inline asm in c. Ack. > > thanks for the reviews so far, i'm working on a v2 of the patchset > (changing configury bits and how all this is enabled) will post it > when the tests finish running. > Could you send the new version as inline instead of attachment? It is default of git send-email and slight easier to review with most email clients.
The 05/07/2020 16:55, Adhemerval Zanella wrote: > > thanks for the reviews so far, i'm working on a v2 of the patchset > > (changing configury bits and how all this is enabled) will post it > > when the tests finish running. > > > > Could you send the new version as inline instead of attachment? It is > default of git send-email and slight easier to review with most email > clients. ok. i sent as attachments because on some patches i'm not the author which is visible in an attachment but not with inline patch..? maybe i should make myself the 'author' and add the original author as 'co-authored-by'? not sure what's the best policy here.
On 07/05/2020 17:14, Szabolcs Nagy wrote: > The 05/07/2020 16:55, Adhemerval Zanella wrote: >>> thanks for the reviews so far, i'm working on a v2 of the patchset >>> (changing configury bits and how all this is enabled) will post it >>> when the tests finish running. >>> >> >> Could you send the new version as inline instead of attachment? It is >> default of git send-email and slight easier to review with most email >> clients. > > ok. > > i sent as attachments because on some patches > i'm not the author which is visible in an > attachment but not with inline patch..? > > maybe i should make myself the 'author' and > add the original author as 'co-authored-by'? > > not sure what's the best policy here. > At least with git send-email, it does handle different author. For instance https://sourceware.org/pipermail/libc-alpha/2020-April/112686.html
From 1e8662264c07e69d807761882e8d77f0916ae562 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy <szabolcs.nagy@arm.com> Date: Tue, 31 Mar 2020 17:32:14 +0100 Subject: [PATCH 06/12] aarch64: fix RTLD_START for BTI Tailcalls must use x16 or x17 for the indirect branch instruction to be compatible with code that uses BTI c at function entries. (Other forms of indirect branches can only land on BTI j.) Also added a BTI c at the ELF entry point of rtld, this is not strictly necessary since the kernel does not use indirect branch to get there, but it seems safest once building glibc itself with BTI is supported. --- sysdeps/aarch64/dl-machine.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h index db3335e5ad..70b9ed3925 100644 --- a/sysdeps/aarch64/dl-machine.h +++ b/sysdeps/aarch64/dl-machine.h @@ -125,6 +125,8 @@ elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) .globl _dl_start_user \n\ .type _dl_start_user, %function \n\ _start: \n\ + // bti c \n\ + hint 34 \n\ mov " PTR "0, " PTR_SP " \n\ bl _dl_start \n\ // returns user entry point in x0 \n\ @@ -178,7 +180,8 @@ _dl_start_user: \n\ adrp x0, _dl_fini \n\ add " PTR "0, " PTR "0, #:lo12:_dl_fini \n\ // jump to the user_s entry point \n\ - br x21 \n\ + mov x16, x21 \n\ + br x16 \n\ "); #define elf_machine_type_class(type) \ -- 2.17.1