[PATCH] D49663: [x86/SLH] Teach the x86 speculative load hardening pass to harden against v1.2 BCBS attacks directly.

Eric Christopher via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 23 17:42:43 PDT 2018


echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

Couple of small nits, ctopper's suggestion seems reasonable too. Only "better" way I had of dealing with this would be not folding the load at all in the first place, but it seems harder to justify given the existing unfolding machinery.

-eric



================
Comment at: llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp:2233-2236
+  // FIXME: All the hardening code is essentially duplicated with the post-load
+  // hardening code. Should refactor that to be sharable here.
+  auto *TargetRC = MRI->getRegClass(OldTargetReg);
+  int TargetRegBytes = TRI->getRegSizeInBits(*TargetRC) / 8;
----------------
Mind sinking this closer to the if statement?


================
Comment at: llvm/lib/Target/X86/X86SpeculativeLoadHardening.cpp:2244
+  // FIXME: Need to teach this about 32-bit mode.
+  if (TargetRegBytes != 8) {
+    unsigned SubRegImms[] = {X86::sub_8bit, X86::sub_16bit, X86::sub_32bit};
----------------
I suppose technically you want < 8?


Repository:
  rL LLVM

https://reviews.llvm.org/D49663





More information about the llvm-commits mailing list