From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80044.outbound.protection.outlook.com [40.107.8.44]) by sourceware.org (Postfix) with ESMTPS id AE22B3857426 for ; Tue, 5 Jul 2022 13:58:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AE22B3857426 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=M+e1FHeb2MP+AP43ircYHUcYGnf3m09+ijMResWACWwFo7GT8jTfBnHPthXvlMctA+93TXHu7sQUUvwf5k0rCDymnsuJ3zRJzwKlkbiWtbvuiA/Hmxxlolo/zFWrI8y4iyzp1RJEspbHIB0gtVanNszTj0EV39v25K8gdFIzc+6nOKbsZtBA05uX8o4hs7znqaMmKepHfx5zW479O5ALV8J8QmiLn8LG+vnTtrJzfVTUqA3ZPpqoacDWOUSRZE4/HVCjXhHPDH2H7XlUWxb55V5jz1bsGk7XcxYOhMwOxiGF4pyYDPRSSTTWRnTYLnEsPo9b7mohTh97ciKd7W9Bcg== 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=FScAlB8tAcZziNCClj9kzVRR0QKDhzGkETCqAj4jIJY=; b=e3BdQ2UitEPYZ/LgSa7pgH60QEJKe/IMDYSiFXVcTDIr1aw07g5BeOuIFwKzibC/13JLegJtoZzwbhz58vcPDj0tcvw/sLoJpR6ljynG3KBVewIKq7jwWIFpB8SHn1P66ulYokBhPE/9Fs50FUrikJIBMhpVu3POJPfVOMu3ZM7nks9WRGKuOq9GGv04W10IuAqkA9leMZMhWkjU2zAfC90vWZ2CD8KHSaC6exHWfAe1u7CriQt2L6zJdScGdlPilEz6fwMK0sBcUikSOSowTpM0mXHJ/PEVT/y+S7djT9GdPIWh8KC/cxzskFvOJ5tfnzQqrHF8rS9DFNSnvaO67Q== 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=FScAlB8tAcZziNCClj9kzVRR0QKDhzGkETCqAj4jIJY=; b=wQy3pWB380K0xQVGlymGDNYQiyNsw9+H7cLQNY2uF0slDWbdfAjUuhhHdSTkQiclmDEew8bE7NvVGatY86EJQEOGb0B7HTAO2BMTdscl1F5iH2N3p1qoW8ab1XC+RsbS55GRP1zq/nXTXnPAC6nc9HCJUX9C/wPI6XEuLTo2o0Q= Received: from DB6PR07CA0012.eurprd07.prod.outlook.com (2603:10a6:6:2d::22) by VI1PR08MB5294.eurprd08.prod.outlook.com (2603:10a6:803:de::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Tue, 5 Jul 2022 13:58:43 +0000 Received: from DBAEUR03FT012.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2d:cafe::b6) by DB6PR07CA0012.outlook.office365.com (2603:10a6:6:2d::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5417.14 via Frontend Transport; Tue, 5 Jul 2022 13:58:43 +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 DBAEUR03FT012.mail.protection.outlook.com (100.127.142.126) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14 via Frontend Transport; Tue, 5 Jul 2022 13:58:43 +0000 Received: ("Tessian outbound d5fa056a5959:v121"); Tue, 05 Jul 2022 13:58:43 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: cb9ca17578efc96a X-CR-MTA-TID: 64aa7808 Received: from 99e6990649e8.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id C2EFB14C-EB65-4179-A6E8-F913EA0F161C.1; Tue, 05 Jul 2022 13:58:36 +0000 Received: from EUR03-DBA-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 99e6990649e8.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 05 Jul 2022 13:58:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gres2qvcX3Drs5zvjVGmcsDBZoosryuS6EA5mStKUrkngPiR2jV2zYtXc8uMlb9BUdkpwm604tC0S7IXb9uNy6+343hISJM+oClUY9d64QkoOitM/dttv6uSgxdI78mdTcdjT2wv7+ueMcBKrtVheOvE6PqEfYvBUFv9AyKBqQwfjiyh+lVsA13QHt0NGQdqX3DVDCTwbQWxLj4k+eDSviKv8AczwVkklcZyJGYTFu4hmKf4qPfOe+UAqFHUDelZqDGUKeilAimBf6ntnyP+rD8aMANefAyX4J5iOM2RudUQW+QX5CQTOxJnTDZsHVBCRZwPPfp85RCzV0va7KSVMg== 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=FScAlB8tAcZziNCClj9kzVRR0QKDhzGkETCqAj4jIJY=; b=GImqub26KUYlj0shlqG3exWJXw5zrYX3qqFnq8pZ3fwdKtukmCgsSiq8SrTdBW7Hk0k1IEO9UYQjKqVyWpiPgcaPoiRM96CpmW3uAkMtDxiENIQiWtqd4wAF6cKxYqE1XbnVpst8e04zbDkB1O6LaI6HaW5BgEIJ/QilLXbHWnk258cDy0U6zbp8aYNnrBaOWzIHd3dQHrzsA2Sx2t0VkwxdcwduTdexoUjbYGLx5NUPvpzPzDT+AYoZFiwTnh99zhmajOKSH44mhW0YiO95z6HutI05Y2/zL6ysI18mQQb92EENdUWu9Hq3agGhX3d+xUitZISOJAvq98CIuVp69g== 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=FScAlB8tAcZziNCClj9kzVRR0QKDhzGkETCqAj4jIJY=; b=wQy3pWB380K0xQVGlymGDNYQiyNsw9+H7cLQNY2uF0slDWbdfAjUuhhHdSTkQiclmDEew8bE7NvVGatY86EJQEOGb0B7HTAO2BMTdscl1F5iH2N3p1qoW8ab1XC+RsbS55GRP1zq/nXTXnPAC6nc9HCJUX9C/wPI6XEuLTo2o0Q= Received: from AM6P194CA0071.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:84::48) by VI1PR08MB3360.eurprd08.prod.outlook.com (2603:10a6:803:3f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.17; Tue, 5 Jul 2022 13:58:34 +0000 Received: from VE1EUR03FT032.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:84:cafe::23) by AM6P194CA0071.outlook.office365.com (2603:10a6:209:84::48) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14 via Frontend Transport; Tue, 5 Jul 2022 13:58:34 +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 VE1EUR03FT032.mail.protection.outlook.com (10.152.18.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5395.14 via Frontend Transport; Tue, 5 Jul 2022 13:58:33 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX04.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; Tue, 5 Jul 2022 13:58:25 +0000 Received: from e125768.cambridge.arm.com (10.2.78.50) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.9 via Frontend Transport; Tue, 5 Jul 2022 13:58:24 +0000 From: Victor Do Nascimento To: Subject: [PATCH 6/8] newlib: libc: setjmp/longjmp M-profile PACBTI-enablement Date: Tue, 5 Jul 2022 14:58:16 +0100 Message-ID: <20220705135818.50088-7-victor.donascimento@arm.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220705135818.50088-1-victor.donascimento@arm.com> References: <20220705135818.50088-1-victor.donascimento@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: ed767c4e-d9e1-46de-c16a-08da5e8e78fc X-MS-TrafficTypeDiagnostic: VI1PR08MB3360:EE_|DBAEUR03FT012:EE_|VI1PR08MB5294: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: OvkLK8fI/fBYtgO45kk2QrC+Ya5GpHWosGbPCpB/bh8fm1XdO3oINTrV4OgFAn+sWk9CXqLgVDvi/urN50BfQgO0fqTJXr3AsdmttJXrKA2G9NfO0d+ERBSGotvNPfth4TqXonLSNOFOJkuxhcqY9yyZSDP2tB1UkNSPlHePU0prza6+QzE4q22sZ6mPoDrrxTKIdpwPOfpRQvG4K1bPh0VYymk3E7GAwIYFb77YE19qJlm2HZ7S/Ctkx7P77Eks1tVE76SMa0aZ4IRai2T8RIVa9v5XtXBGLba4OZUlKhyldh8WdfBlad0zaU43jhFvjmLC4K8oPY+9U2oxr+HJ3DeAW1aJ0X9DqaBlcSiB8okVR1xTZ46axZb2Ehjj7Yyz0r/od6wQfSWvc99UeDVD/NKJQrPucT4Cv5CYnucS2iu9K+sH7hrp75iNAajwlO7A9QScf860vZwRfkALSHSI+WX643j46UZANJh0qIkqUr/rPDXE6RAQhyzuunchlFtg1XEpLCI5IznIbTBcLIcGlDZBzj6xqSU746JTYINZuLbJUVHnJN4qhOy/iO6wrqVo1XJ0UUNeIAkEFU3L9QTGdCDHUgEz6KPT6Q6DrghBvTCUeJGGXLmaCP1bmdY9PPudQcfecHMngPhfjSvuMhdDdLDvyoch7mlMXK/+h6IRjODVAv5VD7lmESeDNKaCZJceBIch5mLPXbJzZ9QaIwng+SlIhCt70k7x5C3zcf0nDUgAQEG17UR0TG+CR10NG3vt9fxzjIK993GIoVRxRMdv6E6AUdxJfDtD2ikbexp3ZcL26EVJ4SLbu2p+5+8++iRtEz4orkdQSofKbsq9cTDv7Xqx1UL4M9nJ+Fsm3R+qu2o= 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)(346002)(136003)(376002)(396003)(39860400002)(46966006)(36840700001)(40470700004)(356005)(82740400003)(40460700003)(8676002)(4326008)(478600001)(70206006)(83380400001)(82310400005)(26005)(7696005)(2906002)(81166007)(8936002)(36756003)(70586007)(5660300002)(47076005)(426003)(2616005)(6916009)(336012)(86362001)(316002)(1076003)(36860700001)(40480700001)(41300700001)(6666004)(186003)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3360 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 3bfd9d6d-33d0-474e-14b8-08da5e8e733f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zp7sLB5R6/h+oj+BrbqKi2vF6j8PS390g647ux/lbTnUZlTi48Pj0rlomKUY22xk61SrtiaXmBExqTwZO76wtS4BBgneEFUL7l+paShm5s0e+uYKPiI8UliW/wfriwf/sA83JbrpbKRltYL3QCjYVMOb7v5quBOyeoDPJomOaJgf9pBUtKxi3GPRC3/JK7eO7aTMYmB+/Et7qZvMrwygmI65vqiNCMkWbY2b2E/PZr5FQHZL9nn7YSoXqsz9zS1xBO2hVj+ql1M8g0nM6OfTSb1fwPdV9JqkkZAb/EFHFGe6rnfZEYIyOYpNja+UunXXgt+OEW4JNHKJOc8uYrMkUvl5GmlCdbinXVMSecCkRIEsh96KLMFSdJC3y89IH6VScorQGzykQN7cJv79shbxwOfzCMx5BlyNvTTSTFx00iv/0TnAOpoht5JAHGhNPZ4Io9i18rNE6PC/j3ruJSFy3CAN0zSWjA5Ar9qN17rnm2CBrMkltHiW/6PV/L3Ygpwk843GcGufxXS2AUD8wL+Dgo27wKki7P6GSeVeUJVzAHih6Q4vaJUd8NN5R9FMJV1r3xJ7HRC1rR1O9gwja7+2eBGjT53XvsOKLB1Dr3BF5N6fWBYopory+xG6AUZDtqr1oaTyhZRllfzLrFyDJASKZaez8KNVh6Ya0HAnuhgqUo6d/bN/m099Bti5qW2NnjoR+MWDjnkeCIvbnHELOQuNyUrSTCKHACwburEgQkj3UzAuNvB5BrqQkqIQwPkwlgtWH0A2vDQ8Cuc4nY7aqcSOAbJ1PG2Tqz7O3EGbVHCZ7RXYhOUMhGPRYZJbNMjq8LCb 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)(376002)(39860400002)(396003)(346002)(46966006)(40470700004)(36840700001)(70206006)(70586007)(8676002)(4326008)(1076003)(36860700001)(8936002)(82310400005)(41300700001)(6666004)(81166007)(36756003)(82740400003)(40480700001)(6916009)(426003)(2906002)(5660300002)(186003)(40460700003)(316002)(26005)(2616005)(83380400001)(86362001)(478600001)(7696005)(47076005)(336012); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2022 13:58:43.4543 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ed767c4e-d9e1-46de-c16a-08da5e8e78fc 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: DBAEUR03FT012.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB5294 X-Spam-Status: No, score=-13.0 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: Tue, 05 Jul 2022 13:58:54 -0000 Add function prologue/epilogue to conditionally add BTI landing pads and/or PAC code generation & authentication instructions depending on compilation flags. --- newlib/libc/machine/arm/setjmp.S | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/newlib/libc/machine/arm/setjmp.S b/newlib/libc/machine/arm/setjmp.S index 21d6ff9e7..d48e1a69b 100644 --- a/newlib/libc/machine/arm/setjmp.S +++ b/newlib/libc/machine/arm/setjmp.S @@ -157,11 +157,15 @@ SYM (.arm_start_of.\name): .globl SYM (\name) TYPE (\name) SYM (\name): + .fnstart + .cfi_startproc PROLOGUE \name .endm .macro FUNC_END name RET + .cfi_endproc + .fnend SIZE (\name) .endm @@ -173,11 +177,25 @@ SYM (\name): /* Save all the callee-preserved registers into the jump buffer. */ #ifdef __thumb2__ +#if __ARM_FEATURE_PAC_DEFAULT +#if __ARM_FEATURE_BTI_DEFAULT + pacbti ip, lr, sp +#else + pac ip, lr, sp +#endif /* __ARM_FEATURE_BTI_DEFAULT */ + mov a4, ip + mov ip, sp + stmea a1!, { a4, v1-v7, fp, ip, lr } +#else +#if __ARM_FEATURE_BTI_DEFAULT + bti +#endif /* __ARM_FEATURE_BTI_DEFAULT */ mov ip, sp stmea a1!, { v1-v7, fp, ip, lr } +#endif /* __ARM_FEATURE_PAC_DEFAULT */ #else stmea a1!, { v1-v7, fp, ip, sp, lr } -#endif +#endif /* __thumb2__ */ #if 0 /* Simulator does not cope with FP instructions yet. */ #ifndef __SOFTFP__ @@ -200,11 +218,17 @@ SYM (\name): /* Restore the registers, retrieving the state when setjmp() was called. */ #ifdef __thumb2__ +#if __ARM_FEATURE_PAC_DEFAULT + ldmfd a1!, { a4, v1-v7, fp, ip, lr } + mov sp, ip + mov ip, a4 +#else ldmfd a1!, { v1-v7, fp, ip, lr } mov sp, ip +#endif /* __ARM_FEATURE_PAC_DEFAULT */ #else ldmfd a1!, { v1-v7, fp, ip, sp, lr } -#endif +#endif /* __thumb2__ */ #if 0 /* Simulator does not cope with FP instructions yet. */ #ifndef __SOFTFP__ @@ -220,5 +244,9 @@ SYM (\name): #endif moveq a1, #1 +#if __ARM_FEATURE_PAC_DEFAULT + aut ip, lr, sp +#endif + FUNC_END longjmp #endif -- 2.36.1