]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: Add gcc Shadow Call Stack support
authorDan Li <ashimida@linux.alibaba.com>
Thu, 3 Mar 2022 07:43:23 +0000 (23:43 -0800)
committerKees Cook <keescook@chromium.org>
Thu, 10 Mar 2022 17:22:09 +0000 (09:22 -0800)
commit06713d07f4742e67b00d15c1b9cc054e364db716
tree09e566a2d90c1de122dd348ff2e483fd815d725d
parent19030b2604e75551c407267bb3fc3e892b9d70d6
arm64: Add gcc Shadow Call Stack support

Shadow call stacks will be available in GCC >= 12, this patch makes
the corresponding kernel configuration available when compiling
the kernel with the gcc.

Note that the implementation in GCC is slightly different from Clang.
With SCS enabled, functions will only pop x30 once in the epilogue,
like:

   str     x30, [x18], #8
   stp     x29, x30, [sp, #-16]!
   ......
-  ldp     x29, x30, [sp], #16   //clang
+  ldr     x29, [sp], #16   //GCC
   ldr     x30, [x18, #-8]!

Link: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=ce09ab17ddd21f73ff2caf6eec3b0ee9b0e1a11e
Reviewed-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Dan Li <ashimida@linux.alibaba.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220303074323.86282-1-ashimida@linux.alibaba.com
arch/Kconfig
arch/arm64/Kconfig
include/linux/compiler-gcc.h