From patchwork Wed Jul 8 12:12:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 39970 Return-Path: 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 0D154386180A; Wed, 8 Jul 2020 12:12:25 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR02-AM5-obe.outbound.protection.outlook.com (mail-eopbgr00066.outbound.protection.outlook.com [40.107.0.66]) by sourceware.org (Postfix) with ESMTPS id D1894386102B for ; Wed, 8 Jul 2020 12:12:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D1894386102B 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=I1N9P48omYav++AgF54eQfEc8J/DsRz/ys2wfPAr3STPJPHdq2JuL9lTd+O6PP7DsKSmTuV6UX+Fq4ik0g/+7XsNRWnw6h6oIZif8FRynUFiHC2xh17MvtEvqSn3G9BIssyxkLrBluuxAdyQeKhkOdcmCAW9g5fpT6iFqe581oM= Received: from DB8PR04CA0012.eurprd04.prod.outlook.com (2603:10a6:10:110::22) by AM6PR08MB5173.eurprd08.prod.outlook.com (2603:10a6:20b:e5::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.20; Wed, 8 Jul 2020 12:12:19 +0000 Received: from DB5EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:110:cafe::d) by DB8PR04CA0012.outlook.office365.com (2603:10a6:10:110::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.21 via Frontend Transport; Wed, 8 Jul 2020 12:12:19 +0000 X-MS-Exchange-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 DB5EUR03FT049.mail.protection.outlook.com (10.152.20.191) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.24 via Frontend Transport; Wed, 8 Jul 2020 12:12:19 +0000 Received: ("Tessian outbound e44de778b77e:v62"); Wed, 08 Jul 2020 12:12:19 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 26163d7ee6c4900b X-CR-MTA-TID: 64aa7808 Received: from c515b2f61a09.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F69C0DF9-E78F-4FBD-987B-46F5B6A74EC3.1; Wed, 08 Jul 2020 12:12:14 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c515b2f61a09.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 08 Jul 2020 12:12:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WJgvY5UwBd+0peNcN5Q6PryPqGltRdnOnIkZoeAekLkUKZKnznEAOsCMW3U5JLHVwrijl2SqHs2MyT/ZVZghfZBW9fHB7YGAK+5fGtKu/r2zEaslAmMPCUfwEAe5/T/qvc2BwYoOZa+7aHGWk4Tzfsac+clbBtwr4dlsgExmlCga2fB/p9ULTQNRVDRJXYnKIgB99EQ5LAxoFr8SmgEZ9PiXmrdZVGtuEMxHxQKUfY3KLFQlVLk8ryeCo26Y86jKGStJBa3lrjkxMTX8N5SeXrpitYs/G4oNOHjus2mhC+jBYfkXmm+ZMXJYb3gClmXZCsTLSoZ+azkPLsFt9NpYEA== 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=TvpHhBx6FH+0NaUZjlQg8u4oBnFWv7XJbgY107AnK8VPjuFScH6gyCVCGMxHBLX9EvUsiXWNhWvm9QqMKaNquC2yQ6aMHF10S89DmFXF6QiViXCNpMYM3GJzeWVdok+7l0AbwBYO8u4KDL75MBHhkmBAGpi5DHCvkWRO1iCpC4VEMLr3fFpJeLFN0p4tnsTLCTMlLe/vY9YS0ea7VZMM9WNi+rJQJhDrHQmZ+bkaG24xY/rm0EOrV/gOdqk3ucf6VryutrXZyrxKHD/lzodHANpn+TEqKdnvvDNtExDcfNtww812kbYAihvXwKAx4PNNUTfzvUYWvVEDuDB351jhsQ== 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=I1N9P48omYav++AgF54eQfEc8J/DsRz/ys2wfPAr3STPJPHdq2JuL9lTd+O6PP7DsKSmTuV6UX+Fq4ik0g/+7XsNRWnw6h6oIZif8FRynUFiHC2xh17MvtEvqSn3G9BIssyxkLrBluuxAdyQeKhkOdcmCAW9g5fpT6iFqe581oM= 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 AM7PR08MB5527.eurprd08.prod.outlook.com (2603:10a6:20b:de::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.28; Wed, 8 Jul 2020 12:12:13 +0000 Received: from AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c]) by AM6PR08MB3047.eurprd08.prod.outlook.com ([fe80::2404:de9f:78c0:313c%6]) with mapi id 15.20.3153.031; Wed, 8 Jul 2020 12:12:13 +0000 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH v7 06/14] aarch64: fix RTLD_START for BTI Date: Wed, 8 Jul 2020 13:12:06 +0100 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0237.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b::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.53) by LO2P265CA0237.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.24 via Frontend Transport; Wed, 8 Jul 2020 12:12:12 +0000 X-Mailer: git-send-email 2.17.1 X-Originating-IP: [217.140.106.53] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 3373714f-66a0-422e-2c97-08d823382999 X-MS-TrafficTypeDiagnostic: AM7PR08MB5527:|AM6PR08MB5173: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:9508;OLM:9508; X-Forefront-PRVS: 04583CED1A X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: LCPn/q5a/5uCPyojPwWmELLYsVK9j/EqE38Heef+p3eQyEIc15qwPpkkie5lhVagqxaanri1jq5AOXkYOYn8oB3BHjREPzqmk2dWJLyT6xRE8CwMQh6RIzPEp/KQfgKtt8zg/5VlhCXBO9EnSQDsrygz601FVBmjDi0BD5DcwfYHyHHZ3xfiggCUsu/YydMp9RpqPfXdSQv4IcwPUAgehTaOTlXc5JW3XLV+N19JYYkRxdmh5t6JzBflRRW0BLoPmERu3xpoPUjh5k8hf0x8xS5uE62WSE1L0nRBnXAbUHI4Gvg2V4C1i8zAxYYCGthwxn98NLWUO3vG2Ws3/eSqcgQwB5F/s4F7rNIThnzP2L7x6lhopFe1z4RSc63ujhCafuC8d7/LH4GbNq+0kzcPcXLuBJD/Iyq3/6/GywQP/xA= 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)(136003)(39860400002)(396003)(376002)(346002)(366004)(8676002)(478600001)(6506007)(2616005)(956004)(8936002)(44832011)(16526019)(2906002)(186003)(26005)(36756003)(66476007)(66556008)(6916009)(316002)(66946007)(6666004)(5660300002)(83380400001)(86362001)(69590400007)(6512007)(6486002)(52116002)(136400200001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: JYV3lfXU9Hdyrncy6Gqe9sX5TLzCyYSqjlIWZBhRIU62U3FXOVGa2jk7S8AEFVUkcd9vYK4NkB8rYf4oh6Dd/X6z06Tcix4hvuNEoJ6Re75icPlYUR0LOklEDXMkqyima3fmdID0fjo2VZhn4Gd68NzJYm84OblVeV+ONLW+6ai98GCRlKoDEiMBIXVcyAIVMKQjMzwESYbO8c18dCE+faZrT56ve3EfpgQlmCCDGYo0fp9Uv+nJE0wh3sVDyyz3AAIvfjQ829Q7gDx4MGI8j1U+iem+cR6qHvD5R4kTurDln0MGRT28NSmI7ajdThmUOlqSD+M6vNa3/qWaq71CLmHnCwqtFy7kEPFoE7VQwOGi40cL7HkuuISTYDBb/x4gi+iqpopoGpxuHmz5ECgVjuimCjOXL7MzmbLnBmUVNMqUNQTwQj5Lq6mNUrVhuoTYUfpx1dCxI6UwEFGNDxNMtnFH7QEZJEc/Td116ra6DrY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5527 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: DB5EUR03FT049.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)(376002)(346002)(39860400002)(396003)(136003)(46966005)(356005)(26005)(81166007)(6506007)(44832011)(2616005)(47076004)(5660300002)(6666004)(478600001)(956004)(70586007)(70206006)(82740400003)(83380400001)(82310400002)(6916009)(336012)(69590400007)(86362001)(36756003)(186003)(6512007)(6486002)(8936002)(2906002)(8676002)(16526019)(316002)(136400200001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 5f96cd98-4b20-4316-88b1-08d8233825a1 X-Forefront-PRVS: 04583CED1A X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 8jS+veCH8e3GNTQZsKCo/23AlsdovCF1rRn419JOggxyedYsaP92dzXFE3H1V4DmTGJFmT1NhC/3qQ07ycp4PZRlxKu+ZGbIx9jbnYbABBVpR1iE948wpNkIj29kRDh0u4ojSp5SrPYqe4yqrwoWZAB4cpP47nU+fF+BrCzMIe+kVVflx0gZJ3hnakzjf9trFAsL+BpQ6yE2U3yLUhsl3ZXWsCNmWgyZX2De2gKn1BPySVZuejcof6Bn5/lmRxAWvM436HjPsuds+0ozKqlzSTz8gFmSGBXEAxDK1bqc6Lfz01hxmW7aBHSE4udlOhQHDJrKhmEWLULzerjFV6Yn+DRxu/14yeLNK+BGAQLBOLtzqn1BMRlSQJpsGUbYL/6qeTNfKJjtPIfsiSiBxeJQoLklNZQ3odMYZ8R+CXZHFp7mq1ttiUiG2uX+OCrpGsMRQuJ68ABjpOBB0okiaHMsKw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2020 12:12:19.5890 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3373714f-66a0-422e-2c97-08d823382999 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-AuthSource: DB5EUR03FT049.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5173 X-Spam-Status: No, score=-16.0 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) \