* [PATCH] selftests/x86: report a skip when shadow stack cannot be enabled
@ 2026-11-05 3:02 Sasha Levin
2026-11-05 19:08 ` Edgecombe, Rick P
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2026-11-05 3:02 UTC (permalink / raw)
To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen
Cc: x86, H . Peter Anvin, Rick Edgecombe, Shuah Khan,
linux-kselftest, linux-kernel
test_shadow_stack prints "[SKIP] Could not enable Shadow stack" when
ARCH_SHSTK_ENABLE fails, as it does on CPUs without shadow stack support
and on kernels built without CONFIG_X86_USER_SHADOW_STACK, but then exits
with 1, so the kselftest runner reports a failure.
Exit with KSFT_SKIP instead.
Fixes: 81f30337ef4f ("selftests/x86: Add shadow stack test")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
Found with KernelCI's x86 builds, which leave
CONFIG_X86_USER_SHADOW_STACK unset. Tested on an AMD EPYC 9655P with
KernelCI's x86_64 build of next-20261104: the test now exits with 4
instead of 1.
tools/testing/selftests/x86/test_shadow_stack.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/x86/test_shadow_stack.c b/tools/testing/selftests/x86/test_shadow_stack.c
index 3d6ca33edba42..f7051ea525d4e 100644
--- a/tools/testing/selftests/x86/test_shadow_stack.c
+++ b/tools/testing/selftests/x86/test_shadow_stack.c
@@ -36,6 +36,8 @@
#include <linux/elf.h>
#include <linux/perf_event.h>
+#include "kselftest.h"
+
/*
* Define the ABI defines if needed, so people can run the tests
* without building the headers.
@@ -1061,7 +1063,7 @@ int main(int argc, char *argv[])
if (ARCH_PRCTL(ARCH_SHSTK_ENABLE, ARCH_SHSTK_SHSTK)) {
printf("[SKIP]\tCould not enable Shadow stack\n");
- return 1;
+ return KSFT_SKIP;
}
if (ARCH_PRCTL(ARCH_SHSTK_DISABLE, ARCH_SHSTK_SHSTK)) {
--
2.53.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] selftests/x86: report a skip when shadow stack cannot be enabled
2026-11-05 3:02 [PATCH] selftests/x86: report a skip when shadow stack cannot be enabled Sasha Levin
@ 2026-11-05 19:08 ` Edgecombe, Rick P
0 siblings, 0 replies; 2+ messages in thread
From: Edgecombe, Rick P @ 2026-11-05 19:08 UTC (permalink / raw)
To: sashal, mingo, tglx, bp, dave.hansen
Cc: hpa, shuah, linux-kselftest, linux-kernel, x86
On Wed, 2026-11-04 at 22:02 -0500, Sasha Levin wrote:
> test_shadow_stack prints "[SKIP] Could not enable Shadow stack" when
> ARCH_SHSTK_ENABLE fails, as it does on CPUs without shadow stack support
> and on kernels built without CONFIG_X86_USER_SHADOW_STACK, but then exits
> with 1, so the kselftest runner reports a failure.
>
> Exit with KSFT_SKIP instead.
>
> Fixes: 81f30337ef4f ("selftests/x86: Add shadow stack test")
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> Found with KernelCI's x86 builds, which leave
> CONFIG_X86_USER_SHADOW_STACK unset. Tested on an AMD EPYC 9655P with
> KernelCI's x86_64 build of next-20261104: the test now exits with 4
> instead of 1.
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
There are some other things labeled SKIP in the same function. But they should
probably actually be FAIL, so the one update done in this patch seems
appropriate.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-05 19:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 3:02 [PATCH] selftests/x86: report a skip when shadow stack cannot be enabled Sasha Levin
2026-11-05 19:08 ` 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
all inboxes | Powered by JetHome®