Skip to content

SSB extra 0

Dave Hansen historical-speck 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest5 patches 25 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5SSB extra 2include/linux/bpf.h include/linux/filter.h kernel/bpf/sockmap.c +1 more+31 -20 replies
2/5SSB extra 3include/linux/filter.h net/core/filter.c+69 -00 replies
3/5SSB extra 1include/linux/filter.h include/linux/nospec.h net/core/filter.c+31 -80 replies
4/5SSB extra 5arch/x86/kernel/cpu/bugs.c+33 -170 replies
5/5SSB extra 4arch/x86/Kconfig arch/x86/include/asm/rmspec.h arch/x86/include/asm/spec-ctrl.h +3 more+70 -40 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchKonrad Rzeszutek Wilk
SeriesR-b
1/5
2/5
3/5
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [MODERATED] [PATCH 0/5] SSB extra 0

BPF is a potential source of gadgets that can be used for memory diambiguation-based attacks. To help mitigate these, we enable the bit in SPEC_CTRL which enables the reduced (memory) speculation mode on the processor when runing BPF code.

This is far from optimal: it does not opt-out of the mitigations for BPF programs which are trusted or which are less likely to be exploited, like those which have been offloaded.

It also uses a fixed (and stupid) algoritm for keeping the MSR write traffic to a minimum. Each time a CPU uses BPF, it does the MSR write to enable the mitigation and then schedules some work in 10ms to disable the mitigation. It repeats this every 10ms if the CPU keeps seeing BPF activity. This can obviously be improved on, but it is simple at the moment and _works_.

Dave Hansen (5):
bpf: add enter/exit markers
bpf: track entry to and exit from BFP code
bpf: use reduced speculation mitigations x86, bugs: centralize SPEC_CTRL MSR mask generation
x86: implement reduced speculation when running BPF

 arch/x86/Kconfig                 |  4 ++
 arch/x86/include/asm/rmspec.h    | 24 ++++++++++++
 arch/x86/include/asm/spec-ctrl.h |  3 ++
 arch/x86/kernel/cpu/bugs.c       | 81 ++++++++++++++++++++++++++++++++--------
 include/linux/bpf.h              |  2 +
 include/linux/filter.h           | 34 ++++++++++++++++-
 include/linux/nospec.h           | 11 ++++++
 kernel/bpf/sockmap.c             |  6 +++
 net/core/filter.c                | 65 ++++++++++++++++++++++++++++++++
 net/kcm/kcmsock.c                |  7 +++-
 10 files changed, 220 insertions(+), 17 deletions(-)
 create mode 100644 arch/x86/include/asm/rmspec.h
Signature · 1 line
2.9.5