summaryrefslogtreecommitdiff
path: root/arch/x86/Makefile
diff options
context:
space:
mode:
authorMatthew Maurer <mmaurer@google.com>2023-10-09 22:42:54 +0000
committerMiguel Ojeda <ojeda@kernel.org>2023-10-23 15:35:00 +0200
commit6a5c032c4b7e4262488703086ab280406dc51298 (patch)
tree57397f56ee55b0a975c379f71afacb16153d3153 /arch/x86/Makefile
parenta7135d10754760f0c038497b44c2c2f2b0fb5651 (diff)
x86: Enable IBT in Rust if enabled in C
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> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Acked-by: "Peter Zijlstra (Intel)" <peterz@infradead.org> Link: https://lore.kernel.org/r/20231009224347.2076221-1-mmaurer@google.com Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'arch/x86/Makefile')
-rw-r--r--arch/x86/Makefile1
1 files changed, 1 insertions, 0 deletions
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