[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 4/4] xen: riscv: enable stack protector feature


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Sat, 30 Nov 2024 01:10:16 +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=sMLsAsxP2jCKXlPGp2d48OpFc6sgoHg60qnvVOllAa0=; b=aEY9T8VKCMjTGIjleNZuRGbY2+jKMaJfgyyUBGYSVW75fh+/IGc3HngvzYFPwf/naj0dSt1SA+ntWF9Em1xJGhI6OuNCtATl3TEburhTj5TRG6n+zyU/g42u34qxiT9iugd1otpMlG/kC7KzEloVZhVfzG/Vrr4eFfyVMa2HBkyJcQMtdL0z3+1XSqJep923te3WTxv5lL6vJorXufoiV/DFmr/TFQTkdiBvOTvmdqRO+tynUx7aEKDj9ASip3TWBPivFVv4M2o6zU5/GEWeHLDNWubddfF44WPP9B/oFngQ9//AdnvYe/Mb4CyYdS49WyjjnOUgQP/PJITug3IBFQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Q6zrJPiOoYZzJHV1mJopSCls5JIBibHr+mbOEgXnZHiDSxUunWb9ODvMUw6nQDcuohPbUTgS9az8Yu84i1LA/6dvTJHfFDykAtTno8NXadCpsGnQj7kifdmFoHKQgXjlWpGvT4dpyPCXlAFaSiDdAiuMrj8lHiKO/4qdYKajaxGZUUVL1OHEINhNFqqvLbUGcRG3vOeEajpodhdrDEAba+oCoD3AHu0ZXpx1lLfz6LL1vbNjwGatohV5OD+e1ZIquuiOaGTAdzKrltrSAxRdNQPSrte9/jLCkwNNbILIp0HxV9is3hAa2fBaXrHWd1nNdSKiGmhXXhh4OgofwDVzyw==
  • 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: Sat, 30 Nov 2024 01:10:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbQsSdrqhVO8R3/0W5bnSX25z8yw==
  • Thread-topic: [PATCH v2 4/4] 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>
Tested-by: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>

---

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
 
 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 <xen/init.h>
 #include <xen/mm.h>
 #include <xen/shutdown.h>
+#include <xen/stack-protector.h>
 #include <xen/vmap.h>
 
 #include <public/version.h>
@@ -57,6 +58,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.1



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.