From: Luis Gerhorst <luis.gerhorst@fau.de>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Luis Gerhorst <luis.gerhorst@fau.de>,
bpf@vger.kernel.org, daniel@iogearbox.net, andrii@kernel.org,
eddyz87@gmail.com, memxor@gmail.com
Subject: Re: [PATCH bpf 4/5] bpf: Emit nospec after BPF_ATOMIC stores to the stack
Date: Wed, 25 Nov 2026 18:12:47 +0100 [thread overview]
Message-ID: <20261125-nospec-result-reply-d60fdc6da8ef@fau.de> (raw)
In-Reply-To: <20261125040820.947816-5-alexei.starovoitov@gmail.com>
Alexei Starovoitov <alexei.starovoitov@gmail.com> writes:
> check_stack_write_fixed_off() sets nospec_result for BPF_ATOMIC insns
> too, but bpf_convert_ctx_accesses() emits the nospec only after BPF_MEM
> stores.
>
> Emit it after BPF_ATOMIC insns as well.
[...]
> + } else if (BPF_CLASS(insn->code) == BPF_STX &&
> + BPF_MODE(insn->code) == BPF_ATOMIC &&
> + env->insn_aux_data[i + delta].nospec_result) {
> + type = BPF_WRITE;
Would it not be possible to avoid the atomic/call-specific handling of
nospec_result? We can patch in the nospec after the call (next
patch) and avoid the speculative path analysis there. Then the design
would treat all instructions that do safety-critical stores the same.
In response to this you find a series that implements this idea. Main
downside is that this requires a new instruction buffer in the
environment, not sure if this is desired.
next prev parent reply other threads:[~2026-11-25 17:13 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 4:08 [PATCH bpf 0/5] bpf: Fixes for speculation barriers and constant reads Alexei Starovoitov
2026-11-25 4:08 ` [PATCH bpf 1/5] bpf: Undo insn aux changes of a failed speculative path Alexei Starovoitov
2026-11-25 4:08 ` [PATCH bpf 2/5] bpf: Treat NOT_INIT as a pointer in __is_pointer_value() Alexei Starovoitov
2026-11-25 4:08 ` [PATCH bpf 3/5] bpf: Use get_unaligned() in bpf_map_direct_read() Alexei Starovoitov
2026-11-25 4:08 ` [PATCH bpf 4/5] bpf: Emit nospec after BPF_ATOMIC stores to the stack Alexei Starovoitov
2026-11-25 17:12 ` Luis Gerhorst [this message]
2026-11-25 17:12 ` [PATCH bpf 0/4] bpf: Emit nospec after every insn that " Luis Gerhorst
2026-11-25 17:12 ` [PATCH bpf 1/4] bpf: Add bpf_insert_insns() to insert insns next to an insn Luis Gerhorst
2026-11-25 17:51 ` sashiko-bot
2026-11-25 18:17 ` bot+bpf-ci
2026-11-25 17:12 ` [PATCH bpf 2/4] selftests/bpf: Test the insns that bpf_insert_insns() inserts Luis Gerhorst
2026-11-25 17:39 ` sashiko-bot
2026-11-25 17:12 ` [PATCH bpf 3/4] bpf: Emit nospec after every insn with nospec_result Luis Gerhorst
2026-11-25 18:17 ` bot+bpf-ci
2026-11-25 17:12 ` [PATCH bpf 4/4] selftests/bpf: Test nospec after stack writes of calls and atomics Luis Gerhorst
2026-11-25 17:45 ` sashiko-bot
2026-11-26 3:40 ` [PATCH bpf 4/5] bpf: Emit nospec after BPF_ATOMIC stores to the stack Alexei Starovoitov
2026-11-25 4:08 ` [PATCH bpf 5/5] bpf: Do not end a speculative path at a call Alexei Starovoitov
2026-11-25 5:00 ` 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=20261125-nospec-result-reply-d60fdc6da8ef@fau.de \
--to=luis.gerhorst@fau.de \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=memxor@gmail.com \
/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