Skip to content

Commit da64e9d

Browse files
samitolvanenwilldeacon
authored andcommitted
arm64: Reserve register 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. Signed-off-by: Sami Tolvanen <[email protected]> Reviewed-by: Nick Desaulniers <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Will Deacon <[email protected]> Signed-off-by: Will Deacon <[email protected]>
1 parent ddc9863 commit da64e9d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/arm64/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ endif
8181

8282
KBUILD_CFLAGS += $(branch-prot-flags-y)
8383

84+
ifeq ($(CONFIG_SHADOW_CALL_STACK), y)
85+
KBUILD_CFLAGS += -ffixed-x18
86+
endif
87+
8488
ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
8589
KBUILD_CPPFLAGS += -mbig-endian
8690
CHECKFLAGS += -D__AARCH64EB__

0 commit comments

Comments
 (0)