From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80073.outbound.protection.outlook.com [40.107.8.73]) by sourceware.org (Postfix) with ESMTPS id 2AD8E3853544 for ; Tue, 5 Jul 2022 13:58:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2AD8E3853544 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=VEHEIWZoCjpT+EPDnakCuVnMDxGHT41vuwYWqRm62R5aSFVJULArbaJwWKcVcUagTuTkH1yyiCx3hTYpGkXltAG6tVKio5pQzuVmDdP7XqUnpV4RijF+MFG4Es9riOSaufEXnCLxhhtSYMAirOw0yqcBj9/QlSFa01B+g6o/+0Kd80FCBjz3Xgyh+7FKP23B+K18C4SSOqQMyDojGXrD4eoJTpnz4VgkzJNzY4QtzYKH3vIxQJ+jEQLkt/se87H7Ja8HwtVHoH94DDQCtt/VGAiVwcB7mI6lPf6te5rrnz2y87sxnES9SLxYUMBmfJ0TyQCIkkitTjc92K1X7XzJqg== 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=MzrVpjU8EcUJx1wL803ec7hG9eb0qTCc6AkGnl6Cpog=; b=b7dfKMMdEGmE96jYMdDjrj3zTY2/IscRLhKbeW1IMaGefs+stXFEB0YCC/1RyRbwZ5nZV+Ri6Nojw6vKGMKxX4YpRzdQ99FsJHKcnbuQwbcIiJxe7GMtDHMXMC3eQuoXP55obVkpqFrRkYhK4fv3LnOtvfrlmyJCGCGteZHSrtCaas/z6ZKOd/BkO5krNN/jUt2G9eZMQNVnmjPDRuhB1Yg0SLtG377u6Jp5ttSz9vPzYnfO+vK7eYnvo9fAnh8QR3+AJVpFdmsQgup8Izf6OWtIsfZvQDiJkpdkMpYypRBPscBE6FFaiPEYrAIfx43SQCl6XEyPffZI3Y7GmWkzgQ== 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=MzrVpjU8EcUJx1wL803ec7hG9eb0qTCc6AkGnl6Cpog=; b=9hxIfU/ByjF4RgN41bANy9X4nm8NhrnbL2Gu4GfLjAW9K8ETIzK8XOpF4XnkS6+8NepNDHAyZWN19q/rJshGKFwqddlYfn2vrI5RT1R70mfuARop7lWeVkkkYnwXN8OOORHDJBEHu1kfzdxl7cLrlmWA49vQjBWhlxTA0tBdygo= Received: from AS8PR07CA0052.eurprd07.prod.outlook.com (2603:10a6:20b:459::13) by DB7PR08MB3516.eurprd08.prod.outlook.com (2603:10a6:10:4f::15) 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:56 +0000 Received: from AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:459:cafe::3a) by AS8PR07CA0052.outlook.office365.com (2603:10a6:20b:459::13) 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:56 +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 AM5EUR03FT009.mail.protection.outlook.com (10.152.16.110) 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:56 +0000 Received: ("Tessian outbound 9336577968ca:v121"); Tue, 05 Jul 2022 13:58:56 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e8a643d382992855 X-CR-MTA-TID: 64aa7808 Received: from 73bf33150e14.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 80CA02BC-99C6-4197-A1EB-910560272699.1; Tue, 05 Jul 2022 13:58:50 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 73bf33150e14.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 05 Jul 2022 13:58:50 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UG5DjPaho5ErNsyDov/zlDvI+pX0JEKH4kemvYojDVxRfdr6Nv5RW3E3PWDYn63q5f/KLxs3TzeitwebJTW5Ew6dNCoGU4aRJp2h1qGotdwjA7ZqV3EIAzV4fQAnZ6h4g24UtUcuXjxtMOnMdIyuQoadx8qkiZAiEXYtPalg4y24hYbuP5hcpkmVmaVlzoy2QEzBQoIwGjlWgJM4tGZm4DcP2fm1MhodHwnXPIFOmMNlFwiasWLGW85r/BiteY5oTB8RDJY6iUGp6iuOBSRJll3IFwrP3kvESVBLcUIpdN15kj8r+9euGAfjmXFue+K9e+mfqmblE3ai7K1awj7Tlw== 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=MzrVpjU8EcUJx1wL803ec7hG9eb0qTCc6AkGnl6Cpog=; b=Mspjv7NNsTiLcrrddPWvsu6LGKdwBPqUrUXY89zrveuG+MvXvyKSqYArXPphmDgodWJOzTjA5qeemb0l+B7Uwz0Rg0ElxOZZK5j5420GXL6C8OZPP68ss2v1v1aBQNU6WAnbrthj6KHqeixtahx2BSrg96DhxC7ZM+Z4hFJoE9W4zXgOWAMQ2C57duIfdVs916I5CVvBu4/OQRYlShdZr1gbGK4RyuO0wT5fuKI6FRsmLs2k7zb2eoaDsMPWuvThzk/q2bIQM8LgLCIFc4D4K2WvvifLr5W3aZhPRV2lTMqp6JGdA4rgZvGMGnxktJU4xD/LMl1mlLs97d4SxfY6qA== 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=MzrVpjU8EcUJx1wL803ec7hG9eb0qTCc6AkGnl6Cpog=; b=9hxIfU/ByjF4RgN41bANy9X4nm8NhrnbL2Gu4GfLjAW9K8ETIzK8XOpF4XnkS6+8NepNDHAyZWN19q/rJshGKFwqddlYfn2vrI5RT1R70mfuARop7lWeVkkkYnwXN8OOORHDJBEHu1kfzdxl7cLrlmWA49vQjBWhlxTA0tBdygo= Received: from AM5PR04CA0022.eurprd04.prod.outlook.com (2603:10a6:206:1::35) by DBAPR08MB5863.eurprd08.prod.outlook.com (2603:10a6:10:1a1::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.14; Tue, 5 Jul 2022 13:58:38 +0000 Received: from VE1EUR03FT022.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:1:cafe::fb) by AM5PR04CA0022.outlook.office365.com (2603:10a6:206:1::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.21 via Frontend Transport; Tue, 5 Jul 2022 13:58:38 +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 VE1EUR03FT022.mail.protection.outlook.com (10.152.18.64) 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:37 +0000 Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2507.9; Tue, 5 Jul 2022 13:58:25 +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; 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:25 +0000 From: Victor Do Nascimento To: Subject: [PATCH 7/8] newlib: libc: aeabi_memmove M-profile PACBTI-enablement Date: Tue, 5 Jul 2022 14:58:17 +0100 Message-ID: <20220705135818.50088-8-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: 6d01726d-9db7-4fa9-c6ab-08da5e8e80c3 X-MS-TrafficTypeDiagnostic: DBAPR08MB5863:EE_|AM5EUR03FT009:EE_|DB7PR08MB3516: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: hHiYerPSaLX14HiaT5gtxPU/KqCGhX5tQmDNBkCiOC0ibfPLmyxL6efojn4diXg/DFWlvofeNHfY1ACelbP0IjXthegB0K5dUBu7TUzP7+/BgOfwN9+x+rdk7+Xb2oA60YNzIJYhufunHf1HrukjlqT4rgher1Uejm6sGnPHBwZsK8E5XNKHLhX6mweDUS+s2sxOyVWMm7KvwIuODCAjp5hoX3MqxKhW8Z5Q/A3aPOHxRk3jWlSSGkN7aW1eHtkC/v+QbXB8x2z+wA1ZKoCjj/FInw7QA7cgeW78u7Lsx1R29GJVKP4tOlYriMy+F+eVYzzNAN7jz3PHhY1wu0Sz/0J4GxkAHR7UEdgWea53c8Sq+5DBgnlFKdpXZLIsxSGW0XacS/2uBpFJAqFp5N0ExF/OvyQYsmslfPCjJxm3qeqEjyt5sGi/EYoZx2H6nUypVydJU+uOktTndLnBb0HjEeMxng5yrey0VMyYSqJdmmHOfbhMd9QiuVwx19MI41duMyUTIz50H+1nnsESdvOh8hGtYVDfo7uUIJx/wukEU0Qq61a+UJQtDF3CYQ8RV+PbiqNIrNbKxrLhE8XfuG+kawqVLAmua3sYoxtCABAOI0Z/xZnGngJ4TwIBQMyllcmu0LsuHCTBz1YtK7zD6+wIK9I0LeRYUpQZ5KulKsrJi7B5iba38XlFMbnes+oHFCsjPJo5iDMa4UOvGU4r2JN/8EjYEnKwrwogUSgzyo9nePJ7KsQleg2ZAqmsqE+CywgkuvCsqXHPyEVyjOMcdf7aN/17ZanvwpwJSdpxQ84TQDSupEzDuXLEyxIsEQdxofBOL40eoNjav5TtqQmOczkg0y/KfOpS2HRjk9WLlaWixwg= 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)(376002)(346002)(396003)(136003)(39860400002)(40470700004)(36840700001)(46966006)(316002)(70206006)(8676002)(70586007)(7696005)(478600001)(4326008)(6916009)(6666004)(40460700003)(82310400005)(8936002)(40480700001)(2906002)(5660300002)(36860700001)(36756003)(86362001)(81166007)(356005)(82740400003)(1076003)(426003)(2616005)(186003)(336012)(83380400001)(47076005)(41300700001)(26005)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR08MB5863 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: b1c345bb-dc9d-4fd6-bb38-08da5e8e75a5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MVxtZOBVDT/kQXVB5e5q3oP48EVGXYIKayaaPqWJRCm2Oh65l9XZALPVMGZU/snuJ/r1ZPV+opkXX7SW3C45k5ZiFYJZUUReWddHV8UDeahHBL13T4YrwyL7P9JStDWwi/avUolIHM+oEFMvH4xDsWoUegWxM00Iouv5NP3iBASFDDPh1fLM+j0bBqQ+wuKN+9hePgZ6hofUparrMpKoQ7FdUdsYGmJlrRALz8qqRx9RTEY5qZWmRIWzgGd1uyOatBPBESvljEKlvtBbPkXfbdqRpV8NWKSH9EVLNnOZMZhgJBrWjgdZE1TVxFYQsIoHJcerzhGdF9pziqK7++V1W0ognFwdBa1bCWsTk1ZleTp01Cpeqd//rmMCLHyJv+AoQMDyJ4mW9i52LJgjRSClJCwoy1qH5CJ9GFAdXeHZFXboOHWhkMqGdYneiK+bkxMPHZAjfyT/ptOrgyQ65X+HodjZidPG/xKzhqIl4TuWe/iYx5qmctTb9AF74sOeUygeQgowPGP5gU/apfTVJ182Kr4Rdmqb5IWCylKdx7767ulaBFp/RHta9QJf4iMQ/kqIcZuA1/vmJ5j25TLf/EuSpAAmG0VNxklDfjncuFhbq096uNogCGX5Q9KmUbaTdnsgZSuQ62y2pXgdaWmn7rN6e9368jASNvZh4BtWMZhVyh4bDDoe9we2h1vLb91fH/66bN9uk9gzWgaPxWg4mqUIDTnNwPrQ5Rc4mNbSBJulAjppMhTPdivC83L9R6/j8OSDuO6qQbu7Ii8zbv1ES9zxXqwvKVVBo49WD/Ww8rsXXOi+AZWcNgRRR82SmCElRo8p 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)(376002)(346002)(136003)(39860400002)(396003)(36840700001)(46966006)(40470700004)(47076005)(336012)(426003)(83380400001)(36756003)(41300700001)(6666004)(6916009)(186003)(40460700003)(36860700001)(316002)(82310400005)(4326008)(8676002)(70586007)(70206006)(5660300002)(7696005)(1076003)(81166007)(8936002)(2616005)(478600001)(2906002)(86362001)(82740400003)(40480700001)(26005); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jul 2022 13:58:56.4246 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6d01726d-9db7-4fa9-c6ab-08da5e8e80c3 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: AM5EUR03FT009.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3516 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: Tue, 05 Jul 2022 13:59:01 -0000 Add function prologue/epilogue to conditionally add BTI landing pads and/or PAC code generation & authentication instructions depending on compilation flags. --- .../libc/machine/arm/aeabi_memmove-thumb2.S | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/newlib/libc/machine/arm/aeabi_memmove-thumb2.S b/newlib/libc/machine/arm/aeabi_memmove-thumb2.S index e9504437b..237e63cc0 100644 --- a/newlib/libc/machine/arm/aeabi_memmove-thumb2.S +++ b/newlib/libc/machine/arm/aeabi_memmove-thumb2.S @@ -26,6 +26,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + #include "pacbti.h" + .thumb .syntax unified .global __aeabi_memmove @@ -33,8 +35,18 @@ ASM_ALIAS __aeabi_memmove4 __aeabi_memmove ASM_ALIAS __aeabi_memmove8 __aeabi_memmove __aeabi_memmove: + .fnstart + .cfi_startproc + pacbti_prologue cmp r0, r1 push {r4} + .save {r4} + .cfi_adjust_cfa_offset 4 +#if __ARM_FEATURE_PAC_DEFAULT + .cfi_offset 4, -8 +#else + .cfi_offset 4, -4 +#endif /* __ARM_FEATURE_PAC_DEFAULT */ bls 3f adds r3, r1, r2 cmp r0, r3 @@ -48,8 +60,18 @@ __aeabi_memmove: strb r4, [r1, #-1]! bne 1b 2: - pop {r4} - bx lr +#if __ARM_FEATURE_PAC_DEFAULT + pop {r4, ip} + .cfi_restore 4 + .cfi_restore 143 + .cfi_def_cfa_offset 0 + aut ip, lr, sp +#else + pop {r4} + .cfi_restore 4 + .cfi_def_cfa_offset 0 +#endif /* __ARM_FEATURE_PAC_DEFAULT */ + bx lr 3: cmp r2, #0 beq 2b @@ -60,6 +82,18 @@ __aeabi_memmove: cmp r2, r1 strb r4, [r3, #1]! bne 4b - pop {r4} - bx lr +#if __ARM_FEATURE_PAC_DEFAULT + pop {r4, ip} + .cfi_restore 4 + .cfi_restore 143 + .cfi_def_cfa_offset 0 + aut ip, lr, sp +#else + pop {r4} + .cfi_restore 4 + .cfi_def_cfa_offset 0 +#endif /* __ARM_FEATURE_PAC_DEFAULT */ + bx lr + .cfi_endproc + .fnend .size __aeabi_memmove, . - __aeabi_memmove -- 2.36.1