From patchwork Fri May 15 14:40:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 1291250 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=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=hMUbR1pz; dkim=pass (1024-bit key) header.d=armh.onmicrosoft.com header.i=@armh.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-armh-onmicrosoft-com header.b=hMUbR1pz; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49NrkC45RYz9sWg for ; Sat, 16 May 2020 00:43:15 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1991539858B0; Fri, 15 May 2020 14:41:37 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) by sourceware.org (Postfix) with ESMTPS id 1FBA03985818 for ; Fri, 15 May 2020 14:41:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1FBA03985818 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=xO+GjftqZsZae5+TyfKkB+AZBpc/CdAj9KfbqhuP/s8=; b=hMUbR1pzTNWbwLET+nZjJ1ztbakhvWSimZHzWVWcv82GW28h1/38ShT6m77SpIN4xn39IiDg4pgqHQpu863HhN9IRZxLC1VQi9xClXlP/NPToWZFYU6Iv22nzVX5XSK7AAC4/PyGYNUMFtvIUcpV8fs3UNidVexgg/XCZKoNvEo= Received: from AM6P193CA0042.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:8e::19) by AM5PR0801MB1713.eurprd08.prod.outlook.com (2603:10a6:203:34::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25; Fri, 15 May 2020 14:41:13 +0000 Received: from AM5EUR03FT015.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8e:cafe::2a) by AM6P193CA0042.outlook.office365.com (2603:10a6:209:8e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20 via Frontend Transport; Fri, 15 May 2020 14:41: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 AM5EUR03FT015.mail.protection.outlook.com (10.152.16.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.19 via Frontend Transport; Fri, 15 May 2020 14:41:12 +0000 Received: ("Tessian outbound 4cdf5642225a:v54"); Fri, 15 May 2020 14:41:12 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 0bc0928531d3b398 X-CR-MTA-TID: 64aa7808 Received: from bbeb8491f7ab.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id EEA04E24-5A14-4AD8-BEFC-7781B44F460A.1; Fri, 15 May 2020 14:41:07 +0000 Received: from EUR03-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id bbeb8491f7ab.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 15 May 2020 14:41:07 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Mlq/m8wrWsntFJom2DhPDmSN+RkkIF3LXvdICAtxqiWM9ZORrbBWaSSAXPQeHuffXGXVYkcrvPKlTAyr/cmdbWsRzjU/FGxUgUjOj33TgwfjKSSnyl9+VCul7nznTb/qDy6B/9mfxAqOdWIlZ2GUdH7uc+Fib8gK0t2hxEC1CYogyExg2ozEGImGpAfefWCeSOQnAEjCIuyfx1OyGliMrKbbO6CUMOF+KQ7bYLYx68WXwmGlnQ9kiwG27mkf8eyUGpbyQ+k/S+yFj6NznA5rht0UFYU+QyXEkfhlIXCZSuxevicmdQU0rQJFwn1LFCvdLD8eyTl/IXbnabY2vTTkfw== 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=xO+GjftqZsZae5+TyfKkB+AZBpc/CdAj9KfbqhuP/s8=; b=SL6RVotQ1AVA1RAwz+vz9OWa+ZzP0VE7+J5HLfyVN3WSvukOpnnYfrlQQ5H0APf7/PxsQg0/ll+3U84NrlRr4N+nlrYrze5yB8ae0lLUM1LhpiyUpTjas/1k+8yf81FPMAhi57REiYhIHHS8SGFH052V+3QvCJFAVtukEQ/dwRp5X/iTNHlmaX7+PfRq2UqnUpMyflseIE+Kx1TA8lXRjoOV/a1+SPrlVQkNe3tkQ0MPqGDqKZ3zn2WqRZgqdm7F99nQNEqwbPfJ0i3gOdI8WLuYrKkXsp6otWFdLrtzFV8VH1MvC0HzSLY3CNHscKXQ30w+Fo3oYbsd+YnqRTs6cw== 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=xO+GjftqZsZae5+TyfKkB+AZBpc/CdAj9KfbqhuP/s8=; b=hMUbR1pzTNWbwLET+nZjJ1ztbakhvWSimZHzWVWcv82GW28h1/38ShT6m77SpIN4xn39IiDg4pgqHQpu863HhN9IRZxLC1VQi9xClXlP/NPToWZFYU6Iv22nzVX5XSK7AAC4/PyGYNUMFtvIUcpV8fs3UNidVexgg/XCZKoNvEo= 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 AM6PR08MB4454.eurprd08.prod.outlook.com (2603:10a6:20b:bf::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.26; Fri, 15 May 2020 14:41:06 +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.2979.033; Fri, 15 May 2020 14:41:06 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v3 08/13] aarch64: fix RTLD_START for BTI Date: Fri, 15 May 2020 15:40:52 +0100 Message-Id: <907a683ba82f7b14e24ff38dfa5c74f056275d3f.1589552055.git.szabolcs.nagy@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) To AM6PR08MB3047.eurprd08.prod.outlook.com (2603:10a6:209:4c::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (217.140.106.55) by LO2P265CA0309.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.24 via Frontend Transport; Fri, 15 May 2020 14:41:06 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 932b9dc6-4bac-49af-ce6d-08d7f8de040b X-MS-TrafficTypeDiagnostic: AM6PR08MB4454:|AM5PR0801MB1713: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-Forefront-PRVS: 04041A2886 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 8gjI3RYRMa0dAva9Qhtu+SDKcaznx9MmsqxYhQLTqfmb+3CIc7vfudukscXL48fpOYaL3hWKpzaKCLK5oeP65f8faKVScvFk1aKO5F/ie1vfyQSmAKBOVHeRsmx/cjklnBC8WQqYUTYzWdIhCxaKXJybP6eWHo9LQLK46/uJVRYcen40J8WbyVWrcHLJKt0ixL4rHsgy7E7FAdM9K69K63q3x/KpTPjPeeBXtX7gsTf+nIN7j5MLynpztXQk8E4t4uf1/htOOLxyLBvNI63L9wSejG33x+91j/ccLllwLw1hjtSleIP2RQ/Cnt1DJu/JSQQb7v0WQgb8MYkorLzbn8oGnUuscG2Sty6rS7c8BuV7fp71MQTFc224pazswmssVp/38O2g4Rni8yUu3iP26lEEyOl2KlM4VpHXt1RTpOgnkoiKQYnK4are/XcmsiwpDkBD4V7bfrHXRCIgSff8uf15FwtxeeawA+DRXVkQoSMnOQsGPHPiAHD3lTCQHRcwR2zAnsKgvKi7yAnO3jm8imySm+F0ycr5rb1wRgT+arQ= 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)(366004)(376002)(136003)(39860400002)(396003)(52116002)(6486002)(36756003)(8676002)(8936002)(6916009)(478600001)(6666004)(86362001)(6512007)(316002)(26005)(5660300002)(16526019)(186003)(6506007)(2906002)(2616005)(956004)(66556008)(66946007)(69590400007)(44832011)(66476007)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: 87e8YfT8oMgesizIRcARVH1ShcKv76IqA0jgnHqdpMzDQ2LRAjW0XTvNo1x6eAXa1gTweQg8johaSpG3u3Oj+Ow6d8wHZcmzfYWH7Z3ln1KBewM+V7OwpPoeZCrZGt3ZspOVr1PEWxRjBySoq6CV1bXI4PfH7EDre2DLmUuFhOuj2UhvgWfP0x8KpozbkBvTSEa0BaOkTVlSX8ubIKYs0xioWnPlDTPntR55HqWO4NlXmWwUflpNmAdXhZiU07ByewjDmnXl8ePQechFy75qCKKdNHc85tlRZsro8BhfX4Aw++nYDbjaG+AuVfuQc4JXKFgu5JoRx9JhMNDbVtO87m87L/YIfGRLWxoPrE6UrkEMrM8F6JiwtnP1opibukhLC5nCsDS0DNxhQ4h/9gNMLeW2jgGOdYyNrDcWIR9JDBSRJWssflf4YCyfp1r3QN0IWIYVl0hqhmGgQmxgJ3Q0Ic/kPRFCJ2THsI0XH/X8+sMtfX7o6mAGmZ+w9rOPJjji X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4454 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: AM5EUR03FT015.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)(39860400002)(346002)(136003)(376002)(396003)(46966005)(6486002)(36906005)(8936002)(2906002)(6506007)(316002)(82740400003)(16526019)(69590400007)(8676002)(6916009)(2616005)(956004)(186003)(86362001)(336012)(26005)(44832011)(6512007)(70586007)(356005)(82310400002)(36756003)(5660300002)(47076004)(81166007)(70206006)(478600001)(6666004)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 0a480374-8670-4ebc-1145-08d7f8ddfff7 X-Forefront-PRVS: 04041A2886 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gfMUjLuHrr+aGhWKmGc6jZNDCJNWg5dcr++JUo3ibVUlXS/8d8gCTfaNT66L1OHzb2cNSZvfLkt5WC60BzPNVmsA56DuyZTjUvZqdcd+x79eFKfz8BbEU3rC/2UPkhpbQ8FxnkCC28X/kyGColKe+myCfv23TGXjpOLbt5UraG515hzWuORqqNxs/HP7vG96Ad5tRA/D369QcoXLfSViy3BovcdY/TSYdnd1BQU8qH3oGLQV2+cMEQtyG+6/x+nUcRBtR5zvCCKIQbwtvQmxIqWDoSMundkZ6DvwjPJegyBMVnPuv6m7MwvbRPvDuNuT0Krd2ZhDjIQLLBvuitZ3nRT5mwJh1WhXk7gWPrRBXRRFU6+eujVGKsEaKs6MlVP6e/iJgfjOjjG0LUKfTEnS5Tk7APH2tyng3JpKeJnkkg2C2AHGyhxoW63xBizWGT7NDQ6INIg/W2uhNR3ms+pAp0T/RBDyBj6y7aiRF80GoAnZ4lXsziqLZw1neWYiDBEnZxkhDRpJ3EhLlR9RbYdOIN3uvwauw6LzYtmY7s4YlmaqTTAExuzwlnTCGbiXW+DCYlCM+Z6HC9kTnW2Eh2QYVA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2020 14:41:12.9881 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 932b9dc6-4bac-49af-ce6d-08d7f8de040b 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: AM5PR0801MB1713 X-Spam-Status: No, score=-19.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, 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 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: , Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" 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. Reviewed-by: Adhemerval Zanella --- 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) \