summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2018-05-02 09:41:34 -0700
committerSami Tolvanen <samitolvanen@google.com>2019-12-13 07:14:20 -0800
commitfb8319c10d6e6ae5c3b794675a49b5a096208c25 (patch)
tree78b2a3e536e8fa02d3096758a059ab07948f1a22 /arch
parent1425ea0ab86f43e235d9081852165ab8ef003346 (diff)
FROMLIST: arm64: reserve x18 from general allocation with SCS
Reserve the x18 register from general allocation when SCS is enabled, because the compiler uses the register to store the current task's shadow stack pointer. Note that all external kernel modules must also be compiled with -ffixed-x18 if the kernel has SCS enabled. Bug: 145210207 Change-Id: If2315ace9a879b3dd2a85f6ba43eddadc4430595 (am from https://lore.kernel.org/patchwork/patch/1149058/) Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm64/Makefile4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index 8654cee8c921..79650bfbbfd9 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -74,6 +74,10 @@ KBUILD_AFLAGS += $(lseinstr) $(brokengasinst)
KBUILD_CFLAGS += $(call cc-option,-mabi=lp64)
KBUILD_AFLAGS += $(call cc-option,-mabi=lp64)
+ifeq ($(CONFIG_SHADOW_CALL_STACK), y)
+KBUILD_CFLAGS += -ffixed-x18
+endif
+
ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
KBUILD_CPPFLAGS += -mbig-endian
CHECKFLAGS += -D__AARCH64EB__