From: sashiko-bot@kernel.org
To: "Zhenzhong Wu" <jt26wzz@gmail.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH stable 6.6.y v2 1/3] bpf: drop knowledge-losing __reg_combine_{32,64}_into_{64,32} logic
Date: Sun, 07 Jun 2026 17:22:28 +0000 [thread overview]
Message-ID: <20260607172228.E5C0E1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260607170959.823755-2-jt26wzz@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Loss of bounds precision causing false-positive rejections of valid BPF programs due to an incomplete backport.
--
commit 759dc64a1dfbfd0437d50a8eab924162772ab60c
Author: Andrii Nakryiko <andrii@kernel.org>
bpf: drop knowledge-losing __reg_combine_{32,64}_into_{64,32} logic
This commit replaces __reg_combine_32_into_64() and __reg_combine_64_into_32()
with reg_bounds_sync() in the BPF verifier. It aims to prevent information loss
during register boundary synchronization after conditional jumps.
Link: https://lore.kernel.org/r/20231102033759.2541186-10-andrii@kernel.org
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 0d90236d0ad94..5f94bff12aa08 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
[ ... ]
> @@ -14329,13 +14285,13 @@ static void reg_set_min_max(struct bpf_reg_state *true_reg,
> tnum_subreg(false_32off));
> true_reg->var_off = tnum_or(tnum_clear_subreg(true_64off),
> tnum_subreg(true_32off));
> - __reg_combine_32_into_64(false_reg);
> - __reg_combine_32_into_64(true_reg);
> + reg_bounds_sync(false_reg);
> + reg_bounds_sync(true_reg);
> } else {
> false_reg->var_off = false_64off;
> true_reg->var_off = true_64off;
> - __reg_combine_64_into_32(false_reg);
> - __reg_combine_64_into_32(true_reg);
> + reg_bounds_sync(false_reg);
> + reg_bounds_sync(true_reg);
> }
> }
[Severity: High]
Does this backport drop bounds precision by relying on an older version of
reg_bounds_sync()?
Upstream, this change seems safe because reg_bounds_sync() was rewritten to
perform exact algebraic bounds derivation as part of a larger patch series.
However, in this 6.6.y backport, that bounds derivation engine appears to be
missing.
Without the updated bounds derivation, reg_bounds_sync() still uses the older,
lossy logic that synchronizes 32-bit and 64-bit bounds by intersecting tnum
bitwise masks. For example, a tightly bounded 64-bit range of [6, 10]
translates to a tnum bitmask of 0xF (15). When reg_bounds_sync() derives the
32-bit bound from this tnum, the bound expands to [0, 15]. Before this patch,
__reg_combine_64_into_32() would precisely copy [6, 10].
Could this loss of precision expand the tracked bounds after conditional jumps
and register coercion, causing the verifier to falsely reject valid BPF
programs that rely on tight bounds for safety?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260607170959.823755-1-jt26wzz@gmail.com?part=1
next prev parent reply other threads:[~2026-06-07 17:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 17:09 [PATCH stable 6.6.y v2 0/3] bpf: backport scalar not-equal tracking fixes Zhenzhong Wu
2026-06-07 17:09 ` [PATCH stable 6.6.y v2 1/3] bpf: drop knowledge-losing __reg_combine_{32,64}_into_{64,32} logic Zhenzhong Wu
2026-06-07 17:22 ` sashiko-bot [this message]
2026-06-07 17:09 ` [PATCH stable 6.6.y v2 2/3] bpf: make the verifier tracks the "not equal" for regs Zhenzhong Wu
2026-06-07 17:09 ` [PATCH stable 6.6.y v2 3/3] selftests/bpf: add helper retval linked scalar pruning test Zhenzhong Wu
2026-06-08 10:11 ` [PATCH stable 6.6.y v2 0/3] bpf: backport scalar not-equal tracking fixes Shung-Hsi Yu
2026-06-10 15:46 ` Zhenzhong Wu
2026-06-11 6:47 ` Shung-Hsi Yu
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=20260607172228.E5C0E1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=jt26wzz@gmail.com \
--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 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.