BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jiri Olsa" <jolsa@kernel.org>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCHv6 06/13] libbpf: Change has_nop_combo to work on top of nop10
Date: Fri, 03 Jul 2026 12:00:28 +0000	[thread overview]
Message-ID: <20260703120028.E0C2D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260703114917.238144-7-jolsa@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Dropping support for the `nop5` combo in `has_nop_combo()` breaks the BPF USDT selftests.
--

commit dc8c1772a19cbe96786096f839e442eb211041bc
Author: Jiri Olsa <jolsa@kernel.org>

libbpf: Change has_nop_combo to work on top of nop10

This patch modifies the USDT has_nop_combo() function to exclusively check
for an 11-byte nop,nop10 sequence, replacing the previous 6-byte nop,nop5
check. This aligns the detection logic with newer kernel support for faster
uprobe handling using nop10.

> diff --git a/tools/lib/bpf/usdt.c b/tools/lib/bpf/usdt.c
> index 57fb82bb81b58..d2ecd3daab961 100644
> --- a/tools/lib/bpf/usdt.c
> +++ b/tools/lib/bpf/usdt.c

[ ... ]

> @@ -604,14 +604,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;
>  }

[Severity: Medium]
Will dropping support for the nop5 combo here break the BPF USDT selftests?

The selftest in tools/testing/selftests/bpf/prog_tests/usdt.c still generates
and expects the nop,nop5 combination for usdt_2. Because this function now
returns false for nop5, collect_usdt_targets() skips the usdt_abs_ip++
optimization.

This causes the uprobe to be placed directly at addr_2, overwriting the nop
with an int3 (0xcc) breakpoint, which makes the test assertion fail:

tools/testing/selftests/bpf/prog_tests/usdt.c:subtest_optimized_attach() {
    ...
    /* 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"))
        return;
    ...
    /* nop stays on addr_2 address */
    ASSERT_EQ(*addr_2, 0x90, "nop");
}

Does the test suite also need to be updated to generate and expect nop,nop10?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260703114917.238144-7-jolsa@kernel.org?part=1

  reply	other threads:[~2026-07-03 12:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-03 11:49 [PATCHv6 00/13] uprobes/x86: Fix red zone issue for optimized uprobes Jiri Olsa
2026-07-03 11:49 ` [PATCHv6 01/13] uprobes/x86: Use proper mm_struct in __in_uprobe_trampoline Jiri Olsa
2026-07-03 11:49 ` [PATCHv6 02/13] uprobes/x86: Remove struct uprobe_trampoline object Jiri Olsa
2026-07-03 11:49 ` [PATCHv6 03/13] uprobes/x86: Do not leak trampoline vma mapping on optimization failure Jiri Olsa
2026-07-03 12:32   ` bot+bpf-ci
2026-07-03 12:45   ` Peter Zijlstra
2026-07-03 14:11     ` Jiri Olsa
2026-07-03 11:49 ` [PATCHv6 04/13] uprobes/x86: Allow to copy uprobe trampolines on fork Jiri Olsa
2026-07-03 11:49 ` [PATCHv6 05/13] uprobes/x86: Move optimized uprobe from nop5 to nop10 Jiri Olsa
2026-07-03 11:49 ` [PATCHv6 06/13] libbpf: Change has_nop_combo to work on top of nop10 Jiri Olsa
2026-07-03 12:00   ` sashiko-bot [this message]
2026-07-03 11:49 ` [PATCHv6 07/13] libbpf: Detect uprobe syscall with new error Jiri Olsa
2026-07-03 11:49 ` [PATCHv6 08/13] selftests/bpf: Emit nop,nop10 instructions combo for x86_64 arch Jiri Olsa
2026-07-03 12:03   ` sashiko-bot
2026-07-03 11:49 ` [PATCHv6 09/13] selftests/bpf: Change uprobe syscall tests to use nop10 Jiri Olsa
2026-07-03 12:00   ` sashiko-bot
2026-07-03 11:49 ` [PATCHv6 10/13] selftests/bpf: Change uprobe/usdt trigger bench code " Jiri Olsa
2026-07-03 11:49 ` [PATCHv6 11/13] selftests/bpf: Add reattach tests for uprobe syscall Jiri Olsa
2026-07-03 11:49 ` [PATCHv6 12/13] selftests/bpf: Add tests for uprobe nop10 red zone clobbering Jiri Olsa
2026-07-03 11:49 ` [PATCHv6 13/13] 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=20260703120028.E0C2D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=jolsa@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