[PATCH] D75935: Add RET-hardening Support to X86 to mitigate Load Value Injection (LVI)

Scott Constable via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 10:19:30 PDT 2020


sconstab created this revision.
sconstab added reviewers: craig.topper, andrew.w.kaylor, chandlerc, zbrid.
Herald added subscribers: jfb, hiraditya, mgorny.
Herald added a project: LLVM.

Adding a pass that replaces every `ret` instruction with the sequence:

  pop <scratch-reg>
  lfence
  jmp *<scratch-reg>

where `<scratch-reg>` is some available scratch register, according to the
calling convention of the function being mitigated.


https://reviews.llvm.org/D75935

Files:
  llvm/lib/Target/X86/CMakeLists.txt
  llvm/lib/Target/X86/X86.h
  llvm/lib/Target/X86/X86LoadValueInjectionRetHardening.cpp
  llvm/lib/Target/X86/X86TargetMachine.cpp
  llvm/test/CodeGen/X86/O0-pipeline.ll
  llvm/test/CodeGen/X86/O3-pipeline.ll
  llvm/test/CodeGen/X86/lvi-hardening-ret.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75935.249417.patch
Type: text/x-patch
Size: 11003 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200310/d2295055/attachment-0001.bin>


More information about the llvm-commits mailing list