LLVM 22.0.0git
X86LoadValueInjectionLoadHardening.cpp File Reference

Go to the source code of this file.

Classes

struct  llvm::GraphTraits< MachineGadgetGraph * >
struct  llvm::DOTGraphTraits< MachineGadgetGraph * >

Namespaces

namespace  llvm
 This is an optimization pass for GlobalISel generic memory operations.

Macros

#define PASS_KEY   "x86-lvi-load"
#define DEBUG_TYPE   PASS_KEY

Typedefs

typedef int(* OptimizeCutT) (unsigned int *Nodes, unsigned int NodesSize, unsigned int *Edges, int *EdgeValues, int *CutEdges, unsigned int EdgesSize)

Functions

 STATISTIC (NumFences, "Number of LFENCEs inserted for LVI mitigation")
 STATISTIC (NumFunctionsConsidered, "Number of functions analyzed")
 STATISTIC (NumFunctionsMitigated, "Number of functions for which mitigations " "were deployed")
 STATISTIC (NumGadgets, "Number of LVI gadgets detected during analysis")
static void writeGadgetGraph (raw_ostream &OS, MachineFunction &MF, MachineGadgetGraph *G)
 INITIALIZE_PASS_BEGIN (X86LoadValueInjectionLoadHardeningPass, PASS_KEY, "X86 LVI load hardening", false, false) INITIALIZE_PASS_END(X86LoadValueInjectionLoadHardeningPass

Variables

static cl::opt< std::stringOptimizePluginPath (PASS_KEY "-opt-plugin", cl::desc("Specify a plugin to optimize LFENCE insertion"), cl::Hidden)
static cl::opt< boolNoConditionalBranches (PASS_KEY "-no-cbranch", cl::desc("Don't treat conditional branches as disclosure gadgets. This " "may improve performance, at the cost of security."), cl::init(false), cl::Hidden)
static cl::opt< boolEmitDot (PASS_KEY "-dot", cl::desc("For each function, emit a dot graph depicting potential LVI gadgets"), cl::init(false), cl::Hidden)
static cl::opt< boolEmitDotOnly (PASS_KEY "-dot-only", cl::desc("For each function, emit a dot graph depicting potential LVI " "gadgets, and do not insert any fences"), cl::init(false), cl::Hidden)
static cl::opt< boolEmitDotVerify (PASS_KEY "-dot-verify", cl::desc("For each function, emit a dot graph to stdout depicting " "potential LVI gadgets, used for testing purposes only"), cl::init(false), cl::Hidden)
static llvm::sys::DynamicLibrary OptimizeDL
static OptimizeCutT OptimizeCut = nullptr
 PASS_KEY
X86 LVI load hardening
X86 LVI load false

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   PASS_KEY

Definition at line 69 of file X86LoadValueInjectionLoadHardening.cpp.

◆ PASS_KEY

#define PASS_KEY   "x86-lvi-load"

Definition at line 68 of file X86LoadValueInjectionLoadHardening.cpp.

Typedef Documentation

◆ OptimizeCutT

typedef int(* OptimizeCutT) (unsigned int *Nodes, unsigned int NodesSize, unsigned int *Edges, int *EdgeValues, int *CutEdges, unsigned int EdgesSize)

Definition at line 106 of file X86LoadValueInjectionLoadHardening.cpp.

Function Documentation

◆ INITIALIZE_PASS_BEGIN()

INITIALIZE_PASS_BEGIN ( X86LoadValueInjectionLoadHardeningPass ,
PASS_KEY ,
"X86 LVI load hardening" ,
false ,
false  )

◆ STATISTIC() [1/4]

STATISTIC ( NumFences ,
"Number of LFENCEs inserted for LVI mitigation"  )

◆ STATISTIC() [2/4]

STATISTIC ( NumFunctionsConsidered ,
"Number of functions analyzed"  )

◆ STATISTIC() [3/4]

STATISTIC ( NumFunctionsMitigated ,
"Number of functions for which mitigations " "were deployed"  )

◆ STATISTIC() [4/4]

STATISTIC ( NumGadgets ,
"Number of LVI gadgets detected during analysis"  )

◆ writeGadgetGraph()

void writeGadgetGraph ( raw_ostream & OS,
MachineFunction & MF,
MachineGadgetGraph * G )
static

Variable Documentation

◆ EmitDot

cl::opt< bool > EmitDot(PASS_KEY "-dot", cl::desc( "For each function, emit a dot graph depicting potential LVI gadgets"), cl::init(false), cl::Hidden) ( PASS_KEY "-dot" ,
cl::desc( "For each function, emit a dot graph depicting potential LVI gadgets") ,
cl::init(false) ,
cl::Hidden  )
static

◆ EmitDotOnly

cl::opt< bool > EmitDotOnly(PASS_KEY "-dot-only", cl::desc("For each function, emit a dot graph depicting potential LVI " "gadgets, and do not insert any fences"), cl::init(false), cl::Hidden) ( PASS_KEY "-dot-only" ,
cl::desc("For each function, emit a dot graph depicting potential LVI " "gadgets, and do not insert any fences") ,
cl::init(false) ,
cl::Hidden  )
static

◆ EmitDotVerify

cl::opt< bool > EmitDotVerify(PASS_KEY "-dot-verify", cl::desc("For each function, emit a dot graph to stdout depicting " "potential LVI gadgets, used for testing purposes only"), cl::init(false), cl::Hidden) ( PASS_KEY "-dot-verify" ,
cl::desc("For each function, emit a dot graph to stdout depicting " "potential LVI gadgets, used for testing purposes only") ,
cl::init(false) ,
cl::Hidden  )
static

◆ false

X86 LVI load false

Definition at line 804 of file X86LoadValueInjectionLoadHardening.cpp.

◆ hardening

X86 LVI load hardening

Definition at line 804 of file X86LoadValueInjectionLoadHardening.cpp.

◆ NoConditionalBranches

cl::opt< bool > NoConditionalBranches(PASS_KEY "-no-cbranch", cl::desc("Don't treat conditional branches as disclosure gadgets. This " "may improve performance, at the cost of security."), cl::init(false), cl::Hidden) ( PASS_KEY "-no-cbranch" ,
cl::desc("Don't treat conditional branches as disclosure gadgets. This " "may improve performance, at the cost of security.") ,
cl::init(false) ,
cl::Hidden  )
static

◆ OptimizeCut

OptimizeCutT OptimizeCut = nullptr
static

Definition at line 109 of file X86LoadValueInjectionLoadHardening.cpp.

◆ OptimizeDL

llvm::sys::DynamicLibrary OptimizeDL
static

Definition at line 105 of file X86LoadValueInjectionLoadHardening.cpp.

◆ OptimizePluginPath

cl::opt< std::string > OptimizePluginPath(PASS_KEY "-opt-plugin", cl::desc("Specify a plugin to optimize LFENCE insertion"), cl::Hidden) ( PASS_KEY "-opt-plugin" ,
cl::desc("Specify a plugin to optimize LFENCE insertion") ,
cl::Hidden  )
static

◆ PASS_KEY

PASS_KEY

Definition at line 803 of file X86LoadValueInjectionLoadHardening.cpp.