Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH v2 2/2] selftest/x86: test ARCH_SHSTK_UNLOCK
       [not found] <20260707191136.1732277-1-bill.roberts@arm.com>
@ 2026-07-07 19:11 ` Bill Roberts
  2026-08-27 23:32   ` Edgecombe, Rick P
  0 siblings, 1 reply; 2+ messages in thread
From: Bill Roberts @ 2026-07-07 19:11 UTC (permalink / raw)
  To: rick.p.edgecombe, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Shuah Khan
  Cc: Bill Roberts, linux-kernel, linux-kselftest

Test that ARCH_SHSTK_UNLOCK can't be called from normal (non-ptrace)
context.

Signed-off-by: Bill Roberts <bill.roberts@arm.com>
---
 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 3d6ca33edba4..cbe7ca4ebd90 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;
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 2/2] selftest/x86: test ARCH_SHSTK_UNLOCK
  2026-07-07 19:11 ` [PATCH v2 2/2] selftest/x86: test ARCH_SHSTK_UNLOCK Bill Roberts
@ 2026-08-27 23:32   ` Edgecombe, Rick P
  0 siblings, 0 replies; 2+ messages in thread
From: Edgecombe, Rick P @ 2026-08-27 23:32 UTC (permalink / raw)
  To: x86@kernel.org, dave.hansen@linux.intel.com, shuah@kernel.org,
	mingo@redhat.com, bp@alien8.de, tglx@kernel.org,
	bill.roberts@arm.com, hpa@zytor.com
  Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org

On Tue, 2026-07-07 at 14:11 -0500, Bill Roberts wrote:
> Test that ARCH_SHSTK_UNLOCK can't be called from normal (non-ptrace)
> context.
> 
> Signed-off-by: Bill Roberts <bill.roberts@arm.com>
> ---

Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-27 23:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20260707191136.1732277-1-bill.roberts@arm.com>
2026-07-07 19:11 ` [PATCH v2 2/2] selftest/x86: test ARCH_SHSTK_UNLOCK Bill Roberts
2026-08-27 23:32   ` Edgecombe, Rick P

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox