From patchwork Tue Jan 14 04:25:56 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Volodymyr Babchuk X-Patchwork-Id: 13938397 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F798C02185 for ; Tue, 14 Jan 2025 04:26:27 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.870900.1281950 (Exim 4.92) (envelope-from ) id 1tXYVF-0007TP-BE; Tue, 14 Jan 2025 04:26:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 870900.1281950; Tue, 14 Jan 2025 04:26:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tXYVF-0007TI-82; Tue, 14 Jan 2025 04:26:09 +0000 Received: by outflank-mailman (input) for mailman id 870900; Tue, 14 Jan 2025 04:26:07 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tXYVD-0007T1-Qg for xen-devel@lists.xenproject.org; Tue, 14 Jan 2025 04:26:07 +0000 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on20612.outbound.protection.outlook.com [2a01:111:f403:260e::612]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a8db482b-d22f-11ef-99a4-01e77a169b0f; Tue, 14 Jan 2025 05:26:01 +0100 (CET) Received: from GV1PR03MB10456.eurprd03.prod.outlook.com (2603:10a6:150:16a::21) by DB8PR03MB6300.eurprd03.prod.outlook.com (2603:10a6:10:13f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8356.12; Tue, 14 Jan 2025 04:25:58 +0000 Received: from GV1PR03MB10456.eurprd03.prod.outlook.com ([fe80::a41e:5aa8:e298:757e]) by GV1PR03MB10456.eurprd03.prod.outlook.com ([fe80::a41e:5aa8:e298:757e%3]) with mapi id 15.20.8335.015; Tue, 14 Jan 2025 04:25:58 +0000 X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a8db482b-d22f-11ef-99a4-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=twLS1QJUg53q+bKBQGsnqe7IItYwsHmxgiwkTBLCrvglecOqxHDRxvzJTDtcCUTKzfsE6jYvCb24eCHWlXj0a7e87QSZR2S36Zzf24XoBUuoCkmAeEj5pvA3BEejXxIHnXkwKMnfkrNSBwrZhX7lSfg+xm+hm8vATCnPHQdn+pKitA+9tu1HvmJEcWWTaaWAnzDHi+6jqWD71iPgonj95Ov42ib2dnxIf/bnqMiHBuqoW5AkofuNEJBtvGyaIVlN9mDbUhW8A8F9wbSoVCV5GiHrgW7wFY6my6FW1r26jBHKFY2UrvjfJ+LTWG9TcFn1Sqfht3ktu3Xou00y//kx8Q== 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=oOdNcIAOSgUxY9nIPcgrwfCpmXDyekAM1FEvRJo6MHM=; b=OZ5qxIAQY3sIPXf1sT0VPQhwQc84C5GyHdSMB7GX159pdJ08RAgkZC1U5n9tulYujHOO3QXVC6jnS8xsCT2RGIIALsk+Qj5eET3snS8XpfEI3Vyp4zN1qt/HlzJguuKmeyyDhuXNhfB44v/iJAgg5Y84bgdpawKDYLBOqsSZypqUZCTJXNW4dvjKDNzUBstrqsaS9bHNNPZSOUFjCNVhdrxfL9F6kj+UfR4wSE4uw8U5stVlhhtMZexOdggcFg1cKjeiLrSWnFuux26/bjHLhxriMgkD2axk0VT2CH+OnqTgPk5OevflMyO3oJIRSMY0OuZadT42j5zlQ/TL7Jvr5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=epam.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oOdNcIAOSgUxY9nIPcgrwfCpmXDyekAM1FEvRJo6MHM=; b=DLsg94Ut0KSS77Z7PLwsfNKYBbo5rEkAGFDsjOPLU6OSkN7aAwdLAMHibx1mmWqVeKFTF39MLcKg/If9QHXA0mQW1mmh/oaCqlXHXxcToHF/o9CKSmWVkWYZWlovFqx9Xrzh6SenT0Fwh6nL/qkBfwzNgdjAbp34EEXoL1+tTnJEZ8sG/pWE2PuHKNTKyxFiloS41IjgprQYIxEui6H5wohQD7+DJ+CF97sLNrOPIFgfzJovZSlNZ6+sdClZv5WIoTSZ73y+cqYVXq+denwQLc5+ExaqzsLr7/HqV37+RxmsR65K3I/7dzxLg1lLi+TsWSVe2LLS/GHt6zQ271jOSg== From: Volodymyr Babchuk To: "xen-devel@lists.xenproject.org" CC: Volodymyr Babchuk , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH v4 3/4] xen: arm: enable stack protector feature Thread-Topic: [PATCH v4 3/4] xen: arm: enable stack protector feature Thread-Index: AQHbZjxnrBLNCau4fk6dLN+QtVmLtA== Date: Tue, 14 Jan 2025 04:25:56 +0000 Message-ID: <20250114042553.1624831-4-volodymyr_babchuk@epam.com> References: <20250114042553.1624831-1-volodymyr_babchuk@epam.com> In-Reply-To: <20250114042553.1624831-1-volodymyr_babchuk@epam.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.47.1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: GV1PR03MB10456:EE_|DB8PR03MB6300:EE_ x-ms-office365-filtering-correlation-id: 94f90734-a613-48c2-47cc-08dd34538bd1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|376014|366016|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?q?ZD6Dg1neyJjs7BOLntiqSUddy+?= =?iso-8859-1?q?Viycyi58r0PQ/kvvxa9WLUCyN4kLZseiP7WpSQfRoLZbq2k7QhtFo4F3ND5V?= =?iso-8859-1?q?7D41BjdhX9mPZoYf7ssNto0vGYsS5qVDDkHTu5hmuACIS3x9UIjlQNiQNGP2?= =?iso-8859-1?q?TTIuFbODnJvZKU1mDZzJlzRjHCI3+hUW/RF4l+2QItbU2DIkrCyBjSPOD5SH?= =?iso-8859-1?q?47DDuTr/kDyBw38eAwz3w+AYR0QCGBEDFqIZH+E8Uy8XsGJ1E4NGUczKKURl?= =?iso-8859-1?q?KPO98eaNlpTviXvJZIwM9gBOd+nMwQuoUVHVNvXxs+wkh5kGsOi53kC+fBIy?= =?iso-8859-1?q?4tEIlAWGMukQ8mgBQOONCb3YGYe3qfSrYh1GmvIPhIxPAmINdaYgsWtSafoX?= =?iso-8859-1?q?dGOW9Xyhnb6QBrYVen+Q6o5kMYHjWvmkeaFZcIFyIoE3wcj6lXbh8jHdRrc7?= =?iso-8859-1?q?41ucZ/apayyP2t5T1xjtVC+UuIXgOqoS6Mb9yr/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= =?iso-8859-1?q?LZL2V5b++ruciA4TKrf6Dxf/z9S21c5JEyL5ObMuSe1/4RESpkhFSMq5fqS8?= =?iso-8859-1?q?ZN1Zu+hgL+OEihXG/yPvb5t3KIZfRG9aPLR11voK/+r+mEXYksY0VTWBGfGq?= =?iso-8859-1?q?XgfnB/?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR03MB10456.eurprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?q?ibo6LQp/izy3ntUh8tLNS53?= =?iso-8859-1?q?5CENi5aR1fdc/avEr4jxaxYH8o5yI3ux2Z/VO8IzaS6drbmhLYu8C9qsfPa/?= =?iso-8859-1?q?9AfTw8NA6W6NFbnNwfLRjqq8poA7jXjajx27b5UbG3AXaTjSHcybnIaG162H?= =?iso-8859-1?q?93/6TLMKB3q1kPNFLkj96TguqY1o6/RbGUczuGmYqBfc9Evry1qbeBqz2fMf?= =?iso-8859-1?q?wlk14tsoZHzatdhkalpsrcyiXzyQduveXPE5lwNOUNgp8BfsujTifbNina1q?= =?iso-8859-1?q?XJqpSWXlQ8097n4mTw5hCulPog8AB7NbxNbAj3BQUKfQs5ALzn/zmR6VHLsy?= =?iso-8859-1?q?JQ//xzTkSUkM3MY0YXkSj6900ILp0owsd7F3yHcH/xqYPvNf/4Ap8gXRdaYq?= =?iso-8859-1?q?MzC9zRMVLu15K686C/FzAcPjRsn9QIt7lV6JKw2tXFiWIU8AaTm5lzEfJ9AR?= =?iso-8859-1?q?q0LHCX1yHqo83gtZpqkhthyMmrxsUEL86QrhK27losWsF3AiEfPXAQ8uCW4a?= =?iso-8859-1?q?ABgDp3e0nBuknn6FxsvbGIh5PoQkPK93z0mdmFa/+M3uI3/alISKT68vuZ2s?= =?iso-8859-1?q?AcwxQ+A7pH0tAyIKvem+yfKIEadvxnTd7Up5IyOmYTOBZPv228zi94tn34ZJ?= =?iso-8859-1?q?9n5sWysuV5rsnx/Ql95SEEI6MQMst81NbFpwN4khrVii2cHLd8FlQqs3kJ7o?= =?iso-8859-1?q?QQefB/ZJBFMDpa1e99VIfYJ12yZol5mTVDL4Ex4xE+hAPkcuUlCFsRYtj5Ja?= =?iso-8859-1?q?vYl4D1N2k7F60qO6pc1RfrBZnTWpPl+KLJfr3FYXz6YZteYEEx1lKMJpmSnk?= =?iso-8859-1?q?LKaQAdwA+ugMyO5J1j3Z+N4PwZ7DDAbumS747Xmkolivs+HwGGY9GL7UHlQL?= =?iso-8859-1?q?66SjG5SUs3lnNh5IxCf7iv6JY6XwUwtACYmB6Tkg6JeNArxzAYRecb6qvsOC?= =?iso-8859-1?q?4cd98flW935k977e3k8gisYLeTgYhBhaJoMxi16nPukiIDju1lEvw5QdqZEb?= =?iso-8859-1?q?UYckelGKO8LczWllS60/AYHCMdzNuIziTwoMLa5fE8jZ+N4gt3Y/l6e3HD9T?= =?iso-8859-1?q?CWm0Wx0/zpr1qteLLDI+u5XxK8APr+YFvxvMiUGUw6hRMitZhpppTFym07P7?= =?iso-8859-1?q?YPoaP7Dbfu9HFmUYLQdGuDucSnG73V7bpqKu6ezKxmheuxB/MGXwRNooYyzx?= =?iso-8859-1?q?NrPFvAUrghkXpx1xH+xRwhDFkikEgkC7k50wHv9U9TiSpRw+rjf5TBCDFf1U?= =?iso-8859-1?q?gvmszPrIKODCJYecTuITygTt2KmNcVZ3h1CsrkqhAejxiXNjPHQYcCKeQlqR?= =?iso-8859-1?q?yaoTEjqgxNJCVOlYBHUtPGrbHE1tjrXoOX2OfUkUsHWzN4i7jb2OE3OZe664?= =?iso-8859-1?q?CBsQB1bVYnJ1Fp3ohRD3P/Dy4ojWG/3rq+N5/QonFY8DBVx9/73kOGvV83yj?= =?iso-8859-1?q?rShZWgu4U1vk2lV8aGsdEUYCxSWWxbZxMxP+AGrAF1nbiMDoA2VnyidisPgU?= =?iso-8859-1?q?FegG7WWVKTrTPXz/cIDBBbvep95J9dpTAegpub+nCG2/lnYPu3ZuSmMMveWa?= =?iso-8859-1?q?Ez0fNHY3JHFQdzdGzMok7He91b8Ir8tXlKUQxV1y9th6DlljqgLwDtRY6o7r?= =?iso-8859-1?q?Ed/LBHcLOoLwghh/PwBTISxXGArtpR1vA9eblIA=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: epam.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: GV1PR03MB10456.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 94f90734-a613-48c2-47cc-08dd34538bd1 X-MS-Exchange-CrossTenant-originalarrivaltime: 14 Jan 2025 04:25:56.6028 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b41b72d0-4e9f-4c26-8a69-f949f367c91d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: +lGlImmpjcC2n94+sI9odtBaapSSisdurf1i8RQHmswF74d0JzvhoV5qYBqZ6vYdnTBP4Oc3/c0vzVzQOIh+ER3Sj7foiXWBqOf6AS2c6J8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR03MB6300 Enable previously added CONFIG_STACK_PROTECTOR feature for ARM platform. We initialize stack protector very early, in head.S using boot_stack_chk_guard_setup. This ensures that all C code from the very beginning can use stack protector. Signed-off-by: Volodymyr Babchuk --- In v4: - setup.c does not call boot_stack_chk_guard_setup() anymore, because the original implementation was removed and boot_stack_chk_guard_setup_early was renamed to boot_stack_chk_guard_setup In v3: - Call boot_stack_chk_guard_setup_early from head.S to ensure that stack is protected from early boot stages - Call boot_stack_chk_guard_setup() later, when time subsystem is sufficiently initialized to provide values for the random number generator. In v2: - Reordered Kconfig entry --- xen/arch/arm/Kconfig | 1 + xen/arch/arm/arm64/head.S | 3 +++ 2 files changed, 4 insertions(+) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index a26d3e1182..8f1a3c7d74 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -16,6 +16,7 @@ config ARM select GENERIC_UART_INIT select HAS_ALTERNATIVE if HAS_VMAP select HAS_DEVICE_TREE + select HAS_STACK_PROTECTOR select HAS_UBSAN config ARCH_DEFCONFIG diff --git a/xen/arch/arm/arm64/head.S b/xen/arch/arm/arm64/head.S index 72c7b24498..5cbd62af86 100644 --- a/xen/arch/arm/arm64/head.S +++ b/xen/arch/arm/arm64/head.S @@ -250,6 +250,9 @@ real_start_efi: #endif PRINT("- Boot CPU booting -\r\n") +#ifdef CONFIG_STACK_PROTECTOR + bl boot_stack_chk_guard_setup +#endif bl check_cpu_mode bl cpu_init