mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: "Vineet Gupta" <vineet.gupta@linux.dev>, <bot+bpf-ci@kernel.org>,
	<ast@kernel.org>, <daniel@iogearbox.net>, <andrii@kernel.org>,
	<eddyz87@gmail.com>, <memxor@gmail.com>
Cc: <martin.lau@linux.dev>, <song@kernel.org>,
	<yonghong.song@linux.dev>, <jolsa@kernel.org>,
	<emil@etsalapatis.com>, <ihor.solodrai@linux.dev>,
	<john.fastabend@gmail.com>, <shuah@kernel.org>,
	<bpf@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>, <martin.lau@kernel.org>,
	<mason@kernel.org>
Subject: Re: [PATCH bpf-next v2 01/13] bpf: move linked-scalar flags out of bpf_reg_state->id [NFC]
Date: Wed, 16 Sep 2026 21:03:43 +0000	[thread overview]
Message-ID: <DLH1N1KP02XT.1KJ79QEMQORI2@gmail.com> (raw)
In-Reply-To: <4cddd4a4-d684-46c9-862e-5708797f399d@linux.dev>

On Mon Sep 14, 2026 at 6:02 PM UTC, Vineet Gupta wrote:
>
>
> On 9/10/26 11:22 PM, bot+bpf-ci@kernel.org wrote:
> >> diff --git a/kernel/bpf/states.c b/kernel/bpf/states.c
> >> index 66fb11b6c6a7..d974baad37ee 100644
> >> --- a/kernel/bpf/states.c
> >> +++ b/kernel/bpf/states.c
> > [ ... ]
> >
> >> @@ -369,13 +369,6 @@ static bool check_ids(u32 old_id, u32 cur_id, struct bpf_idmap *idmap)
> >>    * and r7.id=0 (both independent), without temp IDs both would map old_id=X
> >>    * to cur_id=0 and pass. With temp IDs: r6 maps X->temp1, r7 tries to map
> >>    * X->temp2, but X is already mapped to temp1, so the check fails correctly.
> >> - *
> >> - * When old_id has BPF_ADD_CONST set, the compound id (base | flag) and the
> >> - * base id (flag stripped) must both map consistently. Example: old has
> >> - * r2.id=A, r3.id=A|flag (r3 = r2 + delta), cur has r2.id=B, r3.id=C|flag
> >> - * (r3 derived from unrelated r4). Without the base check, idmap gets two
> >> - * independent entries A->B and A|flag->C|flag, missing that A->C conflicts
> >> - * with A->B. The base ID cross-check catches this.
> >>    */
> >>   static bool check_scalar_ids(u32 old_id, u32 cur_id, struct bpf_idmap *idmap)
> >>   {
> >> @@ -384,15 +377,7 @@ static bool check_scalar_ids(u32 old_id, u32 cur_id, struct bpf_idmap *idmap)
> >>
> >>   	cur_id = cur_id ? cur_id : ++idmap->tmp_id_gen;
> >>
> >> -	if (!check_ids(old_id, cur_id, idmap))
> >> -		return false;
> >> -	if (old_id & BPF_ADD_CONST) {
> >> -		old_id &= ~BPF_ADD_CONST;
> >> -		cur_id &= ~BPF_ADD_CONST;
> >> -		if (!check_ids(old_id, cur_id, idmap))
> >> -			return false;
> >> -	}
> >> -	return true;
> >> +	return check_ids(old_id, cur_id, idmap);
> >>   }
> > [ ... ]
> >
> >> diff --git a/tools/testing/selftests/bpf/progs/verifier_linked_scalars.c b/tools/testing/selftests/bpf/progs/verifier_linked_scalars.c
> >> index d571fbfc86a3..da6cb961a520 100644
> >> --- a/tools/testing/selftests/bpf/progs/verifier_linked_scalars.c
> >> +++ b/tools/testing/selftests/bpf/progs/verifier_linked_scalars.c
> > [ ... ]
> >
> >> @@ -648,10 +648,10 @@ l_exit_%=:							\
> >>   }
> >>
> >>   /*
> >> - * Test that regsafe() verifies base_id consistency for BPF_ADD_CONST
> >> + * Test that regsafe() verifies base_id consistency for ADD_CONST_*
> >>    * linked scalars during state pruning.
> >>    *
> >> - * The false branch (explored first) links R3 to R2 via ADD_CONST.
> >> + * The false branch (explored first) links R3 to R2 via ADD_CONST_64.
> >>    * The true branch (runtime path) links R3 to R4 (unrelated base_id).
> >>    * At the merge point, pruning must fail because the linkage topology
> >>    * differs.
> > Does this comment still match what the code does? The patch removes the
> > "base_id" concept from kernel/bpf/states.c (deleted the paragraph that
> > defined it, removed the two-level compound/base id check from
> > check_scalar_ids), but the comment here still describes the test as
> > verifying "base_id consistency" and refers to "unrelated base_id" on the
> > next line.
> >
> > Looking at the function name and __description below:
> >
> >>    */
> >>   __description("add_const base_id must be consistent for pruning")
> >>   __failure __msg("invalid variable-offset")
> >>   __naked void add_const_base_id_pruning(void)
> > and later at line 695:
> >
> >>   	/* Runtime: R2.id=A, R4.id=C: base_ids A vs C inconsistent,
> >>   	 * pruning should have failed. */
> > Should these be updated to use current terminology, or does "base_id"
> > still have meaning in this context? The test itself still works correctly
> > after the patch, so this appears to be a documentation consistency
> > question rather than a functional issue.
>
> Indeed base_id as a term is gone, but just id alone might be confusing 
> as well.
> How about link id as a replacement for base_id

I don't think "link id" fits either. Just use id.


  reply	other threads:[~2026-09-16 21:03 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-10 16:46 [PATCH bpf-next v2 00/13] bpf: track scalar equality across the low 32 bits Vineet Gupta
2026-09-10 16:46 ` [PATCH bpf-next v2 01/13] bpf: move linked-scalar flags out of bpf_reg_state->id [NFC] Vineet Gupta
2026-09-10 17:52   ` bot+bpf-ci
2026-09-14 18:02     ` Vineet Gupta
2026-09-16 21:03       ` Alexei Starovoitov [this message]
2026-09-16 21:21         ` Vineet Gupta
2026-09-12 18:50   ` Alexei Starovoitov
2026-09-15  1:17     ` Vineet Gupta
2026-09-16 21:02       ` Alexei Starovoitov
2026-09-16 21:24         ` Vineet Gupta
2026-09-17  0:36           ` Alexei Starovoitov
2026-09-10 16:46 ` [PATCH bpf-next v2 02/13] bpf: compare linked-scalar kinds in regs_exact() Vineet Gupta
2026-09-12 18:51   ` Alexei Starovoitov
2026-09-15  1:11     ` Vineet Gupta
2026-09-10 16:46 ` [PATCH bpf-next v2 03/13] bpf: track low-32 scalar equality across zero-extending movs Vineet Gupta
2026-09-10 17:52   ` bot+bpf-ci
2026-09-11  9:29     ` Vineet Gupta
2026-09-12 18:59   ` Alexei Starovoitov
2026-09-15 20:31     ` Vineet Gupta
2026-09-16  4:23       ` Alexei Starovoitov
2026-09-17  0:08         ` Vineet Gupta
2026-09-17  0:30           ` Alexei Starovoitov
2026-09-10 16:46 ` [PATCH bpf-next v2 04/13] selftests/bpf: cover the low-32 link for " Vineet Gupta
2026-09-10 16:46 ` [PATCH bpf-next v2 05/13] bpf: keep the range across a sign extension that cannot change it Vineet Gupta
2026-09-10 17:52   ` bot+bpf-ci
2026-09-11 10:37     ` Vineet Gupta
2026-09-12 19:02   ` Alexei Starovoitov
2026-09-15 21:18     ` Vineet Gupta
2026-09-10 16:46 ` [PATCH bpf-next v2 06/13] selftests/bpf: cover sign extensions that cannot change the range Vineet Gupta
2026-09-10 16:46 ` [PATCH bpf-next v2 07/13] bpf: track low-32 scalar equality across sign-extending movs Vineet Gupta
2026-09-10 17:52   ` bot+bpf-ci
2026-09-11 10:00     ` Vineet Gupta
2026-09-12 19:09   ` Alexei Starovoitov
2026-09-15 20:39     ` Vineet Gupta
2026-09-10 16:46 ` [PATCH bpf-next v2 08/13] selftests/bpf: cover the low-32 link for " Vineet Gupta
2026-09-10 17:52   ` bot+bpf-ci
2026-09-11  8:00     ` Vineet Gupta
2026-09-10 16:46 ` [PATCH bpf-next v2 09/13] bpf: track low-32 scalar equality across narrowing stack fills Vineet Gupta
2026-09-10 16:46 ` [PATCH bpf-next v2 10/13] selftests/bpf: cover the low-32 link for " Vineet Gupta
2026-09-10 17:31   ` bot+bpf-ci
2026-09-11  5:07     ` Vineet Gupta
2026-09-10 16:46 ` [PATCH bpf-next v2 11/13] bpf: record what a narrowing spill actually stores Vineet Gupta
2026-09-10 16:46 ` [PATCH bpf-next v2 12/13] bpf: track low-32 scalar equality across narrowing stack spills Vineet Gupta
2026-09-10 16:46 ` [PATCH bpf-next v2 13/13] selftests/bpf: cover the low-32 link for " Vineet Gupta

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=DLH1N1KP02XT.1KJ79QEMQORI2@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=mason@kernel.org \
    --cc=memxor@gmail.com \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=vineet.gupta@linux.dev \
    --cc=yonghong.song@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

all inboxes | Powered by JetHome®