summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2018-05-02 10:44:59 -0700
committerSami Tolvanen <samitolvanen@google.com>2019-12-13 07:14:20 -0800
commita7f210693021679a8319941f3851aa756604cebc (patch)
treed2001771da73c213cdb63b8d0a04973c979f7882 /arch
parent89384505fe8a768be412249d6541a9972ec1b6f7 (diff)
FROMLIST: add support for Clang's Shadow Call Stack (SCS)
This change adds generic support for Clang's Shadow Call Stack, which uses a shadow stack to protect return addresses from being overwritten by an attacker. Details are available here: https://clang.llvm.org/docs/ShadowCallStack.html Note that security guarantees in the kernel differ from the ones documented for user space. The kernel must store addresses of shadow stacks used by other tasks and interrupt handlers in memory, which means an attacker capable reading and writing arbitrary memory may be able to locate them and hijack control flow by modifying shadow stacks that are not currently in use. Bug: 145210207 Change-Id: Ia5f1650593fa95da4efcf86f84830a20989f161c (am from https://lore.kernel.org/patchwork/patch/1149054/) Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig33
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index cb156bb334a8..b7938a82cedc 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -692,6 +692,39 @@ config CFI_CLANG_SHADOW
If you select this option, the kernel builds a fast look-up table of
CFI check functions in loaded modules to reduce overhead.
+config ARCH_SUPPORTS_SHADOW_CALL_STACK
+ bool
+ help
+ An architecture should select this if it supports Clang's Shadow
+ Call Stack, has asm/scs.h, and implements runtime support for shadow
+ stack switching.
+
+config SHADOW_CALL_STACK
+ bool "Clang Shadow Call Stack"
+ depends on ARCH_SUPPORTS_SHADOW_CALL_STACK
+ help
+ This option enables Clang's Shadow Call Stack, which uses a
+ shadow stack to protect function return addresses from being
+ overwritten by an attacker. More information can be found from
+ Clang's documentation:
+
+ https://clang.llvm.org/docs/ShadowCallStack.html
+
+ Note that security guarantees in the kernel differ from the ones
+ documented for user space. The kernel must store addresses of shadow
+ stacks used by other tasks and interrupt handlers in memory, which
+ means an attacker capable reading and writing arbitrary memory may
+ be able to locate them and hijack control flow by modifying shadow
+ stacks that are not currently in use.
+
+config SHADOW_CALL_STACK_VMAP
+ bool "Use virtually mapped shadow call stacks"
+ depends on SHADOW_CALL_STACK
+ help
+ Use virtually mapped shadow call stacks. Selecting this option
+ provides better stack exhaustion protection, but increases per-thread
+ memory consumption as a full page is allocated for each shadow stack.
+
config HAVE_ARCH_WITHIN_STACK_FRAMES
bool
help