From: Eduard Zingerman <eddyz87@gmail.com>
To: Shung-Hsi Yu <shung-hsi.yu@suse.com>,
Yiyang Chen <chenyy23@mails.tsinghua.edu.cn>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
John Fastabend <john.fastabend@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
bpf@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 1/3] bpf: Preserve pointer state for commuted arithmetic
Date: Thu, 23 Jul 2026 10:57:56 -0700 [thread overview]
Message-ID: <22df73ce6c09065672d3a9406ae59c2cb264f96c.camel@gmail.com> (raw)
In-Reply-To: <c5c2dba26e217763c73c237daa6d8639043f5207.camel@gmail.com>
On Thu, 2026-07-23 at 10:35 -0700, Eduard Zingerman wrote:
> On Thu, 2026-07-23 at 12:25 +0800, Shung-Hsi Yu wrote:
>
> ...
>
> > The sole purpose of having orig_off_reg seem to be for satisfying the
> > 'off_reg == dst_reg' conditional in sanitize_err(). If that's the case,
> > maybe it is better to change sanitize_err to accept an ptr_is_dst_reg
> > argument too.
> >
> > And given now that we are starting to make more use of scratch register
> > states, it seems better to get rid the likes of 'off_reg == dst_reg' all
> > together, and simply have ptr_is_dst_reg passed down by
> > adjust_scalar_min_max_vals().
> >
> >
> > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> > index 52be0a118cce..72d49f2a57a3 100644
> > --- a/kernel/bpf/verifier.c
> > +++ b/kernel/bpf/verifier.c
> > @@ -13505,13 +13505,13 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env,
> > const struct bpf_reg_state *off_reg,
> > struct bpf_reg_state *dst_reg,
> > struct bpf_sanitize_info *info,
> > - const bool commit_window)
> > + const bool commit_window,
> > + const bool ptr_is_dst_reg)
>
> That's a bit invasive. I think the simplest thing to do is to drop
> off_reg and dst_reg parameters from sanitize_err() and re-derive the
> information about which one is a pointer.
Scratch that, dst type is gone when sanitize_err() called.
next prev parent reply other threads:[~2026-07-23 17:58 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 5:27 [PATCH bpf-next v3 0/3] bpf: Preserve pointer state for commuted arithmetic Yiyang Chen
2026-07-22 5:27 ` [PATCH bpf-next v3 1/3] " Yiyang Chen
2026-07-23 3:45 ` Shung-Hsi Yu
2026-07-23 4:25 ` Shung-Hsi Yu
2026-07-23 17:35 ` Eduard Zingerman
2026-07-23 17:57 ` Eduard Zingerman [this message]
2026-07-23 21:07 ` Eduard Zingerman
2026-07-24 3:05 ` Shung-Hsi Yu
2026-07-24 5:07 ` Eduard Zingerman
2026-07-22 5:27 ` [PATCH bpf-next v3 2/3] bpf: Propagate untrusted pointer state in " Yiyang Chen
2026-07-22 5:27 ` [PATCH bpf-next v3 3/3] selftests/bpf: Cover commuted pointer state propagation Yiyang Chen
2026-07-22 5:34 ` sashiko-bot
2026-07-23 21:18 ` Eduard Zingerman
2026-07-22 11:38 ` [PATCH bpf-next v3 0/3] bpf: Preserve pointer state for commuted arithmetic Daniel Wade
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=22df73ce6c09065672d3a9406ae59c2cb264f96c.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chenyy23@mails.tsinghua.edu.cn \
--cc=daniel@iogearbox.net \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=shuah@kernel.org \
--cc=shung-hsi.yu@suse.com \
--cc=song@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