All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Daniel Borkmann" <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v5 6/8] selftests/bpf: Adjust bpf_map layout in verifier_map_ptr
Date: Tue, 07 Jul 2026 19:50:44 +0000	[thread overview]
Message-ID: <20260707195044.729391F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260707193104.350066-7-daniel@iogearbox.net>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Unmodified selftests fail due to removed in-loader signature validation logic.
--

--- Patch [6]: [PATCH bpf-next v5 6/8] selftests/bpf: Adjust bpf_map layout in verifier_map_ptr ---
commit 044ddeab6141689800cc4332d820c23c210957a8
Author: Daniel Borkmann <daniel@iogearbox.net>

selftests/bpf: Adjust bpf_map layout in verifier_map_ptr

This commit updates the expected verifier messages in the verifier_map_ptr
test to account for the removal of the write-only excl member from
struct bpf_map.

> diff --git a/tools/testing/selftests/bpf/progs/verifier_map_ptr.c b/tools/testing/selftests/bpf/progs/verifier_map_ptr.c
> index 1661936598703..e0a65835c861b 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_map_ptr.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_map_ptr.c
[ ... ]
> @@ -97,23 +98,23 @@ __naked void read_non_existent_field_rejected(void)
>  }
>  
>  /*
> - * The u32 excl field spans offsets 32..35 (mend 36). Reading a u32 at offset
> - * 33 starts inside excl but extends past its end, which the verifier rejects
> + * The sha byte array spans offsets 0..31 (mend 32). Reading a u32 at offset
> + * 30 starts inside sha but extends past its end, which the verifier rejects
>   * as an out-of-bounds scalar access.
>   */

[Severity: Medium]
Does this patch series also need to update signed_loader.c to account for the
removal of the excl member and emit_signature_match logic?

It appears that leaving tools/testing/selftests/bpf/prog_tests/signed_loader.c
unmodified causes several tests to fail.

For example, check_sig_match_shape() explicitly looks for
emit_signature_match instructions which are no longer generated:

    for (i = 0; i + 1 < n; i++) {
        if (in[i].code == (BPF_LD | BPF_IMM | BPF_DW) &&
            in[i].src_reg == BPF_PSEUDO_MAP_IDX) {
            a = i;
            break;
        }
    }
    if (!ASSERT_GE(a, 0, "emit_signature_match present"))
        return;

Additionally, metadata_not_exclusive(), metadata_sha_mismatch(), and
metadata_hash_not_computed() test validation failures by passing a NULL
signature. Without a signature, the kernel verifier skips metadata validation
entirely.

Since the runtime check was removed, the loader now successfully executes
and returns 0 instead of -EINVAL, causing these tests to fail:

    r = run_gen_loader(f.gopts.insns, f.gopts.insns_sz, f.blob,
                       f.data_sz, NULL, 0, NULL, 0, true, f.ctx,
                       f.ctx_sz, &ran);
    ASSERT_TRUE(ran, "loader ran");
    ASSERT_EQ(r, -EINVAL, "non-exclusive metadata map rejected");

Are there missing updates to signed_loader.c that should be included here?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260707193104.350066-1-daniel@iogearbox.net?part=6

  reply	other threads:[~2026-07-07 19:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07 19:30 [PATCH bpf-next v5 0/8] Verify BPF signed loader at load time Daniel Borkmann
2026-07-07 19:30 ` [PATCH bpf-next v5 1/8] bpf: Resolve and cache fd_array objects " Daniel Borkmann
2026-07-07 19:30 ` [PATCH bpf-next v5 2/8] bpf: Verify signed loader metadata " Daniel Borkmann
2026-07-07 19:55   ` sashiko-bot
2026-07-07 20:31     ` Daniel Borkmann
2026-07-07 19:30 ` [PATCH bpf-next v5 3/8] libbpf: Drop in-loader metadata check for load-time verification Daniel Borkmann
2026-07-07 19:52   ` sashiko-bot
2026-07-07 20:08     ` Daniel Borkmann
2026-07-07 19:31 ` [PATCH bpf-next v5 4/8] bpftool: Check EVP_Digest when computing excl_prog_hash Daniel Borkmann
2026-07-07 19:31 ` [PATCH bpf-next v5 5/8] bpftool: Cover loader metadata with the program signature Daniel Borkmann
2026-07-07 19:31 ` [PATCH bpf-next v5 6/8] selftests/bpf: Adjust bpf_map layout in verifier_map_ptr Daniel Borkmann
2026-07-07 19:50   ` sashiko-bot [this message]
2026-07-07 20:06     ` Daniel Borkmann
2026-07-07 19:31 ` [PATCH bpf-next v5 7/8] selftests/bpf: Verify load-time signed loader metadata Daniel Borkmann
2026-07-07 19:31 ` [PATCH bpf-next v5 8/8] Documentation/bpf: Add BPF signing and enforcement doc Daniel Borkmann

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=20260707195044.729391F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --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.