From: "Nuoqi Gui" <gnq25@mails.tsinghua.edu.cn>
To: bot+bpf-ci@kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
eddyz87@gmail.com, memxor@gmail.com, martin.lau@linux.dev,
song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org,
emil@etsalapatis.com, shuah@kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
martin.lau@kernel.org, clm@meta.com, ihor.solodrai@linux.dev
Subject: Re: Re: [PATCH bpf-next 1/2] bpf: Preserve pointer spill metadata during half-slot cleanup
Date: Mon, 15 Jun 2026 17:17:36 +0800 (GMT+08:00) [thread overview]
Message-ID: <3e477c52.7e0a2.19eca927613.Coremail.gnq25@mails.tsinghua.edu.cn> (raw)
In-Reply-To: <ba187060a5a8232b69cbd080223bd36f806556fc877c07f470b938870b9e4a05@mail.kernel.org>
> -----Original Messages-----
> From: bot+bpf-ci@kernel.org
> Send time:Monday, 15/06/2026 16:48:49
> To: gnq25@mails.tsinghua.edu.cn, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com, martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org, emil@etsalapatis.com, shuah@kernel.org
> Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, gnq25@mails.tsinghua.edu.cn, ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net, martin.lau@kernel.org, eddyz87@gmail.com, yonghong.song@linux.dev, clm@meta.com, ihor.solodrai@linux.dev
> Subject: Re: [PATCH bpf-next 1/2] bpf: Preserve pointer spill metadata during half-slot cleanup
>
> > bpf: Preserve pointer spill metadata during half-slot cleanup
> >
> > __clean_func_state() cleans dead stack slots in 4-byte halves. When the
> > high half of a STACK_SPILL slot is dead and the low half remains live,
> > cleanup converts the live low half to STACK_MISC or STACK_ZERO and clears
> > the saved spilled_ptr metadata.
> >
> > That conversion is safe only for scalar spills. For a pointer spill, this
> > metadata clear lets a later 32-bit fill from the still-live half avoid the
> > normal non-scalar register-fill check and be treated as an ordinary scalar
> > stack read.
> >
> > Leave non-scalar spill slots intact in this half-live shape. This is
> > conservative for pruning and preserves the existing
> > check_stack_read_fixed_off() rejection path for partial fills from pointer
> > spills.
> >
> > Fixes: 2cb27158adb3 ("bpf: poison dead stack slots")
> > Signed-off-by: Nuoqi Gui <gnq25@mails.tsinghua.edu.cn>
>
> Is the Fixes: tag pointing at the right commit?
>
> The commit referenced, 2cb27158adb3 ("bpf: poison dead stack slots"), adds
> STACK_POISON handling in kernel/bpf/verifier.c and does not contain the
> half-slot cleanup logic being corrected here.
>
> The 4-byte half-slot cleanup in __clean_func_state() that downgrades a
> still-live STACK_SPILL low half to STACK_MISC/STACK_ZERO and clears the
> saved spilled_ptr metadata without checking for SCALAR_VALUE was introduced
> by be23266b4a08 ("bpf: 4-byte precise clean_verifier_state"). That commit
> added the lo_live/hi_live model and the exact block this patch corrects:
>
> if (lo_live && stype == STACK_SPILL) {
>
> be23266b4a08 predates both 2cb27158adb3 and this fix. Should the tag be:
>
> Fixes: be23266b4a08 ("bpf: 4-byte precise clean_verifier_state")
>
>
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
>
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/27533304560
Yes, be23266b4a08 is the right Fixes target.
The bug is in the half-slot cleanup logic introduced by that commit:
when the high half is dead and the low half remains live, it can downgrade
the still-live STACK_SPILL bytes to STACK_MISC/STACK_ZERO and clear the
spilled_ptr metadata.
2cb27158adb3 only changed the dead-slot marker to STACK_POISON and did not
introduce that half-slot spill cleanup behavior.
I will update the tag to:
Fixes: be23266b4a08 ("bpf: 4-byte precise clean_verifier_state")
next prev parent reply other threads:[~2026-06-15 9:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 8:09 [PATCH bpf-next 0/2] " Nuoqi Gui
2026-06-15 8:09 ` [PATCH bpf-next 1/2] " Nuoqi Gui
2026-06-15 8:48 ` bot+bpf-ci
2026-06-15 9:17 ` Nuoqi Gui [this message]
2026-06-15 17:19 ` Eduard Zingerman
2026-06-15 8:09 ` [PATCH bpf-next 2/2] selftests/bpf: Cover half-slot cleanup of pointer spills Nuoqi Gui
2026-06-15 17:19 ` Eduard Zingerman
2026-06-17 15:20 ` [PATCH bpf-next v2 0/2] bpf: Preserve pointer spill metadata during half-slot cleanup Nuoqi Gui
2026-06-17 15:20 ` [PATCH bpf-next v2 1/2] " Nuoqi Gui
2026-06-22 21:10 ` patchwork-bot+netdevbpf
2026-06-17 15:20 ` [PATCH bpf-next v2 2/2] selftests/bpf: Cover half-slot cleanup of pointer spills Nuoqi Gui
2026-06-17 16:02 ` bot+bpf-ci
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=3e477c52.7e0a2.19eca927613.Coremail.gnq25@mails.tsinghua.edu.cn \
--to=gnq25@mails.tsinghua.edu.cn \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox