From: sashiko-bot@kernel.org
To: "Nuoqi Gui" <gnq25@mails.tsinghua.edu.cn>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf v2 2/2] selftests/bpf: Cover stack nospec slot indexing
Date: Wed, 17 Jun 2026 20:12:48 +0000 [thread overview]
Message-ID: <20260617201248.7B33E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260618-f01-11-stack-nospec-slot-index-v2-2-ede9495359b6@mails.tsinghua.edu.cn>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The `__xlated_unpriv` expectation strings contain an extra space in the frame pointer offsets (`r10 - 4` and `r10 - 8`), which will cause the strict substring match against the verifier disassembly to fail.
--
commit 14e5b2945bb48da1c1729feb483806b25ccac3aa
Author: Nuoqi Gui <gnq25@mails.tsinghua.edu.cn>
selftests/bpf: Cover stack nospec slot indexing
This commit adds a verifier test for fixed-offset stack writes where two
4-byte stores initialize opposite halves of the same stack slot. The test
runs through the unprivileged loader and expects both writes to emit
nospec instructions.
> diff --git a/tools/testing/selftests/bpf/progs/verifier_unpriv.c b/tools/testing/selftests/bpf/progs/verifier_unpriv.c
> index c16f8382cf17d..d54e5b59e62e5 100644
> --- a/tools/testing/selftests/bpf/progs/verifier_unpriv.c
> +++ b/tools/testing/selftests/bpf/progs/verifier_unpriv.c
[ ... ]
> @@ -976,4 +976,26 @@ l0_%=: exit; \
> : __clobber_all);
> }
>
> +SEC("socket")
> +__description("unpriv: Spectre v4 stack write slot index")
> +__success __success_unpriv
> +__retval(0)
> +#ifdef SPEC_V4
> +__xlated_unpriv("r0 = 0")
> +__xlated_unpriv("*(u32 *)(r10 - 4) = r0")
[Severity: Medium]
Will this test fail due to the extra space in the offset? The BPF
disassembler typically formats negative offsets without a space after the
minus sign, like *(u32 *)(r10 -4) = r0. Since the selftest framework uses
exact substring matching for the __xlated_unpriv assertions, expecting
(r10 - 4) and (r10 - 8) might cause a spurious test failure.
> +__xlated_unpriv("nospec")
> +__xlated_unpriv("*(u32 *)(r10 - 8) = r0")
> +__xlated_unpriv("nospec")
> +__xlated_unpriv("exit")
> +#endif
> +__naked void stack_write_nospec_slot_index(void)
> +{
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260618-f01-11-stack-nospec-slot-index-v2-0-ede9495359b6@mails.tsinghua.edu.cn?part=2
prev parent reply other threads:[~2026-06-17 20:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-17 16:45 [PATCH bpf v2 0/2] bpf: Fix stack slot index for Spectre v4 nospec checks Nuoqi Gui
2026-06-17 16:45 ` [PATCH bpf v2 1/2] bpf: Fix stack slot index in " Nuoqi Gui
2026-06-17 16:45 ` [PATCH bpf v2 2/2] selftests/bpf: Cover stack nospec slot indexing Nuoqi Gui
2026-06-17 17:24 ` bot+bpf-ci
2026-06-17 20:12 ` 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=20260617201248.7B33E1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=gnq25@mails.tsinghua.edu.cn \
--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.