From: Jiri Olsa <olsajiri@gmail.com>
To: sashiko-reviews@lists.linux.dev
Cc: bpf@vger.kernel.org
Subject: Re: [PATCHv2 07/11] selftests/bpf: Change uprobe syscall tests to use nop10
Date: Tue, 19 May 2026 22:36:40 +0200 [thread overview]
Message-ID: <agzJ2HV2BX0ST3MC@krava> (raw)
In-Reply-To: <20260518111604.CC731C2BCB7@smtp.kernel.org>
On Mon, May 18, 2026 at 11:16:04AM +0000, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
> - [Medium] Missing update to USDT_NOP macro causes `subtest_optimized_attach` test failure.
> - [Medium] Inadequate search bounds in `find_instr()` may cause false test failures.
> - [Low] Misleading benchmark and function names referencing `nop5`.
> --
>
> commit 1996488ddbe422eb1d441da9b06aafe6bd47e6d1
> Author: Jiri Olsa <jolsa@kernel.org>
>
> selftests/bpf: Change uprobe syscall tests to use nop10
>
> Optimized uprobes are now on top of 10-bytes nop instructions,
> reflect that in existing tests.
>
> > diff --git a/tools/testing/selftests/bpf/benchs/bench_trigger.c b/tools/testing/selftests/bpf/benchs/bench_trigger.c
> > index 2f22ec61667b9..bcc4820c802e5 100644
> > --- a/tools/testing/selftests/bpf/benchs/bench_trigger.c
> > +++ b/tools/testing/selftests/bpf/benchs/bench_trigger.c
> > @@ -398,7 +398,7 @@ static void *uprobe_producer_ret(void *input)
> > #ifdef __x86_64__
> > __nocf_check __weak void uprobe_target_nop5(void)
> > {
> > - asm volatile (".byte 0x0f, 0x1f, 0x44, 0x00, 0x00");
> > + asm volatile (".byte 0x66, 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00");
> > }
> >
> > static void *uprobe_producer_nop5(void *input)
>
> This isn't a bug, but should the function and benchmark names also be updated?
>
> The benchmark exposes names like uprobe-nop5 and uretprobe-nop5, but they are
> now testing a 10-byte nop.
they are updated in following separate commit
>
> [ ... ]
>
> > diff --git a/tools/testing/selftests/bpf/prog_tests/usdt.c b/tools/testing/selftests/bpf/prog_tests/usdt.c
> > index 69759b27794d7..a160d7c4fa0d3 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/usdt.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/usdt.c
> > @@ -252,7 +252,7 @@ extern void usdt_1(void);
> > extern void usdt_2(void);
> >
> > static unsigned char nop1[1] = { 0x90 };
> > -static unsigned char nop1_nop5_combo[6] = { 0x90, 0x0f, 0x1f, 0x44, 0x00, 0x00 };
> > +static unsigned char nop1_nop10_combo[11] = { 0x90, 0x66, 0x66, 0x0f, 0x1f, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00 };
>
> Is the loop in find_instr() adequate to find this instruction sequence?
>
> tools/testing/selftests/bpf/prog_tests/usdt.c:find_instr() {
> for (i = 0; i < 10; i++) {
> if (!memcmp(instr, fn + i, cnt))
> return fn + i;
> }
> return NULL;
> }
>
> In uprobe_syscall.c, find_nop10() was updated to search up to 128 bytes to
> account for compiler-generated prologues. If a modern compiler generates a
> prologue longer than 9 bytes for usdt_2(), this will prematurely terminate and
> cause the subtest_optimized_attach() test to fail.
yea find_instr needs same update, will fix
>
> [ ... ]
>
> > @@ -271,17 +271,17 @@ static void subtest_optimized_attach(void)
> > __u8 *addr_1, *addr_2;
> >
> > /* usdt_1 USDT probe has single nop instruction */
> > - addr_1 = find_instr(usdt_1, nop1_nop5_combo, 6);
> > - if (!ASSERT_NULL(addr_1, "usdt_1_find_nop1_nop5_combo"))
> > + addr_1 = find_instr(usdt_1, nop1_nop10_combo, 11);
> > + if (!ASSERT_NULL(addr_1, "usdt_1_find_nop1_nop10_combo"))
> > return;
> >
> > addr_1 = find_instr(usdt_1, nop1, 1);
> > if (!ASSERT_OK_PTR(addr_1, "usdt_1_find_nop1"))
> > return;
> >
> > - /* usdt_2 USDT probe has nop,nop5 instructions combo */
> > - addr_2 = find_instr(usdt_2, nop1_nop5_combo, 6);
> > - if (!ASSERT_OK_PTR(addr_2, "usdt_2_find_nop1_nop5_combo"))
> > + /* usdt_2 USDT probe has nop,nop10 instructions combo */
> > + addr_2 = find_instr(usdt_2, nop1_nop10_combo, 11);
> > + if (!ASSERT_OK_PTR(addr_2, "usdt_2_find_nop1_nop10_combo"))
>
> Does this test fail because USDT_NOP was not updated in usdt.h?
>
> The test expects to find the 11-byte nop1_nop10_combo, but usdt_2.c relies on
> the default definition of USDT_NOP from tools/testing/selftests/bpf/usdt.h.
>
> Because usdt.h was not updated in this patch, usdt_2.c will compile with the
> 6-byte nop sequence, causing find_instr() to return NULL here and the
> ASSERT_OK_PTR to fail.
it's updated separately in another commit
jirka
next prev parent reply other threads:[~2026-05-19 20:36 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 10:59 [PATCHv2 00/11] uprobes/x86: Fix red zone issue for optimized uprobes Jiri Olsa
2026-05-18 10:59 ` [PATCHv2 01/11] uprobes/x86: Use proper mm_struct in __in_uprobe_trampoline Jiri Olsa
2026-05-18 10:59 ` [PATCHv2 02/11] uprobes/x86: Allow to copy uprobe trampolines on fork Jiri Olsa
2026-05-18 11:42 ` sashiko-bot
2026-05-18 12:50 ` Jiri Olsa
2026-05-18 16:04 ` Jiri Olsa
2026-05-18 10:59 ` [PATCHv2 03/11] uprobes/x86: Move optimized uprobe from nop5 to nop10 Jiri Olsa
2026-05-18 11:50 ` bot+bpf-ci
2026-05-18 10:59 ` [PATCHv2 04/11] libbpf: Change has_nop_combo to work on top of nop10 Jiri Olsa
2026-05-18 11:37 ` bot+bpf-ci
2026-05-19 20:36 ` Jiri Olsa
2026-05-18 10:59 ` [PATCHv2 05/11] libbpf: Detect uprobe syscall with new error Jiri Olsa
2026-05-18 11:31 ` sashiko-bot
2026-05-19 20:36 ` Jiri Olsa
2026-05-18 11:37 ` bot+bpf-ci
2026-05-18 17:39 ` Andrii Nakryiko
2026-05-18 10:59 ` [PATCHv2 06/11] selftests/bpf: Emit nop,nop10 instructions combo for x86_64 arch Jiri Olsa
2026-05-18 11:17 ` sashiko-bot
2026-05-19 20:36 ` Jiri Olsa
2026-05-18 10:59 ` [PATCHv2 07/11] selftests/bpf: Change uprobe syscall tests to use nop10 Jiri Olsa
2026-05-18 11:16 ` sashiko-bot
2026-05-19 20:36 ` Jiri Olsa [this message]
2026-05-18 11:50 ` bot+bpf-ci
2026-05-18 10:59 ` [PATCHv2 08/11] selftests/bpf: Change uprobe/usdt trigger bench code " Jiri Olsa
2026-05-18 11:37 ` bot+bpf-ci
2026-05-18 10:59 ` [PATCHv2 09/11] selftests/bpf: Add reattach tests for uprobe syscall Jiri Olsa
2026-05-18 10:59 ` [PATCHv2 10/11] selftests/bpf: Add tests for uprobe nop10 red zone clobbering Jiri Olsa
2026-05-18 10:59 ` [PATCHv2 11/11] 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=agzJ2HV2BX0ST3MC@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox