]> Git Repo - J-linux.git/commitdiff
x86: Enable IBT in Rust if enabled in C
authorMatthew Maurer <[email protected]>
Mon, 9 Oct 2023 22:42:54 +0000 (22:42 +0000)
committerMiguel Ojeda <[email protected]>
Mon, 23 Oct 2023 13:35:00 +0000 (15:35 +0200)
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 <[email protected]>
Reviewed-by: Nick Desaulniers <[email protected]>
Acked-by: "Peter Zijlstra (Intel)" <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Miguel Ojeda <[email protected]>
arch/x86/Makefile

index 5bfe5caaa444b3faf5f6b4c06d98e22bc7e76586..941f7abf6dbfc1e94aeaea0d88d3042f0f6d3b67 100644 (file)
@@ -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
This page took 0.047473 seconds and 4 git commands to generate.