Message ID | 20250113112206.1071596-1-matthieu.longo@arm.com |
---|---|
Headers |
Return-Path: <binutils-bounces~patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 394003857BB0 for <patchwork@sourceware.org>; Mon, 13 Jan 2025 11:23:06 +0000 (GMT) X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on20615.outbound.protection.outlook.com [IPv6:2a01:111:f403:260d::615]) by sourceware.org (Postfix) with ESMTPS id 417AD3858D21 for <binutils@sourceware.org>; Mon, 13 Jan 2025 11:22:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 417AD3858D21 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 417AD3858D21 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:260d::615 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1736767349; cv=pass; b=i++DvuDllAhbEX/9svj+Df+fQmTWIfrR+0yLat9/zsHEQpIoVo6eivovGq7ptfWiiTOyPKEfLeUn7XZp0UPedlkUqo4YPzXejs2rbe+u2R1JupOHTmYKPfN514XmXnQarPbwCccrObOcJQJKW7xARThgo9NNd/EGwHOOmFOKtaU= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1736767349; c=relaxed/simple; bh=qu8s5/0YYALzZ94P7RO85+d8umhnyGt7v8Szfg13J2w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OGaIbXdiH7CHW9jiysowPfdajNd2s4k1apxcyF0wO2tlL1nY2muPxIFTtY05EGNqcVlvRJxnKTIBdC+XKxBP8Up1JU8uBcim5ecFQ6E3ANkjHLufD12Soxt410kOTAsKsebXfW5cdIiDyPWrQcVMrXBpvqZ+KYm+PsBp9Z3Zz88= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 417AD3858D21 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=selector1 header.b=TLxBCmMp ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qorhMutcIxXo/ikBAAwvI3++LwJ9TSD5DZpDxZPU/fSVpu+YtJfCyd4v5jMvfqx14DkxzWYAdSQnFdGDIZsg6CA0EqlkZkD7jg8hDNHsSHXbiBTmzlw+9+bBZ214TcFLpd7d6QTPAqEVcDiJWhC45vKrtmxkDh9Vd9Dtxza2wS8a1k4YOpWCDCn9mlqFlEH+01EhumBMDW6AapM+4oCW8X44qTVWkHFPddD8oE/dqY73P0QqY3T0S/ITqZP6nJQRPJgSBjJ2YrP3nIOBXx01oOfk1iinnsFIjBDjWgIVLd1KMoEaHIOG5WbiAP4aVxt8Ph5kYi7n+JjlUkYYfzrWIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4xDrSxvyjebfHXPgccp9vsKvznbRjK/uKWxwSzcMGDY=; b=Oy9Gocflqezb0EJzQbdGsha3bfreQmvPe0+MGW2HylTVAf/ddnMuSxJK3Gq02ncOx6mzFs5+I4TPdtoIq7jyehKk+WSvLIeuEtDoabvnjDRsbvsp7z+SZmrH4VthiJ8MJU0WzNkdG6ZLnhS5OYdKfSvLogVNnHwr9OoYyN/mJb3PUyCZ+BWBRP9yOm5SextCiXJd4rO8gHkyzK62r3z8gL55ZokcRpMpYzUTjtB2P6TNcRbbEcD5UwJTbybb7NFjam4qQ9e0AObGhHpsCxbNayOkXt7t7U7bv9vbMqn6zcOkyhZTnr2Ca77iiBbVe1+cDn98ecJ14hU2nQfTWcB/RA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 172.205.89.229) smtp.rcpttodomain=sourceware.org smtp.mailfrom=arm.com; dmarc=fail (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arm.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4xDrSxvyjebfHXPgccp9vsKvznbRjK/uKWxwSzcMGDY=; b=TLxBCmMpO8J+ZSa+Ko57uVZ2gyO8F/eJEm2t2VfduJWZQiC0tP0Nb+ak4p29+H8thbVs0TMtFehe/mb/JJhSNixCNBD56J8fkDasjA8GAmMazygnTpf1OmSZoSD8SiN8+Mh6d5/Holp16VSdfdEPC1os/V9u97usf6yAGgN+YTc= Received: from AM0PR04CA0134.eurprd04.prod.outlook.com (2603:10a6:208:55::39) by AS8PR08MB8468.eurprd08.prod.outlook.com (2603:10a6:20b:566::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8335.18; Mon, 13 Jan 2025 11:22:22 +0000 Received: from AMS1EPF0000004E.eurprd04.prod.outlook.com (2603:10a6:208:55:cafe::49) by AM0PR04CA0134.outlook.office365.com (2603:10a6:208:55::39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8335.18 via Frontend Transport; Mon, 13 Jan 2025 11:22:20 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 172.205.89.229) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=fail action=none header.from=arm.com; Received-SPF: Fail (protection.outlook.com: domain of arm.com does not designate 172.205.89.229 as permitted sender) receiver=protection.outlook.com; client-ip=172.205.89.229; helo=nebula.arm.com; Received: from nebula.arm.com (172.205.89.229) by AMS1EPF0000004E.mail.protection.outlook.com (10.167.16.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8356.11 via Frontend Transport; Mon, 13 Jan 2025 11:22:20 +0000 Received: from AZ-NEU-EX05.Arm.com (10.240.25.133) by AZ-NEU-EX05.Arm.com (10.240.25.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 13 Jan 2025 11:22:19 +0000 Received: from PW070M4K.arm.com (10.1.32.155) by mail.arm.com (10.240.25.133) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 13 Jan 2025 11:22:19 +0000 From: Matthieu Longo <matthieu.longo@arm.com> To: <binutils@sourceware.org>, Indu Bhagat <indu.bhagat@oracle.com> CC: Richard Earnshaw <richard.earnshaw@arm.com>, Nick Clifton <nickc@redhat.com>, Jan Beulich <jbeulich@suse.com>, Matthieu Longo <matthieu.longo@arm.com> Subject: [PATCH v3 0/4] aarch64: add DWARF and SFrame support for new CFI directive used for PAuth_LR Date: Mon, 13 Jan 2025 11:22:02 +0000 Message-ID: <20250113112206.1071596-1-matthieu.longo@arm.com> X-Mailer: git-send-email 2.47.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS1EPF0000004E:EE_|AS8PR08MB8468:EE_ X-MS-Office365-Filtering-Correlation-Id: eae31058-262d-4059-bafd-08dd33c48bce X-LD-Processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0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8E88Ydi3IAUyOXG0xjYTH5OOWaqfZwrEauZZwPeerIPejHB9zycnq2fn3/jUdyNHlcG3wfvsQhsX3k9NipY3pzQIDZ2/mxpKv8wJF199vmVmg18zJ3gxJVX5mE8xSkf+oxBzOu5RbUJrexpy5/POzkPFBSC996q8S4wH//ljlj2CPg7PAxb02diPp3BvqIykEWo0pD8Nz7069kgMzwJMY4EPYMbhzLv7lgg6GrFMiLVfxqslfYl5HsxDnceO6OQDANOx/MlBfZGgjH5ewsu3ix4+ImIrKM43z6GW1QZUO3TbAVjdwLgnficNf56e1XQHslVc5XHEsIQCYLRpCBaIZ0YJW3ACI/fyUYC/8zU4PUMc4mMIXzBXovcuzc2+24lkFo5c9uKf8GfpLGPJJ6LzeRrJdAOULVEk3xyflrB3AyCAohNQAQxcXer X-Forefront-Antispam-Report: CIP:172.205.89.229; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(1800799024)(376014); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jan 2025 11:22:20.8353 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eae31058-262d-4059-bafd-08dd33c48bce X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[172.205.89.229]; Helo=[nebula.arm.com] X-MS-Exchange-CrossTenant-AuthSource: AMS1EPF0000004E.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB8468 X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list <binutils.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/binutils>, <mailto:binutils-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/binutils/> List-Post: <mailto:binutils@sourceware.org> List-Help: <mailto:binutils-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/binutils>, <mailto:binutils-request@sourceware.org?subject=subscribe> Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org |
Series |
aarch64: add DWARF and SFrame support for new CFI directive used for PAuth_LR
|
|
Message
Matthieu Longo
Jan. 13, 2025, 11:22 a.m. UTC
This patch series is based on the feedback obtained from previous reviews [1] and [2]. This is in no way a complete implementation of PAuth_LR, and only focuses on DWARF and SFrame. ## Context: The Pointer Authentication (PAuth) feature provides instructions that enable software to sign an address using SP as a diversifier. This form of PAC instruction is typically used for signing return addresses that are stored on the stack. The new Armv9.5-A architecture introduces an enhancement of the previous PAuth feature, called PAuth_LR. It aims at hardening the PAC in a signed return address. When signing the return address in LR, the PC is used as a diversifier, in addition to the SP to generate the PAC code. ## Details 1. Patches 1/4 and 2/4 clarify which CFI directive should be used on AArch64 for PAuth. In GCC 14 and older, the AArch64 GCC backend emits a directive corresponding to a Sparc DWARF extension (".cfi_gnu_window_save" instead of ".cfi_negate_ra_state"). This behavior contradicts the document for DWARF extensions on AArch64 (see [3]). In practice, this behavior didn't have any consequence as the two CFI directives share the same binary encoding (0x2d), but from a developer perspective, created confusion when looking at the generated assembly. This issue was fixed in GCC 15 [4], but this behavior is preserved in binutils for backward compatibility with older versions of GCC. 2. Patch 3/4 defines the new CFI directive .cfi_negate_ra_state_with_pc for PAuth_LR, and adds support for it into DWARF. 3. Patch 4/4 skips the new CFI directive and emits a warning, before failing to generate the FDE entry. Regression tested on aarch64-none-linux-gnu, and no regression found. Ok for binutils-master? Regards, Matthieu. [1]: https://inbox.sourceware.org/binutils/20241108152505.3554049-1-matthieu.longo@arm.com/ [2]: https://inbox.sourceware.org/binutils/20241125162846.94691-1-matthieu.longo@arm.com/ [3]: https://github.com/ARM-software/abi-aa/blob/main/aadwarf64/aadwarf64.rst#id1 [4]: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=9e1c71bab50d51a1a8ec1a75080ffde6ca3d854c Diff from v1: - patch 1: Address Indu Bhagat's comment regarding "dot, space, space, new sentence" issues in the comment block. - patch 2: No change. - patch 3: Address Jan Beulich's comment regarding the order of the declaration of DWARF directives in include/dwarf2.def The second comment regarding the guard for architecture-specific CFI directives will be addressed in a follow-up patch series. - patch 4: No change. Diff from v2: - patch 1: Improve comment about backward compatibility test for .cfi_window_save as suggested by Richard Earnshaw in v1. - patch 2: Idem. Matthieu Longo (4): aarch64: make explicit that CFI gnu_window_save is for Sparc, not AArch64 aarch64 SFrame: use preferred CFI directive for AArch64 PAC aarch64 DWARF: add new CFI directive for PAuth_LR aarch64 SFrame: skip with warning new CFI directive used with pauth_lr bfd/elf-eh-frame.c | 1 + binutils/dwarf.c | 5 +++ gas/dw2gencfi.c | 10 +++++ gas/gen-sframe.c | 24 +++++++++- gas/scfidw2gen.c | 1 + gas/testsuite/gas/aarch64/pac_ab_key.s | 4 +- .../gas/aarch64/pac_compat_cfi_window_save.d | 44 +++++++++++++++++++ .../gas/aarch64/pac_compat_cfi_window_save.s | 20 +++++++++ .../gas/cfi-sframe/cfi-sframe-aarch64-3.d | 20 +++++++++ .../gas/cfi-sframe/cfi-sframe-aarch64-3.s | 26 +++++++++++ .../gas/cfi-sframe/cfi-sframe-aarch64-4.d | 25 +++++++++++ .../gas/cfi-sframe/cfi-sframe-aarch64-4.s | 23 ++++++++++ .../cfi-sframe-aarch64-pac-ab-key-1.s | 8 ++-- gas/testsuite/gas/cfi-sframe/cfi-sframe.exp | 2 + include/dwarf2.def | 2 + 15 files changed, 208 insertions(+), 7 deletions(-) create mode 100644 gas/testsuite/gas/aarch64/pac_compat_cfi_window_save.d create mode 100644 gas/testsuite/gas/aarch64/pac_compat_cfi_window_save.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-3.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-3.s create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-4.d create mode 100644 gas/testsuite/gas/cfi-sframe/cfi-sframe-aarch64-4.s