All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shung-Hsi Yu <shung-hsi.yu@suse.com>
To: Eduard Zingerman <eddyz87@gmail.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: Fri, 24 Jul 2026 11:05:18 +0800	[thread overview]
Message-ID: <amLScROuY5oleavT@u94a> (raw)
In-Reply-To: <04c2eab092885ed738fc87f2db344bca1319a90b.camel@gmail.com>

On Thu, Jul 23, 2026 at 02:07:20PM -0700, Eduard Zingerman wrote:
> On Wed, 2026-07-22 at 05:27 +0000, Yiyang Chen wrote:
> > When scalar += pointer is handled in adjust_ptr_min_max_vals(), the
> > destination register inherits the pointer state from the source pointer.
> > Copying only selected fields is fragile because pointer provenance is
> > tracked by several bpf_reg_state fields.
> > 
> > Use verifier-env scratch storage to preserve the scalar operand while
> > replacing the destination with the full pointer state. This preserves the
> > frame number for PTR_TO_STACK registers and keeps parent identity fields
> > consistent.
> > 
> > Fixes: f1174f77b50c ("bpf/verifier: rework value tracking")
> > Signed-off-by: Yiyang Chen <chenyy23@mails.tsinghua.edu.cn>
> > ---
> >
> >  kernel/bpf/verifier.c | 21 ++++++++++++++-------
> >  1 file changed, 14 insertions(+), 7 deletions(-)
> > 
> > diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> > index 52be0a118cce0..085cbd5222737 100644
> > --- a/kernel/bpf/verifier.c
> > +++ b/kernel/bpf/verifier.c
> > @@ -13726,11 +13726,14 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
> 
> Yiyang,
> 
> I noticed there there is a temporary 'off' reg allocated on stack by
> the caller of this function. So, let's reuse it, ...

'off_reg' perhaps?

+1

> and also adjust the
> sanitize_err signature to minimize changes.
>
> Could you please re-spin using the attached patches?
> 
> Shung-Hsi, wdyt?

Refactoring LGTM. Feels like the alias check 'dst_reg != ptr_reg' would
still bite us later, but perhaps that something for another time.

...

  reply	other threads:[~2026-07-24  3:05 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
2026-07-23 21:07   ` Eduard Zingerman
2026-07-24  3:05     ` Shung-Hsi Yu [this message]
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=amLScROuY5oleavT@u94a \
    --to=shung-hsi.yu@suse.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=eddyz87@gmail.com \
    --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=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 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.