1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/lib
Scott Constable 40fb959a78 [X86] Add Support for Load Hardening to Mitigate Load Value Injection (LVI)
After finding all such gadgets in a given function, the pass minimally inserts
LFENCE instructions in such a manner that the following property is satisfied:
for all SOURCE+SINK pairs, all paths in the CFG from SOURCE to SINK contain at
least one LFENCE instruction. The algorithm that implements this minimal
insertion is influenced by an academic paper that minimally inserts memory
fences for high-performance concurrent programs:

http://www.cs.ucr.edu/~lesani/companion/oopsla15/OOPSLA15.pdf

The algorithm implemented in this pass is as follows:

1. Build a condensed CFG (i.e., a GadgetGraph) consisting only of the following components:
  -SOURCE instructions (also includes function arguments)
  -SINK instructions
  -Basic block entry points
  -Basic block terminators
  -LFENCE instructions
2. Analyze the GadgetGraph to determine which SOURCE+SINK pairs (i.e., gadgets) are already mitigated by existing LFENCEs. If all gadgets have been mitigated, go to step 6.
3. Use a heuristic or plugin to approximate minimal LFENCE insertion.
4. Insert one LFENCE along each CFG edge that was cut in step 3.
5. Go to step 2.
6. If any LFENCEs were inserted, return true from runOnFunction() to tell LLVM that the function was modified.

By default, the heuristic used in Step 3 is a greedy heuristic that avoids
inserting LFENCEs into loops unless absolutely necessary. There is also a
CLI option to load a plugin that can provide even better optimization,
inserting fewer fences, while still mitigating all of the LVI gadgets.
The plugin can be found here: https://github.com/intel/lvi-llvm-optimization-plugin,
and a description of the pass's behavior with the plugin can be found here:
https://software.intel.com/security-software-guidance/insights/optimized-mitigation-approach-load-value-injection.

Differential Revision: https://reviews.llvm.org/D75937
2020-04-03 13:45:50 -07:00
..
Analysis [GraphDiff] Extend GraphDiff to track a list of updates. 2020-04-03 12:10:36 -07:00
AsmParser Remove "mask" operand from shufflevector. 2020-03-31 13:08:59 -07:00
BinaryFormat [llvm-objdump][XCOFF][AIX] Implement -r option 2020-03-27 16:05:42 +00:00
Bitcode Remove "mask" operand from shufflevector. 2020-03-31 13:08:59 -07:00
Bitstream
CodeGen CodeGen: Convert some TII hooks to use Register 2020-04-03 14:52:54 -04:00
DebugInfo Silence -Wpessimizing-move warning 2020-04-03 09:37:39 +02:00
Demangle
DWARFLinker
ExecutionEngine Re-apply 0071eaaf089, "[ORC] Export __cxa_atexit ...", with fixes. 2020-04-02 16:03:35 -07:00
Frontend Revert "[OpenMP][NFCI] Move OpenMP clause information to lib/Frontend/OpenMP" 2020-04-02 02:23:22 -05:00
Fuzzer
FuzzMutate
IR [Alignment][NFC] Deprecate InstrTypes getRetAlignment/getParamAlignment 2020-04-03 13:21:58 +00:00
IRReader
LineEditor
Linker
LTO Revert "[Darwin] Respect -fno-unroll-loops during LTO." 2020-03-30 15:20:30 +01:00
MC [NFC][XCOFF][AIX] Refactor get/setContainingCsect 2020-04-03 13:33:12 +00:00
MCA
Object [Object] Add the method for checking if a section is a debug section 2020-04-02 10:56:00 +02:00
ObjectYAML [yaml2obj] - Add NBucket and NChain fields for the SHT_HASH section. 2020-04-01 12:28:16 +03:00
Option
Passes [NFC] Split Knowledge retention and place it more appropriatly 2020-04-02 15:01:41 +02:00
ProfileData [SampleFDO] Port MD5 name table support to extbinary format. 2020-03-30 22:07:08 -07:00
Remarks
Support [YAMLParser] Scanner::setError - ensure we use the StringRef::iterator argument (PR45043) 2020-04-03 18:55:38 +01:00
TableGen
Target [X86] Add Support for Load Hardening to Mitigate Load Value Injection (LVI) 2020-04-03 13:45:50 -07:00
Testing
TextAPI [llvm][TextAPI] adding inlining reexported libraries support 2020-04-02 13:05:08 -07:00
ToolDrivers
Transforms [VectorCombine] try to form a better extractelement 2020-04-03 13:55:13 -04:00
WindowsManifest
XRay
CMakeLists.txt
LLVMBuild.txt