[tip: x86/mm] selftest/x86: Test ARCH_SHSTK_UNLOCK
From: tip-bot2 for Bill Roberts
Date: Tue Dec 01 2026 - 18:41:10 EST
The following commit has been merged into the x86/mm branch of tip:
Commit-ID: 76b8d9c0594c138fb9b10887a50b1834efa974f0
Gitweb: https://git.kernel.org/tip/76b8d9c0594c138fb9b10887a50b1834efa974f0
Author: Bill Roberts <bill.roberts@xxxxxxx>
AuthorDate: Mon, 02 Nov 2026 12:17:08 -06:00
Committer: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
CommitterDate: Tue, 01 Dec 2026 15:33:26 -08:00
selftest/x86: Test ARCH_SHSTK_UNLOCK
Test that ARCH_SHSTK_UNLOCK can't be called from normal (non-ptrace)
context.
Signed-off-by: Bill Roberts <bill.roberts@xxxxxxx>
Signed-off-by: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@xxxxxxxxx>
Link: https://patch.msgid.link/20261102181708.29178-2-bill.roberts@xxxxxxx
---
tools/testing/selftests/x86/test_shadow_stack.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/testing/selftests/x86/test_shadow_stack.c b/tools/testing/selftests/x86/test_shadow_stack.c
index 3d6ca33..cbe7ca4 100644
--- a/tools/testing/selftests/x86/test_shadow_stack.c
+++ b/tools/testing/selftests/x86/test_shadow_stack.c
@@ -1059,6 +1059,14 @@ int main(int argc, char *argv[])
{
int ret = 0;
+ /* Test that ARCH_SHSTK_UNLOCK can't be called from normal (non-ptrace) context. */
+ if (!ARCH_PRCTL(ARCH_SHSTK_UNLOCK, ARCH_SHSTK_SHSTK)) {
+ printf("[FAIL]\tARCH_SHSTK_UNLOCK should fail in a non-ptrace context\n");
+ goto out;
+ }
+
+ printf("[OK]\tCouldn't enable Shadow stack via UNLOCK\n");
+
if (ARCH_PRCTL(ARCH_SHSTK_ENABLE, ARCH_SHSTK_SHSTK)) {
printf("[SKIP]\tCould not enable Shadow stack\n");
return 1;