[X86] Add a Pass that builds a Condensed CFG for Load Value Injection (LVI) Gadgets
authorScott Constable <scott.d.constable@intel.com>
Mon, 11 May 2020 17:25:35 +0000 (10:25 -0700)
committerCraig Topper <craig.topper@intel.com>
Mon, 11 May 2020 20:08:35 +0000 (13:08 -0700)
commite97a3e5d9d428c4d455fa1b1982728bb71f0c397
treeba8fd715ac3e4ef9f63c561bbe68543fbe67b7f3
parenta1b04aaea210a9a9fbe0cd9dd7f874e12fa97585
[X86] Add a Pass that builds a Condensed CFG for Load Value Injection (LVI) Gadgets

Adds a new data structure, ImmutableGraph, and uses RDF to find LVI gadgets and add them to a MachineGadgetGraph.

More specifically, a new X86 machine pass finds Load Value Injection (LVI) gadgets consisting of a load from memory (i.e., SOURCE), and any operation that may transmit the value loaded from memory over a covert channel, or use the value loaded from memory to determine a branch/call target (i.e., SINK).

Also adds a new target feature to X86: +lvi-load-hardening

The feature can be added via the clang CLI using -mlvi-hardening.

Differential Revision: https://reviews.llvm.org/D75936
13 files changed:
clang/include/clang/Driver/Options.td
clang/lib/Driver/ToolChains/Arch/X86.cpp
clang/test/Driver/x86-target-features.c
llvm/lib/Target/X86/CMakeLists.txt
llvm/lib/Target/X86/ImmutableGraph.h [new file with mode: 0644]
llvm/lib/Target/X86/X86.h
llvm/lib/Target/X86/X86.td
llvm/lib/Target/X86/X86LoadValueInjectionLoadHardening.cpp [new file with mode: 0644]
llvm/lib/Target/X86/X86Subtarget.h
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-gadget-graph.ll [new file with mode: 0644]