public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau	 <martin.lau@linux.dev>,
	Kernel Team <kernel-team@fb.com>,
	Yonghong Song	 <yonghong.song@linux.dev>,
	Shung-Hsi Yu <shung-hsi.yu@suse.com>,
	Paul Chaignon	 <paul.chaignon@gmail.com>,
	Harishankar Vishwanathan	 <harishankar.vishwanathan@gmail.com>
Subject: Re: [PATCH bpf-next v3 0/4] bpf: replace min/max fields with struct cnum{32,64}
Date: Sat, 25 Apr 2026 10:21:49 -0700	[thread overview]
Message-ID: <fd376f47b9512daf669a87b23573f614ec146385.camel@gmail.com> (raw)
In-Reply-To: <CAADnVQJa0x3ph51Eb_0UbO51B5OYfdfLoNdhMNt5nTD3LfpQ1Q@mail.gmail.com>

On Sat, 2026-04-25 at 08:20 -0700, Alexei Starovoitov wrote:
> On Sat, Apr 25, 2026 at 4:48 AM Eduard Zingerman <eddyz87@gmail.com> wrote:
> > 
> > On Sat, 2026-04-25 at 03:05 -0700, Eduard Zingerman wrote:
> > > On Fri, 2026-04-24 at 15:52 -0700, Eduard Zingerman wrote:
> > > > This RFC replaces s64, u64, s32, u32 scalar range domains tracked by
> > > > verifier by a pair of circular numbers (cnums): one for 64-bit domain
> > > > and another for 32-bit domain. Each cnum represents a range as a
> > > > single arc on the circular number line, from which signed and unsigned
> > > > bounds are derived on demand. See also wrapped intervals
> > > > representation as in [1].
> > > > 
> > > > The use of such representation simplifies arithmetic and conditions
> > > > handling in verifier.c and allows to express 32 <-> 64 bit deductions
> > > > in a more mathematically rigorous way.
> > > > 
> > > > [1] https://jorgenavas.github.io/papers/ACM-TOPLAS-wrapped.pdf
> > > 
> > > Uh-oh. range_within() needs an update.
> > > 
> > > [...]
> > 
> > The fix is as in the attachment, the tests are still passing, but the
> > stats had changed a bit. I'll send the fix formally later on Saturday.
> 
> +        if (FN(is_empty)(outer) || FN(is_empty(inner)))
> +               return false;
> 
> too aggressive.
> empty inner should return true, no?
> If both are empty, is also 'return true' ?

Actually, yes. The correct operation name should be 'is_subset',
hence on empty 'inner' it should return true regardless of 'outer'.

This wouldn't make any difference for states comparison (at-least at
the moment), because of the simulate_both_branches_taken() logic that
considers branches with empty registers dead. But still, having
properties properly defined after mathematical operations will save
some debugging time in the future.

      reply	other threads:[~2026-04-25 17:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-24 22:52 [PATCH bpf-next v3 0/4] bpf: replace min/max fields with struct cnum{32,64} Eduard Zingerman
2026-04-24 22:52 ` [PATCH bpf-next v3 1/4] bpf: representation and basic operations on circular numbers Eduard Zingerman
2026-04-24 23:15   ` sashiko-bot
2026-04-24 22:52 ` [PATCH bpf-next v3 2/4] bpf: use accessor functions for bpf_reg_state min/max fields Eduard Zingerman
2026-04-26  3:36   ` Kaitao Cheng
2026-04-24 22:52 ` [PATCH bpf-next v3 3/4] bpf: replace min/max fields with struct cnum{32,64} Eduard Zingerman
2026-04-24 22:52 ` [PATCH bpf-next v3 4/4] selftests/bpf: new cases handled by 32->64 range refinements Eduard Zingerman
2026-04-25  1:20 ` [PATCH bpf-next v3 0/4] bpf: replace min/max fields with struct cnum{32,64} patchwork-bot+netdevbpf
2026-04-25 10:05 ` Eduard Zingerman
2026-04-25 11:48   ` Eduard Zingerman
2026-04-25 15:20     ` Alexei Starovoitov
2026-04-25 17:21       ` Eduard Zingerman [this message]

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=fd376f47b9512daf669a87b23573f614ec146385.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=harishankar.vishwanathan@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=martin.lau@linux.dev \
    --cc=paul.chaignon@gmail.com \
    --cc=shung-hsi.yu@suse.com \
    --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