summaryrefslogtreecommitdiff
path: root/arch/arm64/Makefile
diff options
context:
space:
mode:
authorChristoph Muellner <christoph.muellner@theobroma-systems.com>2018-03-20 11:16:02 +0100
committerChristoph Muellner <christoph.muellner@theobroma-systems.com>2018-04-27 08:28:29 +0200
commit685aaecf4e90f0c1148222e95629ca562e8093db (patch)
tree0da2df49a7973f54a7cd0e1fb8fe48e725ce1621 /arch/arm64/Makefile
parent5a0f312409eab96928a95598d440cf54b5cf7153 (diff)
arm64: Introduce retpoline for aarch64/arm64.linux-4.16.5-amp
This patch adds retpoline support for aarch64. This includes: * Kconfig flag CONFIG_RETPOLINE to enable it * testing for required compiler support * generation of external retpoline thunk functions * patches for the arm64 specific assembly code * Enable /sys/devices/system/cpu/vulnerabilities * arm64: retpoline: Use kernel's EXPORT_SYMBOL macro. * arm64: retpoline: Add thunks for x29 and x30. * arm64: retpoline: Add function signature for symbol versioning. Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com>
Diffstat (limited to 'arch/arm64/Makefile')
-rw-r--r--arch/arm64/Makefile11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/arm64/Makefile b/arch/arm64/Makefile
index a8f6aa92a144..8df25a60dbb9 100644
--- a/arch/arm64/Makefile
+++ b/arch/arm64/Makefile
@@ -88,6 +88,17 @@ ifeq ($(CONFIG_ARM64_MODULE_PLTS),y)
KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/arm64/kernel/module.lds
endif
+RETPOLINE_CFLAGS_GCC := -mindirect-branch=thunk-extern
+RETPOLINE_CFLAGS := $(call cc-option,$(RETPOLINE_CFLAGS_GCC))
+export RETPOLINE_CFLAGS
+
+# Avoid indirect branches in kernel to deal with Spectre
+ifdef CONFIG_RETPOLINE
+ifneq ($(RETPOLINE_CFLAGS),)
+ KBUILD_CFLAGS += $(RETPOLINE_CFLAGS) -DRETPOLINE
+endif
+endif
+
# Default value
head-y := arch/arm64/kernel/head.o