linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFCv2 0/4] API for inhibiting speculative arbitrary read primitives
@ 2018-01-05 14:57 Mark Rutland
  2018-01-05 14:57 ` Mark Rutland
                   ` (4 more replies)
  0 siblings, 5 replies; 19+ messages in thread
From: Mark Rutland @ 2018-01-05 14:57 UTC (permalink / raw)
  To: linux-kernel, linux-arch
  Cc: dan.j.williams, elena.reshetova, corbet, alan, peterz,
	will.deacon, gregkh, tglx, Mark Rutland

Recently, Google Project Zero discovered several classes of attack
against speculative execution. One of these, known as variant-1, allows
explicit bounds checks to be bypassed under speculation, providing an
arbitrary read gadget. Further details can be found on the GPZ blog [1]
and the Documentation patch in this series.

There are a number of potential gadgets in the Linux codebase, and
mitigations for these are architecture-specific.

This RFC attempts to provide a cross-architecture API for inhibiting
these primitives. Hopefully, architecture-specific mitigations can be
unified behind this. An arm64 implementation is provided following the
architecturally recommended sequence laid out in the Arm whitepaper [2].
The API is based on a proposed compiler intrinsic [3].

I've provided a patch to BPF as an example use of the API. I know that
this is incomplete and less than optimal. I'd appreciate feedback from
other affected architectures as to whether this API is suitable for
their required mitigation.

I've pushed the series to my kernel.org repo [4].

Since v1 [5]:
* Remove the nospec_*load helpers
* Added nospec_array_ptr()
* Rework asm-generic implementation to fit other architectures
* Improve documentation

[1] https://googleprojectzero.blogspot.co.uk/2018/01/reading-privileged-memory-with-side.html
[2] https://developer.arm.com/support/security-update
[3] https://developer.arm.com/support/security-update/compiler-support-for-mitigations
[4] git://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git core/nospec
[5] https://lkml.kernel.org/r/20180103223827.39601-1-mark.rutland@arm.com

Thanks,
Mark.

Mark Rutland (4):
  asm-generic/barrier: add generic nospec helpers
  Documentation: document nospec helpers
  arm64: implement nospec_{load,ptr}()
  bpf: inhibit speculated out-of-bounds pointers

 Documentation/speculation.txt    | 166 +++++++++++++++++++++++++++++++++++++++
 arch/arm64/include/asm/barrier.h |  55 +++++++++++++
 include/asm-generic/barrier.h    |  68 ++++++++++++++++
 kernel/bpf/arraymap.c            |  20 +++--
 kernel/bpf/cpumap.c              |   5 +-
 kernel/bpf/devmap.c              |   3 +-
 kernel/bpf/sockmap.c             |   3 +-
 7 files changed, 308 insertions(+), 12 deletions(-)
 create mode 100644 Documentation/speculation.txt

-- 
2.11.0

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

end of thread, other threads:[~2018-01-08 21:47 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-05 14:57 [RFCv2 0/4] API for inhibiting speculative arbitrary read primitives Mark Rutland
2018-01-05 14:57 ` Mark Rutland
2018-01-05 14:57 ` [RFCv2 1/4] asm-generic/barrier: add generic nospec helpers Mark Rutland
2018-01-05 14:57   ` Mark Rutland
2018-01-08 21:47   ` Mark Salter
2018-01-05 14:57 ` [RFCv2 2/4] Documentation: document " Mark Rutland
2018-01-05 14:57   ` Mark Rutland
2018-01-07  5:20   ` Randy Dunlap
2018-01-07 13:06     ` Mark Rutland
2018-01-07 10:27   ` Geert Uytterhoeven
2018-01-07 10:27     ` Geert Uytterhoeven
2018-01-05 14:57 ` [RFCv2 3/4] arm64: implement nospec_ptr() Mark Rutland
2018-01-05 14:57 ` [RFCv2 4/4] bpf: inhibit speculated out-of-bounds pointers Mark Rutland
2018-01-05 14:57   ` Mark Rutland
2018-01-05 16:38   ` Dan Williams
2018-01-05 16:48     ` Mark Rutland
2018-01-05 17:04   ` Alexei Starovoitov
2018-01-08 12:59     ` Reshetova, Elena
2018-01-08 12:59       ` Reshetova, Elena

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).