5 #ifndef CLEARBLUE_YAPSAFUNCTIONCHECKER_H
6 #define CLEARBLUE_YAPSAFUNCTIONCHECKER_H
10 #include "Analysis/Graph/DomTreePass.h"
11 #include "Checker/PSA/TraceSummary.h"
12 #include "Checker/PSA/VulnerabilityTrace.h"
13 #include "Checker/PSA/VulnerabilityTraceBuilder.h"
14 #include "Checker/Sailfish/SailfishChecker.h"
15 #include "Checker/Sailfish/SailfishStateBuilder.h"
16 #include "Checker/Sailfish/SummaryMapper.h"
17 #include "IR/SEG/SymbolicExprGraphSolver.h"
18 #include "Utils/Timer.h"
34 const DomTree *
DT, *PDT;
53 std::shared_ptr<Vulnerability>
TSV;
56 std::map<const SEGSiteBase *, std::set<const SEGOperandNode *>>
Sources;
65 virtual void run() = 0;
67 virtual void handleException() {}
69 virtual void storeSummary(SummaryBase *) = 0;
79 void downstreamSearch(
const SEGNodeBase *CurrentNode,
82 unsigned InlineDepth);
92 void matchFormalActual(SummaryBase *Smry,
const SEGCallSite *CS,
93 std::unordered_map<std::string, SMTExpr> &);
109 void inlineCalleeSummaryStartWithParam(
const SEGCallSite *CS,
113 unsigned InlineDepth,
int Case = 0);
120 inlineCalleeSummaryEndWithReturn(
const SEGCallSite *CS, TraceSummary *Smry,
123 unsigned InlineDepth,
int Case = 0);
133 std::unordered_map<const BasicBlock *, SMTSolver::SMTResultType> &,
141 template <
class TraceSummaryType>
143 createTraceSummary(SMTExprVec Constraints,
144 std::shared_ptr<VulnerabilityTrace> Trace,
145 const std::unordered_set<const SEGArgumentNode *> *Inputs,
146 unsigned InlineDepth) {
147 TraceSummaryType *Smry =
new TraceSummaryType(F, Trace, InlineDepth);
148 Smry->setVulnerabilityMask(-1);
149 auto NonSymDep = Constraints.toAndExpr();
150 Smry->addNonSymDeps(SummaryCacheItem(&NonSymDep,
"", 0));
152 Smry->setInputs(*Inputs);
161 collectVarMapping(
const std::vector<SummaryCacheItem> &ConstraintsCache,
163 std::unordered_map<std::string, SMTExpr> &VariableMapping);
166 void addCachedConstraintsToSummary(SummaryBase *S);
168 void tryReport(std::shared_ptr<VulnerabilityTrace> Trace,
unsigned Depth);
171 #endif // CLEARBLUE_YAPSAFUNCTIONCHECKER_H
std::map< const SEGSiteBase *, std::set< const SEGOperandNode * > > Sources
Taint sources.
Definition: SailfishFunctionChecker.h:56
Definition: SymbolicExprGraph.h:456
std::pair< const SEGOperandNode *, const SEGSiteBase * > ValueSitePairType
Definition: Vulnerability.h:90
Definition: SEGCallSiteOutputNode.h:19
Definition: SEGCallSite.h:51
Definition: SailfishStateBuilder.h:12
Definition: SymbolicExprGraph.h:708
SailfishSummary * Smry
the summary of this function
Definition: SailfishFunctionChecker.h:31
SiteType
Definition: Vulnerability.h:58
std::shared_ptr< Vulnerability > TSV
The vulnerability instance.
Definition: SailfishFunctionChecker.h:53
const DomTree * DT
dom tree and post-dom tree
Definition: SailfishFunctionChecker.h:34
Timer * TimeChecker
Definition: SailfishFunctionChecker.h:50
Definition: SailfishChecker.h:42
SailfishStateBuilder * StateBuilder
Definition: SailfishFunctionChecker.h:46
Definition: SailfishFunctionChecker.h:22
const SymbolicExprGraph * SEG
the symbolic expr graph IR
Definition: SailfishFunctionChecker.h:37
Definition: SailfishChecker.h:37
Definition: SymbolicExprGraph.h:663
SMTFactory ConstraintFactory
the factory to create constraints
Definition: SailfishFunctionChecker.h:40
Function * F
current function
Definition: SailfishFunctionChecker.h:28
The node base of symbolic expression graph.
Definition: SymbolicExprGraph.h:244
Various summaries generated for each function in pipelined PSA checker.
Definition: SummaryMapper.h:19
SailfishChecker * Parent
the parent checker
Definition: SailfishFunctionChecker.h:25