[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/3] xen: riscv: enable stack protector feature
- To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
- Date: Fri, 22 Nov 2024 21:07:30 +0000
- Accept-language: en-US
- 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
- 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-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Cc08jIfohAxGrqPd2m7uaZ+ID4ut1zGkoJJgv1sDdyz37eaOi4mnR4zlGaldvffp4fYHiHzvnBcrInp0TykLtMsxscvszdcEsTA02mrWWjdcHVHBqUI+2P1rlA7tMgAKVYdVZrENh0TyVNtrkHHObePxYxXGUwggUf+YDmbJnw23iSxZSw5GEEjY68eTdo0CEzHq2lXLHFoTZHh5WMweSx6HMtc+FmEpkR/lPI0MzI2TfQrhmTFqqYjDdSGjYlnDbhhIvg/kPEIxaeqQpHejXju87s5PgkAE3IZ/Ic+gOzRb6u1kj0C3//4f5JROQm6CWCHHPukEEbdEl0S10RLPHQ==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
- Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
- Delivery-date: Fri, 22 Nov 2024 21:07:56 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHbPSKK7LmLMh+hFUu+rgI8SvJulg==
- Thread-topic: [PATCH 3/3] xen: riscv: enable stack protector feature
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 <volodymyr_babchuk@xxxxxxxx>
---
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
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 <xen/init.h>
#include <xen/mm.h>
#include <xen/shutdown.h>
+#include <xen/stack_protector.h>
#include <public/version.h>
@@ -55,6 +56,8 @@ void __init noreturn start_xen(unsigned long bootcpu_id,
if ( !boot_fdt_info(device_tree_flattened, dtb_addr) )
BUG();
+ boot_stack_chk_guard_setup();
+
cmdline = boot_fdt_cmdline(device_tree_flattened);
printk("Command line: %s\n", cmdline);
cmdline_parse(cmdline);
--
2.47.0
|