rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: Enable IBT in Rust if enabled in C
@ 2023-10-09 22:42 Matthew Maurer
  2023-10-10  8:12 ` Peter Zijlstra
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Matthew Maurer @ 2023-10-09 22:42 UTC (permalink / raw)
  To: peterz, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, Miguel Ojeda, Alex Gaynor, Wedson Almeida Filho
  Cc: Matthew Maurer, H. Peter Anvin, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
	linux-kernel, rust-for-linux

These flags are not made conditional on compiler support because at the
moment exactly one version of rustc supported, and that one supports
these flags.

Building without these additional flags will manifest as objtool
printing a large number of errors about missing ENDBR and if CFI is
enabled (not currently possible) will result in incorrectly structured
function prefixes.

Signed-off-by: Matthew Maurer <mmaurer@google.com>
---

Split out the IBT additions as per
https://lkml.kernel.org/linux-fsdevel/CANiq72kK6ppBE7j=z7uua1cJMKaLoR5U3NUAZXT5MrNEs9ZhfQ@mail.gmail.com/

arch/x86/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 5bfe5caaa444..941f7abf6dbf 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -81,6 +81,7 @@ ifeq ($(CONFIG_X86_KERNEL_IBT),y)
 #   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104816
 #
 KBUILD_CFLAGS += $(call cc-option,-fcf-protection=branch -fno-jump-tables)
+KBUILD_RUSTFLAGS += -Zcf-protection=branch -Zno-jump-tables
 else
 KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
 endif
-- 
2.42.0.609.gbb76f46606-goog


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-10-23 13:59 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-09 22:42 [PATCH] x86: Enable IBT in Rust if enabled in C Matthew Maurer
2023-10-10  8:12 ` Peter Zijlstra
2023-10-10 14:06   ` Matthew Maurer
2023-10-10 14:24     ` Peter Zijlstra
2023-10-10 14:34       ` Matthew Maurer
2023-10-10 14:56         ` Peter Zijlstra
2023-10-23 13:58           ` Miguel Ojeda
2023-10-10 15:38   ` Nick Desaulniers
2023-10-10 15:48     ` Peter Zijlstra
2023-10-10 22:24     ` Trevor Gross
2023-10-11 17:44 ` Miguel Ojeda
2023-10-12 20:13 ` Trevor Gross
2023-10-12 20:32   ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).