Re: [PATCH] [PATCH V3]ARM64: SCS: Add gcc plugin to support Shadow Call Stack
From: Dan Li <hidden>
Date: 2021-10-13 21:40:17
Also in:
linux-arm-kernel, linux-hardening, lkml
From: Dan Li <hidden>
Date: 2021-10-13 21:40:17
Also in:
linux-arm-kernel, linux-hardening, lkml
On 10/14/21 2:50 AM, Nick Desaulniers wrote:
On Wed, Oct 13, 2021 at 11:03 AM Dan Li [off-list ref] wrote:quoted
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 62c3c1d..da2da8c 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig@@ -81,7 +81,7 @@ config ARM64 select ARCH_SUPPORTS_DEBUG_PAGEALLOC select ARCH_SUPPORTS_HUGETLBFS select ARCH_SUPPORTS_MEMORY_FAILURE - select ARCH_SUPPORTS_SHADOW_CALL_STACK if CC_HAVE_SHADOW_CALL_STACK + select ARCH_SUPPORTS_SHADOW_CALL_STACK if (CC_HAVE_SHADOW_CALL_STACK || GCC_PLUGIN_SHADOW_CALL_STACK) select ARCH_SUPPORTS_LTO_CLANG if CPU_LITTLE_ENDIAN select ARCH_SUPPORTS_LTO_CLANG_THIN select ARCH_SUPPORTS_CFI_CLANG@@ -1062,7 +1062,7 @@ config ARCH_HAS_FILTER_PGPROT # Supported by clang >= 7.0 config CC_HAVE_SHADOW_CALL_STACK - def_bool $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18) + def_bool (CC_IS_CLANG && $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18))I guess since clang supported SCS since clang-7, but the minimally supported version of clang according to Documentation/process/changes.rst is 10.0.1, then this could be: def_boot CC_IS_CLANG || $(cc-option, -fsanitize=shadow-call-stack -ffixed-x18) Then we won't have to touch it again once SCS lands in upstream GCC, as the cc-option test will start to pass?
Thanks Nick, That sounds reasonable.