aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/Makefile
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2021-10-21 16:16:47 +0200
committerArd Biesheuvel <ardb@kernel.org>2021-12-03 15:11:30 +0100
commitf05eb1d24eb564488014d90b31824f71984d7ef5 (patch)
tree5912b4674c2d6e5dd7b82745702e8a39bad14290 /arch/arm/Makefile
parentARM: decompressor: disable stack protector (diff)
downloadlinux-dev-f05eb1d24eb564488014d90b31824f71984d7ef5.tar.xz
linux-dev-f05eb1d24eb564488014d90b31824f71984d7ef5.zip
ARM: stackprotector: prefer compiler for TLS based per-task protector
Currently, we implement the per-task stack protector for ARM using a GCC plugin, due to lack of native compiler support. However, work is underway to get this implemented in the compiler, which means we will be able to deprecate the GCC plugin at some point. In the meantime, we will need to support both, where the native compiler implementation is obviously preferred. So let's wire this up in Kconfig and the Makefile. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Tested-by: Marc Zyngier <maz@kernel.org> Tested-by: Vladimir Murzin <vladimir.murzin@arm.com> # ARMv7M
Diffstat (limited to 'arch/arm/Makefile')
-rw-r--r--arch/arm/Makefile9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 77172d555c7e..e943624cbf87 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -275,6 +275,14 @@ endif
ifeq ($(CONFIG_STACKPROTECTOR_PER_TASK),y)
prepare: stack_protector_prepare
+ifeq ($(CONFIG_CC_HAVE_STACKPROTECTOR_TLS),y)
+stack_protector_prepare: prepare0
+ $(eval KBUILD_CFLAGS += \
+ -mstack-protector-guard=tls \
+ -mstack-protector-guard-offset=$(shell \
+ awk '{if ($$2 == "TSK_STACK_CANARY") print $$3;}'\
+ include/generated/asm-offsets.h))
+else
stack_protector_prepare: prepare0
$(eval SSP_PLUGIN_CFLAGS := \
-fplugin-arg-arm_ssp_per_task_plugin-offset=$(shell \
@@ -283,6 +291,7 @@ stack_protector_prepare: prepare0
$(eval KBUILD_CFLAGS += $(SSP_PLUGIN_CFLAGS))
$(eval GCC_PLUGINS_CFLAGS += $(SSP_PLUGIN_CFLAGS))
endif
+endif
all: $(notdir $(KBUILD_IMAGE))