From patchwork Thu Apr 30 17:37:03 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 38882 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 7B724389851A; Thu, 30 Apr 2020 17:37:23 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10042.outbound.protection.outlook.com [40.107.1.42]) by sourceware.org (Postfix) with ESMTPS id 2F27F3894E6C for ; Thu, 30 Apr 2020 17:37:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2F27F3894E6C 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=M2A6BoZszaWhZvkKMv0RwsWkEVwi4wEzMT+35ZeOJ5Q=; b=gpFyRYvYFp3FSND5bA9tf5rsZA1pOpNfPexGgCWzY18u3erL5VO+8bvUovQltZXWxu93CCyIdH+WZwbKvPDMz2wkN3zzGo0xAJWW19gmhEgMAQLWfie2jKwMQX1GpjtOpGD7Jfi7MyB2LkUI1Io0Wj46NXKsVso4YYwzEN5IurY= Received: from AM5PR0201CA0018.eurprd02.prod.outlook.com (2603:10a6:203:3d::28) by AM0PR08MB3729.eurprd08.prod.outlook.com (2603:10a6:208:fb::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Thu, 30 Apr 2020 17:37:19 +0000 Received: from AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:3d:cafe::f) by AM5PR0201CA0018.outlook.office365.com (2603:10a6:203:3d::28) 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:37:19 +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 AM5EUR03FT013.mail.protection.outlook.com (10.152.16.140) 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:37:18 +0000 Received: ("Tessian outbound b3a67fbfbb1f:v54"); Thu, 30 Apr 2020 17:37:18 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 474bea6732571523 X-CR-MTA-TID: 64aa7808 Received: from 9ec90ad61353.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A0843A08-AEC6-466E-B09C-48BF8D33620A.1; Thu, 30 Apr 2020 17:37:12 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9ec90ad61353.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:37:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d7jhWYHweL7Jb82+134sTvQDgay0oc0ruETv3hoktWupObx2/5MVj3z7TyXeMSas6MTAZ6skYrH6kWbTMZID8k91vv0LiUItQkLEf/aU4BNku4NtxzTMZmdHRaqUCB/mN2J9/JecCE/g2jyC131uoKDbIsbVaQud2dYwafqP+tqb5DViDpNZAirc0AUXiXraH/DLsXmGNm1ZfSJ3iHtutsizBaAnbjX3dwnnnmsJcMFyX+nQu5PSNsUtUUsNmQbV4opJ/aDRcAXb4+FKflbUADKrLXsKNjU0qc1khBkxmvZdmn0X7z9Xq8HaO5rbxhLaJGePJJ0Yy92MqJepeSkcjA== 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=M2A6BoZszaWhZvkKMv0RwsWkEVwi4wEzMT+35ZeOJ5Q=; b=nc9SFgycR/DVhi9YSGrNXg4YUO1cNijjD7NDgeWwyBEiY3hXATThH4QYuohlG0bWtNoK1viBrxqiW0YydE7oxKuV+zy78mc4YzKkN7RkrQGH142cspb4d7VyhJabpCuq5Zm6hu2ersNo5os7+yoGOU8SPfIoc1uxdjtouovsqe5i2JANxtFaKo4VjCQ2onZBJkkyaQdFzECNBupVf//1fBas0+Lf7ZjZTkDTH4IQk2m1kzlcL5rW0iF1TkVDz7PsBueuZEZCTZMVvAUytmChYwWCGhVxhEDi4xgtjJnBGx8cLlSL88kDTTrll85GGsenlTSA0TKoUbJ1++PTE92Bdg== 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=M2A6BoZszaWhZvkKMv0RwsWkEVwi4wEzMT+35ZeOJ5Q=; b=gpFyRYvYFp3FSND5bA9tf5rsZA1pOpNfPexGgCWzY18u3erL5VO+8bvUovQltZXWxu93CCyIdH+WZwbKvPDMz2wkN3zzGo0xAJWW19gmhEgMAQLWfie2jKwMQX1GpjtOpGD7Jfi7MyB2LkUI1Io0Wj46NXKsVso4YYwzEN5IurY= 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 AM6PR08MB4213.eurprd08.prod.outlook.com (2603:10a6:20b:8e::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Thu, 30 Apr 2020 17:37:11 +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:37:11 +0000 Date: Thu, 30 Apr 2020 18:37:03 +0100 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 01/12] elf.h: Add PT_GNU_PROPERTY Message-ID: <20200430173702.GW29015@arm.com> References: <20200430173458.GV29015@arm.com> Content-Disposition: inline In-Reply-To: <20200430173458.GV29015@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: SN4PR0501CA0124.namprd05.prod.outlook.com (2603:10b6:803:42::41) 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 SN4PR0501CA0124.namprd05.prod.outlook.com (2603:10b6:803:42::41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.16 via Frontend Transport; Thu, 30 Apr 2020 17:37:09 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bfaf6d0a-c51f-49dc-c383-08d7ed2d2197 X-MS-TrafficTypeDiagnostic: AM6PR08MB4213:|AM6PR08MB4213:|AM0PR08MB3729: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:1388;OLM:1388; X-Forefront-PRVS: 0389EDA07F 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)(39860400002)(366004)(396003)(136003)(346002)(376002)(8676002)(8936002)(86362001)(316002)(1076003)(4744005)(478600001)(33656002)(5660300002)(6916009)(4326008)(26005)(8886007)(16526019)(52116002)(7696005)(186003)(55016002)(66556008)(36756003)(2616005)(66476007)(66946007)(2906002)(44832011)(956004)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: r2EUCPLRUXvxyW1jm0XJXb8T96zUV4yaohbtHYWiich14qu6Yza/Nk7wNYcDD3cbeUrCEP28s7YwIocaRSaZV0Kqheusni/z7dGJKEHT8gGPopFJoP5GB7WvSo3O8MUj5yGf/h2btA0UQBNE/DYD0qFMh8Sa9T/7FKSB0iULR+bvdQjHF+VK5hw2znlAYQX6TxPvpOxLnu4fG4NX7/S60sH7vcgH4Y2iZKuB3+8LiQ6WGSCkga7G2QifQtesBgxiq0hcG5pux7SKQ1bwW1ZPFDeq/n+A4pFpclEkfgqAFW34OAkGIFOb5a+no28Wp32pC5IzqHS++4LJh8yLFT88sQY17eGI+bVwByQGDhSGhugGGA3RERzUdFwj8TgUN8yZjmZ9tRkXRsfa2YWw63M4RVZZhiCZfj/8Ecz4XnC+5Q1vU8hLIGrwdg9o2XYvzMI3 X-MS-Exchange-AntiSpam-MessageData: JhyLfggfR3C47yOh4pxmmpsjqYAPV1wrXMANnwh0dmX9P/HM5rduj4SyOFkW85WDnzfgx6QHDGcWx5qE5Uhk/I7V7uiJixnfzzEr7aSKeRRuEeLqQNB1vtYgLPzHdmBQiD9G+wIsUuP5HH1AHtWy9CcJjJlYNiLFdLhaKGFgMVUlYC4AvQ8QwPPwzRDhlWdmoV+xuw2w3Y73qwNz+QMfqC16td4Iz11Z23ZSaF4fdMBKYfGkJ8I+7CxIvVA1bbMsSfkCSj1XhS5OW9DrPb0U9FSYjVI63P4w0qJwu1g8VZvrDADLnRXdM4Q8XKPHxGjLU8I+//9VeL8rhuilTwb4vCvFj2wT4Z+K0tJHos7DPD5JtV6rB+FyiYXqWadqHCNnGYwvolRKtTNYvQQMAQ9J2LrAduqwdpuh1dZvQeSRnH21lsPp15QUJNKoHPRsrXUw6RUctg0StsP9CbHHhkbI7/AxAuGhi3H4ZdAoVEr/kop6AAV828GJjc6H4hiAgKjgzIEuGR1E6e/LnjNXps/oh3zUqDnG5YI4CQqsO+jdQxRIfjL9BWmr7Saa7qwtQFrKdxHGyaCgPT2ViXloGzOqtO9ry+xmKR4PqbOugB2Lsxc3/Wqp5E6XFtubScm3oNQph0tRlYsAuFOioevVxc25UaOCprfPp45sSxd1AM70XClBscKVBGl0TlyZ5dOFk+QtzxcdC+h2ooARFHihPlL9ymKC4fZ6utgTU/d3nrHm3cORwZFRyt7OaCL8hXgrQxXGssFJleyZntI7lh+Ks4EvRB+O0grEbHzbcooH/kY6Bgw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4213 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: AM5EUR03FT013.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)(396003)(136003)(346002)(376002)(46966005)(2906002)(5660300002)(336012)(33656002)(356005)(4744005)(2616005)(956004)(478600001)(36756003)(1076003)(16526019)(81166007)(186003)(82740400003)(70206006)(70586007)(316002)(8676002)(47076004)(44832011)(36906005)(82310400002)(86362001)(55016002)(8936002)(6916009)(7696005)(4326008)(6666004)(26005)(8886007); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 6337b402-7b5e-49ef-ef6b-08d7ed2d1cc6 X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZpVMTdkhqsPqCFzJeQXC5dOXggxq1Byqcfvu1QqtwhrSpNoAv5TrM/mv2H54uyi2KWuaEqXwsZJQK3ET5UhDoV0Z7AqftCVoTDd5fwBkGHo8ltivtNImKvthz2zhsnwwV382c7kUvMulL4/7frEAQcKJlh0S3WRBVq6ni1eMPXIRyohb/HHbr/F3vYSdKZ+eZvi1gmmDA9+aON9zSi1XljMYJBPI1l0giF0fgv5CoZsspjCgbD3jSV3Pc1gN/FgC19BI7Bw4U5E0LgGrDZAZqqlEMFynAZbc8edB1QvgH8IvGbwcsvlDEcCAXR53jaLMyufsjlqK1pr1I3FnLb/GGrJo6SSSRhQ0wT8sdDWp6SPZ7QlwYgNjL6rt4za3QJiIvvBjTWFeY8wgL5BP/7GEU85BISDhmOTEKb92MBe3SbapCeP/e4IobbInU3Mb4aYFaA9rjL0E1+n45aYKhq/CPY6D7XadiK8/CCPFGFVJ1edS2CerO/fkjpxp41WbfVea2RrQe7lXxiRpMl0SyI8I8g== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:37:18.8505 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bfaf6d0a-c51f-49dc-c383-08d7ed2d2197 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: AM0PR08MB3729 X-Spam-Status: No, score=-28.2 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 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: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" This program header type is already used in binaries on x86 and aarch64 targets. Reviewed-by: Adhemerval Zanella --- elf/elf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/elf/elf.h b/elf/elf.h index 51e9968405..5b5ce37d9e 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -721,6 +721,7 @@ typedef struct #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ +#define PT_GNU_PROPERTY 0x6474e553 /* GNU property */ #define PT_LOSUNW 0x6ffffffa #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ From patchwork Thu Apr 30 17:37:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 38883 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 DB6DD396E00F; Thu, 30 Apr 2020 17:38:05 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50076.outbound.protection.outlook.com [40.107.5.76]) by sourceware.org (Postfix) with ESMTPS id B3008396E427 for ; Thu, 30 Apr 2020 17:38:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B3008396E427 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=PpFM8CRN33yzS+CZifBqp4VWGWhjYL7swFhOtc9pNBI=; b=BDs1dVuA4cZP2NFjks8Gtvj36TrOjDydrQziElR3bhIj2GRXb8n7RL++V+WnMK8uTk08QKfcrWhVUf9X8BxNDIMtpjkyaJSTLHdX3iRTBV6P2JKwQY8VG2NxoJwh1HrGOEA7g7UNWBElz+AEW57uYMWPUn2E7ykj70CxWE1KVp8= Received: from AM0P190CA0001.EURP190.PROD.OUTLOOK.COM (2603:10a6:208:190::11) by HE1PR0801MB2059.eurprd08.prod.outlook.com (2603:10a6:3:53::8) 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:38:00 +0000 Received: from AM5EUR03FT042.eop-EUR03.prod.protection.outlook.com (2603:10a6:208:190:cafe::44) by AM0P190CA0001.outlook.office365.com (2603:10a6:208:190::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 17:38:00 +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 AM5EUR03FT042.mail.protection.outlook.com (10.152.17.168) 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:37:59 +0000 Received: ("Tessian outbound ff098c684b24:v54"); Thu, 30 Apr 2020 17:37:59 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: afc455cf44a42e31 X-CR-MTA-TID: 64aa7808 Received: from cde9519aa622.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 84A3BD6B-A263-4BE1-BE2D-E89EFE61459F.1; Thu, 30 Apr 2020 17:37:54 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cde9519aa622.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:37:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZkkS/aThDVaN499IAU4SFnELDcf3c2E/Ak7UvJX/X3xT9qsldOae8cAsMpgpRGv6tWv4Kb4IZbqMETvvLswfYYnvilQauriTauthIYzLTq6SQoawGEICwlSyxAj8zAecKFtSLhBuLk7ItIQLDm2fuQZDUVbKkLhIazrQyKjA7ZcsD8FBZ7P9MnTDyerGgZRXE2FFzDQ1Itj0Au4tfMRPlReUMDEhIitYa8k5Nws8yX5HXJX5rsbfrHgEgy8HCVjLZVpoknV4pOmKQ8L0mug5uz0h1Sn5mJK9IGojykHUdPsaG12U73NNoEnT/9Jp5hoJFAbSgWJP2+nY5QHAPMUywQ== 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=PpFM8CRN33yzS+CZifBqp4VWGWhjYL7swFhOtc9pNBI=; b=OobGacG5NhRjqb4xtRWDe7YpGsg/V1bk4aYVcjiBKKe16flTC14+OrdSeZlUEuYWZRlaS6TjasFpw27GP/WJPeo8JFkPbF+D5vdAyePg912iXoqX6wi9riCXRmQeLQ5mPk5ppBD+6We8a9N1QmVx/AFaks4MHA41BHTCzIaRMA+5q4UsC4eq3DoC4pe7TcNelrPoxeSHf52ne2S4zvOtCg2boG81cbXU6PeudKo3ZZMRMQYe1OdrtOde92l+wetiBOuPFp4AK7nE7qzH4amCeX9nvXqlaAkUhYUYch0BBEXPzZTeJ4EVl6MV/F5LDuqbA8LOPfS9NeD4+axyonS1Iw== 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=PpFM8CRN33yzS+CZifBqp4VWGWhjYL7swFhOtc9pNBI=; b=BDs1dVuA4cZP2NFjks8Gtvj36TrOjDydrQziElR3bhIj2GRXb8n7RL++V+WnMK8uTk08QKfcrWhVUf9X8BxNDIMtpjkyaJSTLHdX3iRTBV6P2JKwQY8VG2NxoJwh1HrGOEA7g7UNWBElz+AEW57uYMWPUn2E7ykj70CxWE1KVp8= 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 AM6PR08MB4213.eurprd08.prod.outlook.com (2603:10a6:20b:8e::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Thu, 30 Apr 2020 17:37:53 +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:37:53 +0000 Date: Thu, 30 Apr 2020 18:37:51 +0100 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 02/12] elf.h: add aarch64 property definitions Message-ID: <20200430173751.GX29015@arm.com> References: <20200430173458.GV29015@arm.com> Content-Disposition: inline In-Reply-To: <20200430173458.GV29015@arm.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-ClientProxiedBy: LO2P265CA0072.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::36) 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 LO2P265CA0072.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:60::36) 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:37:52 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1e0ca801-3b02-48cf-59c0-08d7ed2d39f3 X-MS-TrafficTypeDiagnostic: AM6PR08MB4213:|AM6PR08MB4213:|HE1PR0801MB2059: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:5797;OLM:5797; X-Forefront-PRVS: 0389EDA07F 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)(39860400002)(366004)(396003)(136003)(346002)(376002)(8676002)(8936002)(86362001)(316002)(1076003)(4744005)(478600001)(33656002)(5660300002)(6916009)(4326008)(26005)(8886007)(16526019)(52116002)(7696005)(186003)(55016002)(66556008)(36756003)(2616005)(66476007)(66946007)(2906002)(44832011)(956004); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: WZTDHEWdTpFX0C1uwVhaLB9h8M5AkkWawtk/FHAV3b6iep+Nn3ACvMMhOhQ0jn7DWcgUa8A4rCgVgXAZNBI7hIhhGs11tcsUXtmDDGFrjPq8OSO/uDDSgacvDq7//IMQ5jO3BW97jQHpnyQD3hUAAp4t/uwtop9YzBh195Xz4R0REr9FpypakVlxHX0p6lATPYvGMoCy+5Zz3j2g6LYDyOFQNhhzxkIfAKPaOyP1fP2CwPTiVL5Bd06is0vEhhDD1ICqS0eQsC0dqY0rCq7U5vt0AcxrAY/4x/AGdtlY5mPrPLvwvUD9EB7sPiSpQDrcmy743hrEsUviwZNj7m295bxCfuHvPayHe+PcXPxzQXJwfOWIyJvlsWIYc3VWrEPBhi/HtfAm3LAeUq3d+XpYT0VCzUoOrTBlmXvv5X5Ej5qhwvSBuIulK5DQ1WCGVYLY X-MS-Exchange-AntiSpam-MessageData: AhHL+xITgzCCue+0tKakERsDmAWfDsBrEdpVIref/J4lURCpGotAYyA3a6WDEurlUvqjjetTBDeNV72OfUb/fErSh2/fnmALfiUxhli8fKxwsXa0Tw2Ws8PV7TdqzMVdwq2TsQwoP5AHM3Z19lte+OdBMu4YJAp/HObUNnBiicRutwvqc88SAVbu9qm2hWt5xQr1HS5/PJiBNtWb9ICLxGKkV+5/KFIs8mHB9L6MYq9NU2RcLBwH5MA/NtAPTdUFuGIIDlFle9My5QtCWGYPJmgT/9724p0ETQ61FMzMoQkXW2EQgT1jnpwFlPgckW1QPX3QnrqHLNuL4Pqay20rOUJB+IbHzk/sIq0r0riE4wR7m2UYWjTadA8i6tl+S8TP4bGg8hwdfXaCngJOWWT2aNuwhYcHXeOdDMrwFYQhyj0bUzBv2+n8KeeDZHExdU8mhL7v5T2/4gt+iioCrTraPd2HpTCEB/xMQ/DluL0KXXhRb3xPHQUah7EViiW7OG1KFblar/vBDzlb9hxMnkr6qBEqdX4oo5cwXEkNKmqDd5IOpTDYRhB9MxtdTfjrLzm9gtetY7RFq4j0yYvLTMML77GhSyY67m64u4TKflgoCsu9rMHRdloYFOKycEkixmZ9sC5Goc7QiTYAnNjbPeAVTSg1gYTHO8UFdnFIaqyflDlm6py6JXGOzUl8OJwUr21CIrSHMYCiRH3k0Q/WHG/ARNesOe88//FDeA5NWPGL4QvHuXnmqoMDcngkIGbphq6NnIoiTKvSSagZq+N21TQOxOnZFBEgflApK1hZFXgg5uw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4213 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: AM5EUR03FT042.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)(136003)(376002)(346002)(39860400002)(46966005)(86362001)(26005)(36906005)(336012)(356005)(478600001)(44832011)(70206006)(70586007)(8936002)(5660300002)(82310400002)(2616005)(8676002)(81166007)(956004)(47076004)(4744005)(316002)(36756003)(6916009)(7696005)(1076003)(8886007)(2906002)(55016002)(33656002)(4326008)(186003)(16526019)(82740400003); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 7be51375-2833-4a56-446a-08d7ed2d35dc X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: GdRGStnQCc7h51Qk5KKyJ3IWRHVBmS7VckKi/B8e4qP9eZbIrRDRCl5rnKg/YZgTUZOn/bu6y3TZVic10aiYJjulkh4bS3ICSqaSyLAFX2ki6wadS+JHiWbaMDKxduDtQbuuH34Q011iWNLAUncnWUeZyBjHBFsGK1ox3nubEqdxfy8X13FkXJlNsLx7aGlZtF0nYKpwrrj4pFfbL1BniOudqU7u6wYztV06MIQHCknFppWcLdcFOmjKPGpgLteKRBCYqcOW9au8Ce1M3A1Zqs8w/QqiY5I3wTzGkDSCsNRiquQGoaQjOZUFUkSoVjYQiGkiMuvPW9X+Nz9uvGLAm+9i0dT/kDNXYcfwoRBs99Y8ZUKP8M23brpWOl606RQ6qYT0P2E31xdY03KN2xtQlc8vqt0X1Bf5UpCJHN7BaIRgrEKgB2Bz4+I1m8TrwLpuGx+/5J+H3CiNXP/gmL7IhNrpKeB7+2FgrUylUfekH61W9dZTA5/e5UE9Epwy0V0VwMZ7YmpT0t4oT0LH+hyikw== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:37:59.7195 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1e0ca801-3b02-48cf-59c0-08d7ed2d39f3 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: HE1PR0801MB2059 X-Spam-Status: No, score=-28.0 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_NONE, 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: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" These property values are specified by the AArch64 ELF ABI and binutils can create binaries marked with them. Reviewed-by: Adhemerval Zanella --- elf/elf.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/elf/elf.h b/elf/elf.h index 5b5ce37d9e..197b557d15 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -1319,6 +1319,12 @@ typedef struct /* Application-specific semantics, hi */ #define GNU_PROPERTY_HIUSER 0xffffffff +/* AArch64 specific GNU properties. */ +#define GNU_PROPERTY_AARCH64_FEATURE_1_AND 0xc0000000 + +#define GNU_PROPERTY_AARCH64_FEATURE_1_BTI (1U << 0) +#define GNU_PROPERTY_AARCH64_FEATURE_1_PAC (1U << 1) + /* The x86 instruction sets indicated by the corresponding bits are used in program. Their support in the hardware is optional. */ #define GNU_PROPERTY_X86_ISA_1_USED 0xc0000000 From patchwork Thu Apr 30 17:39:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 38884 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 A0948395CC6C; Thu, 30 Apr 2020 17:40:07 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80089.outbound.protection.outlook.com [40.107.8.89]) by sourceware.org (Postfix) with ESMTPS id 8AFAD3898517 for ; Thu, 30 Apr 2020 17:39:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8AFAD3898517 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=a7w9zyCRY7r8vZwVEhz5OVIf9w7fcE8ZlNJBu1/EljI=; b=jUdbwtOiwUpjm5GE2m7gBWyhQQMfvMY18Uf0pTl4+LznCrhUVP8DXS382HmYxSuGRZN5HF2SI8Y+0/6qtrUrFo6iCkeWcCxKY0uN1pJffMU3PJfaBti5xTWKtlUm37wwaCEiUhezJHbieAgn+3b3Db1YhYBZu/DDHrNeS1Bwr0E= Received: from MRXP264CA0028.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:14::16) by DB8PR08MB4571.eurprd08.prod.outlook.com (2603:10a6:10:ac::16) 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:39:52 +0000 Received: from VE1EUR03FT050.eop-EUR03.prod.protection.outlook.com (2603:10a6:500:14:cafe::de) by MRXP264CA0028.outlook.office365.com (2603:10a6:500:14::16) 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:39:52 +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 VE1EUR03FT050.mail.protection.outlook.com (10.152.19.209) 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:39:51 +0000 Received: ("Tessian outbound b3a67fbfbb1f:v54"); Thu, 30 Apr 2020 17:39:51 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: dd1e95b88fde493c X-CR-MTA-TID: 64aa7808 Received: from cfb20e1241de.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 50D7AFA5-DECE-4A08-AEB5-B22AAA446B88.1; Thu, 30 Apr 2020 17:39:45 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id cfb20e1241de.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:39:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IVGtlZgZfgFWSVBSH023nY4MLCh9He6OFS7oiVSaLq7P/AfvrgdDl1skh6XrClRxMRVjI4Put9whQR9IzTLjBdZEVaa3xabVvqTkeYEMzNvc8vvhY2iQWlbC/Z6VnXLmDUsuRPLysivjI9W9/j87Ch+JyJEkuP1jEvuIvraWIvH4wF6MHVZUQoOuH1RUIU/AHbHl7sUX6Va8C4tOrLYK4KqQKsxjYosMM2leyGgtJ9ro24ZeD7AWbMivjGjhwivgN9Ua3oXEnRdtAZxp0ZWHYMhnA8XBUJ8ldHzgAAjaQ8NOE15eK5zH9ShFwIdoYZMrB7TZHUhy7wgq4JeWMKeOVA== 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=a7w9zyCRY7r8vZwVEhz5OVIf9w7fcE8ZlNJBu1/EljI=; b=KDRWSDRFC6PMfmgWMi3xvHWiu57e2N4dcSPctALcBZtoc4xmhQRj9gHmJDlViI091AeWrsxidr/zxszv8ODAVm9L6+GUaI7M31FzT6oI8mBnyAJZn127rDE7G11fp9gjTZIyxVHi4JeeptWGb9J5tkkkygmBceELZA9mzSPwYOmWevvaEgUwWpNw+trVrGS4j/miWjSZ+BnZDbee4CPcKnTGBCkuyzh6r86wfYQILx22Gxv43Hf/dNj0K1Hps4f6M2OKOUwyrimdg8J7Wc1LLVu4U7xwsQyF47p/Wa4a59BeUjYPpeCJl+TNH9Uvou6DGB5kFoHBcZeBYL4sbaQ2Tg== 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=a7w9zyCRY7r8vZwVEhz5OVIf9w7fcE8ZlNJBu1/EljI=; b=jUdbwtOiwUpjm5GE2m7gBWyhQQMfvMY18Uf0pTl4+LznCrhUVP8DXS382HmYxSuGRZN5HF2SI8Y+0/6qtrUrFo6iCkeWcCxKY0uN1pJffMU3PJfaBti5xTWKtlUm37wwaCEiUhezJHbieAgn+3b3Db1YhYBZu/DDHrNeS1Bwr0E= 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 AM6PR08MB4213.eurprd08.prod.outlook.com (2603:10a6:20b:8e::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Thu, 30 Apr 2020 17:39:44 +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:39:44 +0000 Date: Thu, 30 Apr 2020 18:39:37 +0100 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 03/12] aarch64: Add BTI landing pads to assembly code Message-ID: <20200430173936.GY29015@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: SA9PR10CA0015.namprd10.prod.outlook.com (2603:10b6:806:a7::20) 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 SA9PR10CA0015.namprd10.prod.outlook.com (2603:10b6:806:a7::20) 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:39:42 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a4c3fedc-fcef-44e5-73e7-08d7ed2d7c94 X-MS-TrafficTypeDiagnostic: AM6PR08MB4213:|AM6PR08MB4213:|DB8PR08MB4571: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:5236;OLM:5236; X-Forefront-PRVS: 0389EDA07F 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)(39860400002)(366004)(396003)(136003)(346002)(376002)(8676002)(235185007)(8936002)(86362001)(316002)(1076003)(478600001)(33656002)(6916009)(4326008)(26005)(8886007)(16526019)(52116002)(7696005)(186003)(55016002)(66556008)(36756003)(2616005)(66476007)(66946007)(44144004)(33964004)(2906002)(44832011)(564344004)(956004)(66616009)(6666004)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: HKjMBAQ4BKmo8CvBJoRttjLDlGazQUBL1sjV3MYVHA608AguBdkgBA9MWpopsazJK9RHzRpT5oK1j3N0/KvwoAvSgB1ACeMcLH7YTPGlE6gFwqrwr5UqjPGXuY6xxhosdGfh3IqN972pR1jVsIIwQ5roR/0+5kYGONSDLOjiVpv9crcvwBGRXH7Fx5UYbGghXK5d3I0XHe27vsk6iEWsuKXGMHxvbvvHueWv75QpiDkADoj49Mz+uXEfcSGFBavop9Kf1tbv2rFwpc9AvdLNVpug79QXKuZQ8ZFT1ZPGJ9PWw5fXolJ5IE14xp65S2WeQOZZwBpOIB2zu9UrXh/MSjTiKyeB3oSb756jfTZi9SYS42WNn5gbB/21uEvDjMSi X-MS-Exchange-AntiSpam-MessageData: q88gJWnL5RYGfv8iuHFQBM1j8yR4Ch8KiLZnwoN6JOtB2pHwtxGUehuBGGAtIej14vYiegyDaiJCzTZiu48CSCq4AgjvdSYW24k960ltRYNRo2xloM0L6lUpK5JZECRLQoibF1ozMVoemkCM3fmhBxSsPw0Y/909NkQ8cw2oC6Hqy/aixOYsJvhvlQYnzYzucjLvVtLKjywvZz3eNDem2AVo+4hcS/t3F5kRuhJexESOhSUQsip8nKYzHByO2um1Z6SchfW+G2HD9LfAiDbvydGvYlXJa8Rood1Fl1pZ4+GiNJ9i8ucZ4ZumnFOaPPznSygBJZC0zJSZy2dX6cwWzfXtqHZrU3TxnX2zV7nKDZ//n33zBawbqWrE55lxPnKKXDGff28Uj7KEbsHlaYnB0smpm4YfEbMvLg5+y+hpi5GtVN0VTcGvDruR8cKhF5BvLk/GJR1hea7+DI7g03A5zL99vX413bmiA3CYHULT7vPUGlw5ZTTdAaLtr+hELQLIBEizM3H28tMaQg+qBRNYAPME7Tfe7PzXO4Xvp4rEduARaLVzxYbkhcso82JTf5KAsS9vcyF/4hF8Hhb9np8QSVmw25SQDTp4BrZk2HvAnISPc189MEcrCLaPwZdEMDBTLvS3egATdWAobvnxHgV9MNOahDUOTZkS6EYX1urHg1ojtA0o3Hdg4BEw3i6Pkk0AOFF6Odp5oT4KK4yf2+mUBHA2ZBwLQqROv3O6I8684G+HSfofJ3QHqHcdVtoG79uh1y+I1m6QmrwXtyd4/uBWJVzeplnvIfnfYRr4w60VNJE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4213 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: VE1EUR03FT050.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)(136003)(346002)(396003)(39860400002)(376002)(46966005)(2616005)(70206006)(82310400002)(66616009)(86362001)(70586007)(1076003)(235185007)(36756003)(6916009)(2906002)(82740400003)(44144004)(7696005)(186003)(26005)(956004)(16526019)(478600001)(33964004)(6666004)(564344004)(33656002)(8936002)(356005)(47076004)(36906005)(316002)(336012)(8676002)(44832011)(55016002)(8886007)(4326008)(81166007)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: acf1e3d6-8dd1-43ec-31dd-08d7ed2d77f9 X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nXJ1tFidhgJ9HMB5bZvbS+PisScLe/FAtM0z7ZD+ZzzvpPYf+R7mRl1r/yejlkPyUDgG6DUhoYm+ERsvOm2ar5PKLsWZje8k96dCpNv9vyZEyuPE6Ki2dWF2e688pY4U3CqfOoVvoO7kE1mqELMbDil5/fwznQaW//MRsHc0oDX3Zoz/ATt46Cyc6XT8cT2Lf25rujjzVhKTEDjiTLjzN2O/gp3TwykOHZMDpS6/yeDchYQHmrt04VFmG8kDHIcxVKA+4SHNawsq9chrCfeWs5G/D6Qa3EyxOzh0w7Rx9zDCGcJokqBXfohC9AqCBhYd4BCRd/Zp40IdvimhtLpzbLjjQfRJA5VhJ372lNZzvcnyyKesY0HfqdDC0rXANq0KhALUHH2EAkFdOX8DddPN0/Go2/kYcSjpShLcyWXocC8= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:39:51.4192 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a4c3fedc-fcef-44e5-73e7-08d7ed2d7c94 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: DB8PR08MB4571 X-Spam-Status: No, score=-27.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, KAM_STOCKGEN, 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-Disposition: attachment; filename="0003-aarch64-Add-BTI-landing-pads-to-assembly-code.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From 550fe66ed93e13c0f063955e81bfcb8db386413c Mon Sep 17 00:00:00 2001 From: Sudakshina Das Date: Tue, 17 Mar 2020 15:44:18 +0000 Subject: [PATCH 03/12] aarch64: Add BTI landing pads to assembly code Adding the landing pads and the ELF markings are required if glibc is built with branch protection. For the handful of asm files this is done unconditionally, this simplifies maintenance and avoids complications where code layout is carefully aligned such that conditionally turning BTI off may cause performance regression (e.g. string functions). Note: old binutils ld just merges notes of input objects into the output, so if any input has a note claiming BTI support, then the output will have such note too which is undesirable. So after this commit libc shared objects and binaries linked with libc crt code may contain incorrect notes. For this reason checking properties in PT_NOTE is not reliable, new linkers create PT_GNU_PROPERTY which is always reliable when present so on AArch64 only that should be checked for properties. Note: functions using ENTRY or ENTRY_ALIGN now have an additional BTI c after the function label so alignment of the code changes, but ENTRY_ALIGN_AND_PAD was fixed so there is no change to the existing code layout. Co-authored-by: Szabolcs Nagy --- sysdeps/aarch64/__longjmp.S | 1 + sysdeps/aarch64/crti.S | 4 +++ sysdeps/aarch64/crtn.S | 4 +++ sysdeps/aarch64/dl-tlsdesc.S | 5 ++++ sysdeps/aarch64/dl-trampoline.S | 4 +++ sysdeps/aarch64/memchr.S | 1 + sysdeps/aarch64/memcmp.S | 1 + sysdeps/aarch64/memcpy.S | 1 + sysdeps/aarch64/memrchr.S | 1 + sysdeps/aarch64/memset.S | 1 + sysdeps/aarch64/multiarch/memchr_nosimd.S | 1 + sysdeps/aarch64/multiarch/memcpy_falkor.S | 1 + sysdeps/aarch64/multiarch/memcpy_thunderx.S | 1 + sysdeps/aarch64/multiarch/memcpy_thunderx2.S | 1 + sysdeps/aarch64/multiarch/memmove_falkor.S | 1 + sysdeps/aarch64/multiarch/memset_base64.S | 1 + sysdeps/aarch64/multiarch/memset_kunpeng.S | 1 + sysdeps/aarch64/multiarch/strlen_asimd.S | 1 + sysdeps/aarch64/rawmemchr.S | 1 + sysdeps/aarch64/setjmp.S | 1 + sysdeps/aarch64/start.S | 2 ++ sysdeps/aarch64/strchr.S | 1 + sysdeps/aarch64/strchrnul.S | 1 + sysdeps/aarch64/strcmp.S | 1 + sysdeps/aarch64/strcpy.S | 1 + sysdeps/aarch64/strlen.S | 1 + sysdeps/aarch64/strncmp.S | 1 + sysdeps/aarch64/strnlen.S | 1 + sysdeps/aarch64/strrchr.S | 1 + sysdeps/aarch64/sysdep.h | 27 ++++++++++++++++++- sysdeps/unix/sysv/linux/aarch64/__read_tp.S | 1 + sysdeps/unix/sysv/linux/aarch64/clone.S | 1 + sysdeps/unix/sysv/linux/aarch64/getcontext.S | 1 + sysdeps/unix/sysv/linux/aarch64/ioctl.S | 1 + .../unix/sysv/linux/aarch64/libc-__read_tp.S | 1 + sysdeps/unix/sysv/linux/aarch64/setcontext.S | 1 + sysdeps/unix/sysv/linux/aarch64/syscall.S | 1 + sysdeps/unix/sysv/linux/aarch64/vfork.S | 1 + 38 files changed, 77 insertions(+), 1 deletion(-) diff --git a/sysdeps/aarch64/__longjmp.S b/sysdeps/aarch64/__longjmp.S index f9060776b4..362171cdb8 100644 --- a/sysdeps/aarch64/__longjmp.S +++ b/sysdeps/aarch64/__longjmp.S @@ -116,3 +116,4 @@ ENTRY (__longjmp) /* Use br instead of ret because ret is guaranteed to mispredict */ br x30 END (__longjmp) +END_FILE diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S index 1728eac37a..89a9e25f5b 100644 --- a/sysdeps/aarch64/crti.S +++ b/sysdeps/aarch64/crti.S @@ -75,6 +75,7 @@ call_weak_fn: .hidden _init .type _init, %function _init: + BTI_C stp x29, x30, [sp, -16]! mov x29, sp #if PREINIT_FUNCTION_WEAK @@ -89,5 +90,8 @@ _init: .hidden _fini .type _fini, %function _fini: + BTI_C stp x29, x30, [sp, -16]! mov x29, sp + +END_FILE diff --git a/sysdeps/aarch64/crtn.S b/sysdeps/aarch64/crtn.S index c3e97cc449..94a6f970ef 100644 --- a/sysdeps/aarch64/crtn.S +++ b/sysdeps/aarch64/crtn.S @@ -37,6 +37,8 @@ /* crtn.S puts function epilogues in the .init and .fini sections corresponding to the prologues in crti.S. */ +#include + .section .init,"ax",%progbits ldp x29, x30, [sp], 16 RET @@ -44,3 +46,5 @@ .section .fini,"ax",%progbits ldp x29, x30, [sp], 16 RET + +END_FILE diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S index 557ad1d505..d55e0443aa 100644 --- a/sysdeps/aarch64/dl-tlsdesc.S +++ b/sysdeps/aarch64/dl-tlsdesc.S @@ -74,6 +74,7 @@ cfi_startproc .align 2 _dl_tlsdesc_return: + BTI_C DELOUSE (0) ldr PTR_REG (0), [x0, #PTR_SIZE] RET @@ -95,6 +96,7 @@ _dl_tlsdesc_return: cfi_startproc .align 2 _dl_tlsdesc_undefweak: + BTI_C str x1, [sp, #-16]! cfi_adjust_cfa_offset (16) DELOUSE (0) @@ -142,6 +144,7 @@ _dl_tlsdesc_undefweak: cfi_startproc .align 2 _dl_tlsdesc_dynamic: + BTI_C DELOUSE (0) /* Save just enough registers to support fast path, if we fall @@ -235,3 +238,5 @@ _dl_tlsdesc_dynamic: .size _dl_tlsdesc_dynamic, .-_dl_tlsdesc_dynamic # undef NSAVEXREGPAIRS #endif + +END_FILE diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S index 94e965c096..fba5689d09 100644 --- a/sysdeps/aarch64/dl-trampoline.S +++ b/sysdeps/aarch64/dl-trampoline.S @@ -35,6 +35,7 @@ cfi_startproc .align 2 _dl_runtime_resolve: + BTI_C /* AArch64 we get called with: ip0 &PLTGOT[2] ip1 temp(dl resolver entry point) @@ -126,6 +127,7 @@ _dl_runtime_resolve: cfi_startproc .align 2 _dl_runtime_profile: + BTI_C /* AArch64 we get called with: ip0 &PLTGOT[2] ip1 temp(dl resolver entry point) @@ -298,3 +300,5 @@ _dl_runtime_profile: .size _dl_runtime_profile, .-_dl_runtime_profile #endif .previous + +END_FILE diff --git a/sysdeps/aarch64/memchr.S b/sysdeps/aarch64/memchr.S index 85c65cbfca..c67a31223f 100644 --- a/sysdeps/aarch64/memchr.S +++ b/sysdeps/aarch64/memchr.S @@ -159,3 +159,4 @@ L(zero_length): END (MEMCHR) weak_alias (MEMCHR, memchr) libc_hidden_builtin_def (memchr) +END_FILE diff --git a/sysdeps/aarch64/memcmp.S b/sysdeps/aarch64/memcmp.S index 827f54f99e..c6e07f9287 100644 --- a/sysdeps/aarch64/memcmp.S +++ b/sysdeps/aarch64/memcmp.S @@ -178,3 +178,4 @@ END (memcmp) #undef bcmp weak_alias (memcmp, bcmp) libc_hidden_builtin_def (memcmp) +END_FILE diff --git a/sysdeps/aarch64/memcpy.S b/sysdeps/aarch64/memcpy.S index e0b4c4502f..543d9417f3 100644 --- a/sysdeps/aarch64/memcpy.S +++ b/sysdeps/aarch64/memcpy.S @@ -282,3 +282,4 @@ L(copy64_from_start): END (MEMMOVE) libc_hidden_builtin_def (MEMMOVE) +END_FILE diff --git a/sysdeps/aarch64/memrchr.S b/sysdeps/aarch64/memrchr.S index ace5a94e8f..f35a68d14d 100644 --- a/sysdeps/aarch64/memrchr.S +++ b/sysdeps/aarch64/memrchr.S @@ -163,3 +163,4 @@ L(zero_length): END (__memrchr) weak_alias (__memrchr, memrchr) libc_hidden_builtin_def (memrchr) +END_FILE diff --git a/sysdeps/aarch64/memset.S b/sysdeps/aarch64/memset.S index ac577f1660..7cdae20563 100644 --- a/sysdeps/aarch64/memset.S +++ b/sysdeps/aarch64/memset.S @@ -189,3 +189,4 @@ L(zva_other): END (MEMSET) libc_hidden_builtin_def (MEMSET) +END_FILE diff --git a/sysdeps/aarch64/multiarch/memchr_nosimd.S b/sysdeps/aarch64/multiarch/memchr_nosimd.S index 41ce10eb32..6d7d38d5bb 100644 --- a/sysdeps/aarch64/multiarch/memchr_nosimd.S +++ b/sysdeps/aarch64/multiarch/memchr_nosimd.S @@ -221,3 +221,4 @@ L(none_chr): END (MEMCHR) libc_hidden_builtin_def (MEMCHR) +END_FILE diff --git a/sysdeps/aarch64/multiarch/memcpy_falkor.S b/sysdeps/aarch64/multiarch/memcpy_falkor.S index 35a1fae1b9..999aa48b16 100644 --- a/sysdeps/aarch64/multiarch/memcpy_falkor.S +++ b/sysdeps/aarch64/multiarch/memcpy_falkor.S @@ -188,4 +188,5 @@ L(last64): END (__memcpy_falkor) libc_hidden_builtin_def (__memcpy_falkor) +END_FILE #endif diff --git a/sysdeps/aarch64/multiarch/memcpy_thunderx.S b/sysdeps/aarch64/multiarch/memcpy_thunderx.S index e9407571b5..e6e36a6633 100644 --- a/sysdeps/aarch64/multiarch/memcpy_thunderx.S +++ b/sysdeps/aarch64/multiarch/memcpy_thunderx.S @@ -318,5 +318,6 @@ L(move_long): END (MEMCPY) libc_hidden_builtin_def (MEMCPY) +END_FILE #endif diff --git a/sysdeps/aarch64/multiarch/memcpy_thunderx2.S b/sysdeps/aarch64/multiarch/memcpy_thunderx2.S index 68e99455c8..fde4c7198c 100644 --- a/sysdeps/aarch64/multiarch/memcpy_thunderx2.S +++ b/sysdeps/aarch64/multiarch/memcpy_thunderx2.S @@ -474,4 +474,5 @@ L(ext_table): .word L(ext_size_15) -. libc_hidden_builtin_def (MEMCPY) +END_FILE #endif diff --git a/sysdeps/aarch64/multiarch/memmove_falkor.S b/sysdeps/aarch64/multiarch/memmove_falkor.S index 35fc1fdd41..d8cc992d27 100644 --- a/sysdeps/aarch64/multiarch/memmove_falkor.S +++ b/sysdeps/aarch64/multiarch/memmove_falkor.S @@ -223,3 +223,4 @@ L(move_long): END (__memmove_falkor) libc_hidden_builtin_def (__memmove_falkor) +END_FILE diff --git a/sysdeps/aarch64/multiarch/memset_base64.S b/sysdeps/aarch64/multiarch/memset_base64.S index 8f85cd1caf..ee0b832ef9 100644 --- a/sysdeps/aarch64/multiarch/memset_base64.S +++ b/sysdeps/aarch64/multiarch/memset_base64.S @@ -184,3 +184,4 @@ L(zva_64): END (MEMSET) libc_hidden_builtin_def (MEMSET) +END_FILE diff --git a/sysdeps/aarch64/multiarch/memset_kunpeng.S b/sysdeps/aarch64/multiarch/memset_kunpeng.S index 8e051d4fd1..aa7ab62fdd 100644 --- a/sysdeps/aarch64/multiarch/memset_kunpeng.S +++ b/sysdeps/aarch64/multiarch/memset_kunpeng.S @@ -111,3 +111,4 @@ L(set_long): END (MEMSET) libc_hidden_builtin_def (MEMSET) #endif +END_FILE diff --git a/sysdeps/aarch64/multiarch/strlen_asimd.S b/sysdeps/aarch64/multiarch/strlen_asimd.S index 236a2c96a6..c28aa0ca8d 100644 --- a/sysdeps/aarch64/multiarch/strlen_asimd.S +++ b/sysdeps/aarch64/multiarch/strlen_asimd.S @@ -176,3 +176,4 @@ L(page_cross): END (__strlen_asimd) weak_alias (__strlen_asimd, strlen_asimd) libc_hidden_builtin_def (strlen_asimd) +END_FILE diff --git a/sysdeps/aarch64/rawmemchr.S b/sysdeps/aarch64/rawmemchr.S index 5c7a664fb4..4ad614a169 100644 --- a/sysdeps/aarch64/rawmemchr.S +++ b/sysdeps/aarch64/rawmemchr.S @@ -40,3 +40,4 @@ L(do_strlen): END (__rawmemchr) weak_alias (__rawmemchr, rawmemchr) libc_hidden_builtin_def (__rawmemchr) +END_FILE diff --git a/sysdeps/aarch64/setjmp.S b/sysdeps/aarch64/setjmp.S index 28fdd3f46a..9a0201ef70 100644 --- a/sysdeps/aarch64/setjmp.S +++ b/sysdeps/aarch64/setjmp.S @@ -73,3 +73,4 @@ ENTRY (__sigsetjmp) #endif END (__sigsetjmp) hidden_def (__sigsetjmp) +END_FILE diff --git a/sysdeps/aarch64/start.S b/sysdeps/aarch64/start.S index d96cf57e2d..e6c0393c20 100644 --- a/sysdeps/aarch64/start.S +++ b/sysdeps/aarch64/start.S @@ -46,6 +46,7 @@ .globl _start .type _start,#function _start: + BTI_C /* Create an initial frame with 0 LR and FP */ mov x29, #0 mov x30, #0 @@ -110,3 +111,4 @@ __data_start: .long 0 .weak data_start data_start = __data_start +END_FILE diff --git a/sysdeps/aarch64/strchr.S b/sysdeps/aarch64/strchr.S index 4a75e73945..e1f98aa42c 100644 --- a/sysdeps/aarch64/strchr.S +++ b/sysdeps/aarch64/strchr.S @@ -137,3 +137,4 @@ L(tail): END (strchr) libc_hidden_builtin_def (strchr) weak_alias (strchr, index) +END_FILE diff --git a/sysdeps/aarch64/strchrnul.S b/sysdeps/aarch64/strchrnul.S index a65be6cba8..a9ccc54205 100644 --- a/sysdeps/aarch64/strchrnul.S +++ b/sysdeps/aarch64/strchrnul.S @@ -129,3 +129,4 @@ L(tail): END(__strchrnul) weak_alias (__strchrnul, strchrnul) +END_FILE diff --git a/sysdeps/aarch64/strcmp.S b/sysdeps/aarch64/strcmp.S index d044c29e9b..a7bee697c0 100644 --- a/sysdeps/aarch64/strcmp.S +++ b/sysdeps/aarch64/strcmp.S @@ -182,3 +182,4 @@ L(done): RET END(strcmp) libc_hidden_builtin_def (strcmp) +END_FILE diff --git a/sysdeps/aarch64/strcpy.S b/sysdeps/aarch64/strcpy.S index 548130e413..631da4a358 100644 --- a/sysdeps/aarch64/strcpy.S +++ b/sysdeps/aarch64/strcpy.S @@ -321,3 +321,4 @@ libc_hidden_builtin_def (stpcpy) #else libc_hidden_builtin_def (strcpy) #endif +END_FILE diff --git a/sysdeps/aarch64/strlen.S b/sysdeps/aarch64/strlen.S index e01fab7c2a..3af25de4b8 100644 --- a/sysdeps/aarch64/strlen.S +++ b/sysdeps/aarch64/strlen.S @@ -222,3 +222,4 @@ L(page_cross): END (STRLEN) weak_alias (STRLEN, strlen) libc_hidden_builtin_def (strlen) +END_FILE diff --git a/sysdeps/aarch64/strncmp.S b/sysdeps/aarch64/strncmp.S index c5141fab8a..d289d4a3ba 100644 --- a/sysdeps/aarch64/strncmp.S +++ b/sysdeps/aarch64/strncmp.S @@ -270,3 +270,4 @@ L(ret0): END (strncmp) libc_hidden_builtin_def (strncmp) +END_FILE diff --git a/sysdeps/aarch64/strnlen.S b/sysdeps/aarch64/strnlen.S index 5981247dd9..964536dba9 100644 --- a/sysdeps/aarch64/strnlen.S +++ b/sysdeps/aarch64/strnlen.S @@ -213,3 +213,4 @@ END (__strnlen) libc_hidden_def (__strnlen) weak_alias (__strnlen, strnlen) libc_hidden_def (strnlen) +END_FILE diff --git a/sysdeps/aarch64/strrchr.S b/sysdeps/aarch64/strrchr.S index 94da08d351..9f6d956f21 100644 --- a/sysdeps/aarch64/strrchr.S +++ b/sysdeps/aarch64/strrchr.S @@ -164,3 +164,4 @@ L(null_search): END(strrchr) weak_alias (strrchr, rindex) libc_hidden_builtin_def (strrchr) +END_FILE diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 604c489170..07dc7858a5 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -41,12 +41,35 @@ #define ASM_SIZE_DIRECTIVE(name) .size name,.-name +/* Branch Target Identitication support. */ +#define BTI_C hint 34 +#define BTI_J hint 36 + +#define FEATURE_1_BTI 1 +#define FEATURE_1_PAC 2 + +/* Add a GNU_PROPERTY_AARCH64_FEATURE_1_AND note. */ +#define GNU_PROPERTY(features) \ + .section .note.gnu.property, "a"; \ + .p2align 3; \ + .word 4; \ + .word 16; \ + .word 5; \ + .asciz "GNU"; \ + .word 0xc0000000; \ + .word 4; \ + .word features; \ + .word 0; + +#define END_FILE GNU_PROPERTY(FEATURE_1_BTI) + /* Define an entry point visible from C. */ #define ENTRY(name) \ .globl C_SYMBOL_NAME(name); \ .type C_SYMBOL_NAME(name),%function; \ .align 4; \ C_LABEL(name) \ + BTI_C; \ cfi_startproc; \ CALL_MCOUNT @@ -56,6 +79,7 @@ .type C_SYMBOL_NAME(name),%function; \ .p2align align; \ C_LABEL(name) \ + BTI_C; \ cfi_startproc; \ CALL_MCOUNT @@ -68,10 +92,11 @@ .globl C_SYMBOL_NAME(name); \ .type C_SYMBOL_NAME(name),%function; \ .p2align align; \ - .rep padding; \ + .rep padding - 1; /* -1 for bti c. */ \ nop; \ .endr; \ C_LABEL(name) \ + BTI_C; \ cfi_startproc; \ CALL_MCOUNT diff --git a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S index 12e1131fe7..7825aa5e1b 100644 --- a/sysdeps/unix/sysv/linux/aarch64/__read_tp.S +++ b/sysdeps/unix/sysv/linux/aarch64/__read_tp.S @@ -23,3 +23,4 @@ ENTRY (__read_tp) mrs x0, tpidr_el0 RET END (__read_tp) +END_FILE diff --git a/sysdeps/unix/sysv/linux/aarch64/clone.S b/sysdeps/unix/sysv/linux/aarch64/clone.S index 2b14106fd1..15b5a7b217 100644 --- a/sysdeps/unix/sysv/linux/aarch64/clone.S +++ b/sysdeps/unix/sysv/linux/aarch64/clone.S @@ -85,3 +85,4 @@ thread_start: libc_hidden_def (__clone) weak_alias (__clone, clone) +END_FILE diff --git a/sysdeps/unix/sysv/linux/aarch64/getcontext.S b/sysdeps/unix/sysv/linux/aarch64/getcontext.S index 8571556189..95f61d5f28 100644 --- a/sysdeps/unix/sysv/linux/aarch64/getcontext.S +++ b/sysdeps/unix/sysv/linux/aarch64/getcontext.S @@ -107,3 +107,4 @@ ENTRY(__getcontext) PSEUDO_END (__getcontext) weak_alias (__getcontext, getcontext) +END_FILE diff --git a/sysdeps/unix/sysv/linux/aarch64/ioctl.S b/sysdeps/unix/sysv/linux/aarch64/ioctl.S index ed36e309c4..19abf43726 100644 --- a/sysdeps/unix/sysv/linux/aarch64/ioctl.S +++ b/sysdeps/unix/sysv/linux/aarch64/ioctl.S @@ -30,3 +30,4 @@ PSEUDO_END (__ioctl) libc_hidden_def (__ioctl) weak_alias (__ioctl, ioctl) +END_FILE diff --git a/sysdeps/unix/sysv/linux/aarch64/libc-__read_tp.S b/sysdeps/unix/sysv/linux/aarch64/libc-__read_tp.S index 6de259ed83..df5eec8599 100644 --- a/sysdeps/unix/sysv/linux/aarch64/libc-__read_tp.S +++ b/sysdeps/unix/sysv/linux/aarch64/libc-__read_tp.S @@ -17,3 +17,4 @@ . */ #include <__read_tp.S> +END_FILE diff --git a/sysdeps/unix/sysv/linux/aarch64/setcontext.S b/sysdeps/unix/sysv/linux/aarch64/setcontext.S index 61fb813db3..d9d6c0f364 100644 --- a/sysdeps/unix/sysv/linux/aarch64/setcontext.S +++ b/sysdeps/unix/sysv/linux/aarch64/setcontext.S @@ -128,3 +128,4 @@ ENTRY (__startcontext) cbnz x0, __setcontext 1: b HIDDEN_JUMPTARGET (exit) END (__startcontext) +END_FILE diff --git a/sysdeps/unix/sysv/linux/aarch64/syscall.S b/sysdeps/unix/sysv/linux/aarch64/syscall.S index 993e307fcf..10e59ece58 100644 --- a/sysdeps/unix/sysv/linux/aarch64/syscall.S +++ b/sysdeps/unix/sysv/linux/aarch64/syscall.S @@ -42,3 +42,4 @@ ENTRY (syscall) 1: b SYSCALL_ERROR PSEUDO_END (syscall) +END_FILE diff --git a/sysdeps/unix/sysv/linux/aarch64/vfork.S b/sysdeps/unix/sysv/linux/aarch64/vfork.S index 9c8ea48c5a..0306003a22 100644 --- a/sysdeps/unix/sysv/linux/aarch64/vfork.S +++ b/sysdeps/unix/sysv/linux/aarch64/vfork.S @@ -40,3 +40,4 @@ libc_hidden_def (__vfork) weak_alias (__vfork, vfork) strong_alias (__vfork, __libc_vfork) +END_FILE -- 2.17.1 From patchwork Thu Apr 30 17:40:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 38885 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 811DA396DC1A; Thu, 30 Apr 2020 17:40:50 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-eopbgr150052.outbound.protection.outlook.com [40.107.15.52]) by sourceware.org (Postfix) with ESMTPS id 72FB23898517 for ; Thu, 30 Apr 2020 17:40:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 72FB23898517 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=wZ8mxWSak6uI+0F19HSOUAJLkzsrC1PfEOXs+H0MdlA=; b=BQh5yrJ61SP2NaD9Q8/p2pjwK+I+3hseSjywZrtXBrYzK+Apz4rOYdgfovstjTWnvEMRscEg/839jDBIoV4a5zyo9UpK8vIodSGG9UAT8DmJ0XWNCZsOXyHCpnDbRLFHJYRMuOIE+ET1lvAx4JXaIz7latxkqH5aEBabFhdo1+w= Received: from DB6PR0301CA0046.eurprd03.prod.outlook.com (2603:10a6:4:54::14) by VI1PR0801MB2109.eurprd08.prod.outlook.com (2603:10a6:800:8a::12) 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:40:45 +0000 Received: from DB5EUR03FT016.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:54:cafe::18) by DB6PR0301CA0046.outlook.office365.com (2603:10a6:4:54::14) 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:40:45 +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 DB5EUR03FT016.mail.protection.outlook.com (10.152.20.141) 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:40:45 +0000 Received: ("Tessian outbound 5abcb386707e:v54"); Thu, 30 Apr 2020 17:40:45 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: b85fa09b826e035d X-CR-MTA-TID: 64aa7808 Received: from 3ac7e6c5aac5.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 6E36C19B-C616-44CE-8A2E-DA1CD0664EC6.1; Thu, 30 Apr 2020 17:40:40 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 3ac7e6c5aac5.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:40:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CGtDnJXaiAD0G2H952a8Ww/B/SSN7C9xWJGWastBmfH1AU4WCSiYFjeT1CSkeCUlmwVDmNOhfnbW2RCIpy4cOO4hVxbBVWQDapvqn41rIh1bRY/latYiABdDdVQ7rtvlGSpTOGJac022XDDT82Onw+dsLFF7F4ssqgxA6E5jZYDQbBCBKbY86xdmo0k+I2LD282Tqjb6+yT1eFiZEoaOQFAmX4bpKlM0BViyD8Jpg83diPU+K+Hc2B871TSoapKPmzw6jRKxuSh+Jh0GTFmPRq1ZAs17cnrG8rzLX1YJVopET24sVDupX2FxnMsHCd1ANremAZmKelPvVw4EtyUlIQ== 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=wZ8mxWSak6uI+0F19HSOUAJLkzsrC1PfEOXs+H0MdlA=; b=iOdYkZQy0oNkclmZzcl+6UeKnicQRIz98AtOpyFkkJo0kETmYknKd95YcDQwtWa5sck+UsSXGNiisL0X60tUb2Rqd0u+o46tl7Me9aSFZ86ipQES5tOBzsBCjba02E5cdj7O5tprSvhZOs0OfvanfHolI34XJxd95u/wUC71zGpts2TAJnnC9o9IoCmPAVNgGAYZxEbYkeEld3Od0yImHX1aiyL+HJqdrBDawPaIEDPQR6KracSmgsz0d7rlj/A786dPqxAEn3kj0PPvK+ZGJa6yq/Y4OMOXrMMHDIRpxf/N12LXA3DQB92evKyM1C5x9m32ueUzLqziKM2d3MEhKQ== 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=wZ8mxWSak6uI+0F19HSOUAJLkzsrC1PfEOXs+H0MdlA=; b=BQh5yrJ61SP2NaD9Q8/p2pjwK+I+3hseSjywZrtXBrYzK+Apz4rOYdgfovstjTWnvEMRscEg/839jDBIoV4a5zyo9UpK8vIodSGG9UAT8DmJ0XWNCZsOXyHCpnDbRLFHJYRMuOIE+ET1lvAx4JXaIz7latxkqH5aEBabFhdo1+w= 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:40:39 +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:40:39 +0000 Date: Thu, 30 Apr 2020 18:40:32 +0100 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 04/12] aarch64: Rename place holder .S files to .c Message-ID: <20200430174032.GZ29015@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: DM6PR01CA0007.prod.exchangelabs.com (2603:10b6:5:296::12) 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 DM6PR01CA0007.prod.exchangelabs.com (2603:10b6:5:296::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 17:40:38 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 7c797d86-2ff0-4e10-3193-08d7ed2d9ce6 X-MS-TrafficTypeDiagnostic: AM6PR08MB3224:|AM6PR08MB3224:|VI1PR0801MB2109: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: W5DCUi6tPQgnXdawWRf6GpjPRawwRwptNFMtJGjN16h1FKzAV+EtJzhOt5Vdh3god0Y9OXj/lExeZtdWhv8Ox79hN13UlNpuacqt3D2kc1smuD+UeFJ/Nihmb9P1dSLRIxKJ4fcpR8rt/O2tGRjvnXh89Im+roO1igGRid+HW95vgCjR9NE06J9dCDF1clfVNkYWkadsU8sdCKxeXoE4NO2TV/FgMuS0mT9ihTcb7wIXogBaVN4QYRlpwTFySZ6YENSCyKPmcsZ6EtsjnWNfTUhR7Vc+698Cnv7m5cLsqoVQgSwmMnFX9zNDYVbrpY59v/Shs4bYRkm1uGZkwXN7PVTPxMBRGE4NEYzhGAuKgSWVWhZwV7C5UfmA/V5pUfnHC9ssY3HvxAwYgmaaJyJz5w== 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)(6666004)(956004)(2616005)(316002)(142923001)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: CD2GmeqegEGeVOkePHYm1Km2/FjZyrrpbYG/MLYUsvbKft1OvZJ6ZRAFf7fVtaNPp5rX8Jm4Dr4tk0qa53MYwJSFIFJJu8Qjf9zM+6NUsgAaAk/jsUfC33YyjhBH8TFTCSPhT50by9P8zvn2xGLa9rh/eO2Yik/ACiTwv1gTsoE/i61t68GnIKle1g44Apofj/5KLOpxZ/IoExBCIfF9ffpKQrkvyeHC3zG+Tgb/dcYg4dbiM9rqtJH8ABTFFML4QmNcOtUjKLfn+tdd6Xk2uKa16cj1I5utxj6nyjBtaPULNz0sjEQbMpuguTPbuRUR6KwUnZix3Hx7R6E/2XWBrvUpPzyV/hopi9DlwERad4IZnt/FH/mW/PPokn4LZvwi2fPeONvTwdq4j5HkHUq0/SgSOn5BCT2Zo2fj3XK62+q2cv+AfJElx4Xusa3rM4c5iewIvpMUu9yEvKMuC0KmE6jz3pLbRK2Bc2U4b3beTrdrgpArhcPf/tZRowG1TpT/XI19VOUBQ3x4f5fHvQL6oyUZCypG1lG0K6HoOESO/QRmTqr5unHaaMJPagp5Bi84GdXp4eb8RiCV2rRFMdJrWkUkHMvuKh+I4dXOY7ldEXwTvVZIu60YBOjtfuUaFLXG6/iwmU4v6/HSMETVdqquIVBwJw0ykglfG85B8yyo7BLpZ0AbDoPvHT6f+RxEauJS9UO4u2CWVpQFk+4GdQlwjTxrijqEQzPbSt0V8lGhgCsZR2H2/J6C52bXdiMPhjLtkFyTcef9Ra9rkHY5x6GgoLU0zmDqfNaU5JeBmoyteYA= 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: DB5EUR03FT016.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)(346002)(376002)(136003)(39860400002)(396003)(46966005)(316002)(8886007)(86362001)(564344004)(2616005)(2906002)(36756003)(33656002)(956004)(82310400002)(6666004)(8676002)(81166007)(70206006)(478600001)(70586007)(66616009)(16526019)(7696005)(55016002)(26005)(47076004)(336012)(8936002)(186003)(33964004)(44144004)(356005)(1076003)(6916009)(44832011)(235185007)(4326008)(82740400003)(142923001)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: a77f872b-c73d-4e28-7eb5-08d7ed2d990c X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xDwPabE7YVGlXn7bZU5Gq2rNq4I+hTMqk/n74cie0xJ19KHTP5Zok0pi2zPvNB1Jk1ic1ovSGx25OtJULd/ZuHKHsB86F+Skf4jEMTEdalsrHR6C8ZudCv88SaOSoKPyQu1HUvrRw30Sc70CX/LL9FzjvQ9KoSvzakpPLsWFlvQ02X8V/IIkmI3rD/kgZCbSp93GzHKswQDbTp4avFnEyTCn1q+vsHqeIzASHCc+V9Hq2/LUjdmZ0VYOWwkWJ06zpacPlwmhKxpshSVHUPEqABAZXQJavwa4DWkjLlu/uTje5PwTa6uob8xXy2L+rDQ2c8zICpRY5uMy9TKML5QCVcmYZzMpI7LtXJobJxNyWaQUB3YaZQuiJ91MMXIMqQ4is/gdXOIbUNwafYqgAhIK4km26e88L74ZzmZUEH8PYmlpRZDOEnKLGSZ2EVrdULSE X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:40:45.7787 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7c797d86-2ff0-4e10-3193-08d7ed2d9ce6 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: VI1PR0801MB2109 X-Spam-Status: No, score=-26.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, 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-Disposition: attachment; filename="0004-aarch64-Rename-place-holder-.S-files-to-.c.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Reviewed-by: Adhemerval Zanella From 2084e33755ee4d00b3ecf956b1705d8eea46ebc7 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 1 Apr 2020 09:52:37 +0100 Subject: [PATCH 04/12] aarch64: Rename place holder .S files to .c The compiler can add required elf markings based on CFLAGS but the assembler cannot, so using C code for empty files creates less of a maintenance problem. --- sysdeps/aarch64/{bsd-_setjmp.S => bsd-_setjmp.c} | 0 sysdeps/aarch64/{bsd-setjmp.S => bsd-setjmp.c} | 0 sysdeps/aarch64/{memmove.S => memmove.c} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename sysdeps/aarch64/{bsd-_setjmp.S => bsd-_setjmp.c} (100%) rename sysdeps/aarch64/{bsd-setjmp.S => bsd-setjmp.c} (100%) rename sysdeps/aarch64/{memmove.S => memmove.c} (100%) diff --git a/sysdeps/aarch64/bsd-_setjmp.S b/sysdeps/aarch64/bsd-_setjmp.c similarity index 100% rename from sysdeps/aarch64/bsd-_setjmp.S rename to sysdeps/aarch64/bsd-_setjmp.c diff --git a/sysdeps/aarch64/bsd-setjmp.S b/sysdeps/aarch64/bsd-setjmp.c similarity index 100% rename from sysdeps/aarch64/bsd-setjmp.S rename to sysdeps/aarch64/bsd-setjmp.c diff --git a/sysdeps/aarch64/memmove.S b/sysdeps/aarch64/memmove.c similarity index 100% rename from sysdeps/aarch64/memmove.S rename to sysdeps/aarch64/memmove.c -- 2.17.1 From patchwork Thu Apr 30 17:41:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 38886 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 E375E396E835; Thu, 30 Apr 2020 17:41:36 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60085.outbound.protection.outlook.com [40.107.6.85]) by sourceware.org (Postfix) with ESMTPS id 54CD5396E458 for ; Thu, 30 Apr 2020 17:41:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 54CD5396E458 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=4WvHTgRZ3KDY4fLabpWK5IOb2HgEbli/QBIeucR0x9s=; b=4dEFk5ByqLHcHhcNh+C+qrFbgTMdVbnClcSV0fNjXUw76eTMvCEoTSkZAfxp2PQnkytdzVvp8x4Pdk3lqdu7TeyazwPniX+g21uAzRQ2eIUIrehsT/hrlRNa83hxTzz+f5IA1cU6GRIZsZYMETaKZTbM/PJ6inuu5ALFnUf8p5I= Received: from AM5PR04CA0021.eurprd04.prod.outlook.com (2603:10a6:206:1::34) by VE1PR08MB4686.eurprd08.prod.outlook.com (2603:10a6:802:af::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Thu, 30 Apr 2020 17:41:30 +0000 Received: from AM5EUR03FT058.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:1:cafe::34) by AM5PR04CA0021.outlook.office365.com (2603:10a6:206:1::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:41:29 +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 AM5EUR03FT058.mail.protection.outlook.com (10.152.17.48) 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:41:29 +0000 Received: ("Tessian outbound ff098c684b24:v54"); Thu, 30 Apr 2020 17:41:29 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 838bb687e77e53d3 X-CR-MTA-TID: 64aa7808 Received: from 2447f4a9ac69.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 546B8859-9AEB-4902-9D9C-42AECF92608E.1; Thu, 30 Apr 2020 17:41:23 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 2447f4a9ac69.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:41:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oA8/Fx+EUxSxvE+nBj+GeUgxRLamYmoTWu34ImEidCp7D6YqyhbCTxl3jyEU4BWLFQ9bgCQjagtW5+BK8I5sMOjjT/icMo8ARPG/OuI47GFeWgzgqK4uU86va7fu0+RMv9d2pAz5whwqO6D57lLtX128d1vahIusKE5VrkLhqCylhsxSwFxIOXMtuNG+QqfxcojoxKQDwvF6XJYeIKQyEXkmSpokFNwDnc7Y7xwIyhLTRbc/XKFk4lD8tNLu+McMWvqgap9W2YGXRz3O8jh1IJKQvW7Jm1YdIvLJSv1ioEyZ52hQ48KXNtwvm+sv+YP7CoYF6Rw1zkPthJ9u0LNjFQ== 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=4WvHTgRZ3KDY4fLabpWK5IOb2HgEbli/QBIeucR0x9s=; b=ldcdAOFTbjef3zXbRbXzHHJrkZJuCsJVrggqG9w06gc/ZAgg3pG48FvB3ZrVqmYsIx8zFL7YNfVbZiXYkVNiUaIG7vtbToabHbFtR/Z+gAY4ZI+oOztm5xPHPw3G7KPlTQjQEJ8FM1yzo1AXIJVmmokESnMcWhHPY1QNMOPWtzARzxXU22nmUUiUvmev4BK6DupBC6tsoyaVXVeK8WOCq5v+M8zDVoAdiIhFwHG2OTeHQeo+n6scrfoNk9eu0DBbvG1GBAXEhMyYDMXN/JneF15gHkhQw3Bsd5bMcKvYx86nBjJ9oRcvv6VZndAFLJIrQhCbZojPxTL68LHSWJ22LQ== 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=4WvHTgRZ3KDY4fLabpWK5IOb2HgEbli/QBIeucR0x9s=; b=4dEFk5ByqLHcHhcNh+C+qrFbgTMdVbnClcSV0fNjXUw76eTMvCEoTSkZAfxp2PQnkytdzVvp8x4Pdk3lqdu7TeyazwPniX+g21uAzRQ2eIUIrehsT/hrlRNa83hxTzz+f5IA1cU6GRIZsZYMETaKZTbM/PJ6inuu5ALFnUf8p5I= 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:41:22 +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:41:22 +0000 Date: Thu, 30 Apr 2020 18:41:15 +0100 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 05/12] aarch64: fix swapcontext for BTI Message-ID: <20200430174115.GA29015@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: SN4PR0401CA0013.namprd04.prod.outlook.com (2603:10b6:803:21::23) 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 SN4PR0401CA0013.namprd04.prod.outlook.com (2603:10b6:803:21::23) 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:41:21 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 9be22717-f386-4a99-7673-08d7ed2db6f8 X-MS-TrafficTypeDiagnostic: AM6PR08MB3224:|AM6PR08MB3224:|VE1PR08MB4686: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: xf5sl41Vma44LyGic69ZeoS7tyTnic6rCYBmG9vihBUimbkTKIHQUAFP66X5sHWa3IKPknsBPTTb03JMDA93BT/uwR7fhnft1UBmHFDLYO8j4z2CMaYW4Rgbm7PKXFMjnCmeYGSNSn2WbMvJlNC/kbdUdMQIqRc8aRTg8tQNGqIQ48MzZ8HkS3Z9aqNzHP4a5PBq2JMHr5bh+mWOtGhM4trE5ejBudc6vQPw7AaC5CWx+sgZ+A5BW0JFyFwsTyKbCiYjfkHoLPy8ZupCSOpRgqYGnQSOlnac4jQaQREpaemfwpIAMoVx3mj9ydVGuU2p1LUQzsI+plY5YTUwwjMKocR1d2hvxViKKIvTbSqogFyblaUCo88zTZbsQOMubeMC 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)(6666004)(956004)(2616005)(316002)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: rbeww27xIIj5xFeM6FeaH0QtMukR+RO8Me0kYhFfT3hpmCemjon4afugjHljpN0ibXNxrjexcBdcozmEFTrcssXYD/vBHYbNl2tptEZ595iv7X6lEBoF+N5mFu427aOSmWuVMw5kRJVMY4/u+e4idT/YpL5hEd+TF5XCpHCRtqsWkoMaW7XMHD76m05f9U/eQHLE7qQYUcpw/wuco8R6pODVNh/HO8v3DABAqBc5oojc0twOCV4UnfeA2JExypLtUdrkqRYCA9PyffNyv34TH5cKt2xWKi+JP8AksG6ipWu0nUp6cXIEehhIbXPDYLHkTfaeDixyA0G+ZRG1Qo1mNqCH86ADYo0rOYbr1A3rWspr4RDt/5bZ9n7i2En0E120keWVdL7sNhz6hRj4UwmPCkErjd4pEkkhjZ9v1mLTb7oBSIoYLBKexAhmtw7m1O+3YhSGvoctR/NiOmDgtluk08h9SPGuFjoApupVR6lQRfhC+yXFDbGsZJdVSBs0S7vJ+Zf2cV3Q2AR0Oz/xh+6gOwCNI6qiVj7qfjgu5yeVD3E9UXe1lb5pwS9GNGYEcjda+p39FPxRJ0zUW0ZOQrZTjvo7wR8W66I3YX378UEUaKzxTtHzuHXv6SiPo+4X4NDvbZzmmXeFEzvnF53k+J37+rWw8uIskjEoX9dcrjOBAmmFCCT3sxfbwE7vftJToyHkxumhRK/Qqlf7wBIGGZGyxneYkaw3DP88BjPh9kLdr9GQ4kZbHBJxVjAGb5nwAVDbOr5F1ax0knyPXHvaUTxvracbvkVH+jLjt+UtBV+Nock= 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: AM5EUR03FT058.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)(136003)(346002)(376002)(39860400002)(46966005)(66616009)(70206006)(70586007)(6916009)(36756003)(564344004)(336012)(235185007)(2906002)(47076004)(1076003)(8676002)(6666004)(33656002)(82310400002)(478600001)(82740400003)(8936002)(4326008)(36906005)(316002)(44832011)(956004)(2616005)(33964004)(44144004)(26005)(16526019)(81166007)(86362001)(55016002)(7696005)(186003)(8886007)(356005)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 979f2ce8-5cc0-4bed-b55c-08d7ed2db2ca X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: UMBapRAjSb+gQFKTOIbwqxGepZeVMxKK02UmlADIh3A5hrNmysDje8q9gVnmOkm9rD+99nSz7rr19nRHP8YDz4xQsPogiPwnxpnwIsZDq0ifQAJobYLyA/QYWEgnFkxXj0huMyZWGGZTIgpIU/74b+58Px0GIxla2JfJ1QMftgAPcD2HdHVechGG+nfdcZFigqLTUHpiwdwH54yh8oyyY5D7Yv7rwte9/tRaN5VW/DRqn45zTAnMiunqRdCbzU/4Uox1S7O1kMXT3kHdSEaDNzt/k0TieTgu31ac9natuzEekRGwuu2lHZOyNW581gKxXak79Zvwdd1BFX/ci2OJ6WyL0o6mCtd0iqZH9TyVQPidOB0uoGufsRoLpllw0JVfLmfD4ARnG2SVDFQgcDBWplv7mYfwHEa/OKQzBRgN+Ro= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:41:29.4652 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9be22717-f386-4a99-7673-08d7ed2db6f8 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: VE1PR08MB4686 X-Spam-Status: No, score=-27.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_STOCKGEN, 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-Disposition: attachment; filename="0005-aarch64-fix-swapcontext-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Reviewed-by: Adhemerval Zanella From c156ff9d5e332ad17d7fa74b777e8f5466aff0a4 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 1 Apr 2020 10:31:41 +0100 Subject: [PATCH 05/12] aarch64: fix swapcontext for BTI setcontext returns to the specified context via an indirect jump, so there should be a BTI j. In case of getcontext (and all other returns_twice functions) the compiler adds BTI j at the call site, but swapcontext is a normal c call that is currently not handled specially by the compiler. So we change swapcontext such that the saved context returns to a local address that has BTI j and then swapcontext returns to the caller via a normal RET. For this we save the original return address in the slot for x1 of the context because x1 need not be preserved by swapcontext but it is restored when the context saved by swapcontext is resumed. The alternative fix (which is done on x86) would make swapcontext special in the compiler so BTI j is emitted at call sites, on x86 there is an indirect_return attribute for this, on AArch64 we would have to use returns_twice. It was decided against because such fix may need user code updates: the attribute has to be added when swapcontext is called via a function pointer and it breaks always_inline functions with swapcontext. --- sysdeps/unix/sysv/linux/aarch64/swapcontext.S | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/sysdeps/unix/sysv/linux/aarch64/swapcontext.S b/sysdeps/unix/sysv/linux/aarch64/swapcontext.S index d30c543e6f..b60cf04c92 100644 --- a/sysdeps/unix/sysv/linux/aarch64/swapcontext.S +++ b/sysdeps/unix/sysv/linux/aarch64/swapcontext.S @@ -28,8 +28,12 @@ .text ENTRY(__swapcontext) DELOUSE (0) - /* Set the value returned when swapcontext() returns in this context. */ - str xzr, [x0, oX0 + 0 * SZREG] + /* Set the value returned when swapcontext() returns in this context. + And set up x1 to become the return address of the caller, so we + can return there with a normal RET instead of an indirect jump. */ + stp xzr, x30, [x0, oX0 + 0 * SZREG] + /* Arrange the oucp context to return to 2f. */ + adr x30, 2f stp x18, x19, [x0, oX0 + 18 * SZREG] stp x20, x21, [x0, oX0 + 20 * SZREG] @@ -97,5 +101,12 @@ ENTRY(__swapcontext) 1: b C_SYMBOL_NAME(__syscall_error) +2: + /* The oucp context is restored here via an indirect branch, + x1 must be restored too which has the real return address. */ + BTI_J + mov x30, x1 + RET PSEUDO_END (__swapcontext) weak_alias (__swapcontext, swapcontext) +END_FILE -- 2.17.1 From patchwork Thu Apr 30 17:42:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 38887 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 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 ; 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 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: 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-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Reviewed-by: Adhemerval Zanella From 1e8662264c07e69d807761882e8d77f0916ae562 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy 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 From patchwork Thu Apr 30 17:42:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 38888 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 4FCE8396E468; Thu, 30 Apr 2020 17:43:14 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70059.outbound.protection.outlook.com [40.107.7.59]) by sourceware.org (Postfix) with ESMTPS id B3082396D838 for ; Thu, 30 Apr 2020 17:43:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B3082396D838 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=y9+VXiMU6DcRnWwaex86XBWDhrgkY11WqtnJjadsTkQ=; b=g7cC6frs0rFeirhj5mFPDo+vq4Tx14SHHX+ltU8lHjMVXZ8/u0WEzo/Zvo9izmDVKb9hXtZUBb7ndsXa9y5D5CngfUY8OAJTzGINQvIxzyWwS0L1RP1Nq1M+kVsImfr0NatTC4F2VZPUJ3VN6W9WF/87ILp+y2u7/oJOnQwaUK0= Received: from AM5PR0701CA0054.eurprd07.prod.outlook.com (2603:10a6:203:2::16) by AM5PR0801MB1923.eurprd08.prod.outlook.com (2603:10a6:203:4c::15) 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:59 +0000 Received: from AM5EUR03FT037.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:2:cafe::23) by AM5PR0701CA0054.outlook.office365.com (2603:10a6:203:2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2979.11 via Frontend Transport; Thu, 30 Apr 2020 17:42:59 +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 AM5EUR03FT037.mail.protection.outlook.com (10.152.17.241) 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:58 +0000 Received: ("Tessian outbound 4cdf5642225a:v54"); Thu, 30 Apr 2020 17:42:58 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: ce49f0fe58083f1f X-CR-MTA-TID: 64aa7808 Received: from 5aa76c5a1944.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 09F8248D-504B-4573-B03B-3C84A5FB2914.1; Thu, 30 Apr 2020 17:42:53 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5aa76c5a1944.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:42:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hG2S/qRoD42VPxLe1S6s05cTHmn0FG6sdeO5l2FIXe4KS9X697IqrvOxs48jCxxay82FQ1lvdjqMPZbn6QGcEO9kiFjJPAzq4hB/x4ZgfKs8jpWDRX4d7XwT1+WAuMVhocwlbssXnbFU9PHGpcJ7rY8+K0hJJM1PVeW1ujmmzQW7jC/AGu4ItnNp/LrhwMa66Dw6iXCTVmxSfV/um9aS83IrPpcE8YNquWurY8hvEirBp1aBWWO+EhpKiheRnNurYFtWeGkv1CUidRNbJ8lZTrBGrwP6EGVuzhLFFMkFnmvKNVbZALMH7uYYBfw3c9JDEGBgphL6l0bt0ldVYTDapQ== 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=y9+VXiMU6DcRnWwaex86XBWDhrgkY11WqtnJjadsTkQ=; b=niTlYMhOKeOqLf+qC94CPYEtI2PiQ/LKGIsmE7DpqWYDsKm9d8qfV9mHsYna5JG4Jt4W/9nnPLEbM1OVt7QBFV4KqvH1QuQ5HieMpRTBR5m7A30ysWcOeMwZDuVLQsy12NnFrEYWKhrYFWp2j6Lwxzc9jkOFjt8YuA2nU96x9+H+jZ3ym988ByI+KV+kWAHYCdi06OAwfeq0pYwbZKoLMv0VoUqQCFvq+iYuykF3BuhKIxPsUgxAWPqM3jQ7rKpkxso7G1W/ddrl7Y72Qu04TVbdBYb5AkNHku9nOl3UFYrJCANiJVU0AQo4uHiXOa5k5TS/6GEUKZVRzDtIUn5jFA== 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=y9+VXiMU6DcRnWwaex86XBWDhrgkY11WqtnJjadsTkQ=; b=g7cC6frs0rFeirhj5mFPDo+vq4Tx14SHHX+ltU8lHjMVXZ8/u0WEzo/Zvo9izmDVKb9hXtZUBb7ndsXa9y5D5CngfUY8OAJTzGINQvIxzyWwS0L1RP1Nq1M+kVsImfr0NatTC4F2VZPUJ3VN6W9WF/87ILp+y2u7/oJOnQwaUK0= 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:52 +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:52 +0000 Date: Thu, 30 Apr 2020 18:42:50 +0100 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 07/12] aarch64: fix syscalls for BTI Message-ID: <20200430174250.GC29015@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: LO2P265CA0029.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:61::17) 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 LO2P265CA0029.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:61::17) 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:51 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 37245255-213a-4caa-ae72-08d7ed2dec2e X-MS-TrafficTypeDiagnostic: AM6PR08MB3224:|AM6PR08MB3224:|AM5PR0801MB1923: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7219;OLM:7219; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: Cj+pu+KUg83q1A2uyVqrrW2RUSUP7xoaidUBYljvRnRtpX/vZYt8bJK7nmZv5u7L0cNqeevjcYuLOJTQmlIcbgdciV72Yw0uCLV0EgUYsSRjozKbo9jwUqcrcTCRRl1693R/SJ4fctf0J+Hg+W/sU2ttUT+MpIbepUqRdpijFQNoYy6FgTAZNHFP9SEgb75Qiw1s4xO3TWhtkGy2mYRWpYYgb2l94lBtnBxSKoruHtav3nkZrWKVVRLmLx7/xqRvSC9MRVr7MyarOJ+DLpm1kj8ddS7gU/Z7x7wlagyKznljNr2C0i/+nbYFmgd4x1gjAwdahnKm9U9bMdGtXtTyJVPGwDNhTAb74pz89VabVJaOjE1sUQWRd1xBcp0Q9aOh 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: X7tzAyCvDEmQYou571IlONCg8oQnVuoa+E5uhFfEejMSTCEIlg7fO/YrnGMisfoEnQofz7MK/oj/NfQK/tUVawX/SGsh4WhTA46NdpTn+4b6rrtj0D9bv0yiYS1zOLYVuf/ZiDhkFWP871VM/Zev/KpeEyE5ElkB6KnLYkdGtIQvfMHiL88NiOI+qVIAgzbFFzs9ho7vUcY3gdUjgMZyH8O5DpnPtbVie6DR0+P7Ard+azcDz3YpIOwsr6l2WkCAfft4Vi4q1KdQwyaYM12KdfbAxlHdITviD7gn4lacHRd2d15QLFx5gTX5dOA+4i3dWoWMqFgkfV+lZ1hvBd5iM42ocsxDRDd7klfGI58h/nQtraxRsi0GgTQVRgvAwDaftert3W17dJUre5NXaG6tHQ3aCc8Bq8q6/ldZpCSaOuZOi1laxrSlA7p9+fx2DiUNGH7nferA3cVvXQwbZ2SjPVYWhpZkKFpjxCojVGgbY8kJiBNGGOlrmg5aOn1KD6wQ49NZXf9E7MG39VoI6p5nFq0G32hzWRmZTz/XwBh8i5g7OuA/I3amsv9tcYmvE91s0w4e4moB/uIn7SC2NdlSsM+wrbCwcp9zXn1DsSUlqDAojM1FH+7o72WeEsC/04h+reZrmHFcKBAEHG9lH/yB02tpe6iW/EggYM2YKseDKVVT0u2o8du8/7uZuGKJde6im2zLofbFJ2VIBfbhoYoehhAzan0z6DhUYIuBQOamB/p9a9Ls6zTILXL/SoYq9+slvHznWw0WF7dxh9vZubRv3cJGBJ/DZRf9dg9uHlWKUtU= 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: AM5EUR03FT037.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)(396003)(376002)(136003)(346002)(46966005)(1076003)(44144004)(2906002)(235185007)(33964004)(26005)(4326008)(6916009)(36906005)(70586007)(186003)(316002)(47076004)(7696005)(8936002)(66616009)(82310400002)(16526019)(8676002)(36756003)(70206006)(564344004)(44832011)(2616005)(956004)(55016002)(81166007)(33656002)(478600001)(82740400003)(86362001)(356005)(336012)(8886007)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: c64d2b54-484b-40d5-148a-08d7ed2de80c X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zfBs71w39SXBjY7Y1NVPl7ftMfdsBz9A1iDdLUyYGuRgtbzLaVqc/D1U5k/SqXul134iKDqBuEDa+4+bW+l36wVk878IMn8lQaD9PS0np+AAy9wX8ZCuEl+sv3LCHAmpvoi25lG1VZOcj7l4lG8THomlHFU4Hv+LNHSUFFosRaxfHK6Zj7Dp+ObBFDDDyP5ujPpyK7pnpIgm1h7ZRImxFBagzEo1v57IKLK1qK5GaVvOLqWnPmOJMDD8PFQIT3wT5tMQQPXg5MXAzBZdnE92jKFlaOFUrY2GN7oBScWfuVk6zek9Y04TD9D/aVkM3jORuccQlVPQ3PSpXY/rwndu/gCtxM2aJmbIuiqVw1PpF4PjpXBRF8H0+luKOsURYkLmghDHb/tF3Gy8Carzs8yab1KloawFWagjeskj0++bsaM= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:42:58.7438 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 37245255-213a-4caa-ae72-08d7ed2dec2e 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: AM5PR0801MB1923 X-Spam-Status: No, score=-28.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, 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-Disposition: attachment; filename="0007-aarch64-fix-syscalls-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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From 10741a1943239f0b22c8dd3f7df93aa338ec003f Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 1 Apr 2020 15:27:12 +0100 Subject: [PATCH 07/12] aarch64: fix syscalls for BTI Syscall asm code needs an ELF property marking for BTI when glibc is built with BTI support so we add AArch64 variants of syscall-template.S and umount2.S. --- .../sysv/linux/aarch64/syscall-template.S | 20 +++++++++++++++ sysdeps/unix/sysv/linux/aarch64/umount2.S | 25 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 sysdeps/unix/sysv/linux/aarch64/syscall-template.S create mode 100644 sysdeps/unix/sysv/linux/aarch64/umount2.S diff --git a/sysdeps/unix/sysv/linux/aarch64/syscall-template.S b/sysdeps/unix/sysv/linux/aarch64/syscall-template.S new file mode 100644 index 0000000000..50db585289 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/syscall-template.S @@ -0,0 +1,20 @@ +/* Assembly code template for system call stubs. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +END_FILE diff --git a/sysdeps/unix/sysv/linux/aarch64/umount2.S b/sysdeps/unix/sysv/linux/aarch64/umount2.S new file mode 100644 index 0000000000..4fe26c35e2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/umount2.S @@ -0,0 +1,25 @@ +/* umount system call with two parameters. + Copyright (C) 2020 Free Software Foundation, Inc. + + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +PSEUDO (__umount2, umount2, 2) + ret +PSEUDO_END(__umount2) +weak_alias (__umount2, umount2) +END_FILE -- 2.17.1 From patchwork Thu Apr 30 17:43:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 38889 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 047EB396E47C; Thu, 30 Apr 2020 17:43:49 +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-eopbgr00047.outbound.protection.outlook.com [40.107.0.47]) by sourceware.org (Postfix) with ESMTPS id F2722396D838 for ; Thu, 30 Apr 2020 17:43:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F2722396D838 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=8UjoptEGyc6yYLRoYnLHYA7v+mNqRF4FoRTI2Qj3Vyg=; b=hlzEHQg4o/BorwUs+t7hZaWa1hIboU89Tay06HDtz7hI3/7l4Fb2Qd8K3bdvNAGFOhgEoLZdEDsCrq4JLq62/QreG9hPit2M630k+CaXt1ql4gvupSPEQwnMgGUB7HI+CHROWwuH9TO7nxtG2oF5xNrTsp19shl0K4NIgnUPo6g= Received: from AM7PR03CA0018.eurprd03.prod.outlook.com (2603:10a6:20b:130::28) by DB8SPR01MB0023.eurprd08.prod.outlook.com (2603:10a6:10:146::23) 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:43:44 +0000 Received: from VE1EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:130:cafe::31) by AM7PR03CA0018.outlook.office365.com (2603:10a6:20b:130::28) 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:43:43 +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 VE1EUR03FT049.mail.protection.outlook.com (10.152.19.216) 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:43:43 +0000 Received: ("Tessian outbound 4cdf5642225a:v54"); Thu, 30 Apr 2020 17:43:43 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 5b79d80dfe597d61 X-CR-MTA-TID: 64aa7808 Received: from e032eb60604e.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B889B6D7-FEF3-4093-8887-4E5DAC82BBDF.1; Thu, 30 Apr 2020 17:43:37 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e032eb60604e.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:43:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FuxZvR1ie5NXAHQzYRDd6MBSPl7W8priGAE7AdaFfi+ThIcIOFFVZrLpPSdlKVlRNsfgi/3uPWAHBYbxwF9YWOkEmEr3WSUxR+tb9FblK1mS6IolkfFDhdGYKKvtJQOmUklxTF1uqexil+xsA7FBn7trtPXEOE/mfbC7Nbhb5LyUZOEuxiIB/BJU05FrRuHLYiP6GyutciIWs64dj6VlF1IwbgCwctHVjmfJIvnua1V6QyBUoVkbJxda1bWxf00kwj7rExBydfz+Ze5FQJzC/h9O+HrifvuBNfkh7HRuZhUb+iZ9GOxE88NNDeU5So5iE65yvMGGIAyCBq7bgPIvhQ== 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=8UjoptEGyc6yYLRoYnLHYA7v+mNqRF4FoRTI2Qj3Vyg=; b=NuHVBijKOqqdnYt3hMciSzFnTTBz6NnorqoIxY8kZjYN7jcs2i97uvOHc2TQeCQAbJAw0a7W9gP64H1TslrbH2SwFYjrRMDTH3Xx+kMAaA73t2yoQcv1BhHpYpJl8eEslZb3GofYXlS76Xr+E08C/XPUn+nNHmUvLCWS+ynI77yTRQXnFYgsQoJz4TM90G7OWP3yNfB0EBYNOOXp34LI4MAOZYwTm9a6lrNmTJuWy84sWPo4QqKGgk1HnjDcqEUlgj/UJqgYpZSoSzoTcgH5UziJhPAJCXBaVYxGLC+NkTWC3aZr8ztHj5AvNp6rEbfyTsaHhSxU2VGKxFB9IHLAbw== 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=8UjoptEGyc6yYLRoYnLHYA7v+mNqRF4FoRTI2Qj3Vyg=; b=hlzEHQg4o/BorwUs+t7hZaWa1hIboU89Tay06HDtz7hI3/7l4Fb2Qd8K3bdvNAGFOhgEoLZdEDsCrq4JLq62/QreG9hPit2M630k+CaXt1ql4gvupSPEQwnMgGUB7HI+CHROWwuH9TO7nxtG2oF5xNrTsp19shl0K4NIgnUPo6g= 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:43:37 +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:43:37 +0000 Date: Thu, 30 Apr 2020 18:43:30 +0100 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 08/12] Rewrite abi-note.S in C. Message-ID: <20200430174329.GD29015@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: SN6PR01CA0032.prod.exchangelabs.com (2603:10b6:805:b6::45) 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 SN6PR01CA0032.prod.exchangelabs.com (2603:10b6:805:b6::45) 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:43:35 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 2d738563-e6e7-4ff3-e713-08d7ed2e06a4 X-MS-TrafficTypeDiagnostic: AM6PR08MB3224:|AM6PR08MB3224:|DB8SPR01MB0023: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:7691;OLM:7691; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: aBDk0KzfgjV/WrJaGJLCnaaxHhb4noEmrbC7v4C+OYxqEs8Dx7Qz6gtL4ySJLzzhnKsFfBMO+L6nFbWOIuUAvoN92ot5Xxsq+ynVRO9BDQXJqWHeJNRYeRP5tyJT2Llgv99Z5PiDcOrwAQsFa4CfigwALO3RhZFpiA8o98RFPeAV8hfl0czfxkXYyqs2gWnrWhXTvH7FkYdNnUikey+NqsOkgzUgov92m/yw2a8d0pv7uW9SUSplFZ30IFnaZSo+LJefyt2NqTnS7sPbuwjLl/2lqSBX1zV3Jl5lSnXTB33nn0H6ByJInr9QoZ6BOwd6MjODtdU7faA90ikk8YZyX7IHIJYYHJdp8BrwNEVDZmqqK8QTR10eymz8JdOs/Hql 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)(6666004)(956004)(2616005)(316002)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: RPEcXtSZWNsOalnlcCAcrJ27Y5AfkBOxoL3DWEXoYxiJZS39Mx+TJ6LJ4m+IMh1+BnIY8JqrFYLgI00CGD4HfOl0JIQRhtVMm9I5H1ZHqMCCr+R4yrGiYTxK6txsC+cb2Rz/rZ+41AfHS99zV7nFXN2FEOgmX36AXtOoxpZZwpB+yWqAJH6B5z3to0gDS8wlukfclgQr3YHXPW45NQO4ZJZ8qCCcC7EBFGWA0qRot7ztpoS6O2ZGJ1NVAXxRoyF7Lde6oaHJ22owjd4fqsgI1ranaMmkjMuhL2QdYjLtYuEnumaDBoLOQ8ig+8Xl6f/jTuADx5lT2AvjI5OXfZp1H4qGu4lBPQzZOsvm/Z2cPsAu9Gcviow//K7GEuAXv/5MD9P3YKuRE3FjEf5aCUT4mTmcy9VnZXv9Fi8UJrW5XUIfTGPl/vmVrstXLJ6M4cLi76soFHijoWGhMLDD+7Pdbe8nC8oN0tQolRllen7KEtSMhnk8HEWJHjMmrWWZOloC3SPX8XiF4008QS0K8d/PmyzoFzswabix0QMu2UoggRsX0jeasq4CSR2ZlTNsMfilPnCLM46kg1zTiGG85pa1TDvJ+MVQ50Mk4YlfTNEVpim96qZd9qXOhDCia5yyYHfER5HDM6ijv0PgrlH8txSQHdJMhVJaNIk+ZEga+5eVLidw9+TOYsk4VmCdt5hYjBb1yA9sFSvnsjkaP2rTis4pZJKEKusN8lnh/w/TQuhaSlvnBBmaB/iKurEsc9vHYIyTkpyyvfHUEybphGKUwzWKZAKcjFRBugpjJpm+Zk/u8ek= 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: VE1EUR03FT049.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)(396003)(376002)(136003)(346002)(46966005)(8936002)(564344004)(356005)(6916009)(82310400002)(47076004)(8676002)(82740400003)(81166007)(4326008)(55016002)(86362001)(956004)(2906002)(36756003)(44832011)(26005)(16526019)(186003)(235185007)(1076003)(336012)(2616005)(36906005)(478600001)(316002)(33656002)(33964004)(66616009)(44144004)(70586007)(6666004)(7696005)(8886007)(70206006)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 78903919-9059-4737-dc78-08d7ed2e02ab X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pH9pA88ZwhOM0nhIOEscoSPmcWnQxeIms/ROHNrsm+i+0tveChwsw62PlTesVCc3n/f2O/9sEKagjNs3l0Je2GjCXssgGWKwtsrPuDfUNBBgMvVPuvwd0jAaGNJ2/tCgxSyTREmLYg8rodykuRKnovaAfqOoouZEuYsUk7dumCEoyEJUW4kAL5IIO2dMbUx6XVzwzNmhjYJGLdgW2idgiCgZWd+py6T5/UsHqfGq3OyOx7f1HNtM5eQQAcb+DuEB0H7iW1RhT1k3NuXZnNkctcPQW05eWePSJxGyYKmHrg8eOaa6Im+6T2fscisOluq7MSUxUpHgvUg5Vlr0SOkc0z3b8wszMESQ6C87nNSSP3JgRv8USFRguU3XwrzXHGrbLrCGDzkx6pxKe8Mrdea/2+/hlBzv3s9tIZFkQa0H+Cs= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:43:43.0933 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2d738563-e6e7-4ff3-e713-08d7ed2e06a4 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: DB8SPR01MB0023 X-Spam-Status: No, score=-28.9 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-Disposition: attachment; filename="0008-Rewrite-abi-note.S-in-C.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From 0647d5658df82f89d8bf73dec65ef4aa6a4b77a9 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 1 Apr 2020 16:02:03 +0100 Subject: [PATCH 08/12] Rewrite abi-note.S in C. Using C code with __asm() allows the compiler to add target specific object file markings based on CFLAGS. This is e.g. needed for building glibc with branch-protection on AArch64. --- csu/{abi-note.S => abi-note.c} | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) rename csu/{abi-note.S => abi-note.c} (85%) diff --git a/csu/abi-note.S b/csu/abi-note.c similarity index 85% rename from csu/abi-note.S rename to csu/abi-note.c index 2b4b5f8824..5d86b452d9 100644 --- a/csu/abi-note.S +++ b/csu/abi-note.c @@ -56,17 +56,21 @@ offset length contents #include #include /* OS-specific ABI tag value */ +#define STRINGIFY(...) STRINGIFY_1 (__VA_ARGS__) +#define STRINGIFY_1(...) #__VA_ARGS__ + /* The linker (GNU ld 2.8 and later) recognizes an allocated section whose name begins with `.note' and creates a PT_NOTE program header entry pointing at it. */ - .section ".note.ABI-tag", "a" - .p2align 2 - .long 1f - 0f /* name length */ - .long 3f - 2f /* data length */ - .long 1 /* note type */ -0: .asciz "GNU" /* vendor name */ -1: .p2align 2 -2: .long __ABI_TAG_OS /* note data: the ABI tag */ - .long __ABI_TAG_VERSION -3: .p2align 2 /* pad out section */ +__asm ( + " .section \".note.ABI-tag\", \"a\"\n" + " .p2align 2\n" + " .long 1f - 0f\n" /* name length */ + " .long 3f - 2f\n" /* data length */ + " .long 1\n" /* note type */ + "0: .asciz \"GNU\"\n" /* vendor name */ + "1: .p2align 2\n" + "2: .long " STRINGIFY (__ABI_TAG_OS) "\n" /* note data: the ABI tag */ + " .long " STRINGIFY (__ABI_TAG_VERSION) "\n" + "3: .p2align 2"); /* pad out section */ -- 2.17.1 From patchwork Thu Apr 30 17:44:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 38890 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 7116F3896815; Thu, 30 Apr 2020 17:44:29 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60040.outbound.protection.outlook.com [40.107.6.40]) by sourceware.org (Postfix) with ESMTPS id 6BF32383F86A for ; Thu, 30 Apr 2020 17:44:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 6BF32383F86A 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=h3RQHAqYkcXuFETMFssHWSa/TRQITkgDgkfFAfWSA+A=; b=B1zzgmdFdaE4VhLHie8df6DLrf4DzOsUMm93NG8d5Prebt7YuG7ogzg2Af4OtlGwb8ghfCCCXGQKSOtreWZ1LD80F+jszUeZEiYbhnwWgyKZDbKqPBf8y4YxSq3prnzFqFXc3GV+YTKB9XLQCDQaJBg3DKV1iymiYMVhmXkLUvA= Received: from DB7PR03CA0106.eurprd03.prod.outlook.com (2603:10a6:10:72::47) by VI1PR08MB3695.eurprd08.prod.outlook.com (2603:10a6:803:c4::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Thu, 30 Apr 2020 17:44:15 +0000 Received: from DB5EUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:72:cafe::c8) by DB7PR03CA0106.outlook.office365.com (2603:10a6:10:72::47) 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:44:15 +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 DB5EUR03FT022.mail.protection.outlook.com (10.152.20.171) 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:44:15 +0000 Received: ("Tessian outbound 5abcb386707e:v54"); Thu, 30 Apr 2020 17:44:15 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a048f0d551e78beb X-CR-MTA-TID: 64aa7808 Received: from 54d91bd41124.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 0497847D-E009-4326-BEED-CDB495EBEF84.1; Thu, 30 Apr 2020 17:44:10 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 54d91bd41124.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:44:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jRq+7kZZw7UEH5cLMXwR+8BFWn5LyFTyYf6P5GHE4qXL5KzUztlgBlu2sLapFbW0H4LL6qj9txWYOhDF2i7hyfbdnYL/pjpXXASoSfuzoa0mJuaycXmmt9ljBR/Chi0r3X2TKMWCPY4QgpLavsbvZJSWJnOK5GBpNwefBC78oAR8MskXZPg6tR7At0puMXpIiAadE+n5wIYtaWDgIabCKfaN+WrUre7fitYemgPf3aXP8OznFczOBIt+ATgIgnW6eiS/PwibJYR7i06fbBYzFXPQ72Nu3UHcnQauHgonw/fEg5Me/tL+2Dimj7oSqfZjbg9Tjyoo423ydNW0PApRsQ== 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=h3RQHAqYkcXuFETMFssHWSa/TRQITkgDgkfFAfWSA+A=; b=jJHvlv0qI9Tia9M7W4fbUNk+DBp3MjQuUaiOr3ifz8N4rQRuCarM2JW4y1Q5gUJ4R/riS1rpeQy9W7R1dyPwrya3AxCeJxgcVugElO27u3TYQR/eQJjA8ra4LcL1oP8OexngEoihHFremIc61RqJFhKXjKYtyM/vT7YT0335WHXvYVG6IPwPpHiVpM1196QgERGibW0ot9mO7LaOeySmA52GfrH2gaV+Gc4GOb8LZAjzjpr4hFL8TGfTRJMcVOSfk315wYvuB1xr2vULi+GroNQ/dPfnncstgC1pwr3I3LPjBogKV2GqWSmWw/vvHNTO+82g4kT0ZUMKe0REmgLv8g== 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=h3RQHAqYkcXuFETMFssHWSa/TRQITkgDgkfFAfWSA+A=; b=B1zzgmdFdaE4VhLHie8df6DLrf4DzOsUMm93NG8d5Prebt7YuG7ogzg2Af4OtlGwb8ghfCCCXGQKSOtreWZ1LD80F+jszUeZEiYbhnwWgyKZDbKqPBf8y4YxSq3prnzFqFXc3GV+YTKB9XLQCDQaJBg3DKV1iymiYMVhmXkLUvA= 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:44:09 +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:44:09 +0000 Date: Thu, 30 Apr 2020 18:44:07 +0100 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 09/12] aarch64: support BTI enabled binaries Message-ID: <20200430174407.GE29015@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: LO2P265CA0271.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a1::19) 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 LO2P265CA0271.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a1::19) 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:44:08 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 91239c80-c0ef-4d05-33d8-08d7ed2e19e9 X-MS-TrafficTypeDiagnostic: AM6PR08MB3224:|AM6PR08MB3224:|VI1PR08MB3695: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: LBYx95SxpQXHlliQdahcVVbtBl2fJYngmyNlQA+LoktIGtgSngHkO5HI/IBPBZfoLlGmHBl48l2D6NqFvO31vz/rQXQ8aDTUSfH8h5I7rTMB7E0U/AVgsT0U+RXXTJorIXab/2q/h3ZX9BUT7fNcz+P3+9HS33K4tu9uVXA7S57TXEJP7f9YQ7HGNatI/GMOdbGN4nmnA3gsGjKrVAVEHpnvt+JFIXcdQL+ZbsOKsCBgR9qIPcTShybv3aTsp4DFTzdeMTM7EvJw0s/q8JtJGqRnnF8aJX+K/RUgPUnpvaXZFtGHQu2WQMI1A1EJK+4aTbbYEwZS9ew47qBP18lj0mI+XBGQX0/LC1CK9IaLgZbBnma+62xtxNGK8Ge2a1gh 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: 5EqIah2kKAKXhC0H/ief0ReatXCe27Pc3Nvzlp69AYAo+r8sFBYIcv5wRMznAMqxj1l7zc2wUqntLtj51NFFgEu+jqTWk9fAntdnUoaRmr0AUX6W+d/KZlA3P6wpggUNYVRqdtTvh55AdRkwaKX1DXNvSMhSoqwE7bPL82PJg0ziVyOquJrOxuFqTe5CQxbb1OXcETxDxoSQ0cvwv3ccXuqgDEnX3v82rONmH/VPwOXGQbauZXCtFck/VA4RY5iVUFacjNziuiWYRtPxCEirgJLj6XfyRu8WiRuQQEhYrY20eJizn0J5xa/Q2BD6SnqUwaEgn776w9Ac9hVV3WM49B3JlbL70hRShisx6W/RtxwIchXtmuQjp31fG5zhd0kScSFMFJ8SOoVzvpfqu0XDQzL+aQjCGjE1HctqOi2xMZVrMl0L5UWaxIRtk0Ka5W6fu8Ug5d2yIIVe519d1VAf5T9roi/jXeRj29Vm8vnpovoBYPv9v8KFn8lT6xs41T15bdTScqbF8cI9ImZPrkeA9ICQpPePQIH23f7XamD7lFDMW4BTvIjXDSglV/4BPwQahQ1B9Q6yaVSPgVzFQXNeWLV/SVEF2r/Y6KYCZoYFxpDl8x+dyOc+1bG3HVS5I7fdFoVBVUrHd3x/iS+hXx0il5aB7iRpBJntaDn8f2nEw4D3XOg00bWyjbSs/xLKtULLHGSLpeWkxcDJQ5kicws/Q6GRieZMo1s7V+eAXdz6mLJf97F0uR5fi6M61Ybj2/KkRjn5Hd7pceB4WsAJhm5MV75zj6gHpuB9TObr7NtV+Uk= 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: DB5EUR03FT022.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)(46966005)(47076004)(2616005)(956004)(1076003)(33656002)(44144004)(33964004)(26005)(8886007)(4326008)(498600001)(6916009)(44832011)(86362001)(8676002)(336012)(36756003)(70206006)(235185007)(55016002)(66616009)(2906002)(186003)(70586007)(16526019)(82310400002)(7696005)(356005)(81166007)(564344004)(8936002)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: b2ca3033-e59e-4434-9e1e-08d7ed2e1607 X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EgWFRvy+CTQGctwSMeMlKrHeVatPK4CN/XLw7xaQt4npFkR1mMl5m29qks58HqCLaGXgazTucOsqX4IYnvzYzQOF5sJJ9MbC0Xezk7leGMsZW4MgCnKfE18ulpq2iDzyk8rNWYJgh+Ijb1QqMtIwxUXlMUoQ6tdu1n5x04p4wV5dXM6cNE0KnbLfMHp/B8C4wgJHyAfUdHyIg5oUiWonTifumWC64+OVm5TqrRKIHVGpjj1kbyu9G07AWKFvT+mcKO3BRpKUyQ4UF0tPXTYfCe1ald8XxGWv0ugGn+WU4kyulqzicLrdu5IIfQ7RFyv5fw1SajzJVs08oW0mZrMj+Hfwupbn43Wckx8tkXLS2extB5XnNT91zrdZ8DSXacNXLgZORBGUft0SKzpLm2ojwCGRAwnxyaMjD1bZqlWog78= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:44:15.5131 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91239c80-c0ef-4d05-33d8-08d7ed2e19e9 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: VI1PR08MB3695 X-Spam-Status: No, score=-29.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_SHORT, 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-Disposition: attachment; filename="0009-aarch64-support-BTI-enabled-binaries.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From 45c6bce5a691ecec9bba52785bd1f3a4cbc76fd4 Mon Sep 17 00:00:00 2001 From: Sudakshina Das Date: Tue, 17 Mar 2020 15:54:12 +0000 Subject: [PATCH 09/12] aarch64: support BTI enabled binaries Binaries can opt-in to using BTI via an ELF property marking. The dynamic linker has to then mprotect the executable segments with PROT_BTI. In case of static linked executables or in case of the dynamic linker itself, PROT_BTI protection is done by the operating system. On AArch64 glibc uses PT_GNU_PROPERTY instead of PT_NOTE to check the properties of a binary because PT_NOTE can be unreliable with old linkers. Co-authored-by: Szabolcs Nagy --- elf/dl-load.c | 2 + elf/rtld.c | 2 + sysdeps/aarch64/Makefile | 4 + sysdeps/aarch64/dl-bti.c | 54 ++++++ sysdeps/aarch64/dl-prop.h | 170 ++++++++++++++++++ sysdeps/aarch64/linkmap.h | 1 + sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h | 1 + sysdeps/unix/sysv/linux/aarch64/bits/mman.h | 31 ++++ .../unix/sysv/linux/aarch64/cpu-features.c | 3 + .../unix/sysv/linux/aarch64/cpu-features.h | 1 + 10 files changed, 269 insertions(+) create mode 100644 sysdeps/aarch64/dl-bti.c create mode 100644 sysdeps/aarch64/dl-prop.h create mode 100644 sysdeps/unix/sysv/linux/aarch64/bits/mman.h diff --git a/elf/dl-load.c b/elf/dl-load.c index a6b80f9395..0930250619 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1145,6 +1145,8 @@ _dl_map_object_from_fd (const char *name, const char *origname, int fd, l->l_relro_size = ph->p_memsz; break; + case PT_GNU_PROPERTY: + /* Fall through. PT_GNU_PROPERTY holds property notes. */ case PT_NOTE: if (_dl_process_pt_note (l, ph, fd, fbp)) { diff --git a/elf/rtld.c b/elf/rtld.c index b2ea21c98b..88b8e74de0 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -1505,6 +1505,8 @@ of this helper program; chances are you did not intend to run this program.\n\ main_map->l_relro_size = ph->p_memsz; break; + case PT_GNU_PROPERTY: + /* Fall through. PT_GNU_PROPERTY holds property notes. */ case PT_NOTE: if (_rtld_process_pt_note (main_map, ph)) _dl_error_printf ("\ diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 9cb141004d..5ae8b082b0 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -1,5 +1,9 @@ long-double-fcts = yes +ifeq ($(subdir),elf) +sysdep-dl-routines += dl-bti +endif + ifeq ($(subdir),elf) sysdep-dl-routines += tlsdesc dl-tlsdesc gen-as-const-headers += dl-link.sym diff --git a/sysdeps/aarch64/dl-bti.c b/sysdeps/aarch64/dl-bti.c new file mode 100644 index 0000000000..9ce697527d --- /dev/null +++ b/sysdeps/aarch64/dl-bti.c @@ -0,0 +1,54 @@ +/* AArch64 BTI initializers function. + Copyright (C) 2020 Free Software Foundation, Inc. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include + +static int +enable_bti (struct link_map *map, const char *program) +{ + const ElfW(Phdr) *phdr; + unsigned prot = PROT_READ | PROT_EXEC | PROT_BTI; + + for (phdr = map->l_phdr; phdr < &map->l_phdr[map->l_phnum]; ++phdr) + if (phdr->p_type == PT_LOAD && (phdr->p_flags & PF_X)) + { + ElfW(Addr) start = phdr->p_vaddr + map->l_addr; + ElfW(Addr) len = phdr->p_memsz; + if (__mprotect ((void *)start, len, prot) < 0) + { + if (program) + _dl_fatal_printf ("%s: mprotect failed to turn on BTI\n", + map->l_name); + else + _dl_signal_error (EINVAL, map->l_name, "dlopen", + N_("mprotect failed to turn on BTI")); + } + } + return 0; +} + +/* Enable BTI for L if required. */ + +void +_dl_bti_check (struct link_map *l, const char *program) +{ + if (GLRO(dl_aarch64_cpu_features).bti && l->l_mach.bti_guarded) + enable_bti (l, program); +} diff --git a/sysdeps/aarch64/dl-prop.h b/sysdeps/aarch64/dl-prop.h new file mode 100644 index 0000000000..6662e4ab14 --- /dev/null +++ b/sysdeps/aarch64/dl-prop.h @@ -0,0 +1,170 @@ +/* Support for GNU properties. AArch64 version. + Copyright (C) 2018-2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _DL_PROP_H +#define _DL_PROP_H + +#include + +extern void _dl_bti_check (struct link_map *, const char *) + attribute_hidden; + +static inline void __attribute__ ((always_inline)) +_rtld_main_check (struct link_map *m, const char *program) +{ + _dl_bti_check (m, program); +} + +static inline void __attribute__ ((always_inline)) +_dl_open_check (struct link_map *m) +{ + _dl_bti_check (m, 0); +} + +static inline void __attribute__ ((unused)) +_dl_process_aarch64_property (struct link_map *l, + const ElfW(Nhdr) *note, + const ElfW(Addr) size, + const ElfW(Addr) align) +{ + /* The NT_GNU_PROPERTY_TYPE_0 note must be aliged to 4 bytes in + 32-bit objects and to 8 bytes in 64-bit objects. Skip notes + with incorrect alignment. */ + if (align != (__ELF_NATIVE_CLASS / 8)) + return; + + const ElfW(Addr) start = (ElfW(Addr)) note; + + unsigned int feature_1 = 0; + unsigned int last_type = 0; + + while ((ElfW(Addr)) (note + 1) - start < size) + { + /* Find the NT_GNU_PROPERTY_TYPE_0 note. */ + if (note->n_namesz == 4 + && note->n_type == NT_GNU_PROPERTY_TYPE_0 + && memcmp (note + 1, "GNU", 4) == 0) + { + /* Check for invalid property. */ + if (note->n_descsz < 8 + || (note->n_descsz % sizeof (ElfW(Addr))) != 0) + return; + + /* Start and end of property array. */ + unsigned char *ptr = (unsigned char *) (note + 1) + 4; + unsigned char *ptr_end = ptr + note->n_descsz; + + do + { + unsigned int type = *(unsigned int *) ptr; + unsigned int datasz = *(unsigned int *) (ptr + 4); + + /* Property type must be in ascending order. */ + if (type < last_type) + return; + + ptr += 8; + if ((ptr + datasz) > ptr_end) + return; + + last_type = type; + + if (type == GNU_PROPERTY_AARCH64_FEATURE_1_AND) + { + /* The size of GNU_PROPERTY_AARCH64_FEATURE_1_AND is 4 + bytes. When seeing GNU_PROPERTY_AARCH64_FEATURE_1_AND, + we stop the search regardless if its size is correct + or not. There is no point to continue if this note + is ill-formed. */ + if (datasz != 4) + return; + + feature_1 = *(unsigned int *) ptr; + if ((feature_1 & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)) + l->l_mach.bti_guarded = true; + + /* Stop if we found the property note. */ + return; + } + else if (type > GNU_PROPERTY_AARCH64_FEATURE_1_AND) + { + /* Stop since property type is in ascending order. */ + return; + } + + /* Check the next property item. */ + ptr += ALIGN_UP (datasz, sizeof (ElfW(Addr))); + } + while ((ptr_end - ptr) >= 8); + } + + /* NB: Note sections like .note.ABI-tag and .note.gnu.build-id are + aligned to 4 bytes in 64-bit ELF objects. */ + note = ((const void *) note + + ELF_NOTE_NEXT_OFFSET (note->n_namesz, note->n_descsz, + align)); + } +} + +#ifdef FILEBUF_SIZE +static inline int __attribute__ ((unused)) +_dl_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph, + int fd, struct filebuf *fbp) +{ + if (ph->p_type != PT_GNU_PROPERTY) + return 0; + + const ElfW(Nhdr) *note; + ElfW(Nhdr) *note_malloced = NULL; + ElfW(Addr) size = ph->p_filesz; + + if (ph->p_offset + size <= (size_t) fbp->len) + note = (const void *) (fbp->buf + ph->p_offset); + else + { + if (size < __MAX_ALLOCA_CUTOFF) + note = alloca (size); + else + note = note_malloced = malloc (size); + if (note == NULL) + return -1; + if (__pread64_nocancel (fd, (void *) note, size, ph->p_offset) != size) + { + if (note_malloced) + free (note_malloced); + return -1; + } + } + _dl_process_aarch64_property (l, note, ph->p_filesz, ph->p_align); + if (note_malloced) + free (note_malloced); + return 0; +} +#endif + +static inline int __attribute__ ((unused)) +_rtld_process_pt_note (struct link_map *l, const ElfW(Phdr) *ph) +{ + if (ph->p_type != PT_GNU_PROPERTY) + return 0; + const ElfW(Nhdr) *note = (const void *) (ph->p_vaddr + l->l_addr); + _dl_process_aarch64_property (l, note, ph->p_memsz, ph->p_align); + return 0; +} + +#endif /* _DL_PROP_H */ diff --git a/sysdeps/aarch64/linkmap.h b/sysdeps/aarch64/linkmap.h index 943a9ee9e4..cc196512d7 100644 --- a/sysdeps/aarch64/linkmap.h +++ b/sysdeps/aarch64/linkmap.h @@ -20,4 +20,5 @@ struct link_map_machine { ElfW(Addr) plt; /* Address of .plt */ void *tlsdesc_table; /* Address of TLS descriptor hash table. */ + int bti_guarded; /* Branch Target Identification mechanism enabled. */ }; diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h b/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h index 4ee14b4208..af90d8a626 100644 --- a/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h +++ b/sysdeps/unix/sysv/linux/aarch64/bits/hwcap.h @@ -72,3 +72,4 @@ #define HWCAP2_BF16 (1 << 14) #define HWCAP2_DGH (1 << 15) #define HWCAP2_RNG (1 << 16) +#define HWCAP2_BTI (1 << 17) diff --git a/sysdeps/unix/sysv/linux/aarch64/bits/mman.h b/sysdeps/unix/sysv/linux/aarch64/bits/mman.h new file mode 100644 index 0000000000..ecae046344 --- /dev/null +++ b/sysdeps/unix/sysv/linux/aarch64/bits/mman.h @@ -0,0 +1,31 @@ +/* Definitions for POSIX memory map interface. Linux/AArch64 version. + Copyright (C) 2020 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#ifndef _SYS_MMAN_H +# error "Never use directly; include instead." +#endif + +/* AArch64 specific definitions, should be in sync with + arch/arm64/include/uapi/asm/mman.h. */ + +#define PROT_BTI 0x10 + +#include + +/* Include generic Linux declarations. */ +#include diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c index 896c588fee..c2385fb498 100644 --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.c +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.c @@ -83,4 +83,7 @@ init_cpu_features (struct cpu_features *cpu_features) if ((dczid & DCZID_DZP_MASK) == 0) cpu_features->zva_size = 4 << (dczid & DCZID_BS_MASK); + + /* Check if BTI is enabled. */ + cpu_features->bti = (GLRO (dl_hwcap2) & HWCAP2_BTI); } diff --git a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h index 1389cea1b3..88983eb723 100644 --- a/sysdeps/unix/sysv/linux/aarch64/cpu-features.h +++ b/sysdeps/unix/sysv/linux/aarch64/cpu-features.h @@ -64,6 +64,7 @@ struct cpu_features { uint64_t midr_el1; unsigned zva_size; + int bti; }; #endif /* _CPU_FEATURES_AARCH64_H */ -- 2.17.1 From patchwork Thu Apr 30 17:44:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 38891 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 8C0D0395CCC1; Thu, 30 Apr 2020 17:45:05 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140057.outbound.protection.outlook.com [40.107.14.57]) by sourceware.org (Postfix) with ESMTPS id A34DB395C826 for ; Thu, 30 Apr 2020 17:45:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A34DB395C826 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=+6jNoikWpeJEhW7sQAFlp0Jjs/bkQpTDso+Un6YEGco=; b=Meu7QVgeXOVlHk3RVc9UOz24axSj80a/Fo2+4nGLleEjWPsY8R49ywJqGmfdHVbICz8l9/ejeOjYa+e/xNxYEK5vJB0U1PpsXwl1nbvDCaTKmxrg/1GxVuy8XVVxlGzCcXEc99JLpt8q7FDalTNndcmuOyS4LWh9QvBpwddrydI= Received: from DB6P191CA0016.EURP191.PROD.OUTLOOK.COM (2603:10a6:6:28::26) by AM6PR08MB4721.eurprd08.prod.outlook.com (2603:10a6:20b:c7::19) 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:44:59 +0000 Received: from DB5EUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:28:cafe::1c) by DB6P191CA0016.outlook.office365.com (2603:10a6:6:28::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 17:44:59 +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 DB5EUR03FT022.mail.protection.outlook.com (10.152.20.171) 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:44:59 +0000 Received: ("Tessian outbound 5abcb386707e:v54"); Thu, 30 Apr 2020 17:44:59 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 92429e92061b9e83 X-CR-MTA-TID: 64aa7808 Received: from 055f61050c78.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 26D5CE72-B3F7-435B-A5FF-8C77ADE20E13.1; Thu, 30 Apr 2020 17:44:54 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 055f61050c78.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:44:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TNY/vbjiL6LpcR0PEwxCTdax+dM3MHxg5vPWNv/9UB7CUctNXXqIECNAS0TstW1wHkr694nAY889DBQtCfk1QXuJpulSUlzwVuiwXIeI0RnQDMX+LnKphYAOEd3dPp9EkAoIRvyQ66Hu0pULam8e3Re5Yy8B3Epz1B+OVmpIa9Y/E/v0DEiSsBY9GZ8Kplkkrf8HJV/Prs9E6UGy8jUtozzNRkYK81pRUpdM2ua14DYoRtUEK4sHatNBjV0zneCnHH8r9Xoa3SciIOKlQZRLZcJgQhWmfhpGzChliD5OoyW+h6FJd3Tk88TJs9ruiCoD9FP/vI2Q0173J2aspSGo3Q== 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=+6jNoikWpeJEhW7sQAFlp0Jjs/bkQpTDso+Un6YEGco=; b=AhGBmlxLIg/xYiETkrVyenGE9jyA02SH/i2/v9DGdbEi+VrQy+vaoehxiMh/UX9RZWmzwrvw4xDJC0y8z97Klg5YY8LBytK6z2MEdywC7WY1D5Zk258VxxpM31cqzkS6xXVhRYfPCUEOG22V9/NLwVKkIHmOtIFwX/Rkdp5XCfiFuOvmsekrGqHNWoysuHrNKK2qzwn6ILl8AQtNyzL5A5uZHMvqfZXDx9N43h70Hld7hoR7n8Sx/MlE+Zavh7G8oasC/6xIAsOvRKBCl/Y2l9Q6PvsNXmsIxMQgobgoGKQ3iXSD1Wmp0H15znYOZfayzK15PlF6GODME6fUXJgiSA== 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=+6jNoikWpeJEhW7sQAFlp0Jjs/bkQpTDso+Un6YEGco=; b=Meu7QVgeXOVlHk3RVc9UOz24axSj80a/Fo2+4nGLleEjWPsY8R49ywJqGmfdHVbICz8l9/ejeOjYa+e/xNxYEK5vJB0U1PpsXwl1nbvDCaTKmxrg/1GxVuy8XVVxlGzCcXEc99JLpt8q7FDalTNndcmuOyS4LWh9QvBpwddrydI= 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:44:53 +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:44:53 +0000 Date: Thu, 30 Apr 2020 18:44:46 +0100 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 10/12] aarch64: Add pac-ret support to asm files Message-ID: <20200430174446.GF29015@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: SN4PR0601CA0012.namprd06.prod.outlook.com (2603:10b6:803:2f::22) 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 SN4PR0601CA0012.namprd06.prod.outlook.com (2603:10b6:803:2f::22) 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:44:52 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 24a70589-10bd-4a44-8460-08d7ed2e3434 X-MS-TrafficTypeDiagnostic: AM6PR08MB3224:|AM6PR08MB3224:|AM6PR08MB4721: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6108;OLM:6108; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 4KR6pNrLAp6ARdlGh2Qb4d0WVW7mSpZDb/US70W5ZsUo3u4WxvI6EjTMQYtOCIzyJBAnF2c6EiV6JMvW/sUhvcJk0t/99MywBvAgWKGpP2l3DTZqV6O7AczABo5vwh63Z4jc8YRUXX5SKix1Q3YS1bkP5t/tMTG3uatVtIYQpoSSpbMFEUE82/wzQN5SEOt26N62qBLdimgGfyLX3MIa0JJzaiqh5tI4o+fo69HLkwRxOhKrjAs1d+UQcSqexMMw4ThDAo5SWOo9WtLNGcZSAtkCBYm4T8x/VCn8o8DIYlebkVDa1ft9+HZWKC5ib0zPzbRPxfZ30AXvR8t55x41+EUQW0mDyka+4LQvrcIXNf3XTEcsjJ6xkj2rElK7vyPd 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)(6666004)(956004)(2616005)(316002)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: g8CUyDEW2D/Q8s1Qo8fLLXnQEMBFzZtOJnckaNMQGdA/OEH/lCKsT6pnHwfmSqUT/mKDoREtXlRrJNmYq6Yi8r5RMoUUBtHvnxR0Hv7sSvtnkRiRZL7brrhPevtdV4Vzw47o4OZYXYJgCL1j/Qzhndgo8PRjGmLONUy6hllL4T0xps9go8EfG57aNjzJPj74MBtcszNGmmEpps82nBR+6GpsXZg0hiZCZMV6q4DOesSYRy0MVJbPKFZuccl1eoJyPcZzSoOFRjxkBJ6MBJrtbVKQdWzjY5n0yZXmQ4lA0y5BsgQqAbmsEumhISjw3X/4B0GJH7Mo/WA6fo1KQwC/y8mi+FkJN5UodCNyygMmPeNKjdyF84lbdlnb1dU0dOA2xY1llvndm0hV6SsUOUM0Py9iDSjjKbuLKhCjFDiOhsK9HSaw4V8ynYCXT2mPI/Om4t3X1d9JqM700yROB/8RT+iy/D5kUx2k27YOUJrGU2ECz7Wz8kydjIoisJvMTNr08CiqOTd3tLTOhPiumVSUSHWQTfLD/AITrglzzYeuSslyL6ErInwkEyFxGHJNJfhf0Z7tTb79p9QUuK/sMU/GoCPycJl4RZbOoEGyJJfY1rFAJVWBlx7zl+RKIPSizdDfqNL+vmlrH0a9kLdwshth7PN69k+Aj8qPhiTT20C3RI8QjZdDWdqYrbm4Rpto8ITZl3KP2EGZ29ozVwc70S2+PWxD6Vsf1NtAqc5Z9UiFm1x1CHiUKyCaa+ZFc6bCuBnMt8hjO9KzOPcclA5wvwYydmuX5S2J0OiVKLjWerbcC9Q= 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: DB5EUR03FT022.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)(396003)(136003)(39860400002)(346002)(46966005)(16526019)(1076003)(956004)(336012)(356005)(4326008)(186003)(36756003)(26005)(81166007)(47076004)(2906002)(44832011)(82310400002)(564344004)(82740400003)(2616005)(6916009)(8936002)(86362001)(316002)(235185007)(33656002)(70206006)(8676002)(6666004)(478600001)(8886007)(7696005)(55016002)(44144004)(33964004)(66616009)(70586007)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 76a5c4d3-b5e1-4de4-4df7-08d7ed2e306d X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: THNe7Q7wGsvgf8Y67KWSRWYPlrhtQPgPAcZBtJUgISNTJJU//ecATPNv2M10I+HaujLn5/pNiJe9E7ehXWYjlb0s8hVNn3xVVPntuxJfEPgNbVmzRMWO529/eCgYKYQPfTZ6tLHvHYDct4/W5FXp6NjFD0aEE6jbSXhjEUezyAFkn1mSt3givkdtdKQ3WN9ru/Z7UhV7XZe9oqOLDcfoRUMsgI9N3LTMvlCg/a1OQDugcG7im8EHzdocxdZ/TIdcTFefNb7xj8QHFOKBw6O5JofFsMn5fIjhmPEu9fYbUk7JX9V8bJQ64+nbRdRHDDx9EfYLrZjMKpIQ76q5PQwHIOMyR0Yoqjib5LC3/3q0iOOLdlUdbjJYLJvl0Z007BtyKsR4h/3/qrCxnRxJut3nwLIcNaPavNW0KINKWUpyWA0= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:44:59.6280 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24a70589-10bd-4a44-8460-08d7ed2e3434 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: AM6PR08MB4721 X-Spam-Status: No, score=-29.0 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-Disposition: attachment; filename="0010-aarch64-Add-pac-ret-support-to-asm-files.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From de8968ed58686c26391de8343184a1283bb5e305 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 29 Apr 2020 11:49:20 +0100 Subject: [PATCH 10/12] aarch64: Add pac-ret support to asm files This patch unconditionally enables pac-ret in asm files. TODO: This will need configure checks, cannot be done unconditionally because we cannot guarantee pac-ret compatibility (e.g. libgcc unwinder had no support for it before gcc-7 and newer libgcc had bugs that could cause unwind crash when pac-ret and non-pac-ret stack frames are mixed) --- sysdeps/aarch64/crti.S | 8 ++++++++ sysdeps/aarch64/crtn.S | 6 ++++++ sysdeps/aarch64/dl-tlsdesc.S | 8 ++++++++ sysdeps/aarch64/dl-trampoline.S | 15 ++++++++++++++- sysdeps/aarch64/sysdep.h | 18 +++++++++++++++++- 5 files changed, 53 insertions(+), 2 deletions(-) diff --git a/sysdeps/aarch64/crti.S b/sysdeps/aarch64/crti.S index 89a9e25f5b..36f58c9a01 100644 --- a/sysdeps/aarch64/crti.S +++ b/sysdeps/aarch64/crti.S @@ -75,7 +75,11 @@ call_weak_fn: .hidden _init .type _init, %function _init: +#if ENABLE_PAC_RET + PACIASP +#else BTI_C +#endif stp x29, x30, [sp, -16]! mov x29, sp #if PREINIT_FUNCTION_WEAK @@ -90,7 +94,11 @@ _init: .hidden _fini .type _fini, %function _fini: +#if ENABLE_PAC_RET + PACIASP +#else BTI_C +#endif stp x29, x30, [sp, -16]! mov x29, sp diff --git a/sysdeps/aarch64/crtn.S b/sysdeps/aarch64/crtn.S index 94a6f970ef..e1cb74a572 100644 --- a/sysdeps/aarch64/crtn.S +++ b/sysdeps/aarch64/crtn.S @@ -41,10 +41,16 @@ .section .init,"ax",%progbits ldp x29, x30, [sp], 16 +#if ENABLE_PAC_RET + AUTIASP +#endif RET .section .fini,"ax",%progbits ldp x29, x30, [sp], 16 +#if ENABLE_PAC_RET + AUTIASP +#endif RET END_FILE diff --git a/sysdeps/aarch64/dl-tlsdesc.S b/sysdeps/aarch64/dl-tlsdesc.S index d55e0443aa..25628d942f 100644 --- a/sysdeps/aarch64/dl-tlsdesc.S +++ b/sysdeps/aarch64/dl-tlsdesc.S @@ -183,6 +183,10 @@ _dl_tlsdesc_dynamic: callee will trash. */ /* Save the remaining registers that we must treat as caller save. */ +# if ENABLE_PAC_RET + PACIASP + cfi_window_save +# endif # define NSAVEXREGPAIRS 8 stp x29, x30, [sp,#-16*NSAVEXREGPAIRS]! cfi_adjust_cfa_offset (16*NSAVEXREGPAIRS) @@ -233,6 +237,10 @@ _dl_tlsdesc_dynamic: cfi_adjust_cfa_offset (-16*NSAVEXREGPAIRS) cfi_restore (x29) cfi_restore (x30) +#if ENABLE_PAC_RET + AUTIASP + cfi_window_save +#endif b 1b cfi_endproc .size _dl_tlsdesc_dynamic, .-_dl_tlsdesc_dynamic diff --git a/sysdeps/aarch64/dl-trampoline.S b/sysdeps/aarch64/dl-trampoline.S index fba5689d09..c0c4c23128 100644 --- a/sysdeps/aarch64/dl-trampoline.S +++ b/sysdeps/aarch64/dl-trampoline.S @@ -127,7 +127,12 @@ _dl_runtime_resolve: cfi_startproc .align 2 _dl_runtime_profile: +# if ENABLE_PAC_RET + PACIASP + cfi_window_save +# else BTI_C +# endif /* AArch64 we get called with: ip0 &PLTGOT[2] ip1 temp(dl resolver entry point) @@ -291,9 +296,17 @@ _dl_runtime_profile: cfi_def_cfa_register (sp) ldr x29, [x29, #0] cfi_restore(x29) +# if ENABLE_PAC_RET + add sp, sp, SF_SIZE + cfi_adjust_cfa_offset (-SF_SIZE) + AUTIASP + cfi_window_save + add sp, sp, 16 + cfi_adjust_cfa_offset (-16) +# else add sp, sp, SF_SIZE + 16 cfi_adjust_cfa_offset (- SF_SIZE - 16) - +# endif br lr cfi_endproc diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 07dc7858a5..63a04a70cd 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -45,6 +45,18 @@ #define BTI_C hint 34 #define BTI_J hint 36 +/* Return address signing support (pac-ret). */ +#define ENABLE_PAC_RET 1 +#if ENABLE_PAC_RET +# define PACIASP hint 25 +# define AUTIASP hint 29 +# define PACIASP_AND_BTI_C PACIASP +#else +# define PACIASP +# define AUTIASP +# define PACIASP_AND_BTI_C BTI_C +#endif + #define FEATURE_1_BTI 1 #define FEATURE_1_PAC 2 @@ -61,7 +73,11 @@ .word features; \ .word 0; -#define END_FILE GNU_PROPERTY(FEATURE_1_BTI) +#if ENABLE_PAC_RET +# define END_FILE GNU_PROPERTY(FEATURE_1_BTI|FEATURE_1_PAC) +#else +# define END_FILE GNU_PROPERTY(FEATURE_1_BTI) +#endif /* Define an entry point visible from C. */ #define ENTRY(name) \ -- 2.17.1 From patchwork Thu Apr 30 17:45:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Szabolcs Nagy X-Patchwork-Id: 38892 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 6149B396E469; Thu, 30 Apr 2020 17:45:30 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60057.outbound.protection.outlook.com [40.107.6.57]) by sourceware.org (Postfix) with ESMTPS id 73F61395383D for ; Thu, 30 Apr 2020 17:45:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 73F61395383D 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=z9yDjLUV0ccJy38YWyTPfkyd5P3SiySjRuPYF17V4pA=; b=nZaOCOgnW2sHAJ5oAJ8RZwpUqMGZxWItqT7yvevL0HjxriCsdX7PRZ/zLcJEIHziWXas6ky6z5nirO/xPqweLnWzhUVQdUlEEUZoObHU36vcHSz21llcJj6NMQTuUIm3Q6RiszRmwYANbxBvi6OWgfH04PsCM9bDviIBElRAadU= Received: from DB6P191CA0008.EURP191.PROD.OUTLOOK.COM (2603:10a6:6:28::18) by DBBPR08MB4410.eurprd08.prod.outlook.com (2603:10a6:10:d2::20) 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:45:26 +0000 Received: from DB5EUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:28:cafe::e8) by DB6P191CA0008.outlook.office365.com (2603:10a6:6:28::18) 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:45:26 +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 DB5EUR03FT022.mail.protection.outlook.com (10.152.20.171) 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:45:26 +0000 Received: ("Tessian outbound 5abcb386707e:v54"); Thu, 30 Apr 2020 17:45:26 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 49fc8645b29be8d5 X-CR-MTA-TID: 64aa7808 Received: from 5f7acb7c47b4.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 97D9AC50-5073-41CC-8305-91080D105A3A.1; Thu, 30 Apr 2020 17:45:20 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 5f7acb7c47b4.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:45:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lVDu0TZO1W1jHHxzglclR4qVVAjhcuvnOrLpfvdPNQUwd9aj5U8AYHQlIcXf7L36cSd3WCGVsxKzpx+nfeL/41vFHM3vV/NRquM+Nz8dijfrhPtxbfelLijXgS5riXuemK+L3UOqiU3wHKbQBnzP2gG6Nj9xejPHYtG5USbU3MFusyNcv5vDd88WA2OQEHWuczIye9n2UH70lENeiK0Qwwy5tKEXh06nFTvnB7bT5RTN/ma41a5Sm361fYxPVBItVQZJKw0Yi3e0lm4SZFQM16koAZTtyrqxIl1p1JrKHYIm4HtTWfnP1HYMc2IFjYBQRrkf61rWJfAFNW4jDBYGoA== 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=z9yDjLUV0ccJy38YWyTPfkyd5P3SiySjRuPYF17V4pA=; b=lo+ppe2NF4OkfZQ0gmcgJFcECusEmTqsXQAtVjGgfVdV+8X3qMruzRU3sQLJ8I0HLab4o4/jOaXZx9Sp6JWK7THV6N65mdalIyjP+fGPoPeokyD6/oWvEYJSunvp0v0wLkhdzPypap+sgkHKSBcNtJN3k+QWh1bXIAhB9NkUTtBShp2zrrDA58LN31a5CAES/Acn+GtfqgS5xfJ7hlXi2HPc9hJBdF60qTdBMhZI7hJPwXuKK7HmDhxl0FCt83LDSRWVs2xq0iF2oHCxcx84+6gGvFKWClCDqLGeW3dvZE4GyI/l5xt/HDfGRW6H2ng10kDOthjU3XuXVCgljShlbA== 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=z9yDjLUV0ccJy38YWyTPfkyd5P3SiySjRuPYF17V4pA=; b=nZaOCOgnW2sHAJ5oAJ8RZwpUqMGZxWItqT7yvevL0HjxriCsdX7PRZ/zLcJEIHziWXas6ky6z5nirO/xPqweLnWzhUVQdUlEEUZoObHU36vcHSz21llcJj6NMQTuUIm3Q6RiszRmwYANbxBvi6OWgfH04PsCM9bDviIBElRAadU= 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:45:20 +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:45:20 +0000 Date: Thu, 30 Apr 2020 18:45:18 +0100 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 11/12] aarch64: redefine RETURN_ADDRESS to strip PAC Message-ID: <20200430174518.GG29015@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: LO2P265CA0255.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::27) 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 LO2P265CA0255.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:8a::27) 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:45:19 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e962704d-c2d5-42df-e800-08d7ed2e4410 X-MS-TrafficTypeDiagnostic: AM6PR08MB3224:|AM6PR08MB3224:|DBBPR08MB4410: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8882;OLM:8882; X-Forefront-PRVS: 0389EDA07F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: bjQuq4ViE23H5svGlXRCc1tq3ir5ae7Z0U5fMI3Gv080w9paynetaaiy1lo394CMBN/M53Ryjv/NqXiMTG2X3QB1NZVsUbRFLPz+T2bFGAOwvth3oFgRbK+K7hvoIJ/g4PpgyItSaP+sibf9PkTRYfcVEx55fV8+PV9BU+U7zUuQ9V9qiIkvzouIflOD2nij98wXJeXmp8qZUpe+qJcONesWmzYGNn52OR0ZagrKhXt8FeytskdCvT5aFRZo3wzkfwfC92wbBZFkiKrEwuXAPdW43RYdSN8yUEdCoiL1T7RMkAasY7uKFbmGvp6jZSStOdiy6UzzjMtWpIXpbX7rEuYmtAckeLZb0RmsUp8iJiTsYp2VRKIFuIX0BTQyWMPP 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: O7k6YKzBWiwIEP0Ti9wgh9mBhjZi1859iOH5s0lrbSGPovehjzR0xBeR879SAw7qCF8afmm4is+tlvwdwnaH0u1OJ9BOOqagBFbCttKL6HVLrfgk9hTUaEEWDbTjkeSTjRgQJ9tl4NVDoRucTJssXmEbcEzvcs8qPdX8DUdxbZc50VRQk4sGjTSsA3JWspMPQI/9i0Z1WBhQdKUzXs3BkraMAvHS9Hl/RYM/izEbxkAvUkPA7UNtiNHGaJtpyIlTdKWhbUTaZ+BWB6AGIzNxauIgN5QqO3D8/1I4HLSWIpEw9DaateN2wwzZb74opCHTvK0L01hqbdGTttndnaLQHpnb6xT5KTQRm5Pv410i3fkLtW6N9rfC58aDqyjbl6w/r/48AvlwueM41+eq0i4ecaZlWRt0Oe8Eke2Hs55+62jtNiMHOeWjYLD5+tFD6pUJ+eH+xTT3fb/3U3DSnQKNr6TvApj8hBTgUPvGS8+clb/Z4mgWbMuLPTW5obeZ4Zs6eEDCMGGOwHTZ6AA3QbvteaEWg8Xgu//TLkGUVVWXSwXA0E6kzU5MWoU/AtP0bxNuXLIiF0ArrldMqi7ETpuQXzkMflpb94Dn0FLqZ020X13f3qNuwpz5XrzwkIV36Qorv6wZ8NXWAhXKD+Z+TB87lV8OZnVgfd/1KrvPkUo0XyEI0Rx7zTfgTJMqrJ1sG0pvCTlk2uvJC345dNOq5ZhOqdz+7ltXClDxLVUy8yXWk2y+vNMqwyi6m4yqEOIQ3s5CozSBlRSwa6l6iLVW0NpR3N0a77koJE3csXPLZep2zGU= 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: DB5EUR03FT022.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)(376002)(136003)(396003)(46966005)(316002)(8886007)(86362001)(564344004)(2616005)(2906002)(36756003)(33656002)(956004)(82310400002)(8676002)(81166007)(478600001)(70586007)(66616009)(70206006)(16526019)(7696005)(55016002)(26005)(47076004)(336012)(8936002)(186003)(33964004)(44144004)(356005)(1076003)(6916009)(44832011)(235185007)(4326008)(82740400003)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: a19b4921-e676-484d-c810-08d7ed2e403c X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eTIPUTaZaIE3qykpvMgo9OkwpwplkBpVWDs2l/YZ/OerrSM9rWJY3VmSWAhfhikRh/5PseGCL+OFswSK7UOJhvzYWmoyWc+r+kJ3F2Cu8ps4VNV4l8EZQtImcq/Nzvc3kHj25FL/n5xxzDZSb7wQ8V32C6gMHerUM1MQNWrmPJoKEOHUWD12GDmaFaDF8n1GtClLt/7oHwVlooJsUI2kzDl8yP3GdHIQ6EGlO8E2ImknGFosv8+Y7wuromXv2K6h8pGDeVTN45sN5Hkfl/ELicFfpYMLQI7+QrGMNqSlGE6aUzJLuA6dOsQKTrSoyaucPK5V7wzq0nP0vAtLRu4hkiaiUNLr4heDnCHomj7VQdkunK/veWcYbVRkfzDwsLChMaYGsGWm/AWngoFUigMKaEjiLJ25/00u+h3pYSLR8IY= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:45:26.2381 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e962704d-c2d5-42df-e800-08d7ed2e4410 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: DBBPR08MB4410 X-Spam-Status: No, score=-29.1 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-Disposition: attachment; filename="0011-aarch64-redefine-RETURN_ADDRESS-to-strip-PAC.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From 2223e5ed1d78634ef59f0a7efbd3a9885a8da53f Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Wed, 15 Apr 2020 17:40:45 +0100 Subject: [PATCH 11/12] aarch64: redefine RETURN_ADDRESS to strip PAC RETURN_ADDRESS is used at several places in glibc to mean a valid code address of the call site, but with pac-ret that includes a pointer authentication code, so the definition is adjusted. XPAC is added unconditionally for now, but it's only needed if glibc is compiled with -mbranch-protection=pac-ret. Inline asm is used instead of __builtin_aarch64_xpaclri since that's an undocumented builtin and not available in all supported gccs. --- sysdeps/aarch64/sysdep.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 63a04a70cd..87f19b9bef 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -35,6 +35,16 @@ #define PTR_SIZE (1< X-Patchwork-Id: 38893 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 CA869395383D; Thu, 30 Apr 2020 17:46:07 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2068.outbound.protection.outlook.com [40.107.21.68]) by sourceware.org (Postfix) with ESMTPS id 2E4643898517 for ; Thu, 30 Apr 2020 17:46:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2E4643898517 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=aIV40egki7+EiacikILg92940PoVWhWm7hMaibxHJ0c=; b=isd+VcWwb8cEs/fjMMeeJbadynfO+QpTfo1Oax+qacXuaE9HWRMsies0v3C5guSDuLlw6TSrUsegw8BSolukHg3pYpDyaLDkg9O51xlTiEKQ2+8uFN+QFN6I/HjpZ4HI9L4hxA9zhUdQ17CN8PAQ6kOHim7KR7psCn34aqKEMZg= Received: from AM7PR03CA0017.eurprd03.prod.outlook.com (2603:10a6:20b:130::27) by DB6PR0802MB2405.eurprd08.prod.outlook.com (2603:10a6:4:9f::18) 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:46:00 +0000 Received: from AM5EUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:130:cafe::7c) by AM7PR03CA0017.outlook.office365.com (2603:10a6:20b:130::27) 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:46:00 +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 AM5EUR03FT022.mail.protection.outlook.com (10.152.16.79) 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:45:59 +0000 Received: ("Tessian outbound fb9de21a7e90:v54"); Thu, 30 Apr 2020 17:45:59 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e8b0a417275553f9 X-CR-MTA-TID: 64aa7808 Received: from c72dd10b8d8c.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E5314A9A-32ED-4375-B7B6-7E1C135B2A2B.1; Thu, 30 Apr 2020 17:45:54 +0000 Received: from EUR01-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id c72dd10b8d8c.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 30 Apr 2020 17:45:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g5Yz2AYi+5L/6+4ROvbzlTGIo0Pa4P5q9msuTxh2Udhlyhd8FdH+F5rG68ehwcVk8e0cfNYb00Q+28prCFYj2A7SF72slGzQLwW0KhgVsXP/n/phrahiBkUxh3Cxj3+s6SNNzcaX67vGaRqTmLoulZqn0Rar6nf0XxyYiuHRTUi1JsUT4jD7CVU/GHVajtTfd3v4t4SAUjebLHZQXXYfjl3JAyl+un9kuzOzgJsDCwkRI8XOLaId8I2lF5WUTujm8/9IQ1JPWP0X+PUfjAQJ9Ag0bay93f8AhMdik/e+nCr6OPbCPDtOonw4QGgc0ysCSkJkDEqK7oZ1Eq0gXty12w== 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=aIV40egki7+EiacikILg92940PoVWhWm7hMaibxHJ0c=; b=awrOOOUF2eN8QDEQQvnVBaaOO/3cVlCA98tio93dOynpJc8FXD8ymR3WIrsWAtxrVPgFYpRPijToksMlWUHQhzlE19C7PrPYgDsk6LZGuMMnRCd2vXclf+lHQFBbCnKhUgRXypCWCmVL0nMQgbpSBiZD2pLmEPEhFI5SJ10a0eKS6O3AFKJw/hYcJ/47UuECPJFs0BI3NKMMRI4t7uIwr1c4gCX5Lqn/invUcwHAG5v09K+vCuNWqFpQSuvOx2kjmutWrFEfuozM7UZntl5IPll3Bj5Sq1oL/lIEEZVqQnpZzfjeKVwZ/VUfc6FZTKVd0eD5VkOzFZMiHc22htMoGw== 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=aIV40egki7+EiacikILg92940PoVWhWm7hMaibxHJ0c=; b=isd+VcWwb8cEs/fjMMeeJbadynfO+QpTfo1Oax+qacXuaE9HWRMsies0v3C5guSDuLlw6TSrUsegw8BSolukHg3pYpDyaLDkg9O51xlTiEKQ2+8uFN+QFN6I/HjpZ4HI9L4hxA9zhUdQ17CN8PAQ6kOHim7KR7psCn34aqKEMZg= 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 AM6PR08MB4328.eurprd08.prod.outlook.com (2603:10a6:20b:74::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.22; Thu, 30 Apr 2020 17:45:52 +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:45:52 +0000 Date: Thu, 30 Apr 2020 18:45:50 +0100 From: Szabolcs Nagy To: libc-alpha@sourceware.org Subject: [PATCH 12/12] aarch64: Configure option to build glibc with branch protection Message-ID: <20200430174550.GH29015@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: LO2P265CA0397.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::25) 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 LO2P265CA0397.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2958.19 via Frontend Transport; Thu, 30 Apr 2020 17:45:52 +0000 X-Originating-IP: [217.140.106.55] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a307da01-2899-4087-e554-08d7ed2e5826 X-MS-TrafficTypeDiagnostic: AM6PR08MB4328:|AM6PR08MB4328:|DB6PR0802MB2405: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-Forefront-PRVS: 0389EDA07F 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)(376002)(366004)(396003)(39860400002)(136003)(346002)(26005)(55016002)(316002)(36756003)(86362001)(186003)(52116002)(16526019)(33964004)(2616005)(478600001)(956004)(44144004)(7696005)(66616009)(564344004)(8886007)(235185007)(44832011)(66946007)(6916009)(66556008)(2906002)(66476007)(4326008)(8936002)(1076003)(8676002)(33656002)(2700100001); DIR:OUT; SFP:1101; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: evMTBHWuNtw2Y9tUugYwp1dMWiQ33s+RHOIhqLUXRF/EIpQJ4DeOo7/kSV/3neh6fWxarffG0nJxKMKkTxy/McYO+e46Y2i7HplgdJq9wRVKMBBrKw2DXA1mZ9VS1iS03jsJKfMMk4BHJENfjsWv6ocVBcjop1POWW21M7smaUfyg6eT0ARzVsMoGDGj62+aIMeuUT1ZG86Em1FS8z+kadLQXajiSmdsMjOVsRIpBVNqgUelECVRiQ0AVVpezkRTrv+PEU01kju8n/QDxb8fQeSY5hfvptPq5h9I3IxvX77lmRvMN1NqhTUa0D9KxWCwY3U5rkm9Xqb2cvysEHZZ4x5cjg4fBi/YJJB5bmwpx489yDbj9yMmpBv+0g41lP/P X-MS-Exchange-AntiSpam-MessageData: CGM8FQl7WYeTkGmrVSzrT6qlGFIhRQDkcLemDRB6ytFbFoOO+q2UZrHEbM/g0QRpiSm+R6QKluLGuNfi6UKSL5EXT9AtH24sv8sYIbnJk7Qp69pOn0WiZw+tsSOwis+yJcJoVm2psO/DjpbEBxMKN2Wvj45kkQefVJ0TP5M19s1lRR1Q+rx+X9f5/qfmLF7JfxW6c5+BNCgLPnxO6WjXQawQk21SZzz4SGJ9AZD4oIzhD+hRJFqP/W5Lw4x4RN0x628acFu7h13SK60U9RBfIVsEN9RZlbfx1+WwL0E+tDnNP4GN5a6dyDFtfHGa+LdEHR6wP9AE8LKO3HmuXO7hLa3HUek8wvzpX48ub7jx+lrQHEuKR0uF8X1cZme1gewkqPo/gEejy6WaHywkBiigtLceRmEJzoswOzND6OTukrMaN05x5b7KvpnL+nHm4u4G9Wu9y/ZTG86bQhCWy0JcNFdY9jnuXCnOGRnhF2zi+Ma/2vD8zbo06/BZbz5iq7cr+Wyh9MtWMZHnxT0SKTis5kcUc/OSwiM/TnMf1jnjqZE0yTe+bbIm8PiGHyhF6HO9m4MCtv2xdmu4QWBEhYANf0zOqOegqYklecjD/ItdYzbjjuLpbJkXwehCrMWL/gN1SXfEc5j/Ze7/tG4fkzMCSOJjmgf9r96OY4hw3XtNpB1lwYdX7GUHRgR4yBOZMHuGvD27tuDDVhMoe9yKlxN8WzxNjxB2+FtszS9WNwrNlGadXAh7Ne702zIQWXxFqaKK3QBXxeZ0Z2SyS1d5SZkr08qiwXssFFDPGZGC9ssyKUc= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB4328 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: AM5EUR03FT022.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)(136003)(39860400002)(346002)(376002)(396003)(46966005)(86362001)(6916009)(36756003)(564344004)(2906002)(81166007)(70206006)(186003)(66616009)(956004)(2616005)(8936002)(26005)(1076003)(8676002)(336012)(16526019)(7696005)(356005)(82310400002)(33656002)(44144004)(55016002)(4326008)(235185007)(478600001)(33964004)(44832011)(8886007)(70586007)(36906005)(316002)(47076004)(82740400003)(2700100001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: c1e72bab-d9e6-4d26-a535-08d7ed2e53ba X-Forefront-PRVS: 0389EDA07F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zgj6D/LYwi68d4NoQHZYhma4NQ7tdbkCqRkU4ya6rcUNWu4S4fGsRElE1No2KAeI3ql4EzX34ilQLmcEoYBxbdUbsn7dWwZCUTxcUwqu/ZP/4u9boC8bQukRok3Zg0gc5McHxhb3si37PH25UYwvKnJ74QyjylQ+duVFP9/Rr8vwTwsyPIOwAYJhUCMF1N34TxhPLxN9tvqB8AEH+6vobk6KhhsWLkc78ACvuqR98uJR1ulSnitYCHl66NlrqEaha+iamVzGKUnzDI1V0eqzTTegz9GRKMcPhSMpOeRHNpovlwGJb5J4X6sU9s9eFLlwHgRUaZBbP2pu/aNwQhpUbK36sbpI7e3F/u5yjUQAMGJ/H1oFU61lavMV8aWahBh7OjpT+qcMX1cxUvYaRoktq1MXsXOu4pbfeptNCCDDaZ8= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Apr 2020 17:45:59.8657 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a307da01-2899-4087-e554-08d7ed2e5826 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: DB6PR0802MB2405 X-Spam-Status: No, score=-29.2 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-Disposition: attachment; filename="0012-aarch64-Configure-option-to-build-glibc-with-branch-.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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sudakshina Das Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" From ec96daabd8fad129ea3660d479fa63941712c410 Mon Sep 17 00:00:00 2001 From: Sudakshina Das Date: Thu, 26 Mar 2020 11:49:48 +0000 Subject: [PATCH 12/12] aarch64: Configure option to build glibc with branch protection If gcc is configured with --enable-standard-branch-protection then the built glibc should have branch protection suppport too, which includes bti and pac-ret. The new configure option is only for additional configure checks, it does not try to add new CFLAGS (i.e. -mbranch-protection=standard ), it expects gcc to default to using branch protection, since likely the static linked compiler libraries are not compatible otherwise. The -z force-bti linker flag is also passed with branch protection, but this is not very useful: by default the BTI property marking is set on the linker output if all linker inputs have it and it is silently missing otherwise, -z force-bti at least warns if an input is missing the property, but that's not a fatal error. (Using --fatal-warnings ld flag does not work in the test system.) Co-authored-by: Szabolcs Nagy --- configure | 14 +++++++++++++- configure.ac | 6 ++++++ sysdeps/aarch64/Makefile | 4 ++++ sysdeps/aarch64/configure | 31 +++++++++++++++++++++++++++++++ sysdeps/aarch64/configure.ac | 19 +++++++++++++++++++ 5 files changed, 73 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 8df47d61f8..fff5734f6d 100755 --- a/configure +++ b/configure @@ -794,6 +794,7 @@ enable_pt_chown enable_tunables enable_mathvec enable_cet +enable_standard_branch_protection with_cpu ' ac_precious_vars='build_alias @@ -1471,6 +1472,9 @@ Optional Features: depends on architecture] --enable-cet enable Intel Control-flow Enforcement Technology (CET), x86 only + --enable-standard-branch-protection + enable AArch64 Branch Target Identification and + Return Address Signing, AArch64 only Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -3785,7 +3789,7 @@ main () { #ifndef __CET__ -#error no CET compiler support +# error no CET compiler support #endif ; return 0; @@ -3806,6 +3810,14 @@ else fi +# Check whether --enable-standard-branch-protection was given. +if test "${enable_standard_branch_protection+set}" = set; then : + enableval=$enable_standard_branch_protection; libc_cv_branch_protection=$enableval +else + libc_cv_branch_protection=no +fi + + # We keep the original values in `$config_*' and never modify them, so we # can write them unchanged into config.make. Everything else uses # $machine, $vendor, and $os, and changes them whenever convenient. diff --git a/configure.ac b/configure.ac index 5f229679a9..e08b0f3766 100644 --- a/configure.ac +++ b/configure.ac @@ -486,6 +486,12 @@ AC_ARG_ENABLE([cet], [enable_cet=$enableval], [enable_cet=$libc_cv_compiler_default_cet]) +AC_ARG_ENABLE([standard-branch-protection], + AC_HELP_STRING([--enable-standard-branch-protection], + [enable AArch64 Branch Target Identification and Return Address Signing, AArch64 only]), + [libc_cv_branch_protection=$enableval], + [libc_cv_branch_protection=no]) + # We keep the original values in `$config_*' and never modify them, so we # can write them unchanged into config.make. Everything else uses # $machine, $vendor, and $os, and changes them whenever convenient. diff --git a/sysdeps/aarch64/Makefile b/sysdeps/aarch64/Makefile index 5ae8b082b0..313c371e72 100644 --- a/sysdeps/aarch64/Makefile +++ b/sysdeps/aarch64/Makefile @@ -1,5 +1,9 @@ long-double-fcts = yes +ifeq (yes,$(enable-branch-protection)) +sysdep-LDFLAGS += -Wl,-z,force-bti +endif + ifeq ($(subdir),elf) sysdep-dl-routines += dl-bti endif diff --git a/sysdeps/aarch64/configure b/sysdeps/aarch64/configure index 5bd355a691..83a6c8c852 100644 --- a/sysdeps/aarch64/configure +++ b/sysdeps/aarch64/configure @@ -172,3 +172,34 @@ else config_vars="$config_vars default-abi = lp64" fi + +if test "$libc_cv_branch_protection" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for branch protection support" >&5 +$as_echo_n "checking for branch protection support... " >&6; } +if ${libc_cv_branch_protection_support+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat > conftest.c <&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; } \ + && LC_ALL=C $READELF -Wn conftest.so | \ + grep -q 'NT_GNU_PROPERTY_TYPE_0.*AArch64 feature:.* BTI'; then + libc_cv_branch_protection_support=yes + fi + rm -rf conftest.* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_branch_protection_support" >&5 +$as_echo "$libc_cv_branch_protection_support" >&6; } + if test $libc_cv_branch_protection_support = no; then + as_fn_error $? "branch-protection is enabled, but the toolchain does not support it." "$LINENO" 5 + fi +fi +config_vars="$config_vars +enable-branch-protection = $libc_cv_branch_protection" diff --git a/sysdeps/aarch64/configure.ac b/sysdeps/aarch64/configure.ac index 7851dd4dac..d16ba3710a 100644 --- a/sysdeps/aarch64/configure.ac +++ b/sysdeps/aarch64/configure.ac @@ -20,3 +20,22 @@ if test $libc_cv_aarch64_be = yes; then else LIBC_CONFIG_VAR([default-abi], [lp64]) fi + +if test "$libc_cv_branch_protection" = yes; then + AC_CACHE_CHECK([for branch protection support], + [libc_cv_branch_protection_support], + [cat > conftest.c <