All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.12.y 0/6] cBPF JIT spray hardening
@ 2026-07-15 21:27 ` Pawan Gupta
  0 siblings, 0 replies; 18+ messages in thread
From: Pawan Gupta @ 2026-07-15 21:27 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman, Sasha Levin
  Cc: bpf, linux-arm-kernel, loongarch, linuxppc-dev, linux-riscv, x86,
	Alexei Starovoitov, Daniel Borkmann, Dave Hansen

Hi,

These backports harden BPF JIT against spectre-v2 class of attacks. Without
a predictor flush, execution of new BPF program may use stale prediction
left behind by the freed one.

To avoid this, issue an IBPB flush on all CPUs on JIT program allocation.
The flush is conditional to spectre-v2 mitigation applied.

Patch 1-2: Adds the predictor flush hook and enables it on x86 via IBPB.

	  bpf: Support for hardening against JIT spraying
	  x86/bugs: Enable IBPB flush on BPF JIT allocation

Patch 3-6: Narrow the flush to only unprivileged JIT allocations
	   to avoid redundant flushes. Also adds pack-selection changes
	   that minimizes flushes.

	  bpf: Restrict JIT predictor flush to cBPF
	  bpf: Skip redundant IBPB in pack allocator
	  bpf: Prefer packs that won't trigger an IBPB flush on allocation
	  bpf: Prefer dirty packs for eBPF allocations

Conflicts resolved in patch 2 and 3.

---
Pawan Gupta (6):
      bpf: Support for hardening against JIT spraying
      x86/bugs: Enable IBPB flush on BPF JIT allocation
      bpf: Restrict JIT predictor flush to cBPF
      bpf: Skip redundant IBPB in pack allocator
      bpf: Prefer packs that won't trigger an IBPB flush on allocation
      bpf: Prefer dirty packs for eBPF allocations

 arch/arm64/net/bpf_jit_comp.c        |  4 +--
 arch/powerpc/net/bpf_jit_comp.c      |  2 +-
 arch/riscv/net/bpf_jit_comp64.c      |  2 +-
 arch/riscv/net/bpf_jit_core.c        |  3 +-
 arch/x86/include/asm/nospec-branch.h |  4 +++
 arch/x86/kernel/cpu/bugs.c           | 50 +++++++++++++++++++++++---
 arch/x86/net/bpf_jit_comp.c          |  5 +--
 include/linux/filter.h               | 15 ++++++--
 kernel/bpf/core.c                    | 68 ++++++++++++++++++++++++++++++++----
 kernel/bpf/dispatcher.c              |  2 +-
 10 files changed, 134 insertions(+), 21 deletions(-)
---
base-commit: 296aabce459470a4c1b68ffd0c0c0920e563aaad
change-id: 20260714-cbpf-jit-spray-hardening-6-12-y-6951c851a798

Best regards,
--  
Pawan


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

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

end of thread, other threads:[~2026-07-15 21:56 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 21:27 [PATCH 6.12.y 0/6] cBPF JIT spray hardening Pawan Gupta
2026-07-15 21:27 ` Pawan Gupta
2026-07-15 21:27 ` [PATCH 6.12.y 1/6] bpf: Support for hardening against JIT spraying Pawan Gupta
2026-07-15 21:27   ` Pawan Gupta
2026-07-15 21:46   ` sashiko-bot
2026-07-15 21:28 ` [PATCH 6.12.y 2/6] x86/bugs: Enable IBPB flush on BPF JIT allocation Pawan Gupta
2026-07-15 21:28   ` Pawan Gupta
2026-07-15 21:44   ` sashiko-bot
2026-07-15 21:28 ` [PATCH 6.12.y 3/6] bpf: Restrict JIT predictor flush to cBPF Pawan Gupta
2026-07-15 21:28   ` Pawan Gupta
2026-07-15 21:56   ` sashiko-bot
2026-07-15 21:28 ` [PATCH 6.12.y 4/6] bpf: Skip redundant IBPB in pack allocator Pawan Gupta
2026-07-15 21:28   ` Pawan Gupta
2026-07-15 21:28 ` [PATCH 6.12.y 5/6] bpf: Prefer packs that won't trigger an IBPB flush on allocation Pawan Gupta
2026-07-15 21:28   ` Pawan Gupta
2026-07-15 21:29 ` [PATCH 6.12.y 6/6] bpf: Prefer dirty packs for eBPF allocations Pawan Gupta
2026-07-15 21:29   ` Pawan Gupta
2026-07-15 21:44   ` sashiko-bot

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.