aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Edgecombe <[email protected]>2023-06-12 17:11:03 -0700
committerDave Hansen <[email protected]>2023-08-02 15:01:51 -0700
commit488af8ea7131185c1adcbb0b52da2b6800429ecb (patch)
treefb1af1ca7db65a6547e357fac3941668efb3132f
parent0ee44885fe9cf19eb3870947c8f3c275017e48a7 (diff)
x86/shstk: Wire in shadow stack interface
The kernel now has the main shadow stack functionality to support applications. Wire in the WRSS and shadow stack enable/disable functions into the existing shadow stack API skeleton. Signed-off-by: Rick Edgecombe <[email protected]> Signed-off-by: Dave Hansen <[email protected]> Reviewed-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Kees Cook <[email protected]> Acked-by: Mike Rapoport (IBM) <[email protected]> Tested-by: Pengfei Xu <[email protected]> Tested-by: John Allen <[email protected]> Tested-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/all/20230613001108.3040476-38-rick.p.edgecombe%40intel.com
-rw-r--r--arch/x86/kernel/shstk.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kernel/shstk.c b/arch/x86/kernel/shstk.c
index ea0bf113f9cf..d723cdc93474 100644
--- a/arch/x86/kernel/shstk.c
+++ b/arch/x86/kernel/shstk.c
@@ -502,9 +502,17 @@ long shstk_prctl(struct task_struct *task, int option, unsigned long features)
return -EINVAL;
if (option == ARCH_SHSTK_DISABLE) {
+ if (features & ARCH_SHSTK_WRSS)
+ return wrss_control(false);
+ if (features & ARCH_SHSTK_SHSTK)
+ return shstk_disable();
return -EINVAL;
}
/* Handle ARCH_SHSTK_ENABLE */
+ if (features & ARCH_SHSTK_SHSTK)
+ return shstk_setup();
+ if (features & ARCH_SHSTK_WRSS)
+ return wrss_control(true);
return -EINVAL;
}