From nobody Thu Dec 26 21:58:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1732929055; cv=pass; d=zohomail.com; s=zohoarc; b=Tm7xiEPMyzmtfT7/31PmLC4z0wzHen+OhrrlIMepssZZNdUGLrl/crhM2V2C8Iv3PtIpjjB6TpFvg8xVpjKzKkJpMcqn9Qcuv6H9FkyjD+/ZfB99AZ5T6Stpk8wuE0kXu5Su/EK5w9McglVOqQ5G2/0UnWqpmKm1jJDpVbGmq5g= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732929055; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=pw3TVcYG2GcL6D1CgReR7ofWSiP1ku/xjJnw0Bx6q3Y=; b=PZBHZ/p4PLXYL1RO4/wec2vcpoO986REGYcj2wZnli5LPnSMXjHKGU1t9r40xk7TQ2nIPX+1F8toipmAWSDheQqZTUccT8Ox7KrztUFx7eU4GX56R6H30yQvHvr3ziN/f+tmnThqwkWYXKj19hNrzglf7/zyMZtvS8dqKn3dBVU= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1732929055962915.5960342341992; Fri, 29 Nov 2024 17:10:55 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.846084.1261338 (Exim 4.92) (envelope-from ) id 1tHC0A-00044i-Vn; Sat, 30 Nov 2024 01:10:26 +0000 Received: by outflank-mailman (output) from mailman id 846084.1261338; Sat, 30 Nov 2024 01:10:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tHC0A-00044b-SW; Sat, 30 Nov 2024 01:10:26 +0000 Received: by outflank-mailman (input) for mailman id 846084; Sat, 30 Nov 2024 01:10:24 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tHC08-00044C-L7 for xen-devel@lists.xenproject.org; Sat, 30 Nov 2024 01:10:24 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2062d.outbound.protection.outlook.com [2a01:111:f403:2613::62d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ddd7de69-aeb7-11ef-a0cf-8be0dac302b0; Sat, 30 Nov 2024 02:10:20 +0100 (CET) Received: from GV1PR03MB10456.eurprd03.prod.outlook.com (2603:10a6:150:16a::21) by AM9PR03MB7694.eurprd03.prod.outlook.com (2603:10a6:20b:41e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Sat, 30 Nov 2024 01:10:16 +0000 Received: from GV1PR03MB10456.eurprd03.prod.outlook.com ([fe80::a41e:5aa8:e298:757e]) by GV1PR03MB10456.eurprd03.prod.outlook.com ([fe80::a41e:5aa8:e298:757e%7]) with mapi id 15.20.8182.018; Sat, 30 Nov 2024 01:10:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: ddd7de69-aeb7-11ef-a0cf-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDE6MTExOmY0MDM6MjYxMzo6NjJkIiwiaGVsbyI6IkVVUjA1LVZJMS1vYmUub3V0Ym91bmQucHJvdGVjdGlvbi5vdXRsb29rLmNvbSJ9 X-Custom-Transaction: eyJpZCI6ImRkZDdkZTY5LWFlYjctMTFlZi1hMGNmLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyOTI5MDIwLjE2NjI2NCwic2VuZGVyIjoidm9sb2R5bXlyX2JhYmNodWtAZXBhbS5jb20iLCJyZWNpcGllbnQiOiJ4ZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcifQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YD6G+C/NAtQfb76QIil7fgi1+OeLZ2dFPNIeK8s/qjVKpwlDEJ+z59GTFBbwk70/qOtjpMJpxYBq9IqzxU0iozZwEjdxIt+uiscNjOYq/TmAq3xc9b3Zma+q0MsFie7IMKde2LrJHtl69YRSXGsH6S6ioWHwnM/aC+0zZFqz5LvGvCNYvJG3hRtNIlNElBaYiEKiCCy8lKccEt2YaDygqGd93vFN5inleyTng96BpIByWR5uqLuAsLoQRUGBvrrGHkeTLlVZEebzWRvIa7um6h6CxOaD+jy1FphN5TaNhpcHPmg1vXhYAHiCLUrik3EmsBtvOjGVxM0PE9305rEVQA== 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=pw3TVcYG2GcL6D1CgReR7ofWSiP1ku/xjJnw0Bx6q3Y=; b=yKm80CawYha+Q03if7wH3BGEIMHNSk0+y3j7RWXELF31T5p9WhhoPFFPJnlC+Jp5iQSZsmgEgKvt7+3qzziJUu+hyCpv9JmFrIT7KaI4BHfG/Tsg8KaQJxOLVcFB1+R/v4DFTLkDHiSZXmiXGZtfU8G6d0dkDMkYKYiQ2OzkBHShlPXJsBN8N7WoBbZeAcXojeS+R5jZk47GA+R0GGUPqIrcEooovZsIbf4ltx6k8SHzGFdBUWiYZ66ALtKneiTwQkAexLqYfYGEGSzzxxjF4YKvj75HSZfr9eDETfh/Uey4LmF1u3XrAaACw/NYJw6oMPXu6VJ5dUuUmP+LDotT8A== 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=pw3TVcYG2GcL6D1CgReR7ofWSiP1ku/xjJnw0Bx6q3Y=; b=CU72Nx7odxJenceCY73QrfDYf2dCXoR4bauUQWnvOtNKe0KDdzME86NZ8Os4bnZKpz3VU8ZP8M+6FfXXp2ngrWwoclp9cXVM3fRWovGunaM8ko9qXhmufJkT+Sz8soFIMY4ojLsGCK96zypZU+pbZTP7AQmUNr+S9JdEgW40Lmrc9TjIZ5CEoAHRg6lHQsQBAZSfxGqaXVU/yaFuOLTaHmJJaIja/QZmQdFzt7uCgCVBhw6uTeM7YIffhT/FrVudSVgy5lJjLaKXgW1uhZ4iUn9RqobrgMKdsPGDFl11vzbhCQCVvu2898FAh2NyHBNbuGQMH3KCvrXviaHtjQ/lxA== From: Volodymyr Babchuk To: "xen-devel@lists.xenproject.org" CC: Volodymyr Babchuk , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini , Anthony PERARD , Samuel Thibault , =?iso-8859-1?Q?Roger_Pau_Monn=E9?= Subject: [PATCH v2 1/4] common: remove -fno-stack-protector from EMBEDDED_EXTRA_CFLAGS Thread-Topic: [PATCH v2 1/4] common: remove -fno-stack-protector from EMBEDDED_EXTRA_CFLAGS Thread-Index: AQHbQsSdhsEy1dPVQEOcqGdxy6Xe0A== Date: Sat, 30 Nov 2024 01:10:15 +0000 Message-ID: <20241130010954.36057-2-volodymyr_babchuk@epam.com> References: <20241130010954.36057-1-volodymyr_babchuk@epam.com> In-Reply-To: <20241130010954.36057-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_|AM9PR03MB7694:EE_ x-ms-office365-filtering-correlation-id: 51db0109-5a26-494f-f614-08dd10dbc00e x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|366016|376014|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?Q?lmqJT3QWeZaE3+mnJwgGFCwW3Ll1zDnaf/AAGeXYiR79PUuNkaoKILBICr?= =?iso-8859-1?Q?NKsHk6LJv/unBQ2b+e7LCMTXBOYpDU75YnPBxSv9FpjIugcHp/3mQuMjl1?= =?iso-8859-1?Q?IQtpUcP871eKmxksYPERVKhhLY1Ma/7v3G+Vph768PSOULQ7FRAPbednxA?= =?iso-8859-1?Q?WqTcroCea9829YAeIQG4FP+HZ0g4rYWFB1EMpt9lu+jeoEwNcAVJRu+jxT?= =?iso-8859-1?Q?Am6jKBVq7vZA8jYZ7FK9vBLswO0zdBhqi4+NL7oxk6GzBmHtZRmkQIL8oE?= =?iso-8859-1?Q?qjA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4SwxtNOQ608L?= =?iso-8859-1?Q?4N9tWK5Pky/SyHWCfhrFoVN9IeQ6dMEHAMAIBe9mGafRofSCWZM63gDCrT?= =?iso-8859-1?Q?ztzP/c9R+txqUQjIeuf9wYa7mTyiH7suVsG2v/B9eouJidDHIlhloLXlL4?= =?iso-8859-1?Q?IoIdY5AXkqpZB3O84cf3xjOmDrkee+HkCi0g1eofKeXphZteQ0RJ3BCV9Q?= =?iso-8859-1?Q?e63p2j9LpMQRuFbw6WluVq8vk9Vy+F+rZWbEq7sWY0lec5INozVfk=3D?= 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)(366016)(376014)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?enqKTeIn8BbI8MWRMxjxuSvVk4hnW9URqH8eNqB0yMqojgjfAxrFW6QWyP?= =?iso-8859-1?Q?rDxXZr50zHnY8xzPv0yWnSoBS0u2gr1QVuYNp5hNjOEPAsvbushiXy7w5J?= =?iso-8859-1?Q?WC4CBF/pcyvgGri0280f8xz/GgL4GrV28lzoZOCaRVo4NNijzbEm/0iTPn?= =?iso-8859-1?Q?1h7mQzr8T31MUYV4LWlZEefH5vRwFHRk28be0/vtRFXWwoE2r62/3b26vY?= =?iso-8859-1?Q?3cD5FxR3RK6dGIFJ6AHtMmS44aLgEzcECCPzAQGRRMNr7/NEnJctA0ETKK?= =?iso-8859-1?Q?pK2qRr6JJPULr7Dn/SpgfKk84HeONsqHOX6S+T0Gw2DbaOcUsplSFHyhN8?= =?iso-8859-1?Q?TQBW46dO8o2IXv60IpM5nl4NXI2gLCYG/ZL98eSZpgek4Ka7fCVriZSz0H?= =?iso-8859-1?Q?xQWEmQXR45tE+FHWjo2iBKv/pPKcVK/T5dAWSSN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W6+xs2dhC+7Sj9MohcMtAbAvAWkT6weMuv+fUQ4k/uwQyEUh1vH7Q2?= =?iso-8859-1?Q?xvhb+/o6MbFNLj4YIw+4H9OjXUhK9BM/fjHEQnQWQtrcFnlN5gr8SRyzWa?= =?iso-8859-1?Q?cg1W1U3xry69hZq9Gg3mtgYDHMu54rxvd63mlJkqORRgAJ35U6fBQfdfuN?= =?iso-8859-1?Q?FFAJMUsonQs8zW1mxIbUp+1Zugycko3eziBSNloxEFn8ekmPNUGr+9YHJi?= =?iso-8859-1?Q?LIL1Ed/bpyRLTEGI6DkaPo/RWQ+Vd0+38MW+LE33sA7upce+aUgaoL5dWA?= =?iso-8859-1?Q?5fHOtrDdr8Jha24okz2ZFdxGcvEHH0BsfUS8LqdK+KR3hdstFt2tXq6A?= =?iso-8859-1?Q?=3D=3D?= Content-Transfer-Encoding: quoted-printable 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: 51db0109-5a26-494f-f614-08dd10dbc00e X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2024 01:10:15.6837 (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: f2ZsS24ljqzCiqJlCABDUIPp02lkpOw7RuTvaCIdLGmvs1HHMoDfHhsbZvgrygiCPTBgnvavylWX7dUaRmI745llHOo5mkOfBm2WcX9dPsA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7694 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1732929056309019100 Content-Type: text/plain; charset="utf-8" This patch is preparation for making stack protector configurable. First step is to remove -fno-stack-protector flag from EMBEDDED_EXTRA_CFLAGS so separate projects (Hypervisor in this case) can enable/disable this feature by themselves. Signed-off-by: Volodymyr Babchuk --- Changes in v2: - New in v2 --- Config.mk | 2 +- stubdom/Makefile | 2 ++ tools/firmware/Rules.mk | 2 ++ tools/tests/x86_emulator/testcase.mk | 2 ++ xen/Makefile | 2 ++ 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Config.mk b/Config.mk index fa0414055b..c9fef4659f 100644 --- a/Config.mk +++ b/Config.mk @@ -190,7 +190,7 @@ endif APPEND_LDFLAGS +=3D $(foreach i, $(APPEND_LIB), -L$(i)) APPEND_CFLAGS +=3D $(foreach i, $(APPEND_INCLUDES), -I$(i)) =20 -EMBEDDED_EXTRA_CFLAGS :=3D -fno-pie -fno-stack-protector +EMBEDDED_EXTRA_CFLAGS :=3D -fno-pie EMBEDDED_EXTRA_CFLAGS +=3D -fno-exceptions -fno-asynchronous-unwind-tables =20 XEN_EXTFILES_URL ?=3D https://xenbits.xen.org/xen-extfiles diff --git a/stubdom/Makefile b/stubdom/Makefile index 2a81af28a1..41424f6aca 100644 --- a/stubdom/Makefile +++ b/stubdom/Makefile @@ -54,6 +54,8 @@ TARGET_CFLAGS +=3D $(CFLAGS) TARGET_CPPFLAGS +=3D $(CPPFLAGS) $(call cc-options-add,TARGET_CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) =20 +$(call cc-option-add,TARGET_CFLAGS,CC,-fno-stack-protector) + # Do not use host headers and libs GCC_INSTALL =3D $(shell LANG=3DC gcc -print-search-dirs | sed -n -e 's/ins= tall: \(.*\)/\1/p') TARGET_CPPFLAGS +=3D -U __linux__ -U __FreeBSD__ -U __sun__ diff --git a/tools/firmware/Rules.mk b/tools/firmware/Rules.mk index d3482c9ec4..b3f29556b7 100644 --- a/tools/firmware/Rules.mk +++ b/tools/firmware/Rules.mk @@ -15,6 +15,8 @@ $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) =20 $(call cc-option-add,CFLAGS,CC,-fcf-protection=3Dnone) =20 +$(call cc-option-add,CFLAGS,CC,-fno-stack-protector) + # Do not add the .note.gnu.property section to any of the firmware objects= : it # breaks the rombios binary and is not useful for firmware anyway. $(call cc-option-add,CFLAGS,CC,-Wa$$(comma)-mx86-used-note=3Dno) diff --git a/tools/tests/x86_emulator/testcase.mk b/tools/tests/x86_emulato= r/testcase.mk index fc95e24589..49a7a8dee9 100644 --- a/tools/tests/x86_emulator/testcase.mk +++ b/tools/tests/x86_emulator/testcase.mk @@ -4,6 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk =20 $(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) =20 +$(call cc-option-add,CFLAGS,CC,-fno-stack-protector) + CFLAGS +=3D -fno-builtin -g0 $($(TESTCASE)-cflags) =20 LDFLAGS_DIRECT +=3D $(shell { $(LD) -v --warn-rwx-segments; } >/dev/null 2= >&1 && echo --no-warn-rwx-segments) diff --git a/xen/Makefile b/xen/Makefile index 2e1a925c84..34ed8c0fc7 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -432,6 +432,8 @@ else CFLAGS_UBSAN :=3D endif =20 +CFLAGS +=3D -fno-stack-protector + ifeq ($(CONFIG_LTO),y) CFLAGS +=3D -flto LDFLAGS-$(CONFIG_CC_IS_CLANG) +=3D -plugin LLVMgold.so --=20 2.47.1 From nobody Thu Dec 26 21:58:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1732929055; cv=pass; d=zohomail.com; s=zohoarc; b=XIYGxKz3EKXvM7mX+gG/MmCPgGIQd+zHFxiEbC7gnlnxv9aU1LS8FOiT65IGk8CH4lurnVnLBqQtfjvZqufpoD16L2OSLtsVCAQZxLbRYMV8eU2d71BSHbe7/9NG7zr9no0/zM2qZ8yWZJNSAjWEK9Er3phcIAgrQHERCXiM4Vs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732929055; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Lk0HamVq4FxAqQJVSVFKu2L4HLWpx3Q1Ibp43i+aQ68=; b=W1rAlieFGtbyeMkfHIykBGiLkponN0IYQpN/0FnbTGKS7+pAIU8Trhdsdvu5rE2Nk3JUXEJP68bZ8kD1B2qwBuOK1Bw39UzKNk0pPfL424nQ9GPUxG0VKRkA2yzEPmmwdtyKl1A4ilpNnKSp+frJSgBItZcwRi54+2tPfSaECaA= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17329290559421013.0873371892809; Fri, 29 Nov 2024 17:10:55 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.846089.1261378 (Exim 4.92) (envelope-from ) id 1tHC0H-00054I-54; Sat, 30 Nov 2024 01:10:33 +0000 Received: by outflank-mailman (output) from mailman id 846089.1261378; Sat, 30 Nov 2024 01:10:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tHC0H-000543-1a; Sat, 30 Nov 2024 01:10:33 +0000 Received: by outflank-mailman (input) for mailman id 846089; Sat, 30 Nov 2024 01:10:31 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tHC0F-00044C-MA for xen-devel@lists.xenproject.org; Sat, 30 Nov 2024 01:10:31 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2062d.outbound.protection.outlook.com [2a01:111:f403:2613::62d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e3b013fd-aeb7-11ef-a0cf-8be0dac302b0; Sat, 30 Nov 2024 02:10:29 +0100 (CET) Received: from GV1PR03MB10456.eurprd03.prod.outlook.com (2603:10a6:150:16a::21) by AM9PR03MB7694.eurprd03.prod.outlook.com (2603:10a6:20b:41e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Sat, 30 Nov 2024 01:10:16 +0000 Received: from GV1PR03MB10456.eurprd03.prod.outlook.com ([fe80::a41e:5aa8:e298:757e]) by GV1PR03MB10456.eurprd03.prod.outlook.com ([fe80::a41e:5aa8:e298:757e%7]) with mapi id 15.20.8182.018; Sat, 30 Nov 2024 01:10:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: e3b013fd-aeb7-11ef-a0cf-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDE6MTExOmY0MDM6MjYxMzo6NjJkIiwiaGVsbyI6IkVVUjA1LVZJMS1vYmUub3V0Ym91bmQucHJvdGVjdGlvbi5vdXRsb29rLmNvbSJ9 X-Custom-Transaction: eyJpZCI6ImUzYjAxM2ZkLWFlYjctMTFlZi1hMGNmLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyOTI5MDI5LjUxMjg3OSwic2VuZGVyIjoidm9sb2R5bXlyX2JhYmNodWtAZXBhbS5jb20iLCJyZWNpcGllbnQiOiJ4ZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcifQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=zFqp34+OGvfFHvkj3/xy1m1SC+EToXdPAuQ37nOuGfYewssDfFd6e7kgPczw7AAadMrQOLAzc0LVyqxcM7O5Id1u4YyDB9W35zinQhqhcZx9z4iuEoN6NDaqKdc0QW087gMgiF2V0jibt2DFP2q65n1s0JoqOF97OwEx0fRKZz/oKSpruGBjfd0kmBq1SaYP4tRDC5LikTsJODQ8ijduQhk9SoSk+RueWHsM1mZGDi6j+GRLzcIYwX0VX9dLsoiIn8oa2inK7V8w2k0lE0PwItc/y7MsorxFYJ7LA+1JFbGUlQHHdcnQw52EIWNg4Ma6p3zM/1YqTgVAvkWQRJvadQ== 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=Lk0HamVq4FxAqQJVSVFKu2L4HLWpx3Q1Ibp43i+aQ68=; b=iHuMjI2DnApIM7wpX6t+pA+JCnNN1bkXT9M0QzFvYPvsZeynjx694lo3K2lxRQtjVCsKZpM3J40+F5uNFUjO6ffxjNYsYtNAeKU1rnj9U7kRAptrnurACkO0HrCuZ817DLFnAQavwfVa1UF4sCxzap1C9j0Dr/qF/qBKO8nMfVtdJZCYbll70ivDgk/sv9MhoPW2B+ju1ZIdXL3WFy9kxMYSA+/rjjOP1jz6p5a0oBu6sBfSfSyL6+FuYBT+QoLtqspvulBH3n9m84xHdBBnUGo10ymvM1td57dL6b9Hl/hXgN2URvMOlkQ4Ontr+VxIX5MgtvhCOVQ9WwISqqkDKw== 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=Lk0HamVq4FxAqQJVSVFKu2L4HLWpx3Q1Ibp43i+aQ68=; b=SORKnbMj8pPcCXoYMfim6hzzIMFFW/HnhLWdGowsBxMYt1doiibgPWQfpE8h+f+4U6z9KRQjhkalmEfVpAWd8F4qbuf1QCXvBPzLBITWicjAlnwOglNSRgnA8VuK7Hta85fK46kiZvAK64C78Zx86pnXb8WUcRTZTeBB5oO2jf3JdU4euMm4C/Ca0FxmjBQyrvahxtFrh+SwQWFXAlecNFCwG8W6xMmjg0M2eOcGJSPUp4/rNAwZPjYkWew3vJdi514Tkc+Q5UHS2S/c881gQnztXVX28IDZLEGvN6A8irX+MdFpBHy0fy0Vr4bSx+JnSyoM0Ngs47ojgpxyVDp1LQ== From: Volodymyr Babchuk To: "xen-devel@lists.xenproject.org" CC: Volodymyr Babchuk , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v2 2/4] xen: common: add ability to enable stack protector Thread-Topic: [PATCH v2 2/4] xen: common: add ability to enable stack protector Thread-Index: AQHbQsSdkWILXIuO706XPyPrUU1cAA== Date: Sat, 30 Nov 2024 01:10:15 +0000 Message-ID: <20241130010954.36057-3-volodymyr_babchuk@epam.com> References: <20241130010954.36057-1-volodymyr_babchuk@epam.com> In-Reply-To: <20241130010954.36057-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_|AM9PR03MB7694:EE_ x-ms-office365-filtering-correlation-id: 60322106-e114-43c4-5a18-08dd10dbc03a x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|366016|376014|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?Q?NKwJhqdwrA8AdoAVasRDl/n3y0mu8VdAOlyGm6rUqLoUhd/yf8TDMuYWCW?= =?iso-8859-1?Q?rPK6woFaQPQLUbiKVl99Vgin48aBY8cxUqszhhTuAs865TnB9+/GuCZ1Gt?= =?iso-8859-1?Q?4uktCrcEqwkIv+OLGOHPViT1V2UZXW9suUqTFAqtF5zkT9JtKpCHO7GELd?= =?iso-8859-1?Q?ZLIGeGw7fgEiKkok3y27ISu94ANRCRv2hcBoqU1WkqC0UwIKEhylbAoQpW?= =?iso-8859-1?Q?eKbZWycPeKrh5IWOan2CFNmOPx3HfSVYMbAVlU7TjJvSy4HBFdUJrhMLJ1?= =?iso-8859-1?Q?YtB43JweQKasVeSiZkIQ03GBNP3cgHF2pR1GB29Y9WkOsaCeichriMqKan?= =?iso-8859-1?Q?p3QLfhMVECqGSwkykND9NHrpElO9FOQsc69CkTBsB6AaNMD80Tmzam5LcZ?= =?iso-8859-1?Q?wbGFY44yqIQxS1INVyTUB/IwXXOrNEe60YLzwnKHXMQZrybq9wU1N4DBnq?= =?iso-8859-1?Q?Y2nAuPCwMOKnnZmy4xGkj+0MpRHBVCw5Y3bqtVA0uOSKeQ9n1gOxkBSgMl?= =?iso-8859-1?Q?xY6+ETgRlKaWcATOkBILKk/UvTJd1ummlGAHTAhYRXCSL7N8sySxzh8B0i?= =?iso-8859-1?Q?v+8z+ZGH4i69VycACD8cHl4rRRUT5pl7y1dCEjqcH6rzDnnfaYTwyfx/QS?= =?iso-8859-1?Q?TsvSeo9WBh7kbY4JGnWUqj0ieYFd54QnvpU985enihf07hLoesi8sK+kWt?= =?iso-8859-1?Q?AkxEtNrnHuz4ex2df4fRWbjbISoXSL6KKIP4EWHT177I3+9gcNSgPPSh1j?= =?iso-8859-1?Q?ux3+m/hPk5NDK5fzwyDkJKOj1UjDfWJYKkKOxGD8AlsiGDsTpWioyC+JbB?= =?iso-8859-1?Q?GKhGlT55spZROGY12lBqceZnNNFjU7Ulj17GY0G0zJcNJLfh9fyP0C4B/M?= =?iso-8859-1?Q?172gD2C7Xrm5wlpsdN5V7QcNlfbv4mO2kWmN6L46TY5i76ygy7Pw2Wfkuh?= =?iso-8859-1?Q?0CcUTDlJu68kEdCTLl1zd4guYCsrIvessvt5BU2xve71Rv3+PX6dzJS2mx?= =?iso-8859-1?Q?Sj8C0P3bozL7YG7ceCkaNTGpLqIeyenyaouqR+9FMXlaf3cVfN7GcONMV3?= =?iso-8859-1?Q?E4OiC4IRIHTnBqnMgR0oAP70U9suCJurn7cyfAkCs2yVBeLlc/aHlRmLex?= =?iso-8859-1?Q?Fcm9g/9rRNrwEPjpePTfpi2L4LdMsJK9rCwLFTF07Q0gmP6Himr8X5Kpxr?= =?iso-8859-1?Q?Du65Ng7E2TQ1kMfUP9VT0L3Lw8BxqKTBQiCso/05f1B805KI93WB6QokX0?= =?iso-8859-1?Q?Tqptzyw91cD/5x0DkUJae0rErwMKFJklRwoVBXWCGTBkpn83+gHWFVrM8h?= =?iso-8859-1?Q?oyW0ygayD1AemYnzNbw177MFlDS56fF79V6PbXuwyvzdnDoS7lf+wmbMI8?= =?iso-8859-1?Q?7RmsfShATTdviZL/F6w/HSQvliqJDfk9yALCCAagm2sgT6rHXzWd2ax2An?= =?iso-8859-1?Q?lXlEvxacN3f6NyJ4l6q48mNe/+k1VuuhmMsBYA=3D=3D?= 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)(366016)(376014)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?+erIPVTbcmK5GUDyNz1iwfblWfClsddW1E8dT2A+jXYGQdq1avVzEjpSlY?= =?iso-8859-1?Q?QdUIObWv2TXq+b/asYVttAwL4Qwetz+MQeSYZI/jdAfJSfEiPVmd+YOxH1?= =?iso-8859-1?Q?O4pPelrVLbXGB7dw6I9m8XYntmqayPmYw8BIEwyrJCDbJbPMNaAvQgvDGi?= =?iso-8859-1?Q?W6fuSKoQaDiI5ArloZ4jME0Z6ec2j9zIa530KyHUkXbQ1mcb5VsA886Wg/?= =?iso-8859-1?Q?wQ+qXVdJQY5o7cgsSHphELu9uu4Zwxsc1Pj/tJmpb2r3DtQeg9y4it+b31?= =?iso-8859-1?Q?bYjd7DaCfYAheCh8j11gWzzq3f+0IHcF0IHEwUttKZ6Whsd2QTauON+fyr?= =?iso-8859-1?Q?+AUBmnD91vYTUlPE9Jg8OrRmniusGDUU+ji5W3PVwubZZIdmgPCuPir6yq?= =?iso-8859-1?Q?IkSE6unnl4UOBcBJn0wGS2TB7u7e9Tsv9j7Bn30DNwpj/bXVRxbngoxCDu?= =?iso-8859-1?Q?SbhSnN8wF/wOD9PwtiOqxUYYsafiXF8xaiGuiYZaqB1mXEzB/3hu0E9XyA?= =?iso-8859-1?Q?ipisL5UsGvrW8YdBZ+rdsEYQayWnrLmzz/4znC/xtD6Yf72xhRu6lxA1ac?= =?iso-8859-1?Q?JOoEI63IiL5dA3fgvpxQn9ie+8BhR8yMlg/ir+PyIj9ADHuzMkuP22fTJ7?= =?iso-8859-1?Q?S5v2/FsQwXCNkagsc6fWoYExOo6MdT/nOwZWu+XCXi8X8NUNsLsr8ccQSn?= =?iso-8859-1?Q?fomcxlDpr2AsIIAVQztFKr29slQ6tbm2skQb/pVgaTzNajFWdr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sLzpTp6UtXFqLfiEXh1N/1MFqr+s9RK7Z+A?= =?iso-8859-1?Q?=3D=3D?= Content-Transfer-Encoding: quoted-printable 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: 60322106-e114-43c4-5a18-08dd10dbc03a X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2024 01:10:15.9693 (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: YiUZz6WwqrIFFAp1fDWSyt23wu64HqX0xw/vnD1NF6npLWOSnv4S+Gc/dd5x7gek+I75mN+oz8EeGfIIjn18rpuOugVreHcn8W4KFIlrX4g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7694 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1732929056345019100 Content-Type: text/plain; charset="utf-8" Both GCC and Clang support -fstack-protector feature, which add stack canaries to functions where stack corruption is possible. This patch makes general preparations to enable this feature on different supported architectures: - Added CONFIG_HAS_STACK_PROTECTOR option so each architecture can enable this feature individually - Added user-selectable CONFIG_STACK_PROTECTOR option - Implemented code that sets up random stack canary and a basic handler for stack protector failures Signed-off-by: Volodymyr Babchuk --- Changes in v2: - Moved changes to EMBEDDED_EXTRA_CFLAGS into separate patch - Renamed stack_protector.c to stack-protector.c - Renamed stack_protector.h to stack-protector.h - Removed #ifdef CONFIG_X86 in stack-protector.h - Updated comment in stack-protector.h (also, we can't call boot_stack_chk_guard_setup() from asm code in general case, because it calls get_random() and get_random() may depend in per_cpu infrastructure, which is initialized later) - Fixed coding style - Moved CONFIG_STACK_PROTECTOR into newly added "Compiler options" submenu - Marked __stack_chk_guard as __ro_after_init --- xen/Makefile | 4 ++++ xen/common/Kconfig | 17 +++++++++++++++++ xen/common/Makefile | 1 + xen/common/stack-protector.c | 10 ++++++++++ xen/include/xen/stack-protector.h | 29 +++++++++++++++++++++++++++++ 5 files changed, 61 insertions(+) create mode 100644 xen/common/stack-protector.c create mode 100644 xen/include/xen/stack-protector.h diff --git a/xen/Makefile b/xen/Makefile index 34ed8c0fc7..0de0101fd0 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -432,7 +432,11 @@ else CFLAGS_UBSAN :=3D endif =20 +ifeq ($(CONFIG_STACK_PROTECTOR),y) +CFLAGS +=3D -fstack-protector +else CFLAGS +=3D -fno-stack-protector +endif =20 ifeq ($(CONFIG_LTO),y) CFLAGS +=3D -flto diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 90268d9249..64fd04f805 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -86,6 +86,9 @@ config HAS_UBSAN config HAS_VMAP bool =20 +config HAS_STACK_PROTECTOR + bool + config MEM_ACCESS_ALWAYS_ON bool =20 @@ -213,6 +216,20 @@ config SPECULATIVE_HARDEN_LOCK =20 endmenu =20 +menu "Compiler options" + +config STACK_PROTECTOR + bool "Stack protection" + depends on HAS_STACK_PROTECTOR + help + Use compiler's option -fstack-protector (supported both by GCC + and Clang) to generate code that checks for corrupted stack + and halts the system in case of any problems. + + Please note that this option will impair performance. + +endmenu + config DIT_DEFAULT bool "Data Independent Timing default" depends on HAS_DIT diff --git a/xen/common/Makefile b/xen/common/Makefile index b279b09bfb..ceb5b2f32b 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -45,6 +45,7 @@ obj-y +=3D shutdown.o obj-y +=3D softirq.o obj-y +=3D smp.o obj-y +=3D spinlock.o +obj-$(CONFIG_STACK_PROTECTOR) +=3D stack-protector.o obj-y +=3D stop_machine.o obj-y +=3D symbols.o obj-y +=3D tasklet.o diff --git a/xen/common/stack-protector.c b/xen/common/stack-protector.c new file mode 100644 index 0000000000..b258590d3a --- /dev/null +++ b/xen/common/stack-protector.c @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include +#include + +unsigned long __ro_after_init __stack_chk_guard; + +void __stack_chk_fail(void) +{ + panic("Detected stack corruption\n"); +} diff --git a/xen/include/xen/stack-protector.h b/xen/include/xen/stack-prot= ector.h new file mode 100644 index 0000000000..779d7cf9ec --- /dev/null +++ b/xen/include/xen/stack-protector.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef XEN__STACK_PROTECTOR_H +#define XEN__STACK_PROTECTOR_H + +#ifdef CONFIG_STACKPROTECTOR + +extern unsigned long __stack_chk_guard; + +/* + * This function should be always inlined. Also it should be called + * from a function that never returns or a function that with + * stack-protector disabled. + */ +static always_inline void boot_stack_chk_guard_setup(void) +{ + __stack_chk_guard =3D get_random(); + if (BITS_PER_LONG =3D=3D 64) + __stack_chk_guard |=3D ((unsigned long)get_random()) << 32; +} + +#else + +static inline void boot_stack_chk_guard_setup(void) {} + +#endif /* CONFIG_STACKPROTECTOR */ + +#endif /* XEN__STACK_PROTECTOR_H */ + --=20 2.47.1 From nobody Thu Dec 26 21:58:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1732929053; cv=pass; d=zohomail.com; s=zohoarc; b=HXLO6QFENgXILfLBWs7F84qUqUFjNZT6bcP4b58YclZvNzMagpNsOoEi22CgOj/LmKD6VC5dTKzEAWaNkpktLfWUYMFsBg9BUl5RhdfVooTgtOx6PJhEG8G1Opy6gr50ntndFBBz+2nfnZhA7kKvcWbMh+yCgd7u+xwYGPe9sj4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732929053; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=/GsamCxU4DN+NHcKP8lPzqtJEu/j5Oky0k16OeYjFl0=; b=cCoBYdxAl61gYwKXKsfjUabYiyWc4/bl0ljPGmEi7T3V6NZKXY2pd+tYJY/3yXQHiAqgg2QBwyZvZ8y51ZfYccpYP27DVyUgSVF9jNc/wB9a5RJUmXas97rBlOGt2jlOoWtIdCjvzhBx5aWIQ9vTQ382pWIP2hWA9lq4Cxp+o7g= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1732929053871996.740133127167; Fri, 29 Nov 2024 17:10:53 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.846087.1261368 (Exim 4.92) (envelope-from ) id 1tHC0E-0004ma-Qe; Sat, 30 Nov 2024 01:10:30 +0000 Received: by outflank-mailman (output) from mailman id 846087.1261368; Sat, 30 Nov 2024 01:10:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tHC0E-0004mR-MT; Sat, 30 Nov 2024 01:10:30 +0000 Received: by outflank-mailman (input) for mailman id 846087; Sat, 30 Nov 2024 01:10:29 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tHC0D-00044C-G4 for xen-devel@lists.xenproject.org; Sat, 30 Nov 2024 01:10:29 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2062d.outbound.protection.outlook.com [2a01:111:f403:2613::62d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e2799066-aeb7-11ef-a0cf-8be0dac302b0; Sat, 30 Nov 2024 02:10:27 +0100 (CET) Received: from GV1PR03MB10456.eurprd03.prod.outlook.com (2603:10a6:150:16a::21) by AM9PR03MB7694.eurprd03.prod.outlook.com (2603:10a6:20b:41e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Sat, 30 Nov 2024 01:10:16 +0000 Received: from GV1PR03MB10456.eurprd03.prod.outlook.com ([fe80::a41e:5aa8:e298:757e]) by GV1PR03MB10456.eurprd03.prod.outlook.com ([fe80::a41e:5aa8:e298:757e%7]) with mapi id 15.20.8182.018; Sat, 30 Nov 2024 01:10:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: e2799066-aeb7-11ef-a0cf-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDE6MTExOmY0MDM6MjYxMzo6NjJkIiwiaGVsbyI6IkVVUjA1LVZJMS1vYmUub3V0Ym91bmQucHJvdGVjdGlvbi5vdXRsb29rLmNvbSJ9 X-Custom-Transaction: eyJpZCI6ImUyNzk5MDY2LWFlYjctMTFlZi1hMGNmLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyOTI5MDI3LjQ4MTM3Niwic2VuZGVyIjoidm9sb2R5bXlyX2JhYmNodWtAZXBhbS5jb20iLCJyZWNpcGllbnQiOiJ4ZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcifQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dJGgNN3u03vI/zEaAexMLmSK2Zk65WXniXdHACi6cyM8r+F0r2FXdIpV3O5XL7T9DGmqoklF4im4QHVe9TDJz2NqD/6OmtPsDgb2/5JYQP0qgw8zqGsVqH+nM9Q0jkajP7k+07dAhzlJcsAWmWuKHTmh+g+B4DriZ01lZnYzb10vsrCKXOPGMMuTN0N1V71Nf9IzXWbRrL/iefXkQ2Gz46ivOmjqzrsdc8SfdQe1fgEkswMBH4PV4pbmWLV8xU6Gbm5DmfMu4WIUxqeI8KVXyIfUF4Mg+KXKtOFGjVADbWqR9WM7lpAi++XEq3X7mIYe/fEyYbiyhWjfzXhOEVz1Ug== 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=/GsamCxU4DN+NHcKP8lPzqtJEu/j5Oky0k16OeYjFl0=; b=lp99NVvkken8eGyMkGD+JrsaN1ZI2NfxRM6h5GFUEFjJA8T5yhh00gZzK2dYRRVUGCYtrmD1G/SOIqocgboZ8ZGdLJwmGBng2PdMxTm4bDGJrEnCwPG4c+nOj4QplbXA1vFs1M/9iLXNQafT+7QlqwZ1UiDHbVkA0+X6ipEVknARbtGiU48yGEknP7muSu2rNXCOB9zu/8++JhN9FxtcLF/OSbg58Vx31cB/kXSMPESgqzOf03B1/4Zqv0L+bWHOzip6oVa267kj9wVGJLs4xPGc2GqmpDr6v/XZbbWqjlfrs2Wm+VIEGCUYXOj6IhrhLzA7gYTK/wLcNP5DHBRN/Q== 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=/GsamCxU4DN+NHcKP8lPzqtJEu/j5Oky0k16OeYjFl0=; b=ESjXKrQw569T3+U6ohQnUqwuP94i1DzmsjeDPVIfej6Tw0mkRzsJgVxyFMH9N9xClCzmatafnhbM4ZLMosnwUv1kDOjFdTjHHT4nijevx5MU0kW3uz6cpBt6bVz8KDs8OCuxbp4SK4IYJJ5oaebwJo03QdkZZ/a/83RNkHL7+3Z23ySNxRU5czgU2+Jl4ZV/aRlkQ2Z1sEADr4VBWk1Wg0rhW4C6DpRACek2dWP0h0KNt2engewxtyvkQBMTt1vCcrAdt8MLihifG17fIK1XE57QDLUfMaIQtiOlA7DARqEcrHCW3JKlk4HiwvKYylg1b7JoDs8NBBY2FaucDmuH6w== From: Volodymyr Babchuk To: "xen-devel@lists.xenproject.org" CC: Volodymyr Babchuk , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH v2 3/4] xen: arm: enable stack protector feature Thread-Topic: [PATCH v2 3/4] xen: arm: enable stack protector feature Thread-Index: AQHbQsSdZeSazgkTckCfCx9gDu8jUA== Date: Sat, 30 Nov 2024 01:10:16 +0000 Message-ID: <20241130010954.36057-4-volodymyr_babchuk@epam.com> References: <20241130010954.36057-1-volodymyr_babchuk@epam.com> In-Reply-To: <20241130010954.36057-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_|AM9PR03MB7694:EE_ x-ms-office365-filtering-correlation-id: a3c86f64-0920-46bf-b577-08dd10dbc065 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|366016|376014|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?Q?bRipTcm2C1tHjSJy+OQ79DxPH5BBdwz4nolXBL/9hMF/CDqAYvcarMCkXq?= =?iso-8859-1?Q?yMxzE/Ctk1otpwQGiHDjWA1lkY3bHRZZYrmtxmCCbhlAfYEUH1gLCUoRAZ?= =?iso-8859-1?Q?8WY8iYQXDzFXBWY19QrAz9M4EoHNEE6HI2yjnDXefDOdhFdxSxEFK13/Wy?= =?iso-8859-1?Q?Mpf/53jrqxkLOgC7+KNp6eSzf3r1OOGE7X/FEQKmcYmbW5t/X2FaKcX48Q?= =?iso-8859-1?Q?CdNhXbcuyKy8RF35vdx/1g+JmHUBhBRpoZTozfVRoHp9MqxNBtLKHHK21p?= =?iso-8859-1?Q?w4PPY/tBAnnnca6VqQZAGeByCdgPhxGpFtAQbYVuoWf8try4iiUxtHJe2Q?= =?iso-8859-1?Q?6NpoG9VZlNDQt7XO9i17kf1EsRN/9QYLV7ND/bp1wD7vG1Ps3t5uNMXrcq?= =?iso-8859-1?Q?XpbPdqgyZkkMwp9dPtaRLJjb55c5T7GskME7U0ck46giwyyUc73Ks5tv2F?= =?iso-8859-1?Q?k5JSdx3sX6/zFiK+gp/Eu0rPCVdoTeJInmeKebiJqqakqxRxX18AY5PmCH?= =?iso-8859-1?Q?YV0B0XekvJHegoGfHDxgxvZjPF7cEaaO2JzL4VjTjCGtzt0ufUmvAvW/eC?= =?iso-8859-1?Q?fhHOg78Rx8UnlLP4wlE8JdNBhGs3twFhNCx7+jYIQgjyIkz3bT6i2Fzjps?= =?iso-8859-1?Q?2ECCfIwHH/KcTkWZgtKdouAgDHh4+bihasRrcxPmXJ3jaEiNblCo6krpi3?= =?iso-8859-1?Q?FSLRtKeMTt0tWvkLD/l8ul2qVuY3KP2okJzMvi818uByAfpPaevYomqAa8?= =?iso-8859-1?Q?gXJZr2l0+ddu1XCYR+UvRtFTpzPNZb8wzDha8y6oabym/BeTjB4JCIJ6Vu?= =?iso-8859-1?Q?20nxBljGjbPgWUzr9JdksXLntW9czRomkyhWlWiI8EmnVVavcNQsoIR2Pt?= =?iso-8859-1?Q?ckheaC4kTbsPJrygzYtOA7pw/od1au6+yLYIO2SVfIAHALlHthYkEsdbqh?= =?iso-8859-1?Q?N5MMnG7CrEv1KJHJBa8NjQ+XYeFW/PFtzOfm3VmXpm4xNwWSoIt1BSz2nm?= =?iso-8859-1?Q?+Ibv/pchvWRKoLaqbEXsrR3oFQCN0hP7inYECvsEdSpZ+sdtf/HjNRdXHQ?= =?iso-8859-1?Q?pZksxO0+haVrmOqDOIG4smBdkTPyaviTSeqakLAQFo036bGW46xBq5rggd?= =?iso-8859-1?Q?xLRXJq2Ew9fF2gYgAHyhHXvSh6nI017sy0XAqYlImhUIgF9Mkw2ExlkinJ?= =?iso-8859-1?Q?XtaOvezl9umFLo6iEVUljS2Jkq894miFtFW/kLyQfRJEcRKem7DQ/v5ozH?= =?iso-8859-1?Q?EwUtIeq2Cl2CwAWlJha4/X9KDI5ekZDqDSonjZkA+dKkltmVQOt9I4EgmS?= =?iso-8859-1?Q?9QrWT/hnY0yPHP9w/0LPJxSrMioREQCKju6GbfQmb8tvsKIEXu+3768Srl?= =?iso-8859-1?Q?uwCv3jXXJA5WjcpwMFPxzAD5dKuUQixpO5kelUSiVEvR4aq7rxbGg+oQZN?= =?iso-8859-1?Q?tvozmcaj4QbKsjHzL2y3Z7Powrguoif7iBBcXA=3D=3D?= 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)(366016)(376014)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?nOhroqYjEZr1xhJrVW8pCTk4jsml6Kxveykifqrv0tG2E+W69E7boVcm33?= =?iso-8859-1?Q?YvHiRLlQhe6yqA4BWnOt1+I+2iH+pT0ypAJy4ALLbcFgIajqHFV8bTUfN/?= =?iso-8859-1?Q?Qwbfe6PIGps2tV+nksYkTcUErusBdY63A3zleVaZh+Ytf22zsjyUlWH6ZS?= =?iso-8859-1?Q?aBetpjo9XDQ3e57TdxTXzdWV8dlIFrb+mgxH9z4VDI/ts4uZjg1eFD1I7d?= =?iso-8859-1?Q?AbgYtsEgni7gIDXOeJ2+5yBzAMOe7UXxa2rPwqpi9oA0MRuQcPuiLTMZT/?= =?iso-8859-1?Q?gahSBxqtsPLP8WINEF6h/ybwyrHQHUnaUD6zbbLozyq1/xqON4dloRXmCX?= =?iso-8859-1?Q?h+2TUYIoZJzTh9XduZEAi4cugW9I9FelL0L53OluzFKIH2do33O63Vki5V?= =?iso-8859-1?Q?BIwqJjGwdlxE4IDdsWE+yFFaPuPL0KtiBCjLVg4aFztwF843p/Kv0U0Bc6?= =?iso-8859-1?Q?DIslb1IcIsbtbzhE/ZYkAV86lKcmc0NoWhlPwWEJfffQoUfHmbY/uR7R1J?= =?iso-8859-1?Q?fXCAE/F83K78tAg6rl+LienQPdSZxgfzgvhN86wQ+9SyBpLyz76B+ylxpG?= =?iso-8859-1?Q?H/RrTAz+CfwHZ2yoaxlCj6gED9DR/i6zFSlxPjVkGcDIpaKfADoHUz1sqT?= =?iso-8859-1?Q?nTa8xR8ZM4BM5086bF5ksIUmXRn1p5RYkLaLELOPiB81p4dqYHDbAWOaZ1?= =?iso-8859-1?Q?zGGElP8jo2JVfHjIM/FPx2Y9PUG3c3pxKjNO6GhHiGRou0dCrXa1PCDO0s?= =?iso-8859-1?Q?SAYycQbHp8pwSQUkD66/n12w/lBlUUkvAPdrxazjyOlfTk1YbaCJan44hZ?= =?iso-8859-1?Q?4mmW06oYhnJzLbGqGXxx188yuHU9nbx035w4UMqf8uDc8GWu0FPu/z/9XG?= =?iso-8859-1?Q?MN+kECszwtbeUQ8+Lu3peaJUXNtzmKwx3eYlmy/qcTIKMXjwpZq0BAzlgY?= =?iso-8859-1?Q?BUyccuWz/AdexVue6jvrlngrkF5DGr4YUCPaGq0vfy+EoCf42YoMKi9DLw?= =?iso-8859-1?Q?UpMwDYs8+Jut0wJMwS0yMSgCFaek5iwvJPKSNRCOTrfuggoprQ8HG283WJ?= =?iso-8859-1?Q?BROQROgnJv30yPBhLOxw2iOPW5EvszYRAyDEU0hDSMakKww7WVIPorBMG4?= =?iso-8859-1?Q?mqHRACyzR/8rhb8GxSeUG0gou5nQ1jw87TifDxnnWVhCN+bYcLWQQlBge0?= =?iso-8859-1?Q?4DiVBWUsNxFyGGWey3TDJmCrTiZ8W+zul5FpXD/PDcb8PtUFHx45nJz4tQ?= =?iso-8859-1?Q?QDxillcuRl9DpTGZeh4HZOc9dPZgMeCS39RGpJEgBJwSEmgvyRwmat0JMD?= =?iso-8859-1?Q?uZ+/wWDMOFyTspTo0G6tnis+wQll570I4vZawVTvw/hvmOXKHzyiaOUTeI?= =?iso-8859-1?Q?MQFZN7LS+qFID8mggSIXW40vE0luQi2V7o9MEHAvNs1iK82kJwH/ognNiw?= =?iso-8859-1?Q?sjQ9HSPwGGYd/6dDgXI51tcU3iKf7iH6wONi0HWixQ80SIMGb6x02PYHQi?= =?iso-8859-1?Q?DFyL8r4wBnsUrgw+0JYo1j/REWSG1rZG5pH/CUoClCT9EwiiH0YSetP3A9?= =?iso-8859-1?Q?LxIOgAaIMsAf4q/CLn/mb0xZgZ4GF1Z39lIZBxaEA6ss1v/7hGh5jCQHrh?= =?iso-8859-1?Q?Gvm42T0zkZ7iV8BUoqAHiHyZ/P5D05JC4pCzB2uaPUJyFf5THMS2RC6g?= =?iso-8859-1?Q?=3D=3D?= Content-Transfer-Encoding: quoted-printable 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: a3c86f64-0920-46bf-b577-08dd10dbc065 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2024 01:10:16.2832 (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: dTYxlbX7Jb1Qk0SQ0QLzkPO3bKSZbxWLl0LdEcOJrrry+kyGOR39IBbqxxKggknROqf0p8ODu/uv4JQFumc3AYa5Cuhr6/yJs7vAnqIxEuw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7694 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1732929054187019100 Content-Type: text/plain; charset="utf-8" Enable previously added CONFIG_STACK_PROTECTOR feature for ARM platform. Here we can call boot_stack_chk_guard_setup() in start_xen() function, because it never returns, so stack protector code will not be triggered because of changed canary. Signed-off-by: Volodymyr Babchuk --- In v2: - Reordered Kconfig entry --- xen/arch/arm/Kconfig | 1 + xen/arch/arm/setup.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 23bbc91aad..a24c88c327 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -16,6 +16,7 @@ config ARM select HAS_ALTERNATIVE if HAS_VMAP select HAS_DEVICE_TREE select HAS_PASSTHROUGH + select HAS_STACK_PROTECTOR select HAS_UBSAN select IOMMU_FORCE_PT_SHARE =20 diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 2e27af4560..f855e97e25 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -341,6 +342,8 @@ void asmlinkage __init start_xen(unsigned long fdt_padd= r) */ system_state =3D SYS_STATE_boot; =20 + boot_stack_chk_guard_setup(); + if ( acpi_disabled ) { printk("Booting using Device Tree\n"); --=20 2.47.1 From nobody Thu Dec 26 21:58:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass(p=quarantine dis=none) header.from=epam.com ARC-Seal: i=2; a=rsa-sha256; t=1732929052; cv=pass; d=zohomail.com; s=zohoarc; b=md6bgcS+w8x+RUHWK7RpKyggD3zvCcFKxkfpZdM3aG/CrgHcdM4uZJ1V4BBwFT+RvDhAJbkVxQqO2iGPk478hRRCywLFd3x5iZVrsnHN7dleVdqctjlG2oonjsyLspmCXqhU57hvwg15e36dXcJs0VwGW5RJjhL+3LxMvjgR+Nc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732929052; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sMLsAsxP2jCKXlPGp2d48OpFc6sgoHg60qnvVOllAa0=; b=HkDXePHz8MURI1s7ELff0L7aeFa2spmdTqZ5upTSHhEJ40FiXsx+73AGpFAjoUQTcsOQjVSPTrfVdIGwm38mfyzYNjhVFpNbfyWK7uFZpPnNNBppHw6oiRi0QXpIq+09rEzMtvO82i/65u/qM8twhiESmz4eRkmqeHujGuafxCQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=epam.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1732929052288153.878391089528; Fri, 29 Nov 2024 17:10:52 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.846086.1261358 (Exim 4.92) (envelope-from ) id 1tHC0C-0004XA-J3; Sat, 30 Nov 2024 01:10:28 +0000 Received: by outflank-mailman (output) from mailman id 846086.1261358; Sat, 30 Nov 2024 01:10:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tHC0C-0004X3-Fh; Sat, 30 Nov 2024 01:10:28 +0000 Received: by outflank-mailman (input) for mailman id 846086; Sat, 30 Nov 2024 01:10:27 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tHC0B-00044C-F1 for xen-devel@lists.xenproject.org; Sat, 30 Nov 2024 01:10:27 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2062d.outbound.protection.outlook.com [2a01:111:f403:2613::62d]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e142c225-aeb7-11ef-a0cf-8be0dac302b0; Sat, 30 Nov 2024 02:10:25 +0100 (CET) Received: from GV1PR03MB10456.eurprd03.prod.outlook.com (2603:10a6:150:16a::21) by AM9PR03MB7694.eurprd03.prod.outlook.com (2603:10a6:20b:41e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.15; Sat, 30 Nov 2024 01:10:17 +0000 Received: from GV1PR03MB10456.eurprd03.prod.outlook.com ([fe80::a41e:5aa8:e298:757e]) by GV1PR03MB10456.eurprd03.prod.outlook.com ([fe80::a41e:5aa8:e298:757e%7]) with mapi id 15.20.8182.018; Sat, 30 Nov 2024 01:10:17 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version 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: e142c225-aeb7-11ef-a0cf-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDE6MTExOmY0MDM6MjYxMzo6NjJkIiwiaGVsbyI6IkVVUjA1LVZJMS1vYmUub3V0Ym91bmQucHJvdGVjdGlvbi5vdXRsb29rLmNvbSJ9 X-Custom-Transaction: eyJpZCI6ImUxNDJjMjI1LWFlYjctMTFlZi1hMGNmLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyOTI5MDI1LjQ3MTA3Nywic2VuZGVyIjoidm9sb2R5bXlyX2JhYmNodWtAZXBhbS5jb20iLCJyZWNpcGllbnQiOiJ4ZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcifQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Q6zrJPiOoYZzJHV1mJopSCls5JIBibHr+mbOEgXnZHiDSxUunWb9ODvMUw6nQDcuohPbUTgS9az8Yu84i1LA/6dvTJHfFDykAtTno8NXadCpsGnQj7kifdmFoHKQgXjlWpGvT4dpyPCXlAFaSiDdAiuMrj8lHiKO/4qdYKajaxGZUUVL1OHEINhNFqqvLbUGcRG3vOeEajpodhdrDEAba+oCoD3AHu0ZXpx1lLfz6LL1vbNjwGatohV5OD+e1ZIquuiOaGTAdzKrltrSAxRdNQPSrte9/jLCkwNNbILIp0HxV9is3hAa2fBaXrHWd1nNdSKiGmhXXhh4OgofwDVzyw== 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=sMLsAsxP2jCKXlPGp2d48OpFc6sgoHg60qnvVOllAa0=; b=aEY9T8VKCMjTGIjleNZuRGbY2+jKMaJfgyyUBGYSVW75fh+/IGc3HngvzYFPwf/naj0dSt1SA+ntWF9Em1xJGhI6OuNCtATl3TEburhTj5TRG6n+zyU/g42u34qxiT9iugd1otpMlG/kC7KzEloVZhVfzG/Vrr4eFfyVMa2HBkyJcQMtdL0z3+1XSqJep923te3WTxv5lL6vJorXufoiV/DFmr/TFQTkdiBvOTvmdqRO+tynUx7aEKDj9ASip3TWBPivFVv4M2o6zU5/GEWeHLDNWubddfF44WPP9B/oFngQ9//AdnvYe/Mb4CyYdS49WyjjnOUgQP/PJITug3IBFQ== 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=sMLsAsxP2jCKXlPGp2d48OpFc6sgoHg60qnvVOllAa0=; b=rvv9qRw9tXc23DMjcV9jea3tJ3lcW7hrrPAu15DPg2WMMVRlDy4Lg41kTFuxd9PUn/36dl5cgJpXkd8NLRzdxf3Dphu+V8w9slewHJju+mzkElhm2pyHNUTmNvakRozC3cR7U8DCW5fbIZqh5CUa4o4yabNAN5zojJTT41Vm/eXFdPMchEtzHZBVnr4mAgvO/wbdj18b2gc9SzrLq5BC4tdzrZGH99LsLscIjREWS3EQA/PIeA3SPb5Qm1G7t6MB9L4zPc8skzRGm3FcHVrc5swkyX9GwwoPaHzulX9LEyjLG/VXiXanxQ+rPk75SluQ3TUv1cuSeRRS7i+WEEEl3Q== From: Volodymyr Babchuk To: "xen-devel@lists.xenproject.org" CC: Volodymyr Babchuk , Alistair Francis , Bob Eshleman , Connor Davis , Oleksii Kurochko , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v2 4/4] xen: riscv: enable stack protector feature Thread-Topic: [PATCH v2 4/4] xen: riscv: enable stack protector feature Thread-Index: AQHbQsSdrqhVO8R3/0W5bnSX25z8yw== Date: Sat, 30 Nov 2024 01:10:16 +0000 Message-ID: <20241130010954.36057-5-volodymyr_babchuk@epam.com> References: <20241130010954.36057-1-volodymyr_babchuk@epam.com> In-Reply-To: <20241130010954.36057-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_|AM9PR03MB7694:EE_ x-ms-office365-filtering-correlation-id: cd6b4f3d-38c6-47e6-1237-08dd10dbc094 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230040|1800799024|366016|376014|38070700018; x-microsoft-antispam-message-info: =?iso-8859-1?Q?k3mjZrk9VHb7MObOMvN85ZqNUkvQyQJ7H2Fb/FMmMEj93r4gE49ZJ38yjU?= =?iso-8859-1?Q?Dr+w414prgQDAp5wlwOnbW5eEcemHqXTVK92aTxCqcQR9GZP3KXK4ZQLbQ?= =?iso-8859-1?Q?kLR44QVHVKertD+sS07H4CJ/BVu/DE/cUIwxSHFgker9t/p7z4x34SukGf?= =?iso-8859-1?Q?3zmi6T9BT8Bu0VhEs8+PUA+f/ci90PYNccA1IeleqwO2vICq7HSHVWIGUF?= =?iso-8859-1?Q?F4mU2dj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Xutkd?= =?iso-8859-1?Q?Yl2cgb2PSEQzh/n7r8gqzjvr9Y1gWFqJvt9UkoY/z12Nc3iqCbm5sksvUD?= =?iso-8859-1?Q?fBWTninHDgx3IIC/+IKmB7nfJYyPMtsfhGo8oBTFTLd4a+P4TO6lR+mNl/?= =?iso-8859-1?Q?VjaIrd60cJYmBI1MvdxGJxpNlDSEKLptjadYnxT26IY3JAb8hFPM9ej68J?= =?iso-8859-1?Q?iPQCp51Oxo4BbtLGhb252p9EWEs67c/rOASYvkoN6qs4IvWnzXBRfRLTnD?= =?iso-8859-1?Q?yfOScW6Jwo69pXFXR9Kpz4Iiu8yhGbsbpHH7GJHPIWYj47BLudM2VFAZyE?= =?iso-8859-1?Q?try/OqTqaE+kWIaIRMEwJWrQy47FB1PV3D0Bkg=3D=3D?= 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)(366016)(376014)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?1X3XPcbFMFaVlCJOmqJr0uiSPPlahk6n9va9JCIoqHAmNpq+PlvNXExJSJ?= =?iso-8859-1?Q?8BnrEGNk8AVDsKgCtcO+FPZZxw3R2FXmJqq97RdvzCkyI6nBWn3nX5CUmq?= =?iso-8859-1?Q?PT6KkIhEpayOzI8zzIic9h51oSWSLBLwlvGEjtREJs0XIhzF8tIWrhcWKy?= =?iso-8859-1?Q?9DA+ja0jISlgfI7+cEr6znCy5eFaZDizn2vHh/Os6gPwtYwgo91ObEPqqf?= =?iso-8859-1?Q?43XLk03uPD3a5oCuvbL0Un+ERLxAltfMPSWHw3XrIfpbGoLJih8y+Z/04B?= =?iso-8859-1?Q?GCkNBDDcxg8/4OBfMGaIBWkENAUlmkwGBQhpKA5yRN6h3KoOj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LxgBljc7tOOYycgXfJg9EZa8RoEFhCTBlyZpugk1LGPhrsd8q?= =?iso-8859-1?Q?yFvVjb+yvtQXd/abbpsIEbVQ91XQXp/vGBYicoTNGQfhITGHfkBVSQ/iT3?= =?iso-8859-1?Q?vr8R660aQOrSSHh19HqN5uybmvWnM/S5uW8Gpj3/mDNKl/DxDd4oVGifW3?= =?iso-8859-1?Q?ZVA4+PNBqZQoq88KqoPe+y6cK3xxD5d8dfDVYCrThagxLe+7yMPNXbpa2h?= =?iso-8859-1?Q?4+VBJoPYmoLmhMrC9PrGQ8WsA+pxq7E8axx393adTe9HYLqDJCYAGw19rL?= =?iso-8859-1?Q?oN/Xc7WCusm/Ve0RmvqtvFkqT4c6qO2nJDg/tfB6/ITLpyvPUmrzlh2H0q?= =?iso-8859-1?Q?FtDbr/rnuc44f1xR2L3k7laXWKnm4bH+ryL+VsELSnnHDYsz10QC9gNJYq?= =?iso-8859-1?Q?ukmul5f6T2fLLRPdc74JPYd4b5JB4nXbIFIAoJ/shfjnLal03Woxyx1A?= =?iso-8859-1?Q?=3D=3D?= Content-Transfer-Encoding: quoted-printable 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: cd6b4f3d-38c6-47e6-1237-08dd10dbc094 X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2024 01:10:16.5991 (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: 8X8GmRRjURy0XqMk2Shw6ukUfXhf3iq3UNSrXAZZbQI1AhDmi0qfmbXJXvRquAlFNRoK1sCeIcrmW3IN1CPUkOooU7mGRzZ4qyloR9wGUgU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR03MB7694 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1732929054190019100 Content-Type: text/plain; charset="utf-8" Enable previously added CONFIG_STACK_PROTECTOR feature for RISC-V platform. Here we can call boot_stack_chk_guard_setup() in start_xen() function, because it never returns, so stack protector code will not be triggered because of changed canary. Signed-off-by: Volodymyr Babchuk Tested-by: Oleksii Kurochko --- In v2: - Reordered Kconfig entry - Added Oleksii's Tested-by tag --- xen/arch/riscv/Kconfig | 1 + xen/arch/riscv/setup.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig index 1858004676..79b3b68754 100644 --- a/xen/arch/riscv/Kconfig +++ b/xen/arch/riscv/Kconfig @@ -4,6 +4,7 @@ config RISCV select GENERIC_BUG_FRAME select HAS_DEVICE_TREE select HAS_PMAP + select HAS_STACK_PROTECTOR select HAS_VMAP =20 config RISCV_64 diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 9680332fee..59eddb465a 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -7,6 +7,7 @@ #include #include #include +#include #include =20 #include @@ -57,6 +58,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id, if ( !boot_fdt_info(device_tree_flattened, dtb_addr) ) BUG(); =20 + boot_stack_chk_guard_setup(); + cmdline =3D boot_fdt_cmdline(device_tree_flattened); printk("Command line: %s\n", cmdline); cmdline_parse(cmdline); --=20 2.47.1