@@ -599,21 +599,22 @@ config STACKPROTECTOR_STRONG
599599config ARCH_SUPPORTS_SHADOW_CALL_STACK
600600 bool
601601 help
602- An architecture should select this if it supports Clang's Shadow
603- Call Stack and implements runtime support for shadow stack
602+ An architecture should select this if it supports the compiler's
603+ Shadow Call Stack and implements runtime support for shadow stack
604604 switching.
605605
606606config SHADOW_CALL_STACK
607- bool "Clang Shadow Call Stack"
608- depends on CC_IS_CLANG && ARCH_SUPPORTS_SHADOW_CALL_STACK
607+ bool "Shadow Call Stack"
608+ depends on ARCH_SUPPORTS_SHADOW_CALL_STACK
609609 depends on DYNAMIC_FTRACE_WITH_REGS || !FUNCTION_GRAPH_TRACER
610610 help
611- This option enables Clang 's Shadow Call Stack, which uses a
612- shadow stack to protect function return addresses from being
613- overwritten by an attacker. More information can be found in
614- Clang 's documentation:
611+ This option enables the compiler 's Shadow Call Stack, which
612+ uses a shadow stack to protect function return addresses from
613+ being overwritten by an attacker. More information can be found
614+ in the compiler 's documentation:
615615
616- https://clang.llvm.org/docs/ShadowCallStack.html
616+ - Clang: https://clang.llvm.org/docs/ShadowCallStack.html
617+ - GCC: https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#Instrumentation-Options
617618
618619 Note that security guarantees in the kernel differ from the
619620 ones documented for user space. The kernel must store addresses
@@ -1159,16 +1160,30 @@ config HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
11591160 to the compiler, so it will attempt to add canary checks regardless
11601161 of the static branch state.
11611162
1162- config RANDOMIZE_KSTACK_OFFSET_DEFAULT
1163- bool "Randomize kernel stack offset on syscall entry"
1163+ config RANDOMIZE_KSTACK_OFFSET
1164+ bool "Support for randomizing kernel stack offset on syscall entry" if EXPERT
1165+ default y
11641166 depends on HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET
1167+ depends on INIT_STACK_NONE || !CC_IS_CLANG || CLANG_VERSION >= 140000
11651168 help
11661169 The kernel stack offset can be randomized (after pt_regs) by
11671170 roughly 5 bits of entropy, frustrating memory corruption
11681171 attacks that depend on stack address determinism or
1169- cross-syscall address exposures. This feature is controlled
1170- by kernel boot param "randomize_kstack_offset=on/off", and this
1171- config chooses the default boot state.
1172+ cross-syscall address exposures.
1173+
1174+ The feature is controlled via the "randomize_kstack_offset=on/off"
1175+ kernel boot param, and if turned off has zero overhead due to its use
1176+ of static branches (see JUMP_LABEL).
1177+
1178+ If unsure, say Y.
1179+
1180+ config RANDOMIZE_KSTACK_OFFSET_DEFAULT
1181+ bool "Default state of kernel stack offset randomization"
1182+ depends on RANDOMIZE_KSTACK_OFFSET
1183+ help
1184+ Kernel stack offset randomization is controlled by kernel boot param
1185+ "randomize_kstack_offset=on/off", and this config chooses the default
1186+ boot state.
11721187
11731188config ARCH_OPTIONAL_KERNEL_RWX
11741189 def_bool n
0 commit comments