public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Eduard Zingerman <eddyz87@gmail.com>
To: Harishankar Vishwanathan <harishankar.vishwanathan@gmail.com>
Cc: Helen Koike <koike@igalia.com>,
	paul.chaignon@gmail.com,  shung-hsi.yu@suse.com,
	andrii@kernel.org, yonghong.song@linux.dev, ast@kernel.org,
		bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-dev@igalia.com
Subject: Re: [PATCH 1/2] bpf: deduce_bounds_64_from_32 tightening with circular range logic
Date: Wed, 15 Apr 2026 11:12:23 -0700	[thread overview]
Message-ID: <e055c5e1112e42c03c929282b95d5ec2b31295e4.camel@gmail.com> (raw)
In-Reply-To: <CAM=Ch07+xVRHvRJBqQukCrU-br=HHyFWbdjbP+vOB6XKaOOYag@mail.gmail.com>

On Wed, 2026-04-15 at 12:19 -0400, Harishankar Vishwanathan wrote:
> On Wed, Apr 15, 2026 at 3:12 AM Eduard Zingerman <eddyz87@gmail.com> wrote:
> > 
> > On Fri, 2026-04-10 at 09:40 -0300, Helen Koike wrote:
> > > Unify handling of signed and unsigned using circular range logic.
> [...]
> 
> > Hi Helen, Harishankar, Shung-Hsi, Paul,
> > 
> > I think this algorithm is correct and covers all cases discussed earlier.
> > I also prepared simple correctness check using cbmc in [1].
> > It shows that for any valid input register state deduce_bounds_64_from_32
> > does not loose any values (check_soundness() function in [1], which validates).
> > It also shows that there exist invalid input register state,
> > such that deduce_bounds_64_from_32() "fixes" it to be valid
> > (check_invalid_preserved() function in [1], which produces a counter-example).
> 
> IIUC, this patch enhances the new deduce_bounds_64_from_32, while
> also having the property that it "maintains invalid input register states".

It enhances deduce_bounds_64_from_32, but it does *not* maintain the
invalid stays invalid property. It can be adjusted to provide a signal
when 64-bit and 32-bit ranges do not intersect.
In any case, I see that you handle this situation already in [1].
Therefore, I think we can proceed with this patch as-is.

[1] https://lore.kernel.org/bpf/20260415160728.657270-1-harishankar.vishwanathan@gmail.com/T/#t

> 
> > Now, the question is whether we want check_invalid_preserved() to hold.
> > Harishankar is working on an extension to simulate_both_branches_taken()
> > checking for additional cases of invariant violation.
> > Disagreement between 64-bit and 32-bit ranges is one of such violations.
> > The logic in deduce_bounds_64_from_32() can be extracted as "intersect"
> > function producing a signal describing if intersection actually exist.
> > So, the question is for Harishankar, would you like to have such
> > "intersect" function?
> 
> I  think using the new reg_bounds_intersect() "intersection checks"
> introduced in [1] to exit early in sync is still useful because
> the other sub-sync function might still "fix" the bounds
> 
> [1] https://lore.kernel.org/bpf/20260415160728.657270-2-harishankar.vishwanathan@gmail.com/T/#u
> 
> > [...]

  reply	other threads:[~2026-04-15 18:12 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 12:40 [PATCH 1/2] bpf: deduce_bounds_64_from_32 tightening with circular range logic Helen Koike
2026-04-10 12:40 ` [PATCH 2/2] selftests/bpf: new cases handled by 32->64 range refinements Helen Koike
2026-04-14  8:26 ` [PATCH 1/2] bpf: deduce_bounds_64_from_32 tightening with circular range logic Shung-Hsi Yu
2026-04-14 16:25   ` Helen Koike
2026-04-14 18:32     ` Eduard Zingerman
2026-04-15  7:12 ` Eduard Zingerman
2026-04-15 16:19   ` Harishankar Vishwanathan
2026-04-15 18:12     ` Eduard Zingerman [this message]
2026-04-16  3:52   ` Shung-Hsi Yu
2026-04-16  7:43     ` Eduard Zingerman
2026-04-16 13:45       ` Paul Chaignon
2026-04-15 18:12 ` Eduard Zingerman

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=e055c5e1112e42c03c929282b95d5ec2b31295e4.camel@gmail.com \
    --to=eddyz87@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=harishankar.vishwanathan@gmail.com \
    --cc=kernel-dev@igalia.com \
    --cc=koike@igalia.com \
    --cc=linux-kernel@vger.kernel.org \
    --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