From: Jiri Olsa <olsajiri@gmail.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Oleg Nesterov <oleg@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Jakub Sitnicki <jakub@cloudflare.com>,
bpf@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCHv3 05/12] libbpf: Change has_nop_combo to work on top of nop10
Date: Fri, 22 May 2026 23:28:10 +0200 [thread overview]
Message-ID: <ahDKatbb_ixUY_XF@krava> (raw)
In-Reply-To: <CAEf4BzY3bV+gkA4fRm=jzaTowG1QtXogLDOKkG3CrR5EWzDPcg@mail.gmail.com>
On Fri, May 22, 2026 at 11:52:56AM -0700, Andrii Nakryiko wrote:
> On Thu, May 21, 2026 at 5:45 AM Jiri Olsa <jolsa@kernel.org> wrote:
> >
> > We now expect nop combo with 10 bytes nop instead of 5 bytes nop,
> > fixing has_nop_combo to reflect that.
> >
> > Fixes: 41a5c7df4466 ("libbpf: Add support to detect nop,nop5 instructions combo for usdt probe")
> > Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
> > Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> > ---
> > tools/lib/bpf/usdt.c | 16 ++++++++--------
> > 1 file changed, 8 insertions(+), 8 deletions(-)
> >
> > diff --git a/tools/lib/bpf/usdt.c b/tools/lib/bpf/usdt.c
> > index e3710933fd52..484a4354e82b 100644
> > --- a/tools/lib/bpf/usdt.c
> > +++ b/tools/lib/bpf/usdt.c
> > @@ -305,7 +305,7 @@ struct usdt_manager *usdt_manager_new(struct bpf_object *obj)
> >
> > /*
> > * Detect kernel support for uprobe() syscall, it's presence means we can
> > - * take advantage of faster nop5 uprobe handling.
> > + * take advantage of faster nop10 uprobe handling.
> > * Added in: 56101b69c919 ("uprobes/x86: Add uprobe syscall to speed up uprobe")
>
> Would be nice to add commit that switches nop5 to nop10 (but until it
> lands hash is not stable, so, hmmm, maybe we'll land this patch
> separately? send it a bit later to bpf-next?)
hm, I think that would affect the subtest_optimized_attach usdt test
which depend on this behaviour, will check
jirka
>
>
> but otherwise lgtm
>
> Acked-by: Andrii Nakryiko <andrii@kernel.org>
>
> > */
> > man->has_uprobe_syscall = kernel_supports(obj, FEAT_UPROBE_SYSCALL);
> > @@ -596,14 +596,14 @@ static int parse_usdt_spec(struct usdt_spec *spec, const struct usdt_note *note,
> > #if defined(__x86_64__)
> > static bool has_nop_combo(int fd, long off)
> > {
> > - unsigned char nop_combo[6] = {
> > - 0x90, 0x0f, 0x1f, 0x44, 0x00, 0x00 /* nop,nop5 */
> > + unsigned char nop_combo[11] = {
> > + 0x90, 0x66, 0x2e, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00,
> > };
> > - unsigned char buf[6];
> > + unsigned char buf[11];
> >
> > - if (pread(fd, buf, 6, off) != 6)
> > + if (pread(fd, buf, 11, off) != 11)
> > return false;
> > - return memcmp(buf, nop_combo, 6) == 0;
> > + return memcmp(buf, nop_combo, 11) == 0;
> > }
> > #else
> > static bool has_nop_combo(int fd, long off)
> > @@ -814,8 +814,8 @@ static int collect_usdt_targets(struct usdt_manager *man, struct elf_fd *elf_fd,
> > memset(target, 0, sizeof(*target));
> >
> > /*
> > - * We have uprobe syscall and usdt with nop,nop5 instructions combo,
> > - * so we can place the uprobe directly on nop5 (+1) and get this probe
> > + * We have uprobe syscall and usdt with nop,nop10 instructions combo,
> > + * so we can place the uprobe directly on nop10 (+1) and get this probe
> > * optimized.
> > */
> > if (man->has_uprobe_syscall && has_nop_combo(elf_fd->fd, usdt_rel_ip)) {
> > --
> > 2.53.0
> >
next prev parent reply other threads:[~2026-05-22 21:28 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 [this message]
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
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=ahDKatbb_ixUY_XF@krava \
--to=olsajiri@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=jakub@cloudflare.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.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.