@@ -758,4 +758,21 @@ config GUP_BENCHMARK
config ARCH_HAS_PTE_SPECIAL
bool
+config USER_STACK_POINTER_CHECKS
+ bool "Check user stack pointer points to stack pages"
+ depends on MMU
+ default y
+ help
+ This feature can be used to enforce that the user stack pointer
+ points to either the kernel-allocated user stack or a mapping
+ created with the MAP_STACK flag.
+
+ By default, no checks are performed, and an application must
+ opt-in via the PR_SP_CHECK prctl() system call if it wishes to
+ enable checking. Checking can be independently controlled for
+ system calls and page fault handling.
+
+config ARCH_HAS_USP_CHECK_SYSCALL
+ bool
+
endmenu
Provide Kconfig entries to enable/disable user stack pointer checking and also for architectures to expose the system call controls via prctl() once they have augmented their system call entry path to perform the necessary checks. Cc: Kees Cook <keescook@chromium.org> Cc: Jann Horn <jannh@google.com> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Matthew Wilcox <willy@infradead.org> Cc: Michal Hocko <mhocko@suse.com> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Will Deacon <will.deacon@arm.com> --- mm/Kconfig | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) -- 2.11.0