From nobody Thu Dec 26 20:57:27 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=1732309694; cv=pass; d=zohomail.com; s=zohoarc; b=ZHU3UwmtZClP3gAiPUdXZwkkG6dN/WsI74cHzr2tJIW21ZnQ69XAmGM2hIIg4eGHFp7/KJRkfjNlkm0Gh7w6rtOkk34uchgozyTMxCCDTmyreYrKJHudmFUi7Mt2ywdBxj1O0NxEvyjS2IofSFCLtUejw7SNv9zAkHmyGBlRNEM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732309694; 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=FNlNjXvfJVm1fbN8Mlag5X39oGFDKabRNL8lFdyjINQ=; b=VbBH4/SxzKFl2Mw50rSyClF9TxpF5SkmlP9lxaFq0tdwJxPPDbDi9/RC+0IbJ/pAq80xi2Lsz6y7iUCMTsNgh9xFir5d534vi0e+iVphmeTsZ1ioY3c2AzkcPdC1xNnox88Xy1X6Xz56WZBA1/vZVKqphutV786biid64SVYfwY= 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 1732309694090646.6926011096728; Fri, 22 Nov 2024 13:08:14 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.842002.1257463 (Exim 4.92) (envelope-from ) id 1tEasR-0007BX-OC; Fri, 22 Nov 2024 21:07:43 +0000 Received: by outflank-mailman (output) from mailman id 842002.1257463; Fri, 22 Nov 2024 21:07:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tEasR-0007BQ-Kw; Fri, 22 Nov 2024 21:07:43 +0000 Received: by outflank-mailman (input) for mailman id 842002; Fri, 22 Nov 2024 21:07:42 +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 1tEasQ-0006xA-Cp for xen-devel@lists.xenproject.org; Fri, 22 Nov 2024 21:07:42 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20624.outbound.protection.outlook.com [2a01:111:f403:2614::624]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id cded252b-a915-11ef-a0cc-8be0dac302b0; Fri, 22 Nov 2024 22:07:38 +0100 (CET) Received: from GV1PR03MB10456.eurprd03.prod.outlook.com (2603:10a6:150:16a::21) by PAWPR03MB9738.eurprd03.prod.outlook.com (2603:10a6:102:2ed::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.20; Fri, 22 Nov 2024 21:07:33 +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.016; Fri, 22 Nov 2024 21:07:33 +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: cded252b-a915-11ef-a0cc-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDE6MTExOmY0MDM6MjYxNDo6NjI0IiwiaGVsbyI6IkVVUjA1LURCOC1vYmUub3V0Ym91bmQucHJvdGVjdGlvbi5vdXRsb29rLmNvbSJ9 X-Custom-Transaction: eyJpZCI6ImNkZWQyNTJiLWE5MTUtMTFlZi1hMGNjLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyMzA5NjU4LjcxODkwMiwic2VuZGVyIjoidm9sb2R5bXlyX2JhYmNodWtAZXBhbS5jb20iLCJyZWNpcGllbnQiOiJ4ZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcifQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=KOhZIL40V/Nn3Nr8jf7dyQjk78wYeb7xRrCxGc/tHb3ui5uRjtOmc1Mno5oZBuCQugk1pomgajMBOZJHTkFExDDjNXZNiTLBq4yPFC5eNg/gR/aH6MnVBbbs0hc8yVOmNRd0bQobbBJfdE786Gb5HUBdPNtaTg5AfnQlOdxAu0upPLbpAauHZbTlVHHp9Y5SOrLeb441Jfkx4yQ8R0yHaLiuEpYqbsNx501ju9fkbpI9Z1cOIaT9D1212Fy4AmRPwLtVbVdN6Tj6QwfQ632bc7a7+P5pHOX4JDHSFdICpvjFk6gjxvQB5xs22DNp7ZHIf2GfTQ+amCHCaFul42ZjzA== 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=FNlNjXvfJVm1fbN8Mlag5X39oGFDKabRNL8lFdyjINQ=; b=ETfWokfsftBTMWlAP2/XzVckgU0HSJ+jX7Lm02TZhCrgq6flzj+s/R0qUfRiyJADrMk9Em8VAgzbDbxrvJ27hFXn2oSdqnhwlxTrR3cTkFrOdYsEQ0Q6zmk9oyvhzBD2pG0WRLroeXyIehvhrcMswsuMSZftbvX2tB45V9E89YqoPDEAW0uIGaPbUFVq5qYRfVZvCGyOn5L74TZTZOVfAUVlomLTat4Fvl0sU7rvUf0ki3EEoeowTlItbRzo4TuiADcBAM+UMQHz/xZRWACBpooEUAzIi8uadYd+x2nRf1y6zsJVdZVwmPKATL7h3904H6GMUcYYNkd4tim0csu7uw== 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=FNlNjXvfJVm1fbN8Mlag5X39oGFDKabRNL8lFdyjINQ=; b=DMMeYNkOxbZ63EYB8U867/Ri28w2iqf4yLgi9C6wnY+3OGD6qda4OZh5YHmOOM8XjkZ6Dn5hFN5ZYh42WGCzGrxQwJNCsB56TWKkXnDVDLiQSruAR37IAMlHlI7i7wlIfa+FMzPCY/1vtBqE8Ry7PhYv9QzXDLg+bo0IRdxzXOyWGlikqnZQ+ep1AL8cXbRueeKZEoLey16nG6Pi05BnEEpDxlonkUyxAB2DH4PhGhZZXidj4ryXEoFLH9fp9MQmTkpZ3c/S3uP0XndDuSvQZaLbdRws8IspzR6tT00uzhpwpoj/OkT3gV3/n2eNTvXE/CVzL5DtYRGdKRrcCYFAng== 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 1/3] xen: common: add ability to enable stack protector Thread-Topic: [PATCH 1/3] xen: common: add ability to enable stack protector Thread-Index: AQHbPSKKCRg4722UIUuMGLA9PEEyZg== Date: Fri, 22 Nov 2024 21:07:29 +0000 Message-ID: <20241122210719.2572072-2-volodymyr_babchuk@epam.com> References: <20241122210719.2572072-1-volodymyr_babchuk@epam.com> In-Reply-To: <20241122210719.2572072-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.0 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_|PAWPR03MB9738:EE_ x-ms-office365-filtering-correlation-id: b0bbdf27-da14-4f83-6faa-08dd0b39af00 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?DKQUg+TzQpo7IG5DnsdqPQbmPA+uelJ8+lUk/CUrhsgqFveQlfih7Hiyum?= =?iso-8859-1?Q?J7a7+WAvqr/PlW83ZNsCRwpeluSwR7tcyW53Wi4ZU/+pe/6olSpTnbTZsO?= =?iso-8859-1?Q?FxUqSsj8889gcYw9auQPozOjTQUriMKwIPfp/im/gn51yXHt2F89dR2t7J?= =?iso-8859-1?Q?X3KtJDTWzP9t59lRRGuzlUdyZj6fxfLv7uhoG8LSVCzZ5J+2gYSqMQDBho?= =?iso-8859-1?Q?p1sfsIxrPWJHNjb/TObyfYW03jly3Llm9Z+PXecGdp1PrfsLT6e1n1DEbl?= =?iso-8859-1?Q?OT89yeyT6AcBBTNFNzop28ukPf6p28XbF7JNPdP6VImyvI59Edmuxxo5Fj?=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GjDOQZrGuo1P5euH7To8UFAktIqeYkA?= =?iso-8859-1?Q?ccnjZW1ZnmAUO8pwgBpol+x2xncgWqEo7vPqmYpSXwWytx4LjA05OBTVBa?= =?iso-8859-1?Q?fC0ja4FpO674WMFeg/BlWy15RiX2A9SM9DnRW09nLdZKM+p3UZrBMethQv?= =?iso-8859-1?Q?tJciEK+ZgQ?= 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?vj0VqqDdUDo4X3IZXk197zOxV7GKHVIwcibUexws1BOQRvJPwBsOV0vprL?= =?iso-8859-1?Q?nNXTlwdri6k53ngQFmUazmb7mJuB2v37vOlxBuuVBqDSjfFPZZTwuSyFah?= =?iso-8859-1?Q?RXQNaipwLzEqOJPtPskjPr/HDpK8oGx47wL1d8pt2uRakChgtxyoj87gqT?= =?iso-8859-1?Q?1iGchD0E5uZbAcbbAPPRK5REbNwcMDoMbdrFGNoJIYtoQi2EoaR8HbbWNt?= =?iso-8859-1?Q?f2b28qOgS3nKqN8CIWUu4BhT3paHQDuFZl895H4aQTe6vmIcfwiO0q+KGU?= =?iso-8859-1?Q?Hq1nUyPvqNXU2YIT8gbbifYHZKkVRmdzwXMbj/KZuPkHl+oYY5C/xc502A?= =?iso-8859-1?Q?mWiyNTV9T0STyjrE2juKQoSH81hS2+mIynVnF5eyurtjB0+g4kMg1bhOca?= =?iso-8859-1?Q?T3ARsBVmvCowKXX4uUPVrkQlnqhjNcfqBQwehHRtiZzHQxbkf7v6YkE2jo?= =?iso-8859-1?Q?uCd1BQ2d/ZbYt+2Bveq2SErWKd6GUyP8kTUkq+ZBCdWcEIBBljWKG51TLO?= =?iso-8859-1?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JegC9l?= =?iso-8859-1?Q?z0yFI/kSN/ymGLeLI7b5nVotHJYR7DFhHx8lLD0ccZg/2IdqhC31/kjPIM?= =?iso-8859-1?Q?XfmQaS4JTWmcbbmJOANFPIJlufO012/76N2Q9Sp61HZdTr6SL08ED44sS9?= =?iso-8859-1?Q?zXdrUo4Wutmg5QsZuSETztNOmiLx3aKknOeWKc4Au4rEpdmujSP6+b7/G+?= =?iso-8859-1?Q?Tmoz122NqaoR08no9S74WgRiPO6hHSmqdCcCuPY9kGtL2/AO4Pik0AdA?= =?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: b0bbdf27-da14-4f83-6faa-08dd0b39af00 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2024 21:07:29.6659 (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: igXOCkrOe4Tzz2Nto8WxFLZSW9QJuA3B5aSPjw/Qi2duMO3zOp1ofuQrO+6V+PR3YgNhZof61iQQ6cBY8KKuS1CkOt4BYBzJW4yng1xaWhg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9738 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1732309696803116600 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: - "-fno-stack-protector" is removed from global config - 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 --- Config.mk | 2 +- stubdom/Makefile | 2 ++ tools/firmware/Rules.mk | 2 ++ tools/tests/x86_emulator/testcase.mk | 2 ++ xen/Makefile | 6 ++++++ xen/common/Kconfig | 13 ++++++++++++ xen/common/Makefile | 1 + xen/common/stack_protector.c | 16 +++++++++++++++ xen/include/xen/stack_protector.h | 30 ++++++++++++++++++++++++++++ 9 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 xen/common/stack_protector.c create mode 100644 xen/include/xen/stack_protector.h diff --git a/Config.mk b/Config.mk index f1eab9a20a..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 -fno-stack-protec= tor-all +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..0de0101fd0 100644 --- a/xen/Makefile +++ b/xen/Makefile @@ -432,6 +432,12 @@ else CFLAGS_UBSAN :=3D endif =20 +ifeq ($(CONFIG_STACK_PROTECTOR),y) +CFLAGS +=3D -fstack-protector +else +CFLAGS +=3D -fno-stack-protector +endif + ifeq ($(CONFIG_LTO),y) CFLAGS +=3D -flto LDFLAGS-$(CONFIG_CC_IS_CLANG) +=3D -plugin LLVMgold.so diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 90268d9249..0ffd825510 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 @@ -516,4 +519,14 @@ config TRACEBUFFER to be collected at run time for debugging or performance analysis. Memory and execution overhead when not active is minimal. =20 +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 diff --git a/xen/common/Makefile b/xen/common/Makefile index b279b09bfb..a9f2d05476 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..de7c20f682 --- /dev/null +++ b/xen/common/stack_protector.c @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include +#include + +#ifndef CONFIG_X86 +/* + * GCC uses TLS to store stack canary value on x86. + * All other platforms use this global variable. + */ +unsigned long __stack_chk_guard; +#endif + +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..97f1eb5ac0 --- /dev/null +++ b/xen/include/xen/stack_protector.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef XEN__STACK_PROTECTOR_H +#define XEN__STACK_PROTECTOR_H + +#ifdef CONFIG_STACKPROTECTOR + +#ifndef CONFIG_X86 +extern unsigned long __stack_chk_guard; +#endif + +/* + * This function should be always inlined. Also it should be called + * from a function that never returns. + */ +static 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.0 From nobody Thu Dec 26 20:57:27 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=1732309696; cv=pass; d=zohomail.com; s=zohoarc; b=TB+jEF9d/dSdTnRoh6JDHDlsh+oD9M1SWh5SFipgBhHXexmvw8ztRkUzA8FdKMgQ/gaLR7rzJqGJ3JtW+n0EVfxjUgHddpILQDnL1+JJpxe7VQHP5VRiQV00Bpi7QQisVWdPi2yhNnmZ8NGO/Lc98+ZdX3WojYwwbodMJxWniXo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732309696; 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=hKhc6MOCXjks3p+mF1Hok1MhyOqzBUachJYh4VSNAfA=; b=FEAR5ha25669FnAQFYMrvWFjj7wVa4jf6bRkpKZmRROyLODaLaV+I59m+LHlt5Ruwl64u0IEAQloNsxoFd835mQ07sjm8o+41wRhf9CRH9WKMNZFh6iSpZ1VLnzUGyUUCStQC5j7zZeYu4FlIUHIu29aAOLa0taR2ARIQGHYEeg= 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 1732309696403789.983013471434; Fri, 22 Nov 2024 13:08:16 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.842003.1257473 (Exim 4.92) (envelope-from ) id 1tEasT-0007QE-5j; Fri, 22 Nov 2024 21:07:45 +0000 Received: by outflank-mailman (output) from mailman id 842003.1257473; Fri, 22 Nov 2024 21:07:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tEasT-0007Q2-18; Fri, 22 Nov 2024 21:07:45 +0000 Received: by outflank-mailman (input) for mailman id 842003; Fri, 22 Nov 2024 21:07:44 +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 1tEasS-0006xA-FC for xen-devel@lists.xenproject.org; Fri, 22 Nov 2024 21:07:44 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20624.outbound.protection.outlook.com [2a01:111:f403:2614::624]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d0226e3e-a915-11ef-a0cc-8be0dac302b0; Fri, 22 Nov 2024 22:07:42 +0100 (CET) Received: from GV1PR03MB10456.eurprd03.prod.outlook.com (2603:10a6:150:16a::21) by PAWPR03MB9738.eurprd03.prod.outlook.com (2603:10a6:102:2ed::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.20; Fri, 22 Nov 2024 21:07:33 +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.016; Fri, 22 Nov 2024 21:07:33 +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: d0226e3e-a915-11ef-a0cc-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDE6MTExOmY0MDM6MjYxNDo6NjI0IiwiaGVsbyI6IkVVUjA1LURCOC1vYmUub3V0Ym91bmQucHJvdGVjdGlvbi5vdXRsb29rLmNvbSJ9 X-Custom-Transaction: eyJpZCI6ImQwMjI2ZTNlLWE5MTUtMTFlZi1hMGNjLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyMzA5NjYyLjQyMjQzNiwic2VuZGVyIjoidm9sb2R5bXlyX2JhYmNodWtAZXBhbS5jb20iLCJyZWNpcGllbnQiOiJ4ZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcifQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ByzlH/mC/RxZMcA3Jn7WlK2C4XWE8REKDsqGHfRgSnr/0Po/17BWtfFqpY2BvucsxaDYL5jkUTE75MNQgeOb6wr4jiDSdk9hXPaQ5BX/CPOq95euYk3xIOOe/vS88vYFOFuXbesritFa1eEC2EX7B4Lozfm26dcaOvC60+VsHVJQW3mjY43VrdHjytMWXJSmJ4QBt5DW5OvNXcSXO9/FokxljoTmkaPe+I0lmHxHvoJre6gp6zz5oKsaH/a8J3r8UYyTWFVMkAXWPN4PcfIT6T8MoRWXxpxCbsdItu6q0vizdHW0La0Z1y5Ltiw8oeVjOURHbnYJTC8IExeDCtav/A== 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=hKhc6MOCXjks3p+mF1Hok1MhyOqzBUachJYh4VSNAfA=; b=pzOchMNl+fLT32dCQV7r01lAII9BvuvkhjInQ/RNH5X/xrJRs3aB4lXVCWE/n4OaWoFdbIwu5pKWfjAPCRg4LRhNxdH1+DcoTmh3pxINE8k4RYcTSZa2vqXoUxUNkWnPbtUXBBXSpDGTTPcAJRxdkWWUgu1nctjMAnr8geautjgOtGmdhTK29moic0FmmTxkh9N/49yos88deeSdMRFGpiP2AMFWmLyA5bmSUrHYz7QJwML9Q4I4B72B5ZDiFxs+PKbTWhc7wkwzzjHbC9Zrqgmz36aqSa4ziq6msKF5CiCFHIxBjxA87gv8cUwMCl0x3CnCL2DGapZ4g5aV/mS3xQ== 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=hKhc6MOCXjks3p+mF1Hok1MhyOqzBUachJYh4VSNAfA=; b=pt5H47fIUyJkZlZPkYguX3OnwuVCPvbRHPgulL39nx2yB/2tQrEmEx92hxjB3eEJ6bBNpiwi3BB/ZT+fAuK2GYdMCNfKCnIJNjDqkYsnz5rjHoC9XVGHyP/u1cWbLUnB17vxEAyT8FTGkGCeKVVjklEnLC/3yA0pxfM920Z8cAdjdnWZPcAJsCiFDqHoYeCKpuqFxZg4AboDPvHLYEczbX6xiWvc+rae41QTplfCbUKk+2HksElq5xEyVH4ZCNUCro6Uc2rkYB+pkjIy9tFm0EXU2N6Luu5w27oP+1u4RGuiBczL/77/pFpbahcUUf4qx3FX0H28ayH9P/63iJczpw== From: Volodymyr Babchuk To: "xen-devel@lists.xenproject.org" CC: Volodymyr Babchuk , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Volodymyr Babchuk Subject: [PATCH 2/3] xen: arm: enable stack protector feature Thread-Topic: [PATCH 2/3] xen: arm: enable stack protector feature Thread-Index: AQHbPSKKppr5gbUiFkmSWcjt2gLITQ== Date: Fri, 22 Nov 2024 21:07:29 +0000 Message-ID: <20241122210719.2572072-3-volodymyr_babchuk@epam.com> References: <20241122210719.2572072-1-volodymyr_babchuk@epam.com> In-Reply-To: <20241122210719.2572072-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.0 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_|PAWPR03MB9738:EE_ x-ms-office365-filtering-correlation-id: 0ae32b17-3bee-4fa5-71ba-08dd0b39af41 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?+579lqAQJn6kfrGeZZuax79w41sh3ApDnHGJe3ih1gow+1IKiJy3sgXoer?= =?iso-8859-1?Q?EFdPAfetsNuDfx5B5/xoxgILkRvUgr5lzKkaZr58nG2AV3liptaBOh9w4S?= =?iso-8859-1?Q?emvuDzcdDWw//RgpaW6bIlEGAtTVJz8JetJAD0EXrUUpzAK27IBwBt38RG?= =?iso-8859-1?Q?W72K6lh3PYr17acSIsq2fKyBzBzLHl+vg+YeqYNz6ZZhdAJrUVI6cvL7mq?= =?iso-8859-1?Q?yfepkpzrtcg45VE+Sd1AygZlaMecLAaFMWmkoc72W1EC1IyFbC79R0kFV5?= =?iso-8859-1?Q?ZAwhsL+/vvXn4qpvnZY3aloxNK8WN+Y0UOMPFqtoRy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J8MI1G90kEezS8DGw1A3MWZyvXuCB1nVhnt5Us7rY2Nbd7RD+y?= =?iso-8859-1?Q?jVXfzT9MX3n8VQu2eqeONua7aCTGmrny1wA8t/I+vEgKCH5QCEItVY4QmX?= =?iso-8859-1?Q?TgwHRGaLxqUUwVuZjU+ufuQWKZVRRKME2oL3nFN8m8yCKvpbvoSEN/tgeu?= =?iso-8859-1?Q?/m8S6/rwOr0e0hvKm3u9Tl77dJhtMIjSPAQT31l1Dh+9v5j7PS7BQ=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)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?/+Tecr5i2su+bV/AdY0bINogBkte2JNwP1tioneadIsb8AnAlKUmqeR7z0?= =?iso-8859-1?Q?4aPheOU9L3yj31MUB5WIzVr5LFH1HqBoi98v+f+jqZFbKkJJlvwa7IwmWZ?= =?iso-8859-1?Q?ToL207uEoCDpGWVLnL81mXU1g7nhbGsnh8Trw7VEv6sWa2CCVv4umeq0T0?= =?iso-8859-1?Q?ZD4k03xv7Fjet9b/cSh7JIbahxGiuy04BIH+yjc9TA6A8aELBhj5dWRoAO?= =?iso-8859-1?Q?MWImesC1UoX7dah8bABP50+YCuvFN61zgGyP6cCmiMcLeNJyvUTomxFQhG?= =?iso-8859-1?Q?P7e+U5dAQ69jycjqFxolt+IllSp1FEvOjJ8a5VpdGgstSbg5CfrEu49rLE?= =?iso-8859-1?Q?HdZKfW4ARrpJQDtHQWfkgOO4hsaagswpjCyuW39fdEEPSAQU/CMfqD8BY3?= =?iso-8859-1?Q?OJofNhnI0DVWwwOTJVBX87eFD9RsGzWIGlS2ZcmSsIax+cDtZLJgAWZVSD?= =?iso-8859-1?Q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YQ1r2HZl49YChg+?= =?iso-8859-1?Q?+LDyu1TIhBi/YNnbanZNX0tIstvP6a7d1wjUYLFuYFuuy4RxTz2nV3K71T?= =?iso-8859-1?Q?B1BMME54P/uU5GdnlGQDl1fpnmgizelprw8/ukrfFwAwcu4M7LJPs09k0e?= =?iso-8859-1?Q?iaxLHIyDkPMKxbOmy+5Iq/J2Whpdn90P1v/TxhTf6q8PkhMSi9WFeqom2l?= =?iso-8859-1?Q?7dq5shtD0MyJF+JsotuLs8cIkGKy4D0nWsZNFK6uz+v8qBvtSG76nB+3c8?= =?iso-8859-1?Q?guZoE40SJX+bPXO0CDFd7JdiyNfGXqjzwet+3VIAeV+I4F/LTIyGei2w?= =?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: 0ae32b17-3bee-4fa5-71ba-08dd0b39af41 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2024 21:07:29.9392 (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: KMYuHsr6PE5ZEiu/DOeB5dDQSh190D8NrYXaktEnim0720bVzcySTr9s6Qj2Hb7DHt+64EoTnf4mzTZNWsusZIQUUnRzFWryflWdUh4mgm0= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9738 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1732309698265116600 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 --- 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 15b2e4a227..8fbb31bc07 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -17,6 +17,7 @@ config ARM select HAS_PASSTHROUGH select HAS_UBSAN select IOMMU_FORCE_PT_SHARE + select HAS_STACK_PROTECTOR =20 config ARCH_DEFCONFIG string diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 71ebaa77ca..2bd3caf90b 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.0 From nobody Thu Dec 26 20:57:27 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=1732309700; cv=pass; d=zohomail.com; s=zohoarc; b=m1CD4XFAqga/PcR4eL4i9lsh2BgLS0VIJ9r1vfe9ajg+J6lx0wEudxUqCjmM5Lio1FBqXreGzJOxldcyFBfUHwrUMKbS+70sIaAylN38wX7Fmp1Y56DUqveNVU0z0bT5CED0dRmLrzZTcsw7Y47xft3XycIOGZ/ySHGPxUXq4P0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1732309700; 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=KNLjq8vKDQdOVp6utg+lFA4xZstRQk7PIXTXtcimxyI=; b=cnE7+7JnRyRlB/8j/oxfGr9oyfuQOpVglhbN4QZ+CYSH4EBCUb1zjmSTComAdKscpDbQnzf4leM2l/7GOPZ7XGqymPDp6ul/1EGdEQf+xUMGcPdjH/IYSjoYfH3G4HMiajXR4ZdwBnUH79TqrZtTullyvk870j0cDItdo561k9M= 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 1732309700024583.9550066777838; Fri, 22 Nov 2024 13:08:20 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.842004.1257483 (Exim 4.92) (envelope-from ) id 1tEasV-0007gH-BJ; Fri, 22 Nov 2024 21:07:47 +0000 Received: by outflank-mailman (output) from mailman id 842004.1257483; Fri, 22 Nov 2024 21:07:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tEasV-0007g8-8G; Fri, 22 Nov 2024 21:07:47 +0000 Received: by outflank-mailman (input) for mailman id 842004; Fri, 22 Nov 2024 21:07:46 +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 1tEasU-0006xA-Fy for xen-devel@lists.xenproject.org; Fri, 22 Nov 2024 21:07:46 +0000 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on20624.outbound.protection.outlook.com [2a01:111:f403:2614::624]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id d15de20e-a915-11ef-a0cc-8be0dac302b0; Fri, 22 Nov 2024 22:07:44 +0100 (CET) Received: from GV1PR03MB10456.eurprd03.prod.outlook.com (2603:10a6:150:16a::21) by PAWPR03MB9738.eurprd03.prod.outlook.com (2603:10a6:102:2ed::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.20; Fri, 22 Nov 2024 21:07:34 +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.016; Fri, 22 Nov 2024 21:07:34 +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: d15de20e-a915-11ef-a0cc-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDE6MTExOmY0MDM6MjYxNDo6NjI0IiwiaGVsbyI6IkVVUjA1LURCOC1vYmUub3V0Ym91bmQucHJvdGVjdGlvbi5vdXRsb29rLmNvbSJ9 X-Custom-Transaction: eyJpZCI6ImQxNWRlMjBlLWE5MTUtMTFlZi1hMGNjLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyMzA5NjY0LjQ4NDcwNSwic2VuZGVyIjoidm9sb2R5bXlyX2JhYmNodWtAZXBhbS5jb20iLCJyZWNpcGllbnQiOiJ4ZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcifQ== ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Cc08jIfohAxGrqPd2m7uaZ+ID4ut1zGkoJJgv1sDdyz37eaOi4mnR4zlGaldvffp4fYHiHzvnBcrInp0TykLtMsxscvszdcEsTA02mrWWjdcHVHBqUI+2P1rlA7tMgAKVYdVZrENh0TyVNtrkHHObePxYxXGUwggUf+YDmbJnw23iSxZSw5GEEjY68eTdo0CEzHq2lXLHFoTZHh5WMweSx6HMtc+FmEpkR/lPI0MzI2TfQrhmTFqqYjDdSGjYlnDbhhIvg/kPEIxaeqQpHejXju87s5PgkAE3IZ/Ic+gOzRb6u1kj0C3//4f5JROQm6CWCHHPukEEbdEl0S10RLPHQ== 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=KNLjq8vKDQdOVp6utg+lFA4xZstRQk7PIXTXtcimxyI=; b=E01hlIWj/eTOKonvNibrbU4UYzF+vMb2XwJFwoOfk/8BPJAgjYEnxdJkTwfPAdGaYYZTAAWNK7V7byG7LOYTiN4X3tCTzv1F88h9GEpObquM1koSDRM+j/Nw0m9l8jwuFI6xyxbz56QGrz+4GkGE0rUapPnNXHyqBO1WW6VuAj0SCwg8rUubt6Msx+kpYvy0MkvbNz3tbOwr1LfTeqlNP0i7HwAZJ2dExXXBxWfNwJEBxpzPfPTsl0m6YblnFUE722pE+ZP8RtoviQjDh7hINlRs1uwWH8uEpWEsSgjFrucLzlJOllxBE30LJj2hh/yKAu4tGBgvzbjn8fLBZ+X1bA== 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=KNLjq8vKDQdOVp6utg+lFA4xZstRQk7PIXTXtcimxyI=; b=h80nxDy5HnoCjpqdz+JfSKd+vZrddveWYASYi+Ke/OaBT2JcOfxz1snkQKO/WDdnPhsGepIyPe6+EyKn/hDZ8QoFvNeBy1RwNkgVBm1L6pVWkuWAVSwqAdgzzvov16/7IAeZu5aSI9FZ3cOG4meV8t0jZvuCAuZDJDIn3aAXVUIXg9r9tk4RZLiBwHc+wYsLK4404Ixzfn/UexW8rhlvsqzWSXKLyqyjoao6kmpdMLshknyouEATJTxe87cAIm1fG7xL9DG1FAudUlCEpv6sESG0/a8vLGNWIKLvzSA0iFWZBAZZpIZH77q3uogQSMEvQrT67t0Pf49w2mRM03uQ4A== 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 3/3] xen: riscv: enable stack protector feature Thread-Topic: [PATCH 3/3] xen: riscv: enable stack protector feature Thread-Index: AQHbPSKK7LmLMh+hFUu+rgI8SvJulg== Date: Fri, 22 Nov 2024 21:07:30 +0000 Message-ID: <20241122210719.2572072-4-volodymyr_babchuk@epam.com> References: <20241122210719.2572072-1-volodymyr_babchuk@epam.com> In-Reply-To: <20241122210719.2572072-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.0 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_|PAWPR03MB9738:EE_ x-ms-office365-filtering-correlation-id: 9021afc3-c04b-4a6e-27e7-08dd0b39af7d 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?gfvSFmTDN0jJASxjgOGw44tKspQvz4vljlKLduxbZ023iMxbWImwdl/njf?= =?iso-8859-1?Q?BCXCV7pJyul+SVUS1mUPm0jWLENspPZUN2WwtGNzACxXhF60PFwtnB+NyQ?= =?iso-8859-1?Q?ApR0ZQ0Pdh8eHj8+R79R1HwuoXQb3G/fO241bxvz+r9o1lj/pKaC7nFB63?= =?iso-8859-1?Q?EZPFg7uDNeojHwtYDz11tLkoySEdzcShIAM4/XldOUwUwY4yadQsHj8t+g?= =?iso-8859-1?Q?m8SERasOTIEV0PwM6EYH9krnlUfTCcq+Dd9IfhaVPyqUBfaJRKLT6e1Zn6?= =?iso-8859-1?Q?oG9gPokRfNDM/NCDfAzeXfRIKaFt+VtLuSdR7h1FZYq9TshE34/yD715hp?= =?iso-8859-1?Q?s/zHVBBZN+q2B7cvdSqdENeyYchRuDocTL54PD1c2bIIaknxHX9SX7/tA8?= =?iso-8859-1?Q?GQ1fpG7kzEST7iYUK0G2EIWcjm/4gIGlSQqHDtlS7iIqwRLGgoZgggGn8U?= =?iso-8859-1?Q?jXUWPX7MZrpB3HvD8QjMBYTNXFwEJnrkLo4DtaXIJP78ra3tpEKicxFQQN?= =?iso-8859-1?Q?opdTj+hgwDQH1lZmR6AFArB+NFykXmGfe8pII51IWOe7IU1U+wXEamTCZk?= =?iso-8859-1?Q?8eH6Mtir9AkKtj0OynjuJ+Wcnat/90H4aZIGzncKauAlGJLPxqk8j6Ik4n?= =?iso-8859-1?Q?Q2Ej0Ya6dNzFSiK3v/Vz2qpmv+wBO3jst4UNOq1WknC/0NtwNnxM0gAMYa?= =?iso-8859-1?Q?bspgPBWUX+H6AjBiQ0YAb8oQ0s9l4wgFNFQc772TU4t3CYTG5NnADwcvaJ?= =?iso-8859-1?Q?1eBYaMxe9Mvv+Geu6nNdYolPANSGIn5wdZVwiymm+B+vDrx5uGGvgIpKP0?= =?iso-8859-1?Q?hmchAJztNyuzS7S1igB1evaHzwBdEALi/Oej/18FqB6oVrmK97+YVTZ1j1?= =?iso-8859-1?Q?0nkWrg+0LxDsieD6Td5bF8hHD8E2J7EHac0HGDPgP/OOQQU/9rmUmM2ZN6?= =?iso-8859-1?Q?EpKU26bnG7fA6AuPGRJdY6uNmlNnOFBivA9hxyMO0Gp2DVp3iKZxbx70y6?= =?iso-8859-1?Q?DbMyvRhp5YUFQNp3o4UXFRorf5lF34+dDNVksLPtd+/7HUygxUt0f0/sPe?= =?iso-8859-1?Q?EXq91Nc7uy+p2GJzJpcvZ6ViCYiB9Z4GlwSI9aYV8ypjDk09xbwAUy/QSL?= =?iso-8859-1?Q?aUeG0YEkGhGybleLRHjGqpjUuxCK5yO/TDwet/0jQfMggHa5buC2L4k4r4?= =?iso-8859-1?Q?esy4vId6GarXc4/K7b4m9rW5WkxL/YvJnh6ieb1SD3qnG/SIPQ8ApD9OV/?= =?iso-8859-1?Q?BOR10jhua6GignkWJGZQ2Muqwv576RF7KHuRYF/Hrtr2ZSwlAcFIvqH4RL?= =?iso-8859-1?Q?jLoRFp3919VSHfT2yajnQ4goOxz5zUTSaYy4FXju6/HCJAam/My9cjbdXv?= =?iso-8859-1?Q?YSf1bgCgf8/D3BPbpGYveTnG/1uodpaQLTna8MQIqJ2vw8pjpnRvc=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)(376014)(366016)(38070700018);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?TVkB6YN8SxXyDh3744jI/T8IGN96a0VTC4bClbj5l89rpKt0n04jckaw6Y?= =?iso-8859-1?Q?sUFRQ9y+zcBoSSxc8i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1?Q?su6YQKCTIHYfOW1doSumev7mZ2q/S95Ot5QthP3g52LGkWXQpAyqIwucbE?= =?iso-8859-1?Q?K2etWL0WWfP9y1dPaIsG4kG8CGxtR1L99+YmhZi0PbEfvWd8a+rnVZX9Q0?= =?iso-8859-1?Q?gr9VyiSXTfcXM2x9bZC0/6+9ddWI1MKtvFaffLC1AvuznNBn1mE7LGGSZS?= =?iso-8859-1?Q?Ky2HsEmuaZQr2q0cIRt0C2TAO7iIKBHiFuTK/krcoM+nyzoNL1KuDxAt14?= =?iso-8859-1?Q?6Gne7LqDBmnj/DhttfXWziX4UDF9udT+1bwg0/98nTce3g9X3RStZpADAq?= =?iso-8859-1?Q?8cnlPqpOTmPxAK2/plglRDg7Gx4GVMdWPnNfauO/F8oBxGTeAXkzyf4n0v?= =?iso-8859-1?Q?/u6TQitmYYHPmuNmm6wei+Rq4SGAlH6nbAVoaV+bMWgOa+PDzo4Xvmy0Eo?= =?iso-8859-1?Q?n/kxMVorlEYZGSDNy8+7aP2id5CbXlJfyA2Ki2OavbYN1gQ0QXLmTf3dJN?= =?iso-8859-1?Q?jOAE546fOWQOpb/DbmnDI7o9s2MeLUB/N7bACRQhQYZ8M6eH/rm+lPsf37?= =?iso-8859-1?Q?m5rgDACruWGhmKMqEB6mfuGDnW3Oe3bmhePgZg76/U4OueDi63bpc7Awbj?= =?iso-8859-1?Q?oi+9N0fuMzBk3FJPFkAsfapgHgJHuSX0HOf2Ff3t5QAPiMzmJpO++zkV6E?= =?iso-8859-1?Q?LMHksXbXegWvsyxPSNeJil1acLJA/vrMBRPl+3AVAgmMoqVq4enB+rBw?= =?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: 9021afc3-c04b-4a6e-27e7-08dd0b39af7d X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2024 21:07:30.2212 (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: UpOkUQd1/b95pJhxZaWSKVqshQsDw9zPAr01nWxFrfcWuqYH8y3u2rA1sC7EQYNL2y7hlaolqaTRK2PxKfIqdA3WczEvrgXIEFenQ7cKo24= X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAWPR03MB9738 X-ZohoMail-DKIM: pass (identity @epam.com) X-ZM-MESSAGEID: 1732309702394116600 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 --- I tested this patch for buildability, but didn't verified that Xen really boots on RISC-V when this feature is enabled. So I am asking RISC-V maintainers to provide feedback on it. --- 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..1481f23b66 100644 --- a/xen/arch/riscv/Kconfig +++ b/xen/arch/riscv/Kconfig @@ -5,6 +5,7 @@ config RISCV select HAS_DEVICE_TREE select HAS_PMAP select HAS_VMAP + select HAS_STACK_PROTECTOR =20 config RISCV_64 def_bool y diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index e29bd75d7c..cd71748d2c 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -7,6 +7,7 @@ #include #include #include +#include =20 #include =20 @@ -55,6 +56,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.0