From: Richard Patel <ripatel@wii.dev>
To: Rick Edgecombe <rick.p.edgecombe@intel.com>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org
Cc: "H . Peter Anvin" <hpa@zytor.com>, Kees Cook <kees@kernel.org>,
Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
Richard Patel <ripatel@wii.dev>
Subject: [PATCH 3/3] selftests/x86: skip shstk tests where perf_event_open() fails
Date: Thu, 8 Oct 2026 20:16:10 +0000 [thread overview]
Message-ID: <20261008201610.1003569-4-ripatel@wii.dev> (raw)
In-Reply-To: <20261008201610.1003569-1-ripatel@wii.dev>
perf_event_open() without caps fails with EACCES on some kernels.
With this fix, the shadow stack selftest passes without privileges
on a kernel with a RHEL-like config.
Signed-off-by: Richard Patel <ripatel@wii.dev>
---
tools/testing/selftests/x86/test_shadow_stack.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/x86/test_shadow_stack.c b/tools/testing/selftests/x86/test_shadow_stack.c
index 67baebbdbd87..e2340232a7b6 100644
--- a/tools/testing/selftests/x86/test_shadow_stack.c
+++ b/tools/testing/selftests/x86/test_shadow_stack.c
@@ -952,8 +952,11 @@ static int test_uretprobe(void)
fd = syscall(__NR_perf_event_open, &attr, 0 /* pid */, -1 /* cpu */,
-1 /* group_fd */, PERF_FLAG_FD_CLOEXEC);
- if (fd < 0)
+ if (fd < 0) {
+ printf("[SKIP]\tUretprobe test, perf_event_open() failed: %m\n");
+ err = 0;
goto out;
+ }
if (sigsetjmp(jmp_buffer, 1))
goto out;
@@ -1031,8 +1034,11 @@ static int test_uprobe_call(void)
fd = syscall(__NR_perf_event_open, &attr, 0 /* pid */, -1 /* cpu */,
-1 /* group_fd */, PERF_FLAG_FD_CLOEXEC);
- if (fd < 0)
+ if (fd < 0) {
+ printf("[SKIP]\tUprobe on CALL test, perf_event_open() failed: %m\n");
+ err = 0;
goto out;
+ }
if (sigsetjmp(jmp_buffer, 1))
goto out;
--
2.52.0
next prev parent reply other threads:[~2026-10-08 20:17 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 20:16 [PATCH 0/3] x86/shstk: ban ia32 sigreturn Richard Patel
2026-10-08 20:16 ` [PATCH 1/3] x86/shstk: ban ia32 sigreturn when shadow stack is enabled Richard Patel
2026-10-08 20:59 ` Edgecombe, Rick P
2026-10-08 21:50 ` Richard Patel
2026-10-08 22:34 ` Edgecombe, Rick P
2026-10-08 22:47 ` Richard Patel
2026-10-08 23:11 ` Edgecombe, Rick P
2026-10-08 23:29 ` Richard Patel
2026-10-09 11:36 ` Richard Patel
2026-10-09 22:14 ` Edgecombe, Rick P
2026-10-08 20:16 ` [PATCH 2/3] selftests/x86: test shadow stack sigreturn protection Richard Patel
2026-10-08 20:16 ` Richard Patel [this message]
2026-10-08 21:00 ` [PATCH 0/3] x86/shstk: ban ia32 sigreturn 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=20261008201610.1003569-4-ripatel@wii.dev \
--to=ripatel@wii.dev \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kees@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.