From: Jiri Olsa <olsajiri@gmail.com>
To: sashiko-reviews@lists.linux.dev
Cc: bpf@vger.kernel.org
Subject: Re: [PATCHv3 06/12] libbpf: Detect uprobe syscall with new error
Date: Mon, 25 May 2026 17:44:12 +0200 [thread overview]
Message-ID: <ahRuTKNgJ8UmguT7@krava> (raw)
In-Reply-To: <20260521132920.227EB1F000E9@smtp.kernel.org>
On Thu, May 21, 2026 at 01:29:19PM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] Missing kernel-side dependency causes selftest failure and feature detection breakage
replied in the previous post:
https://lore.kernel.org/bpf/agzJtkZuSRVK3YR_@krava/
jirka
> --
>
> commit 2bfbf90e3446befa63868457a72590c57c20d562
> Author: Jiri Olsa <jolsa@kernel.org>
>
> libbpf: Detect uprobe syscall with new error
>
> This commit updates libbpf feature detection and selftests to expect
> EPROTO instead of ENXIO when the uprobe syscall is called outside a
> kernel-generated uprobe trampoline.
>
> > diff --git a/tools/lib/bpf/features.c b/tools/lib/bpf/features.c
> > index 4f19a0d79b0cf..a37aaea5253e5 100644
> > --- a/tools/lib/bpf/features.c
> > +++ b/tools/lib/bpf/features.c
> > @@ -577,10 +577,10 @@ static int probe_ldimm64_full_range_off(int token_fd)
> > static int probe_uprobe_syscall(int token_fd)
> > {
> > /*
> > - * If kernel supports uprobe() syscall, it will return -ENXIO when called
> > + * If kernel supports uprobe() syscall, it will return -EPROTO when called
> > * from the outside of a kernel-generated uprobe trampoline.
> > */
> > - return syscall(__NR_uprobe) < 0 && errno == ENXIO;
> > + return syscall(__NR_uprobe) < 0 && errno == EPROTO;
>
> [Severity: High]
> Is this patch missing a kernel-side dependency? Looking at the current kernel
> tree in arch/x86/kernel/uprobes.c, SYSCALL_DEFINE0(uprobe) still explicitly
> returns -ENXIO:
>
> if (!in_uprobe_trampoline(regs->ip))
> return -ENXIO;
>
> Without the corresponding kernel patch to change this to -EPROTO, will
> this cause libbpf to incorrectly conclude that the uprobe syscall is
> unsupported, and cause the updated selftests below to fail?
>
> > }
>
> [ ... ]
>
> > diff --git a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> > index 955a37751b52d..c944136252c6d 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/uprobe_syscall.c
> > @@ -762,7 +762,7 @@ static void test_uprobe_error(void)
> > long err = syscall(__NR_uprobe);
> >
> > ASSERT_EQ(err, -1, "error");
> > - ASSERT_EQ(errno, ENXIO, "errno");
> > + ASSERT_EQ(errno, EPROTO, "errno");
> > }
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260521124411.31133-7-jolsa@kernel.org?part=1
next prev parent reply other threads:[~2026-05-25 15:44 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-21 12:43 [PATCHv3 00/12] uprobes/x86: Fix red zone issue for optimized uprobes Jiri Olsa
2026-05-21 12:44 ` [PATCHv3 01/12] uprobes/x86: Use proper mm_struct in __in_uprobe_trampoline Jiri Olsa
2026-05-22 18:50 ` Andrii Nakryiko
2026-05-21 12:44 ` [PATCHv3 02/12] uprobes/x86: Remove struct uprobe_trampoline object Jiri Olsa
2026-05-21 13:26 ` bot+bpf-ci
2026-05-24 22:13 ` Jiri Olsa
2026-05-22 18:50 ` Andrii Nakryiko
2026-05-21 12:44 ` [PATCHv3 03/12] uprobes/x86: Allow to copy uprobe trampolines on fork Jiri Olsa
2026-05-22 18:50 ` Andrii Nakryiko
2026-05-24 21:54 ` Jiri Olsa
2026-05-21 12:44 ` [PATCHv3 04/12] uprobes/x86: Move optimized uprobe from nop5 to nop10 Jiri Olsa
2026-05-21 13:35 ` Peter Zijlstra
2026-05-22 21:19 ` Jiri Olsa
2026-05-22 18:50 ` Andrii Nakryiko
2026-05-22 21:19 ` Jiri Olsa
2026-05-26 9:19 ` Peter Zijlstra
2026-05-26 10:19 ` Jiri Olsa
2026-05-21 12:44 ` [PATCHv3 05/12] libbpf: Change has_nop_combo to work on top of nop10 Jiri Olsa
2026-05-21 13:01 ` sashiko-bot
2026-05-22 18:52 ` Andrii Nakryiko
2026-05-22 21:28 ` Jiri Olsa
2026-05-26 14:26 ` Jiri Olsa
2026-05-21 12:44 ` [PATCHv3 06/12] libbpf: Detect uprobe syscall with new error Jiri Olsa
2026-05-21 13:26 ` bot+bpf-ci
2026-05-21 13:29 ` sashiko-bot
2026-05-25 15:44 ` Jiri Olsa [this message]
2026-05-21 12:44 ` [PATCHv3 07/12] selftests/bpf: Emit nop,nop10 instructions combo for x86_64 arch Jiri Olsa
2026-05-21 13:21 ` sashiko-bot
2026-05-25 15:43 ` Jiri Olsa
2026-05-26 10:58 ` Jakub Sitnicki
2026-05-26 14:30 ` Jiri Olsa
2026-05-21 13:26 ` bot+bpf-ci
2026-05-26 10:58 ` Jakub Sitnicki
2026-05-21 12:44 ` [PATCHv3 08/12] selftests/bpf: Change uprobe syscall tests to use nop10 Jiri Olsa
2026-05-21 13:05 ` sashiko-bot
2026-05-21 13:26 ` bot+bpf-ci
2026-05-22 18:57 ` Andrii Nakryiko
2026-05-25 15:44 ` Jiri Olsa
2026-05-21 12:44 ` [PATCHv3 09/12] selftests/bpf: Change uprobe/usdt trigger bench code " Jiri Olsa
2026-05-21 12:44 ` [PATCHv3 10/12] selftests/bpf: Add reattach tests for uprobe syscall Jiri Olsa
2026-05-21 12:44 ` [PATCHv3 11/12] selftests/bpf: Add tests for uprobe nop10 red zone clobbering Jiri Olsa
2026-05-21 13:26 ` bot+bpf-ci
2026-05-25 15:44 ` Jiri Olsa
2026-05-21 12:44 ` [PATCHv3 12/12] selftests/bpf: Add tests for forked/cloned optimized uprobes Jiri Olsa
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=ahRuTKNgJ8UmguT7@krava \
--to=olsajiri@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.