[PATCH] D44824: [Spectre] Introduce a new pass to do speculative load hardening to mitigate Spectre variant #1.

Chandler Carruth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 11 03:54:24 PDT 2018


chandlerc updated this revision to Diff 154962.
chandlerc added a comment.

Major rebase and update.

This now relies heavily on the new EFLAGS copy lowering. It also enhances it in
significant ways to handle complex control flow patterns with copies of EFLAGS
produced by this pass.

As a consequence of relying more on EFLAGS copying (and the fact that we have
reliably and efficient lowering of EFLAGS copies now) I've completely nuked
a bunch of the options for hacking around this.

There are still BMI2-based code paths that try to use SHRX rather than
EFLAGS-clobbering OR instructions. Some of these may not make sense, but it
seemed a bit premature to remove them.

I've done some minor cleanups to the code as well.

We now have a large number of users that want to experiment with this ASAP.
While I understand that there is probably a lot of work left to do to make this
100%, I'd like to focus on getting something into at least a tolerable state to
land. It is all hidden behind a flag and so not going to break things. We can
clean things up and improve things incrementally but a lot of users I think
would prefer that even a beta version of this be available sooner rather than
later.

So, please begin actually reviewing the code. I'll be working on trivial
testing very soon and expect to at least have the basics covered shortly.

Most of the LLVM test suite passes with this enabled, but I am seeing a number
of failures so a bug snuck in here somewhere. I'll be working on that, but
hopefully doesn't block the majority of code review.


Repository:
  rL LLVM

https://reviews.llvm.org/D44824

Files:
  llvm/docs/SpeculativeLoadHardening.md
  llvm/docs/speculative_load_hardening_microbenchmarks.png
  llvm/include/llvm/CodeGen/MachineBasicBlock.h
  llvm/lib/CodeGen/MachineBasicBlock.cpp
  llvm/lib/CodeGen/RegisterCoalescer.cpp
  llvm/lib/Target/X86/CMakeLists.txt
  llvm/lib/Target/X86/LLVMBuild.txt
  llvm/lib/Target/X86/X86.h
  llvm/lib/Target/X86/X86FlagsCopyLowering.cpp
  llvm/lib/Target/X86/X86InstrInfo.h
  llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp
  llvm/lib/Target/X86/X86TargetMachine.cpp
  llvm/test/CodeGen/X86/speculative-load-hardening.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44824.154962.patch
Type: text/x-patch
Size: 135994 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180711/45bd95e6/attachment-0001.bin>


More information about the llvm-commits mailing list