From patchwork Wed Sep 18 13:55:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthieu Longo X-Patchwork-Id: 97646 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 139A3385841C for ; Wed, 18 Sep 2024 13:57:19 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:260c::601]) by sourceware.org (Postfix) with ESMTPS id 995D03858C56 for ; Wed, 18 Sep 2024 13:56:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 995D03858C56 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 995D03858C56 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:260c::601 ARC-Seal: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1726667788; cv=pass; b=H9NDbtRbambShf9WdxtBIwO9RtJnyZ3H2WFk6h+WNPs6+eAE+LXC/QouYe32yKjj0amgkuXLWWqPXZW355N8Tum8AaTSaRUK/4WBcqWsm+04s3/0RQNH+3qXAAzKsZX/UP+QmBgqEK6rpoFU1KXh4AfUW2bUk5DP42NE1NOW2xs= ARC-Message-Signature: i=3; a=rsa-sha256; d=sourceware.org; s=key; t=1726667788; c=relaxed/simple; bh=QUn4c1zNHWtkfkEcqTaidPjXbpZGI4qXrx4em1vN7R4=; h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID: MIME-Version; b=Qe/hL1yS0GE4Td3tw3stPOtOA35s+AWlaJPCPFQ4HDGStbCjUCVGKMfB8hWntSwjx3LxvCV2IpR4jianJ2DUot5a4JGam28rfTlxBUA0aP3XtbvPCQ95nm3TL+PoMy1qS9Ho4mRdEV4B41Exu/YJ/qa/hgg86omjhT2jwpl3gvA= ARC-Authentication-Results: i=3; server2.sourceware.org ARC-Seal: i=2; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=pass; b=NHGDk3T1aGIkrVqC5vAtCS1izL/giewqgRd28d3vX1CIYu9rtwxNz2jiowRhULGdXsqoSl+zFXnjsm8BiXYPrS8zY53Covk4Lj6prGSW4a0RH7Va2dHHa8gjI2jrajf6ngRcdZBr9ZI0gZPwG0w1OAhH3pYp0xuSozBVEhZqWapWbkV9AbxLePqU6lOFJI8sz2hOwgC8k4SXY6tsRqVJVZZ7v9tz3HScobbBw5Xu3Rldmt/nNLbOHn9mTNjXa4aY6gifr1H8Pm7rkZxfMsB6v+ZgymHOuWbv9lsRVdRpAFwtdnXgYjo2jZZzoWQ+I4729Bj12rFW3xHaNXiwVpC7Qg== ARC-Message-Signature: i=2; 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=4Rf+EofgcNcZjDSmbAz7VD630IRTpJ1ZKnW/bsb8/6w=; b=x300X7jY8RQlxm3O9sJjI+KtAnc+EsqlWiY03VX0UAQaVApEfV7SI8h50ZiMpYEiSmpnzD/rEsqHQD9b8vf98sYHz8290RiCUD71LEHidmgZm70bVuRrNi47eSDfSFVZM00zDTorEaRqndvc6sS6BoPa1H+JLmJMask8EhC27twZtVcd8WKSPKKTAoLb4fE97prPU1C2fOfAoZQbNE1T57EQktU4C9qR54b9WwX9cjI+IKGIpdy8GZMMyvuksZXtrKn7LZsRQcctxoiNLMVlHV1b9uFeIhXFnzWiBMEdlqjjG4IaCY1vPuUj7L//jQik955bUFbpu73Ut4zkKTId0w== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=arm.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) 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=4Rf+EofgcNcZjDSmbAz7VD630IRTpJ1ZKnW/bsb8/6w=; b=VQyBp3tt5ihwWui5x+djfRsVW1YhnnPW2KO4Ba6qVJKjxKT07ZGMXfATG6SO82kSoZHmVqMeBUjoTeB6VPVl4jNGTyFaIneDKcZPGQcX1O13YUSFTkCZq7/IFaW6Ym8SmEDKKywrEtph3XRUlYdHyCuHJs1PYroNDIZbdC6b02I= Received: from DB8PR04CA0024.eurprd04.prod.outlook.com (2603:10a6:10:110::34) by VI1PR08MB5424.eurprd08.prod.outlook.com (2603:10a6:803:136::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.17; Wed, 18 Sep 2024 13:56:14 +0000 Received: from DU6PEPF0000A7E4.eurprd02.prod.outlook.com (2603:10a6:10:110:cafe::c9) by DB8PR04CA0024.outlook.office365.com (2603:10a6:10:110::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.30 via Frontend Transport; Wed, 18 Sep 2024 13:56:14 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=arm.com;dmarc=pass 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; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DU6PEPF0000A7E4.mail.protection.outlook.com (10.167.8.43) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7918.13 via Frontend Transport; Wed, 18 Sep 2024 13:56:13 +0000 Received: ("Tessian outbound 0881e36152ee:v457"); Wed, 18 Sep 2024 13:56:12 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: a7657408b10345a8 X-TessianGatewayMetadata: 1xN2rhNOu02hWhopZsjhZqP3BxoWFNxaNMi9SenHs/3RR5D6HzZGJuWaBXdaHHEdxlljIabn1ffuI/im2Zkne2myHDiedec3CNYlIltg4X+LwZbI9uywqRI7wYJMzRQsh8Bo+w8zK7pdKyxlFME50ulPcKknuCsrNAOnP/8MYFE= X-CR-MTA-TID: 64aa7808 Received: from L0683250fc6c1.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 440B3128-AC4B-4991-9530-D504850CB136.1; Wed, 18 Sep 2024 13:56:01 +0000 Received: from EUR02-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id L0683250fc6c1.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 18 Sep 2024 13:56:01 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qSznb7DE5Vky20e5EtQ+tre696hv+qxvMwrCkrEqz0sQhZVViUjDbSFn9lG6jsO2XTilZcp4NjT7LEm1gJLu3gpJQOl/4BQGREVy8wRMYz360N19ZqDWfU69KGKemMzR0MDOkIHz2PZna84VQUmo6cp3tZ9QaDzBzvO5BHsBzzIpmtjkaNX8+de3DjnMQkjQj/PKS3BbJL3htH5vpEk2PMwWXdB/JlvyX7nTMhqUSphsbFa3iWwKHaPnohl0hDNum/fKuN44mmTKtZGyUK7/82lp9sCguLXoZ9cycqOZ+heJPlgTx/yFFThRnPGJ71F4ssZpWZVWBNhAZPLvACKwBw== 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=4Rf+EofgcNcZjDSmbAz7VD630IRTpJ1ZKnW/bsb8/6w=; b=AeLB5zk96tNmYKRjfbG8rDedj4LjxLdwx7/TOYsyYTHsBIwFUDL2Mx5PLQIgDS1Ab8esDVxVkgOCdRt/JCwztYAYSNcEteTbbydKDJmqCICxngHbXkhj1i8YT85hj/Bmc5cSVM17Wp0WL5CIc5msv1HkLtLluaTSD10a+DKyeDG0MIuMN2eALJOFlZYMEbSQiscOGI4/K1ayHXJNSyR8mBA7RuY2lU/RXAy/7Eis85zKOiberEnsed1zeKBBD6Ae4FZlFKaFET1u8JH/YM7jQbgsXkBTIgBPCuOov68MSWBBnzhh7+6m9clqmT0G+xQrEJFBcxlQh93YxHXzcjh84A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (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=4Rf+EofgcNcZjDSmbAz7VD630IRTpJ1ZKnW/bsb8/6w=; b=VQyBp3tt5ihwWui5x+djfRsVW1YhnnPW2KO4Ba6qVJKjxKT07ZGMXfATG6SO82kSoZHmVqMeBUjoTeB6VPVl4jNGTyFaIneDKcZPGQcX1O13YUSFTkCZq7/IFaW6Ym8SmEDKKywrEtph3XRUlYdHyCuHJs1PYroNDIZbdC6b02I= Received: from DB8PR09CA0008.eurprd09.prod.outlook.com (2603:10a6:10:a0::21) by DBBPR08MB10724.eurprd08.prod.outlook.com (2603:10a6:10:53d::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.11; Wed, 18 Sep 2024 13:55:56 +0000 Received: from DB3PEPF00008859.eurprd02.prod.outlook.com (2603:10a6:10:a0:cafe::6) by DB8PR09CA0008.outlook.office365.com (2603:10a6:10:a0::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.25 via Frontend Transport; Wed, 18 Sep 2024 13:55:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by DB3PEPF00008859.mail.protection.outlook.com (10.167.242.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7918.13 via Frontend Transport; Wed, 18 Sep 2024 13:55:56 +0000 Received: from AZ-NEU-EX06.Arm.com (10.240.25.134) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 18 Sep 2024 13:55:54 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX06.Arm.com (10.240.25.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 18 Sep 2024 13:55:53 +0000 Received: from PW070M4K.cambridge.arm.com (10.57.76.20) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Wed, 18 Sep 2024 13:55:53 +0000 From: Matthieu Longo To: CC: Richard Earnshaw , Szabolcs Nagy , Jakub Jelinek , Richard Sandiford , Ian Lance Taylor , Matthieu Longo Subject: [PATCH v2 1/4] aarch64: store signing key and signing method in DWARF _Unwind_FrameState Date: Wed, 18 Sep 2024 14:55:03 +0100 Message-ID: <20240918135506.1534663-2-matthieu.longo@arm.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240918135506.1534663-1-matthieu.longo@arm.com> References: <20240918135506.1534663-1-matthieu.longo@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DB3PEPF00008859:EE_|DBBPR08MB10724:EE_|DU6PEPF0000A7E4:EE_|VI1PR08MB5424:EE_ X-MS-Office365-Filtering-Correlation-Id: 7d3168a1-77d1-4019-e851-08dcd7e9a868 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info-Original: FnjtNvNly+h3A8Hl9BQwo1VEU/4VFwDII24nvGS3Cwn42dFjnzmJ1HQ8hGMI2PUWt2j6AKUwBVOXqjeyVD0GG4ps9p/NhrVwyEBiX+1edNJ9NLdebQSbRGcdlyIuqSpVKbDjMQcbWiTutR0bPEyowUXGfP9Yql5x3d8JtMSV0lTDkwnss2g6zUdzK2/RiQ7f508llrqVzbATlB0cWaLVNB6xN3wXQCw7jSXHA0fywPNsIk/u6JcAsi5ps37y9OmcuCtuLV5v1cWiJm9DMOCjdjL/CKB+5EDg8Aa34gDwyMu01+sQLPBORHwtIl5MMTRNklYAl9vSRyW0gMmM1sgP/8aJf7LcxmDjf2gwZnrWXZaSnC1F/hHLWcepQI3BXN2wu537v+CP8CtYG1baQjVfjJVLIoSe9ObaH4ZuXK/TDMBlkCBtALn1n7fWM/6VV7mE3ZJndfnzQkPZ3FWeT5kC8L2FcvrlMgkce9csKDOG0TcCa/W1UZjmU9WGj5izLN/2uiBLQF2OUcxgWK6gSbwPFk5nvBdZmhNA7/vj5y0mq9SURSYwCgt2MhyiiA6zEg6AhrjmcxdtUGJmTai4Mv7OCe2USiIscKoS2GIGPWHQW0jYzrsYifKS51XqkJgCHfq/e76MxaPri5CVdtsiIWB0KD84Oz2EigIT9GLgo5DgHKQfrJ7fHWMDVQVce1TpJ3x51G/blgQAFqWRX6SQU/97Usm5wmqNQyJnD9X1gh83++EO/cJcq5CebuLvapJPc3mV8GusprXTqgb5s+3KVWN2yu1j7duwgEV4tOae57T/ro/xb05CEGzqYuPULloYa31OsTiyfQy0jKq0zje0ISbNTt0LmNi3UcRUJc/Ovclw0zbpseP8Hk/pZ9E0zeVieg2rtwFZu9Qtq4ibuN+fX1TDu6/+DV2Z0JQSEP6NXi02gVh2wthslYv6eK0HUyKPnVJwOfASyaEeMSfuNzcF+Ely86iLfBgL68pp3z7qKekPslvXqVKUCkwtn570c/gxwdULydnN/PrnHkK/n2vlTIvGnpJbdjId6xfCVxarjVzMkJxja6G2cJkMmp84zvsNS3XP+PP8qcWSn61TAUFDHxLvZsco2q8rEBmy1Ef2WIHGVNkEV2cTQzzm6Mx3NnVnFQva2zC1JeaQOczgoXqgtzSfbx/ciZgMPJZnRrAE1rYA/QybZlJP0tCZx7qJIfw8AXxLYUw/qBu61H+adZrCVbF/w0CNxBuuR8ZBeG27VZJh1KznsV7WyhYg+jazhvuZmmZxP4dL5FyEcGcOnDyhnaUE8c3IGFbaPgb60WWn7xhwwnCbOu4OHAntVYBo4KFm7IjvBSR8Cm4dBsEbvG0wEZHOxkAa5Gz/n0YrdhD9/U7CAMOclezbtovefdM+Mb4+FmOEJw/x9UHp7s3t9PmRiCCVVvRUz9WuMFR72SBxWwGZvWNoKh2nuyzhg8bejVkTVN5e X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:nebula.arm.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(36860700013)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB10724 X-MS-Exchange-SkipListedInternetSender: ip=[2603:10a6:10:a0::21]; domain=DB8PR09CA0008.eurprd09.prod.outlook.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU6PEPF0000A7E4.eurprd02.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: d263b324-b1e1-4606-adf4-08dcd7e99e62 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|35042699022|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: jO4KRCIV5ma/IaZDYZg3bxWlH9dEZNWDbIi3ABFUOE9ArtaZDgfH2LHjhpXiJ23EB7if7iagjAR1LoTUjDvyuUngmBKvy9vEH7chjwhj0o0AlzfpYS/2qC5H8lmKu0iIh65u6XTqcQd3peyVYiLxrhYhBmVmbAUh6U88tqUMosukL/GuEWv5oKP5W6T91b0VRCtL4endjXZCye4Lw8dVr9mMKeYnJ6cVoii1ZE7zXHQCP6AhbGUYuQV+/kf4g2kNhOyT6t1HuY3h0Ik12Gu0SxBgSwWiPdTGKBjcF0kB7XSc52BNCGuhm+o+/6yk53ekb0blXvOyl4Tu6fEpPMlNj2Jm+JdSJSvHdeiO+yAm6/lgd4WUr82vg8AJ1g5geJpIOOYOaeFC3zfGiagoCHQ9Q/AhnvMFYanZ0yFLF5BOMwOwjpMmmumd+hws7otDPvSvQ35XGkdXDbI5wXygQkvEYMqiiOw6bUu/bX4AacwvaGxWV3mXGkXBHMYE7NRHy/RS7m9Bp/8UMeEfXY28tRzpxH0NlRC/2IibgJHh8ybgSoHOyx5Fb18QYoGyx/kQVJz9xQFA7yk3EqnD5zWJ32W2QwpM5z/T2QOloxd4i18KwXKUX0vM1i20Sjbl6PndGLsQpFPf6ReW/t4jYu7nKweZPEfjLPx8PbBqm/gE/iCCYEm38oQfJQvpJ5YQEux4fWo1g4lN9QpHN3cgYi7sc0r+6erUDQDN8XC8IeMkVYy7l2EFmz673dg08krNdCf3aDmuMC+OLS1WSBTXSIpzclr03J2TQ6XEskjTohdrJhOZSvfA9Iqy2zUdq0c0zPdQJ5EF3RRv6oyfxiOeWl2EldQSHKDOBcniCTOXUTWvYRW9ZLclbbgmUWweykKYf6IlT3040vsdkB8EyN+oQvrLiAgPYmthK1PKg3HjzLi17BqCtpXC9yagESbeNyAna/74pwdBuPfukZRH5e1ZPJFnGeK8b34JyUnzoX7Ifqqx84O+2cRSYKfBIPmOHcd87d/fiYdV29XnHH5pz+x1OEvCXQs/pCmIX7uRkguUmItW1IPjDdYn0O3XD4oI9h0jzP1kFFzSoK/Q+mp+Z+lVNM3d1FeKnleGKg95tgmlj8bppzEuBtXF1+pv5k+iGBPz71KuD49IyyMUxNOb0HcHuSS5YlxtaqcY2zv/0UKNxvjThrwriqIMyDYG8t0eGgxz29l/IL/UG67x0GkfdntGqAD6TaahbrH5hDDIa2flOLkqUfXjhLAAXnHISAJESsg7RZcHhMRXFB3qFBXn7y4J/uZzXxrAj/BhGZqkkFpgJ+SuNrJqR6oASkCiHv1yvkUKWL4fDeiaic8mrA/cVt0H2Tf9j5xVkladsBx8urBLWHRp4TJi50ddTQOW5SmcR6EV3kjX/YJX/OwDiBerfX+ABPSP1gGX99jG24C/IEoBJBYozE/xiYwavHL1xep+rCsOdT0aUu99 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; SFS:(13230040)(376014)(35042699022)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Sep 2024 13:56:13.2254 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7d3168a1-77d1-4019-e851-08dcd7e9a868 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DU6PEPF0000A7E4.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5424 X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FORGED_SPF_HELO, GIT_PATCH_0, KAM_SHORT, SPF_HELO_PASS, SPF_NONE, TXREP, UNPARSEABLE_RELAY 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~patchwork=sourceware.org@gcc.gnu.org This patch is only a refactoring of the existing implementation of PAuth and returned-address signing. The existing behavior is preserved. _Unwind_FrameState already contains several CIE and FDE information (see the attributes below the comment "The information we care about from the CIE/FDE" in libgcc/unwind-dw2.h). The patch aims at moving the information from DWARF CIE (signing key stored in the augmentation string) and FDE (the used signing method) into _Unwind_FrameState along the already-stored CIE and FDE information. Note: those information have to be saved in frame_state_reg_info instead of _Unwind_FrameState as they need to be savable by DW_CFA_remember_state and restorable by DW_CFA_restore_state, that both rely on the attribute "prev". Those new information in _Unwind_FrameState simplifies the look-up of the signing key when the return address is demangled. It also allows future signing methods to be easily added. _Unwind_FrameState is not a part of the public API of libunwind, so the change is backward compatible. A new architecture-specific handler MD_ARCH_EXTENSION_FRAME_INIT allows to reset values (if needed) in the frame state and unwind context before changing the frame state to the caller context. A new architecture-specific handler MD_ARCH_EXTENSION_CIE_AUG_HANDLER isolates the architecture-specific augmentation strings in AArch64 backend, and allows others architectures to reuse augmentation strings that would have clashed with AArch64 DWARF extensions. aarch64_demangle_return_addr, DW_CFA_AARCH64_negate_ra_state and DW_CFA_val_expression cases in libgcc/unwind-dw2-execute_cfa.h were documented to clarify where the value of the RA state register is stored (FS and CONTEXT respectively). libgcc/ChangeLog: * config/aarch64/aarch64-unwind.h (AARCH64_DWARF_RA_STATE_MASK): The mask for RA state register. (aarch64_ra_signing_method_t): The diversifiers used to sign a function's return address. (aarch64_pointer_auth_key): The key used to sign a function's return address. (aarch64_cie_signed_with_b_key): Deleted as the signing key is available now in _Unwind_FrameState. (MD_ARCH_EXTENSION_CIE_AUG_HANDLER): New CIE augmentation string handler for architecture extensions. (MD_ARCH_EXTENSION_FRAME_INIT): New architecture-extension initialization routine for DWARF frame state and context before execution of DWARF instructions. (aarch64_context_ra_state_get): Read RA state register from CONTEXT. (aarch64_ra_state_get): Read RA state register from FS. (aarch64_ra_state_set): Write RA state register into FS. (aarch64_ra_state_toggle): Toggle RA state register in FS. (aarch64_cie_aug_handler): Handler AArch64 augmentation strings. (aarch64_arch_extension_frame_init): Initialize defaults for the signing key (PAUTH_KEY_A), and RA state register (RA_no_signing). (aarch64_demangle_return_addr): Rely on the frame registers and the signing_key attribute in _Unwind_FrameState. * unwind-dw2-execute_cfa.h: Use the right alias DW_CFA_AARCH64_negate_ra_state for __aarch64__ instead of DW_CFA_GNU_window_save. (DW_CFA_AARCH64_negate_ra_state): Save the signing method in RA state register. Toggle RA state register without resetting 'how' to REG_UNSAVED. * unwind-dw2.c: (extract_cie_info): Save the signing key in the current _Unwind_FrameState while parsing the augmentation data. (uw_frame_state_for): Reset some attributes related to architecture extensions in _Unwind_FrameState. (uw_update_context): Move authentication code to AArch64 unwinding. * unwind-dw2.h (enum register_rule): Give a name to the existing enum for the register rules, and replace 'unsigned char' by 'enum register_rule' to facilitate debugging in GDB. (_Unwind_FrameState): Add a new architecture-extension attribute to store the signing key. --- libgcc/config/aarch64/aarch64-unwind.h | 145 ++++++++++++++++++++----- libgcc/unwind-dw2-execute_cfa.h | 26 +++-- libgcc/unwind-dw2.c | 19 +++- libgcc/unwind-dw2.h | 17 ++- 4 files changed, 159 insertions(+), 48 deletions(-) diff --git a/libgcc/config/aarch64/aarch64-unwind.h b/libgcc/config/aarch64/aarch64-unwind.h index daf96624b5e..94ea5891b4e 100644 --- a/libgcc/config/aarch64/aarch64-unwind.h +++ b/libgcc/config/aarch64/aarch64-unwind.h @@ -25,52 +25,145 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #if !defined (AARCH64_UNWIND_H) && !defined (__ILP32__) #define AARCH64_UNWIND_H -#define DWARF_REGNUM_AARCH64_RA_STATE 34 +#include "ansidecl.h" +#include + +#define AARCH64_DWARF_REGNUM_RA_STATE 34 +#define AARCH64_DWARF_RA_STATE_MASK 0x1 + +/* The diversifiers used to sign a function's return address. */ +typedef enum +{ + aarch64_ra_no_signing = 0x0, + aarch64_ra_signing_sp = 0x1, +} __attribute__((packed)) aarch64_ra_signing_method_t; + +/* The key used to sign a function's return address. */ +typedef enum { + AARCH64_PAUTH_KEY_A, + AARCH64_PAUTH_KEY_B, +} __attribute__((packed)) aarch64_pointer_auth_key; + +#define MD_ARCH_EXTENSION_CIE_AUG_HANDLER(fs, aug) \ + aarch64_cie_aug_handler (fs, aug) + +#define MD_ARCH_EXTENSION_FRAME_INIT(context, fs) \ + aarch64_arch_extension_frame_init (context, fs) #define MD_DEMANGLE_RETURN_ADDR(context, fs, addr) \ aarch64_demangle_return_addr (context, fs, addr) -static inline int -aarch64_cie_signed_with_b_key (struct _Unwind_Context *context) +static inline aarch64_ra_signing_method_t +aarch64_context_ra_state_get (struct _Unwind_Context *context) +{ + const int index = AARCH64_DWARF_REGNUM_RA_STATE; + return _Unwind_GetGR (context, index) & AARCH64_DWARF_RA_STATE_MASK; +} + +static inline aarch64_ra_signing_method_t +aarch64_fs_ra_state_get (_Unwind_FrameState const *fs) +{ + const int index = AARCH64_DWARF_REGNUM_RA_STATE; + return fs->regs.reg[index].loc.offset & AARCH64_DWARF_RA_STATE_MASK; +} + +static inline void +aarch64_fs_ra_state_set (_Unwind_FrameState *fs, + aarch64_ra_signing_method_t signing_method) { - const struct dwarf_fde *fde = _Unwind_Find_FDE (context->bases.func, - &context->bases); - if (fde != NULL) + fs->regs.reg[AARCH64_DWARF_REGNUM_RA_STATE].loc.offset = signing_method; +} + +static inline void +aarch64_fs_ra_state_toggle (_Unwind_FrameState *fs) +{ + /* /!\ Mixing DW_CFA_val_expression with DW_CFA_AARCH64_negate_ra_state will + result in undefined behavior (likely an unwinding failure), as the + chronology of the DWARF directives will be broken. */ + gcc_assert (fs->regs.how[AARCH64_DWARF_REGNUM_RA_STATE] == REG_ARCHEXT); + + aarch64_ra_signing_method_t signing_method = aarch64_fs_ra_state_get (fs); + gcc_assert (signing_method == aarch64_ra_no_signing + || signing_method == aarch64_ra_signing_sp); + aarch64_fs_ra_state_set (fs, (signing_method == aarch64_ra_no_signing) + ? aarch64_ra_signing_sp + : aarch64_ra_no_signing); +} + +/* CIE handler for custom augmentation string. */ +static inline bool +aarch64_cie_aug_handler (_Unwind_FrameState *fs, unsigned char aug) +{ + /* AArch64 B-key pointer authentication. */ + if (aug == 'B') { - const struct dwarf_cie *cie = get_cie (fde); - if (cie != NULL) - { - const unsigned char *aug_str = cie->augmentation; - return __builtin_strchr ((const char *) aug_str, - 'B') == NULL ? 0 : 1; - } + fs->regs.signing_key = AARCH64_PAUTH_KEY_B; + return true; } - return 0; + return false; +} + +/* At the entrance of a new frame, some cached information from the CIE/FDE, + and registers values related to architectural extensions require a default + initialization. + If any of those values related to architecture extensions had to be saved + for the next frame, it should be done via the architecture extensions handler + MD_FROB_UPDATE_CONTEXT in uw_update_context_1 (libgcc/unwind-dw2.c). */ +static inline void +aarch64_arch_extension_frame_init (struct _Unwind_Context *context ATTRIBUTE_UNUSED, + _Unwind_FrameState *fs) +{ + /* By default, DW_CFA_AARCH64_negate_ra_state assumes key A is being used + for signing. This can be overridden by adding 'B' to the augmentation + string. */ + fs->regs.signing_key = AARCH64_PAUTH_KEY_A; + + /* All registers are initially in state REG_UNSAVED, which indicates that + they inherit register values from the previous frame. However, the + return address starts every frame in the "unsigned" state. It also + starts every frame in a state that supports the original toggle-based + DW_CFA_AARCH64_negate_ra_state method of controlling RA signing. */ + fs->regs.how[AARCH64_DWARF_REGNUM_RA_STATE] = REG_ARCHEXT; + aarch64_fs_ra_state_set (fs, aarch64_ra_no_signing); } /* Do AArch64 private extraction on ADDR_WORD based on context info CONTEXT and unwind frame info FS. If ADDR_WORD is signed, we do address authentication - on it using CFA of current frame. */ + on it using CFA of current frame. + Note: when DW_CFA_val_expression is used, FS only records the location of the + associated CFI program, rather than the value of the expression itself. + The CFI program is executed by uw_update_context when updating the context, + so the value of the expression must be taken from CONTEXT rather than FS. */ static inline void * aarch64_demangle_return_addr (struct _Unwind_Context *context, _Unwind_FrameState *fs, _Unwind_Word addr_word) { void *addr = (void *)addr_word; - const int reg = DWARF_REGNUM_AARCH64_RA_STATE; - - if (fs->regs.how[reg] == REG_UNSAVED) - return addr; - - /* Return-address signing state is toggled by DW_CFA_GNU_window_save (where - REG_UNSAVED/REG_UNSAVED_ARCHEXT means RA signing is disabled/enabled), - or set by a DW_CFA_expression. */ - if (fs->regs.how[reg] == REG_UNSAVED_ARCHEXT - || (_Unwind_GetGR (context, reg) & 0x1) != 0) + const int reg = AARCH64_DWARF_REGNUM_RA_STATE; + + /* In libgcc, REG_ARCHEXT means that the RA state register was set by an + AArch64 DWARF instruction and contains a valid value, or is used to + describe the initial state set in aarch64_arch_extension_frame_init. + Return-address signing state is normally toggled by DW_CFA_AARCH64_negate + _ra_state (also knwon by its alias as DW_CFA_GNU_window_save). + However, RA state register can be set directly via DW_CFA_val_expression + too. GCC does not generate such CFI but some other compilers reportedly + do (see PR104689 for more details). + Any other value than REG_ARCHEXT should be interpreted as if the RA state + register is set by another DWARF instruction, and the value is fetchable + via _Unwind_GetGR. */ + aarch64_ra_signing_method_t signing_method = aarch64_ra_no_signing; + if (fs->regs.how[reg] == REG_ARCHEXT) + signing_method = aarch64_fs_ra_state_get (fs); + else if (fs->regs.how[reg] != REG_UNSAVED) + signing_method = aarch64_context_ra_state_get (context); + + if (signing_method == aarch64_ra_signing_sp) { _Unwind_Word salt = (_Unwind_Word) context->cfa; - if (aarch64_cie_signed_with_b_key (context) != 0) + if (fs->regs.signing_key == AARCH64_PAUTH_KEY_B) return __builtin_aarch64_autib1716 (addr, salt); return __builtin_aarch64_autia1716 (addr, salt); } diff --git a/libgcc/unwind-dw2-execute_cfa.h b/libgcc/unwind-dw2-execute_cfa.h index a6b249f9ad6..5d73e0420b1 100644 --- a/libgcc/unwind-dw2-execute_cfa.h +++ b/libgcc/unwind-dw2-execute_cfa.h @@ -271,23 +271,25 @@ fs->regs.how[reg] = REG_SAVED_VAL_EXP; fs->regs.reg[reg].loc.exp = insn_ptr; } + /* Don't execute the expression, but jump over it by adding + DW_FORM_block's size to insn_ptr. */ insn_ptr = read_uleb128 (insn_ptr, &utmp); insn_ptr += utmp; break; - case DW_CFA_GNU_window_save: #if defined (__aarch64__) && !defined (__ILP32__) - /* This CFA is multiplexed with Sparc. On AArch64 it's used to toggle - return address signing status. REG_UNSAVED/REG_UNSAVED_ARCHEXT - mean RA signing is disabled/enabled. */ - reg = DWARF_REGNUM_AARCH64_RA_STATE; - gcc_assert (fs->regs.how[reg] == REG_UNSAVED - || fs->regs.how[reg] == REG_UNSAVED_ARCHEXT); - if (fs->regs.how[reg] == REG_UNSAVED) - fs->regs.how[reg] = REG_UNSAVED_ARCHEXT; - else - fs->regs.how[reg] = REG_UNSAVED; + case DW_CFA_AARCH64_negate_ra_state: + /* This CFA is multiplexed with SPARC. + On AArch64 it's used to toggle the status of return address signing + with SP as a diversifier. + - REG_ARCHEXT means that the RA state register in FS contains a + valid value, and that no other DWARF directive has changed the + value of this register. + - any other value is not compatible with negating the RA state. */ + aarch64_fs_ra_state_toggle (fs); + break; #else + case DW_CFA_GNU_window_save: /* ??? Hardcoded for SPARC register window configuration. */ if (__LIBGCC_DWARF_FRAME_REGISTERS__ >= 32) for (reg = 16; reg < 32; ++reg) @@ -295,8 +297,8 @@ fs->regs.how[reg] = REG_SAVED_OFFSET; fs->regs.reg[reg].loc.offset = (reg - 16) * sizeof (void *); } -#endif break; +#endif case DW_CFA_GNU_args_size: insn_ptr = read_uleb128 (insn_ptr, &utmp); diff --git a/libgcc/unwind-dw2.c b/libgcc/unwind-dw2.c index 0849e89cd34..40d64c0c0a3 100644 --- a/libgcc/unwind-dw2.c +++ b/libgcc/unwind-dw2.c @@ -501,11 +501,11 @@ extract_cie_info (const struct dwarf_cie *cie, struct _Unwind_Context *context, fs->signal_frame = 1; aug += 1; } - /* aarch64 B-key pointer authentication. */ - else if (aug[0] == 'B') - { - aug += 1; - } + +#if defined(MD_ARCH_EXTENSION_CIE_AUG_HANDLER) + else if (MD_ARCH_EXTENSION_CIE_AUG_HANDLER (fs, aug[0])) + aug += 1; +#endif /* Otherwise we have an unknown augmentation string. Bail unless we saw a 'z' prefix. */ @@ -996,6 +996,9 @@ uw_frame_state_for (struct _Unwind_Context *context, _Unwind_FrameState *fs) memset (&fs->regs.how[0], 0, sizeof (*fs) - offsetof (_Unwind_FrameState, regs.how[0])); +#if defined(MD_ARCH_EXTENSION_FRAME_INIT) + MD_ARCH_EXTENSION_FRAME_INIT (context, fs); +#endif context->args_size = 0; context->lsda = 0; @@ -1197,7 +1200,11 @@ uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs) { case REG_UNSAVED: case REG_UNDEFINED: - case REG_UNSAVED_ARCHEXT: + /* If the value depends on an augmenter, then there is no processing + to do here, and the value computation should be delayed until the + architecture handler computes the value correctly based on the + augmenter information. */ + case REG_ARCHEXT: break; case REG_SAVED_OFFSET: diff --git a/libgcc/unwind-dw2.h b/libgcc/unwind-dw2.h index 0dd8611f697..e6b30b7188e 100644 --- a/libgcc/unwind-dw2.h +++ b/libgcc/unwind-dw2.h @@ -22,16 +22,17 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see . */ -enum { +enum register_rule +{ REG_UNSAVED, REG_SAVED_OFFSET, REG_SAVED_REG, REG_SAVED_EXP, REG_SAVED_VAL_OFFSET, REG_SAVED_VAL_EXP, - REG_UNSAVED_ARCHEXT, /* Target specific extension. */ + REG_ARCHEXT, /* Target specific extension. */ REG_UNDEFINED -}; +} __attribute__((packed)); /* The result of interpreting the frame unwind info for a frame. This is all symbolic at this point, as none of the values can @@ -49,7 +50,7 @@ typedef struct const unsigned char *exp; } loc; } reg[__LIBGCC_DWARF_FRAME_REGISTERS__+1]; - unsigned char how[__LIBGCC_DWARF_FRAME_REGISTERS__+1]; + enum register_rule how[__LIBGCC_DWARF_FRAME_REGISTERS__+1]; enum { CFA_UNSET, @@ -65,6 +66,14 @@ typedef struct _Unwind_Sword cfa_offset; _Unwind_Word cfa_reg; const unsigned char *cfa_exp; + + /* Architecture extensions information from CIE/FDE. + Note: this information has to be saved in struct frame_state_reg_info + instead of _Unwind_FrameState as DW_CFA_restore_state has to be able to + restore them. */ +#if defined(__aarch64__) && !defined (__ILP32__) + unsigned char signing_key; +#endif } regs; /* The PC described by the current frame state. */