From: Eduard Zingerman <eddyz87@gmail.com>
To: Puranjay Mohan <puranjay@kernel.org>, bpf@vger.kernel.org
Cc: Puranjay Mohan <puranjay12@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@kernel.org>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>,
kernel-team@meta.com
Subject: Re: [PATCH bpf-next v4 1/2] bpf: Support negative offsets, BPF_SUB, and alu32 for linked register tracking
Date: Wed, 04 Feb 2026 12:44:42 -0800 [thread overview]
Message-ID: <9252b79ef036a3147803e4878eb3c7144c4327c5.camel@gmail.com> (raw)
In-Reply-To: <20260204151741.2678118-2-puranjay@kernel.org>
On Wed, 2026-02-04 at 07:17 -0800, Puranjay Mohan wrote:
> Previously, the verifier only tracked positive constant deltas between
> linked registers using BPF_ADD. This limitation meant patterns like:
>
> r1 = r0;
> r1 += -4;
> if r1 s>= 0 goto l0_%=; // r1 >= 0 implies r0 >= 4
> // verifier couldn't propagate bounds back to r0
> if r0 != 0 goto l0_%=;
> r0 /= 0; // Verifier thinks this is reachable
> l0_%=:
>
> Similar limitation exists for 32-bit registers.
>
> With this change, the verifier can now track negative deltas in reg->off
> enabling bound propagation for the above pattern.
>
> For alu32, we make sure the destination register has the upper 32 bits
> as 0s before creating the link. BPF_ADD_CONST is split into
> BPF_ADD_CONST64 and BPF_ADD_CONST32, the latter is used in case of alu32
> and sync_linked_regs uses this to zext the result if known_reg has this
> flag.
>
> Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
> ---
Acked-by: Eduard Zingerman <eddyz87@gmail.com>
next prev parent reply other threads:[~2026-02-04 20:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-04 15:17 [PATCH bpf-next v4 0/2] bpf: Improve linked register tracking Puranjay Mohan
2026-02-04 15:17 ` [PATCH bpf-next v4 1/2] bpf: Support negative offsets, BPF_SUB, and alu32 for " Puranjay Mohan
2026-02-04 20:44 ` Eduard Zingerman [this message]
2026-02-04 15:17 ` [PATCH bpf-next v4 2/2] selftests/bpf: Add tests for improved " Puranjay Mohan
2026-02-04 21:12 ` Eduard Zingerman
2026-02-04 21:53 ` [PATCH bpf-next v4 0/2] bpf: Improve " Alexei Starovoitov
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=9252b79ef036a3147803e4878eb3c7144c4327c5.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
--cc=martin.lau@kernel.org \
--cc=memxor@gmail.com \
--cc=mykyta.yatsenko5@gmail.com \
--cc=puranjay12@gmail.com \
--cc=puranjay@kernel.org \
/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