Skip to content

Commit 488af8e

Browse files
rpedgecohansendc
authored andcommitted
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
1 parent 0ee4488 commit 488af8e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

arch/x86/kernel/shstk.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,9 +502,17 @@ long shstk_prctl(struct task_struct *task, int option, unsigned long features)
502502
return -EINVAL;
503503

504504
if (option == ARCH_SHSTK_DISABLE) {
505+
if (features & ARCH_SHSTK_WRSS)
506+
return wrss_control(false);
507+
if (features & ARCH_SHSTK_SHSTK)
508+
return shstk_disable();
505509
return -EINVAL;
506510
}
507511

508512
/* Handle ARCH_SHSTK_ENABLE */
513+
if (features & ARCH_SHSTK_SHSTK)
514+
return shstk_setup();
515+
if (features & ARCH_SHSTK_WRSS)
516+
return wrss_control(true);
509517
return -EINVAL;
510518
}

0 commit comments

Comments
 (0)