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

[PATCH v2 0/4] Add stack protector


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Sat, 30 Nov 2024 01:10:15 +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=EcE4MQ/KInbQ64EOEx7RiuJiz/7SMxJqXpiSvjkursY=; b=XF7PVkZCIbSfdo7hN3RtIVY0WggRNv8lMX2BcfLvmcNx+KcoAifqJT00opQ2QBtHL+1A6z1ptIsuA3mWgmfFvZvwMC55zvCUfi6Cvjez3/T5ubCHtPvC/cfix7+2PROFOJ4AJDtbGL70TdUeRdnKtyfeDp2j7/9/WnY9CHIN3voLSi4L7J8ONFVKK6ybp6xPyTKj8CM8FmZc3HomTIDGq2wK6rhHdFTuQLc4MFRi+D3IKognLqBkCYIFmHagPAf3/fMLcIXXzbHxf4Rp/pGd+2lfUihO6t6NXgRqlDJ6NYTjjY59qlWOK3uTCxg6h5SnCkkYat+WaewP78DUDKOP4A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=p397pjFfKceIz2yvkKEbUrFGhM7n4ujTPvyNfK0Q6hNcHzVCvm6KNa55lS8QONIlM/Wl2/C8CQOoI5elcnc+aaeBDK5yGfpUK0MwFTaFejFt8Hs0SVtrsYVDREb6qf5D+4OibBkjoGoJ97kFNsDtW5yhxDglmgqVxaLYsaP4GQWzw3cvmn9MTf2EvZvzcCIdZGCb9lK2Wf4gYejtBqG2gzLdYE95Y/ERiyqiJGdR5RoMRQz+DOmMVn7jslKSkuYXMKAq+IYUk3iMrT94zxyClcgAFYjmJLP/cI8XUo2TwAw70hQ4c3igJ9gI5j2lNHBVfRVrwDavUevS6mWwsu0yEQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=epam.com;
  • Cc: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Samuel Thibault <samuel.thibault@xxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, Connor Davis <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • Delivery-date: Sat, 30 Nov 2024 01:10:37 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbQsSclqo0UcXa3ESeciBOaRXmoA==
  • Thread-topic: [PATCH v2 0/4] Add stack protector

Both GCC and Clang support -fstack-protector feature, which add stack
canaries to functions where stack corruption is possible. This series
makes possible to use this feature in Xen. I tested this on ARM64 and
it is working as intended. Tested both with GCC and Clang.

It is hard to enable this feature on x86, as GCC stores stack canary
in %fs:40 by default, but Xen can't use %fs for various reasons. It is
possibly to change stack canary location new newer GCC versions, but
this will change minimal GCC requirement, which is also hard due to
various reasons. So, this series focus mostly on ARM and RISCV.

Changes in v2:

 - Patch "xen: common: add ability to enable stack protector" was
   divided into two patches.
 - Rebase onto Andrew's patch that removes -fno-stack-protector-all
 - Tested on RISC-V thanks to Oleksii Kurochko
 - Changes in individual patches covered in their respect commit
 messages


Volodymyr Babchuk (4):
  common: remove -fno-stack-protector from EMBEDDED_EXTRA_CFLAGS
  xen: common: add ability to enable stack protector
  xen: arm: enable stack protector feature
  xen: riscv: enable stack protector feature

 Config.mk                            |  2 +-
 stubdom/Makefile                     |  2 ++
 tools/firmware/Rules.mk              |  2 ++
 tools/tests/x86_emulator/testcase.mk |  2 ++
 xen/Makefile                         |  6 ++++++
 xen/arch/arm/Kconfig                 |  1 +
 xen/arch/arm/setup.c                 |  3 +++
 xen/arch/riscv/Kconfig               |  1 +
 xen/arch/riscv/setup.c               |  3 +++
 xen/common/Kconfig                   | 17 ++++++++++++++++
 xen/common/Makefile                  |  1 +
 xen/common/stack-protector.c         | 10 ++++++++++
 xen/include/xen/stack-protector.h    | 29 ++++++++++++++++++++++++++++
 13 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 xen/common/stack-protector.c
 create mode 100644 xen/include/xen/stack-protector.h

-- 
2.47.1



 


Rackspace

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