Skip to content

Commit 6a5c032

Browse files
maurerojeda
authored andcommitted
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>
1 parent a7135d1 commit 6a5c032

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/x86/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ ifeq ($(CONFIG_X86_KERNEL_IBT),y)
8181
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104816
8282
#
8383
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=branch -fno-jump-tables)
84+
KBUILD_RUSTFLAGS += -Zcf-protection=branch -Zno-jump-tables
8485
else
8586
KBUILD_CFLAGS += $(call cc-option,-fcf-protection=none)
8687
endif

0 commit comments

Comments
 (0)