From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR03-VE1-obe.outbound.protection.outlook.com (mail-eopbgr50042.outbound.protection.outlook.com [40.107.5.42]) by sourceware.org (Postfix) with ESMTPS id 7A9153858C53 for ; Fri, 5 Aug 2022 09:21:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7A9153858C53 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-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=f5h0IdbtcLwoYio91qFu4mK/drV9iDyY/mqco7aHV4V+PP0OEl80Cwsbj9wQogET4XCw+jgqA2x3mnKXdGjlBU+NoKGBA72MPzKLtMFBCD8hYLx6LnrZqvLTVynb43g6ImysXZPcaYjayFkNYqhgbn/in+wuuO51nLyp7X7BI7LGYJzrNcpftntUPK5RZBK/mDus2dL67D0Uik/+79B4JzhWj1qLkrG/BiKejDK0ce1D/OHI6deWW0Jtj7vaj6FnXkTsqkdKuRAfsKh+r6rAFYhsHUHY+WXcw1fOUhwiC+BwxhgvyTfs9/G8jXFqxSIVKAdCl2ujibnilZahuXrOvQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=W3VOt9cW0vETcy7LtEpFHJ/h/gkeGj1fPPbZ63nGyX0=; b=ckBfCB4Hr9+4e5c2Ta0NaKiU56Qxsd+MN1eTVmZkgooe44mo/HwpMfbw9/32Av2SrYXM2hPUMKFM+JvOyhyVPG5T8dNpETvNsqxatrdi/IXS8JrBDyTvHmZo513+Q8Qnth4GHeeyAn/rtZlO22RExfXPUeXpkTdy2uSGfErpoIaR0eVg6ID5OCvqzDHNsBi2ItYrl6teEPDl5PNXFIrTMRzb75u2ZZO7HfCWFhFBmW5ydWAaJUdj4yUvhCdrfENXYM4whHwJHswBIeAlCF7NDghheQefAsO+R9kZEHn+lYpf0nZOyeL0LH69emaFq4rNX8Y5ZNG13aE/9/AT7tWHFQ== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=sourceware.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=armh.onmicrosoft.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=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=W3VOt9cW0vETcy7LtEpFHJ/h/gkeGj1fPPbZ63nGyX0=; b=FwjqIq9uLBFhtV33MM/hSVKrDvGO9GUhii01Ljyvu5GIEJuBy2fITwP2L+xHkmw4AjJbndhJj7pmwPFpEggzRD3dyoeIJNC5Ol1lPkULQpx2koapXr+7f7PjnTsOYLY6qJKwn9H6f4ResJrr1Vs0MbOpv6yI8FoUL1HhPitIKKY= Received: from AM5PR1001CA0052.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:15::29) by AM0PR08MB4114.eurprd08.prod.outlook.com (2603:10a6:208:132::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Fri, 5 Aug 2022 09:21:19 +0000 Received: from AM5EUR03FT027.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:15:cafe::14) by AM5PR1001CA0052.outlook.office365.com (2603:10a6:206:15::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14 via Frontend Transport; Fri, 5 Aug 2022 09:21:19 +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=armh.onmicrosoft.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 AM5EUR03FT027.mail.protection.outlook.com (10.152.16.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5482.12 via Frontend Transport; Fri, 5 Aug 2022 09:21:19 +0000 Received: ("Tessian outbound fccf984e7173:v123"); Fri, 05 Aug 2022 09:21:19 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 16962fe4265e1e8a X-CR-MTA-TID: 64aa7808 Received: from 06068e001893.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 49E1F091-2C65-4CAF-9002-CD0964247922.1; Fri, 05 Aug 2022 09:21:12 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 06068e001893.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 05 Aug 2022 09:21:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XWuxHEQfo4jQtH3s5eXKvHzrmOxCbdjrHoJ1wOXsVn5ZZaYDVmURyrwK+9YbUQlmx6N7m57FtzeCD8Gm05yEsxDBrWIxNE8Z05Lc7/iPT0lBvVCv6YAgqhPN085yERTyrCDsxLUy9N0DGtl6HfwsvjrJTWgup5Ij7EdOOsbKGk7IBTSCCASr/Nm+Fsi+eY1jNZdHDyGo6x87JSPzFEMs3WzIfLl1vaLr6Mq7BN/OTlQiM/Kx5gYa62ldORXU4jJI+wh5tP+tzurvMMfWnr/Eifveav/+ba2JD6stCGcxWu50VfFgRz2SENkvZ3iQNJqsWREmZfSGhzZcP31kGhrrFQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=W3VOt9cW0vETcy7LtEpFHJ/h/gkeGj1fPPbZ63nGyX0=; b=i7W8fpp5v6nZN1iXbwZNH2/D/xB9E/EJKVlaTVMHiz4YI82mOFWGm5G0qIUQiskdELwPeZrF9nUHh/+9PpnbHH1jgeoG4FuX090ZYRk417fyl4pmhJiuF94RN6dLVV5c3FaIk+2r2VTcBrF/+QXoyPnTYiFT52fr+m1gBZkvpPPPJ1bZ4Ydy1RlAWMHW88IHE0w4XvJ33IqylkLZC00Sa/rNe9V+diaeecLlxw3vcjEg3SyvMCFwRcfQpDeMZXY+Oczie8GpS6NjyxFcWOF83zZdV6z2Bt+zbzhS3F6iZmqXlYXGKpyBFL19hXNJHOgqUY5WWj0IIalMu/XWUOPaEw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=sourceware.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 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=W3VOt9cW0vETcy7LtEpFHJ/h/gkeGj1fPPbZ63nGyX0=; b=FwjqIq9uLBFhtV33MM/hSVKrDvGO9GUhii01Ljyvu5GIEJuBy2fITwP2L+xHkmw4AjJbndhJj7pmwPFpEggzRD3dyoeIJNC5Ol1lPkULQpx2koapXr+7f7PjnTsOYLY6qJKwn9H6f4ResJrr1Vs0MbOpv6yI8FoUL1HhPitIKKY= Received: from AS8PR04CA0141.eurprd04.prod.outlook.com (2603:10a6:20b:127::26) by AM0PR08MB4369.eurprd08.prod.outlook.com (2603:10a6:208:13e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Fri, 5 Aug 2022 09:21:10 +0000 Received: from AM5EUR03FT035.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:127:cafe::bb) by AS8PR04CA0141.outlook.office365.com (2603:10a6:20b:127::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16 via Frontend Transport; Fri, 5 Aug 2022 09:21:10 +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 AM5EUR03FT035.mail.protection.outlook.com (10.152.16.119) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5482.12 via Frontend Transport; Fri, 5 Aug 2022 09:21:09 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2507.9; Fri, 5 Aug 2022 09:21:09 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.9; Fri, 5 Aug 2022 09:21:09 +0000 Received: from e125768 (10.2.78.50) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.9 via Frontend Transport; Fri, 5 Aug 2022 09:21:09 +0000 From: "Victor L. Do Nascimento" To: Richard Earnshaw CC: , Subject: Re: [PATCH v2 1/8] newlib: libc: define M-profile PACBTI-enablement macros In-Reply-To: <72ab6827-13eb-a2ed-668c-d6b53a83e9ca@foss.arm.com> (Richard Earnshaw's message of "Thu, 4 Aug 2022 16:19:21 +0100") References: <20220803153524.20631-1-victor.donascimento@arm.com> <20220803153524.20631-2-victor.donascimento@arm.com> <72ab6827-13eb-a2ed-668c-d6b53a83e9ca@foss.arm.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) Date: Fri, 5 Aug 2022 10:21:08 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: 2ef25868-cb27-4cae-a75d-08da76c3db30 X-MS-TrafficTypeDiagnostic: AM0PR08MB4369:EE_|AM5EUR03FT027:EE_|AM0PR08MB4114:EE_ x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: XnXewYhcv+k3tvJ/Yz93LeWHHR+gjjnG9tbVMlsfpF7JN38aPpPvktm6YwFKv33TOXXBYYDXja8vvcguPqT0mdNMA/csyvAFP02AuIQh12zYBVTnnd5NTu86bwW/YUK1VhPw18MS7b/8/fMU1JYTgEFEY975gN/NxZ2q3FHrCVBxZGrbEfuHMAeeAjL2veWBbDh71pVDT74hTAQ4H88xXK1s777i5CfFe4eFHOZ62cFob0HsclX7zKA6/02Fl1IwOH2iecQtxtJ6mjyBryB5i43c/hJuCgV0Nx7ajHXI3+EstWIm7h3JpBT+mhbJY2O50y8+Bu3816s+MowQLTJGrUvHiigYLFCtgY4X9gopgdIXAoC949hpBFg1KGOklis0v1jts3+ZXKEZwXgjFqcYapIILtFYiuABXvcE58KKx8kXc3gH3Zl0GEadtN2B3+CDBjn7CO1/gKhe6XXb7xzlJuyvKIAbfNTFcSy98Q7+vs2QvxInKSazM/l2nUkntvfVNuCYH55ahVb5y+iMVwjYBY6wUzYoc+QZ2FyvT9hDSoEGDcwf0lH+xPhgxY79FfXL5ZHtkpfrFIEvf6YlrS4PyVPJ2jDis1oua0HX7AVbielInLxM9S8qr1dsAD2zBamBykmz6AWwHcQJxSJ9oqOyq+DFPTagRsNpQRFrMDrob2ECvYrUvV1fHo+P2+sFpTV9Uzk7h9urqRDdxX9PsI0vW7RuK/PSc82OWFRTC0Ops2Xp8JAtS0zo/Scslub1QNVTz7LEvWZEXXkLCjUwBEtJ3BDAouj5Hn2zV/z8v4pvJoKkDgKP3uMR1CpLlBCMU66uZJ7qndfbinRzZPfQqPkqew== 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:(13230016)(4636009)(136003)(346002)(376002)(396003)(39860400002)(36840700001)(46966006)(40470700004)(82740400003)(81166007)(356005)(36860700001)(426003)(2616005)(186003)(47076005)(83380400001)(6862004)(8936002)(4326008)(40460700003)(336012)(8676002)(70206006)(70586007)(5660300002)(82310400005)(40480700001)(41300700001)(2906002)(478600001)(26005)(316002)(86362001)(53546011)(54906003)(36756003)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4369 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT027.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: f66ee18e-81b5-422a-6d69-08da76c3d58b X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ssR8B38ZNk552WbMD4gEsfanfFD5nc8OCpgR92q0ZZ+AH0Bs3ung+nbTPtloFyjVPNR+5DkwjU2UDvLOrR8OBTjPRaDuUjTLkfxv0U/gvlydHoGEl8Q6SYbH1lbxUa4UmsCqTpRHByacbtBsRxv6sbVRAhImVNM7KF4U4uI7OD1o49h2owo/mtSDxp/kDwC5r04ST8t2yctNFyelrVRXfnvbqZ43LFpwbylyMKXB5uc/j0+0qTQQqkiOhohusmvuyjWazPM+bzLl95D02y68O3H+XBQ32avDvPvqFCWQISD8WAQLHU9au5wwdL6oIo+abKeR2x2VtH2No4ANcukKPR0lViO021mW6IsWcfMzqYhu7g/qqJ/7MaoZ/X8cnA6utzduywJ4b93GyDZkIsLuZrPwmt1RPeck7aMKhvtNgo7vLSDvOxuNX/7T12v9wl2jV8yPL56ORZv2zUve/F4Xdqw0Tw9CYJkNPF8OTB0CTmdpJR/G27op3c+yWYu5szoxBtFcyDFEpDTFQKOOlsFKfVNVs5dLcBSdio1cLQ7iak8el/bseIJraTmZLMpk7cfPHgpy02o1AfjvTcCEw/E938EGlkevDQ8ng+LfaLVOJv+Op/qYYN5foVQ8PL/+YZF6Ph3gTJORV5rMG7sahMcuZbZJda6g2rkVksJChKg2Plat2w4wm7x5i0Pybkjpr9b5HC27wkMjfhLiq0zo5kghHX7QIW1wcBUotm8nPql9ZLlXS2J5CbXqtXiPXJ4hEpZFkICeFRf2gpwMBIKwn4aQVyV9Xnj7/VShv+1Dbd6/BWk1qmngH8tdYIBkYD0HQx2o 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:(13230016)(4636009)(136003)(39860400002)(396003)(346002)(376002)(46966006)(40470700004)(36840700001)(82310400005)(53546011)(70586007)(70206006)(8676002)(4326008)(81166007)(82740400003)(26005)(36756003)(86362001)(41300700001)(83380400001)(336012)(2906002)(186003)(478600001)(5660300002)(426003)(6862004)(8936002)(47076005)(2616005)(54906003)(36860700001)(40460700003)(40480700001)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2022 09:21:19.3820 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ef25868-cb27-4cae-a75d-08da76c3db30 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: AM5EUR03FT027.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4114 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_NONE, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE, 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: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Aug 2022 09:21:26 -0000 Richard Earnshaw writes: > On 03/08/2022 16:35, Victor Do Nascimento wrote: >> Create an assembly header file that conditionally defines fuction >> prologues/epilogues depending on the compile-time mbranch-protection >> argument values. >> * newlib/libc/machine/arm/pacbti.h: New. >> --- >> newlib/libc/machine/arm/pacbti.h | 64 ++++++++++++++++++++++++++++++++ >> 1 file changed, 64 insertions(+) >> create mode 100644 newlib/libc/machine/arm/pacbti.h >> diff --git a/newlib/libc/machine/arm/pacbti.h >> b/newlib/libc/machine/arm/pacbti.h >> new file mode 100644 >> index 000000000..4c31d00bc >> --- /dev/null >> +++ b/newlib/libc/machine/arm/pacbti.h >> @@ -0,0 +1,64 @@ >> +/* >> + * Copyright (c) 2022 Arm Ltd >> + * All rights reserved. >> + * >> + * Redistribution and use in source and binary forms, with or without >> + * modification, are permitted provided that the following conditions >> + * are met: >> + * 1. Redistributions of source code must retain the above copyright >> + * notice, this list of conditions and the following disclaimer. >> + * 2. Redistributions in binary form must reproduce the above copyright >> + * notice, this list of conditions and the following disclaimer in the >> + * documentation and/or other materials provided with the distribution. >> + * 3. The name of the company may not be used to endorse or promote >> + * products derived from this software without specific prior written >> + * permission. >> + * >> + * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED >> + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF >> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. >> + * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, >> + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED >> + * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >> + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF >> + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING >> + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS >> + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >> + */ >> + >> +/* Checki whether leaf function PAC signing has been requested >> + in the -mbranch-protect compile-time option. */ >> +#define LEAF_PROTECT_BIT 2 >> +#define __HAVE_PAC_LEAF \ >> + __ARM_FEATURE_PAC_DEFAULT & (1 << LEAF_PROTECT_BIT) > > Either this header needs to avoid polluting the user namespace, or it > doesn't. If it does, then LEAF_PROTECT_BIT fails to do that. If it > doesn't then __HAVE_PAC_LEAF should really be HAVE_PAC_LEAF (to avoid > polluting the reserved namespace. I suspect this header is private to > newlib (won't be exported to users), so should not be prefixing names > with __. > >> + >> +/* Macro to handle function entry depending on branch-protection >> + schemes. */ >> + .macro pacbti_prologue >> +#if __HAVE_PAC_LEAF >> +#if __ARM_FEATURE_BTI_DEFAULT >> + pacbti ip, lr, sp >> +#else >> + pac ip, lr, sp >> +#endif /* __ARM_FEATURE_BTI_DEFAULT */ >> + .cfi_register 143, 12 >> + str ip, [sp, #-4]! > > This causes the stack to lose 8-byte alignment. Whilst for leaf > functions that's probably not a problem, the macro should have an > option where the user can ask for alignment to be preserved. But > there should also be an option to not save IP on the stack at all (for > when the user does not modify IP in the function body). Thanks for the feedback here. So we introduce two options the user is given control over. I guess this raises two questions concerning design choices to be made. 1. How do we expose these options to the user, and 2. What should we define as default values? Regarding defaults, in order to maximize performance my initial guess would be that we don't push IP to the stack, such that we save on instructions by omitting pushes and pops and automatically preserve stack alignment that way. Even so, that leaves the question of how to best allow users to modify these parameters prior to compiling the library. Any thoughts?? >> + .save {ra_auth_code} >> + .cfi_def_cfa_offset 4 >> + .cfi_offset 143, -4 >> +#elif __ARM_FEATURE_BTI_DEFAULT >> + bti >> +#endif /* __HAVE_PAC_LEAF */ >> + .endm >> + >> +/* Macro to handle different branch exchange cases depending on >> + branch-protection schemes. */ >> + .macro pacbti_epilogue >> +#if __HAVE_PAC_LEAF >> + ldr ip, [sp], #4 >> + .cfi_restore 143 >> + .cfi_def_cfa_offset 0 >> + aut ip, lr, sp >> +#endif /* __HAVE_PAC_LEAF */ >> + bx lr >> + .endm > > I think these macros are really misnamed, firstly, they're only for > leaf functions and secondly, they (particularly the epilogue) does > something even if PAC is not needed. So I think they should be > renamed as 'leaf_prologue' and 'leaf_epilogue' respectively. Agreed. > In consequence, I think this file should really be merged into the > existing arm_asm.h, then we don't need yet another header file. > > Finally, the header needs to define a (C) macro that defines how much > to adjust the CFI offset by for various scenarios: > - When PAC is not used > - When PAC is used with no alignment > - When PAC is used and asked for 8-byte alignment to be preserved. I'm thinking we set the value of PAC_CFI_ADJ contigent on values of PAC_LEAF_PUSH_SP and PAC_PRESERVE_STACK_ALIGN when HAVE_PAC_LEAF is set (once I define these new macros, of course). V. > R.