From: Jiri Olsa <jolsa@kernel.org>
To: Oleg Nesterov <oleg@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Andrii Nakryiko <andrii@kernel.org>
Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-trace-kernel@vger.kernel.org, x86@kernel.org,
"Song Liu" <songliubraving@fb.com>, "Yonghong Song" <yhs@fb.com>,
"John Fastabend" <john.fastabend@gmail.com>,
"Hao Luo" <haoluo@google.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Alan Maguire" <alan.maguire@oracle.com>,
"David Laight" <David.Laight@ACULAB.COM>,
"Thomas Weißschuh" <thomas@t-8ch.de>,
"Ingo Molnar" <mingo@kernel.org>, "Jann Horn" <jannh@google.com>,
"Alejandro Colomar" <alx@kernel.org>
Subject: [PATCH perf/core 2/3] selftests/bpf: Fix uprobe_sigill test for uprobe syscall error value
Date: Fri, 5 Sep 2025 22:57:30 +0200 [thread overview]
Message-ID: <20250905205731.1961288-3-jolsa@kernel.org> (raw)
In-Reply-To: <20250905205731.1961288-1-jolsa@kernel.org>
The uprobe syscall now returns -ENXIO errno when called outside
kernel trampoline, fixing the current sigill test to reflect that
and renaming it to uprobe_error.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
.../selftests/bpf/prog_tests/uprobe_syscall.c | 34 ++++---------------
1 file changed, 6 insertions(+), 28 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
index 5da0b49eeaca..6d75ede16e7c 100644
--- a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
+++ b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
@@ -757,34 +757,12 @@ static void test_uprobe_race(void)
#define __NR_uprobe 336
#endif
-static void test_uprobe_sigill(void)
+static void test_uprobe_error(void)
{
- int status, err, pid;
+ long err = syscall(__NR_uprobe);
- pid = fork();
- if (!ASSERT_GE(pid, 0, "fork"))
- return;
- /* child */
- if (pid == 0) {
- asm volatile (
- "pushq %rax\n"
- "pushq %rcx\n"
- "pushq %r11\n"
- "movq $" __stringify(__NR_uprobe) ", %rax\n"
- "syscall\n"
- "popq %r11\n"
- "popq %rcx\n"
- "retq\n"
- );
- exit(0);
- }
-
- err = waitpid(pid, &status, 0);
- ASSERT_EQ(err, pid, "waitpid");
-
- /* verify the child got killed with SIGILL */
- ASSERT_EQ(WIFSIGNALED(status), 1, "WIFSIGNALED");
- ASSERT_EQ(WTERMSIG(status), SIGILL, "WTERMSIG");
+ ASSERT_EQ(err, -1, "error");
+ ASSERT_EQ(errno, ENXIO, "errno");
}
static void __test_uprobe_syscall(void)
@@ -805,8 +783,8 @@ static void __test_uprobe_syscall(void)
test_uprobe_usdt();
if (test__start_subtest("uprobe_race"))
test_uprobe_race();
- if (test__start_subtest("uprobe_sigill"))
- test_uprobe_sigill();
+ if (test__start_subtest("uprobe_error"))
+ test_uprobe_error();
if (test__start_subtest("uprobe_regs_equal"))
test_uprobe_regs_equal(false);
if (test__start_subtest("regs_change"))
--
2.51.0
next prev parent reply other threads:[~2025-09-05 20:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 20:57 [PATCH perf/core 0/3] uprobes/x86: change error path for uprobe syscall Jiri Olsa
2025-09-05 20:57 ` [PATCH perf/core 1/3] uprobes/x86: Return error from uprobe syscall when not called from trampoline Jiri Olsa
2025-09-08 11:25 ` Oleg Nesterov
2025-09-16 11:37 ` [tip: perf/core] " tip-bot2 for Jiri Olsa
2025-09-05 20:57 ` Jiri Olsa [this message]
2025-09-05 21:40 ` [PATCH perf/core 2/3] selftests/bpf: Fix uprobe_sigill test for uprobe syscall error value Andrii Nakryiko
2025-09-16 11:37 ` [tip: perf/core] " tip-bot2 for Jiri Olsa
2025-09-05 20:57 ` [PATCH 3/3] man2: Add uprobe syscall page Jiri Olsa
2025-09-15 11:47 ` [PATCH perf/core 0/3] uprobes/x86: change error path for uprobe syscall Peter Zijlstra
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=20250905205731.1961288-3-jolsa@kernel.org \
--to=jolsa@kernel.org \
--cc=David.Laight@ACULAB.COM \
--cc=alan.maguire@oracle.com \
--cc=alx@kernel.org \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=haoluo@google.com \
--cc=jannh@google.com \
--cc=john.fastabend@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=songliubraving@fb.com \
--cc=thomas@t-8ch.de \
--cc=x86@kernel.org \
--cc=yhs@fb.com \
/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.