BPF List
 help / color / mirror / Atom feed
From: "Alexei Starovoitov" <alexei.starovoitov@gmail.com>
To: <bot+bpf-ci@kernel.org>, <eddyz87@gmail.com>, <bpf@vger.kernel.org>
Cc: <andrii@kernel.org>, <daniel@iogearbox.net>, <kernel-team@fb.com>,
	<yonghong.song@linux.dev>, <martin.lau@kernel.org>,
	<mason@kernel.org>, <ihor.solodrai@linux.dev>
Subject: Re: [PATCH bpf-next 1/2] bpf: support 32-bit linear scalar evolution
Date: Tue, 20 Oct 2026 21:00:15 +0000	[thread overview]
Message-ID: <DM9YUX1TXEEC.1FCUJ0M8D7HGU@gmail.com> (raw)
In-Reply-To: <77720df26bea4edfd16a92d307115ad152f9ab558df8848fd8e0d7cb31e9f5eb@mail.kernel.org>

On Tue, Oct 20, 2026 at 04:35 AM bot+bpf-ci@kernel.org <bot+bpf-ci@kernel.org> wrote:
>> +	if (!scev_value_compatible(env, st, &initial_val, &bound_val))
>> +		return false;
>
> For a pointer-vs-pointer JMP32 latch (allowed for privileged programs, since
> check_cond_jmp_op() only rejects pointer comparisons when !allow_ptr_leaks),
> can the computed max_header_count end up smaller than the real number of
> iterations?  bpf_widen_scev_regs() and bpf_clamp_scev_regs() then bound the
> induction pointer's range with that count, and the memory access checks
> inside the loop depend on it being a true upper bound.
>
> Would it make sense to return false here when latch->jmp32 is set and either
> initial_val.ptr_reg or bound_val.ptr_reg is >= 0?  zext32 latches cannot
> involve pointers, because ALU32 on pointers is rejected.

Yes. Seems like a real bug.

  r1 = map_value + 0, r2 = map_value + 56
  l: r1 += 8; if w1 <= w2 goto l

max_header_count is 8 and r1 is clamped to 0..56. If the low 32 bits
of r2 are 0xfffffff8 then w1 wraps to 0 and the latch stays true,
so r1 walks past the map value.

pls fix in a followup.

  reply	other threads:[~2026-10-20 21:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20 11:06 [PATCH bpf-next 0/2] bpf: support 32-bit linear scalar evolution Eduard Zingerman
2026-10-20 11:06 ` [PATCH bpf-next 1/2] " Eduard Zingerman
2026-10-20 11:35   ` bot+bpf-ci
2026-10-20 21:00     ` Alexei Starovoitov [this message]
2026-10-20 21:06       ` Eduard Zingerman
2026-10-20 11:38   ` sashiko-bot
2026-10-20 11:06 ` [PATCH bpf-next 2/2] selftests/bpf: tests for 32-bit scalar evolution bounds computation Eduard Zingerman
2026-10-20 11:35   ` bot+bpf-ci
2026-10-20 21:00 ` [PATCH bpf-next 0/2] bpf: support 32-bit linear scalar evolution patchwork-bot+netdevbpf

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=DM9YUX1TXEEC.1FCUJ0M8D7HGU@gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@kernel.org \
    --cc=mason@kernel.org \
    --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