From: Eduard Zingerman <eddyz87@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>,
bot+bpf-ci@kernel.org, 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 14:06:58 -0700 [thread overview]
Message-ID: <94c04d9a833d73c368ea9d6bdfcbded27556233d.camel@gmail.com> (raw)
In-Reply-To: <DM9YUX1TXEEC.1FCUJ0M8D7HGU@gmail.com>
On Tue, 2026-10-20 at 21:00 +0000, Alexei Starovoitov wrote:
> 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.
Yes, and another complain about clamping and possibly dead states.
I'll send follow up for pointers today. For clamping need to think a bit.
next prev parent reply other threads:[~2026-10-20 21:07 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
2026-10-20 21:06 ` Eduard Zingerman [this message]
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=94c04d9a833d73c368ea9d6bdfcbded27556233d.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--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 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.