BPF List
 help / color / mirror / Atom feed
* [PATCH bpf v2 0/4] bpf: Fixes for speculation barriers and constant reads
@ 2026-11-26  3:38 Alexei Starovoitov
  2026-11-26  3:38 ` [PATCH bpf v2 1/4] bpf: Undo insn aux changes of a failed speculative path Alexei Starovoitov
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Alexei Starovoitov @ 2026-11-26  3:38 UTC (permalink / raw)
  To: bpf; +Cc: daniel, andrii, eddyz87, memxor, luis.gerhorst

From: Alexei Starovoitov <ast@kernel.org>

These patches fix bugs in the verifier:

  patch  area
  -----  ------------------------------------------------------------------
  1      insn aux data after a failed check on a speculative path
  2      spills of invalid registers
  3      unaligned reads of read-only maps
  4      the barrier after a store to the stack by an atomic or a call

v1 -> v2:
- Replace patches 4 and 5 with one patch that emits the nospec after
  calls too (Luis). Patch 5 rejected bounded loops with such a call.

Patch 4 takes the idea of Luis's series [1] and inserts the nospec in
another way. bpf_patch_insn_data() moves the aux data to the last insn
of a patch, so "call; nospec" takes it from the call. [1] adds
bpf_insert_insns() and a new pass for that. Patch 4 leaves the call as
it is and makes "nospec; insn" of the next insn, with the code that is
there already. The price: a jump to the next insn runs the nospec too.
bpf-next has replaced bpf_patch_insn_data() with the patch list, so the
new helper would go away at the merge.

v1: https://lore.kernel.org/bpf/20261125040820.947816-1-alexei.starovoitov@gmail.com/
[1] https://lore.kernel.org/bpf/cover.1795625597.git.luis.gerhorst@fau.de/

Signed-off-by: Alexei Starovoitov <ast@kernel.org>

Alexei Starovoitov (4):
  bpf: Undo insn aux changes of a failed speculative path
  bpf: Treat NOT_INIT as a pointer in __is_pointer_value()
  bpf: Use get_unaligned() in bpf_map_direct_read()
  bpf: Emit nospec after calls and atomics that write to the stack

 kernel/bpf/fixups.c   | 11 +++++++++--
 kernel/bpf/verifier.c | 16 +++++++++++-----
 2 files changed, 20 insertions(+), 7 deletions(-)


base-commit: 3db9d99ba7b8d5a4a520f5abf785e17406f518a5
-- 
2.55.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-26  7:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-26  3:38 [PATCH bpf v2 0/4] bpf: Fixes for speculation barriers and constant reads Alexei Starovoitov
2026-11-26  3:38 ` [PATCH bpf v2 1/4] bpf: Undo insn aux changes of a failed speculative path Alexei Starovoitov
2026-11-26  3:38 ` [PATCH bpf v2 2/4] bpf: Treat NOT_INIT as a pointer in __is_pointer_value() Alexei Starovoitov
2026-11-26  3:38 ` [PATCH bpf v2 3/4] bpf: Use get_unaligned() in bpf_map_direct_read() Alexei Starovoitov
2026-11-26  3:38 ` [PATCH bpf v2 4/4] bpf: Emit nospec after calls and atomics that write to the stack Alexei Starovoitov
2026-11-26  4:27   ` bot+bpf-ci
2026-11-26  7:59   ` Luis Gerhorst

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox