From: Sasha Levin <sashal@kernel.org>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] selftests/x86: report a skip when shadow stack cannot be enabled
Date: Wed, 4 Nov 2026 22:02:45 -0500 [thread overview]
Message-ID: <20261105030245.1241500-1-sashal@kernel.org> (raw)
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
next reply other threads:[~2026-11-05 3:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-05 3:02 Sasha Levin [this message]
2026-11-05 19:08 ` Edgecombe, Rick P
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261105030245.1241500-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rick.p.edgecombe@intel.com \
--cc=shuah@kernel.org \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®