BPF List
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Jiayuan Chen" <jiayuan.chen@linux.dev>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf 1/2] bpf: fix REG INVARIANTS VIOLATION on speculative pointer arithmetic
Date: Wed, 19 Aug 2026 13:06:17 +0000	[thread overview]
Message-ID: <20260819130617.C0E691F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260819125840.286434-1-jiayuan.chen@linux.dev>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The multi-line comment introduced in the patch does not follow the preferred BPF subsystem comment style.
--

--- Patch [1]: [PATCH bpf 1/2] bpf: fix REG INVARIANTS VIOLATION on speculative pointer arithmetic ---
commit d06a2ef5d24e558f7ddc1472c5b3c370252aa5c5
Author: Jiayuan Chen <jiayuan.chen@linux.dev>
bpf: fix REG INVARIANTS VIOLATION on speculative pointer arithmetic

This patch defers the clearing of r32 for pointer registers until after
sanitize_ptr_alu() has potentially snapshotted the register state. This
prevents an inconsistent state where the speculative path receives a snapshot
with an unbounded r32 but a constant var_off, resolving a verifier warning.

Link: https://lore.kernel.org/bpf/CAGM=xGB1fJ9kT8XTitVo74B0WGqgjkoUHdLwzytwV0AyqeVApw@mail.gmail.com/

> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index e421ea2b80c3a..ff83c8ef57be4 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -14570,6 +14567,14 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, struct bpf_insn
>  			return sanitize_err(env, insn, ret);
>  	}
>  
> +	/* Pointer types do not carry 32-bit bounds at the moment. Blank r32

[Severity: Low]
This isn't a bug, but the multi-line comment here does not follow the
preferred BPF subsystem style. The opening /* should be on its own line.

> +	 * only after sanitize_ptr_alu() may have snapshotted dst_reg into a
> +	 * speculative path: otherwise that snapshot freezes a const offset
> +	 * with an unbounded r32, which later trips reg_bounds_sanity_check().
> +	 * reg_bounds_sync() below re-derives r32 from the updated offset.
> +	 */
> +	__mark_reg32_unbounded(dst_reg);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260819125840.286434-1-jiayuan.chen@linux.dev?part=1

      parent reply	other threads:[~2026-08-19 13:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-19 12:58 [PATCH bpf 1/2] bpf: fix REG INVARIANTS VIOLATION on speculative pointer arithmetic Jiayuan Chen
2026-08-19 12:58 ` [PATCH bpf 2/2] selftests/bpf: Add reg-invariants test for " Jiayuan Chen
2026-08-19 13:49   ` bot+bpf-ci
2026-08-19 13:06 ` sashiko-bot [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=20260819130617.C0E691F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=jiayuan.chen@linux.dev \
    --cc=sashiko-reviews@lists.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