svf-lib 1.0.993 → 1.0.994
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SVF-osx/Release-build/lib/CUDD/libCudd.a +0 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/CFL/CFGNormalizer.h +6 -3
- package/SVF-osx/include/CFL/CFLAlias.h +26 -15
- package/SVF-osx/include/CFL/CFLGrammar.h +30 -16
- package/SVF-osx/include/CFL/CFLSolver.h +9 -5
- package/SVF-osx/include/CFL/GrammarBuilder.h +10 -7
- package/SVF-osx/include/CUDD/cudd.h +20 -11
- package/SVF-osx/include/CUDD/cuddInt.h +48 -31
- package/SVF-osx/include/CUDD/epd.h +35 -29
- package/SVF-osx/include/CUDD/mtr.h +4 -3
- package/SVF-osx/include/CUDD/st.h +7 -4
- package/SVF-osx/include/CUDD/util.h +6 -6
- package/SVF-osx/include/FastCluster/fastcluster.h +13 -12
- package/SVF-osx/include/Graphs/CFLGraph.h +16 -10
- package/SVF-osx/include/Graphs/CHG.h +2 -2
- package/SVF-osx/include/Graphs/ConsG.h +2 -1
- package/SVF-osx/include/Graphs/GenericGraph.h +3 -3
- package/SVF-osx/include/Graphs/ICFG.h +2 -2
- package/SVF-osx/include/Graphs/ICFGEdge.h +16 -9
- package/SVF-osx/include/Graphs/ICFGNode.h +2 -2
- package/SVF-osx/include/Graphs/IRGraph.h +10 -6
- package/SVF-osx/include/Graphs/PTACallGraph.h +1 -1
- package/SVF-osx/include/Graphs/SVFG.h +4 -3
- package/SVF-osx/include/Graphs/SVFGNode.h +14 -8
- package/SVF-osx/include/Graphs/ThreadCallGraph.h +4 -2
- package/SVF-osx/include/Graphs/VFG.h +45 -39
- package/SVF-osx/include/Graphs/VFGNode.h +8 -4
- package/SVF-osx/include/MSSA/MemSSA.h +1 -1
- package/SVF-osx/include/MTA/FSMPTA.h +55 -44
- package/SVF-osx/include/MTA/LockAnalysis.h +11 -9
- package/SVF-osx/include/MTA/LockResultValidator.h +64 -54
- package/SVF-osx/include/MTA/MHP.h +17 -13
- package/SVF-osx/include/MTA/MTAResultValidator.h +24 -20
- package/SVF-osx/include/MTA/PCG.h +9 -7
- package/SVF-osx/include/MTA/TCT.h +27 -22
- package/SVF-osx/include/MemoryModel/LocationSet.h +5 -3
- package/SVF-osx/include/MemoryModel/PersistentPointsToCache.h +28 -13
- package/SVF-osx/include/MemoryModel/PersistentPointsToDS.h +2 -2
- package/SVF-osx/include/MemoryModel/PointerAnalysis.h +5 -4
- package/SVF-osx/include/MemoryModel/PointsTo.h +8 -2
- package/SVF-osx/include/MemoryModel/SVFIR.h +6 -5
- package/SVF-osx/include/MemoryModel/SVFStatements.h +65 -45
- package/SVF-osx/include/MemoryModel/SVFVariables.h +6 -5
- package/SVF-osx/include/MemoryModel/SymbolTableInfo.h +18 -15
- package/SVF-osx/include/SABER/PathCondAllocator.h +14 -7
- package/SVF-osx/include/SABER/ProgSlice.h +2 -1
- package/SVF-osx/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-osx/include/SABER/SrcSnkDDA.h +8 -4
- package/SVF-osx/include/SVF-FE/CHGBuilder.h +4 -2
- package/SVF-osx/include/SVF-FE/DataFlowUtil.h +10 -9
- package/SVF-osx/include/SVF-FE/IRAnnotator.h +8 -8
- package/SVF-osx/include/SVF-FE/LLVMModule.h +13 -12
- package/SVF-osx/include/SVF-FE/LLVMUtil.h +4 -4
- package/SVF-osx/include/SVF-FE/SVFIRBuilder.h +13 -9
- package/SVF-osx/include/SVF-FE/SymbolTableBuilder.h +3 -2
- package/SVF-osx/include/Util/BDDExpr.h +32 -16
- package/SVF-osx/include/Util/BasicTypes.h +77 -25
- package/SVF-osx/include/Util/CoreBitVector.h +2 -1
- package/SVF-osx/include/Util/CxtStmt.h +37 -27
- package/SVF-osx/include/Util/ExeState.h +42 -22
- package/SVF-osx/include/Util/ExtAPI.h +1 -1
- package/SVF-osx/include/Util/NodeIDAllocator.h +7 -4
- package/SVF-osx/include/Util/Options.h +3 -3
- package/SVF-osx/include/Util/SVFBasicTypes.h +49 -40
- package/SVF-osx/include/Util/SVFModule.h +5 -5
- package/SVF-osx/include/Util/SVFUtil.h +12 -9
- package/SVF-osx/include/Util/Z3Expr.h +191 -144
- package/SVF-osx/include/WPA/Andersen.h +11 -11
- package/SVF-osx/include/WPA/VersionedFlowSensitive.h +4 -1
- package/package.json +1 -1
|
@@ -281,28 +281,33 @@ public:
|
|
|
281
281
|
return false;
|
|
282
282
|
}
|
|
283
283
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
284
|
+
/// Return all the VFGNodes of a function
|
|
285
|
+
///@{
|
|
286
|
+
inline VFGNodeSet& getVFGNodes(const SVFFunction *fun)
|
|
287
|
+
{
|
|
288
|
+
return funToVFGNodesMap[fun];
|
|
289
|
+
}
|
|
290
|
+
inline bool hasVFGNodes(const SVFFunction *fun) const
|
|
291
|
+
{
|
|
292
|
+
return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
|
|
293
|
+
}
|
|
294
|
+
inline bool VFGNodes(const SVFFunction *fun) const
|
|
295
|
+
{
|
|
296
|
+
return funToVFGNodesMap.find(fun) != funToVFGNodesMap.end();
|
|
297
|
+
}
|
|
298
|
+
inline VFGNodeSet::const_iterator getVFGNodeBegin(const SVFFunction *fun) const
|
|
299
|
+
{
|
|
300
|
+
FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
|
|
301
|
+
assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
|
|
302
|
+
return it->second.begin();
|
|
303
|
+
}
|
|
304
|
+
inline VFGNodeSet::const_iterator getVFGNodeEnd(const SVFFunction *fun) const
|
|
305
|
+
{
|
|
306
|
+
FunToVFGNodesMapTy::const_iterator it = funToVFGNodesMap.find(fun);
|
|
307
|
+
assert(it != funToVFGNodesMap.end() && "this function does not have any VFGNode");
|
|
308
|
+
return it->second.end();
|
|
309
|
+
}
|
|
310
|
+
///@}
|
|
306
311
|
/// Add control-flow edges for top level pointers
|
|
307
312
|
//@{
|
|
308
313
|
VFGEdge* addIntraDirectVFEdge(NodeID srcId, NodeID dstId);
|
|
@@ -462,9 +467,9 @@ protected:
|
|
|
462
467
|
icfgNode->addVFGNode(vfgNode);
|
|
463
468
|
|
|
464
469
|
if(const SVFFunction* fun = icfgNode->getFun())
|
|
465
|
-
|
|
470
|
+
funToVFGNodesMap[fun].insert(vfgNode);
|
|
466
471
|
else
|
|
467
|
-
|
|
472
|
+
globalVFGNodes.insert(vfgNode);
|
|
468
473
|
}
|
|
469
474
|
|
|
470
475
|
/// Add a VFG node for program statement
|
|
@@ -545,20 +550,21 @@ protected:
|
|
|
545
550
|
/// Otherwise, we need to handle formalRet using <PAGNodeID,CallSiteID> pair to find FormalRetVFG node same as handling actual parameters
|
|
546
551
|
inline void addFormalRetVFGNode(const PAGNode* uniqueFunRet, const SVFFunction* fun, RetPESet& retPEs)
|
|
547
552
|
{
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
553
|
+
FormalRetVFGNode *sNode = new FormalRetVFGNode(totalVFGNode++, uniqueFunRet, fun);
|
|
554
|
+
addVFGNode(sNode, pag->getICFG()->getFunExitICFGNode(fun));
|
|
555
|
+
for (RetPESet::const_iterator it = retPEs.begin(), eit = retPEs.end(); it != eit; ++it)
|
|
556
|
+
sNode->addRetPE(*it);
|
|
557
|
+
|
|
558
|
+
PAGNodeToFormalRetMap[uniqueFunRet] = sNode;
|
|
559
|
+
/// if this uniqueFunRet is a phi node, which means it will receive values from multiple return instructions of fun
|
|
560
|
+
/// we will set this phi node's def later
|
|
561
|
+
/// Ideally, every function uniqueFunRet should be a PhiNode (SVFIRBuilder.cpp), unless it does not have ret instruction
|
|
562
|
+
if (!pag->isPhiNode(uniqueFunRet))
|
|
563
|
+
{
|
|
564
|
+
std::string warn = fun->getName();
|
|
565
|
+
SVFUtil::writeWrnMsg(warn + " does not have any ret instruction!");
|
|
566
|
+
setDef(uniqueFunRet, sNode);
|
|
567
|
+
}
|
|
562
568
|
}
|
|
563
569
|
/// Add a callsite Receive VFG node
|
|
564
570
|
inline void addActualRetVFGNode(const PAGNode* ret,const CallICFGNode* cs)
|
|
@@ -619,7 +625,7 @@ protected:
|
|
|
619
625
|
setDef(edge->getRes(),sNode);
|
|
620
626
|
PAGNodeToUnaryOPVFGNodeMap[edge->getRes()] = sNode;
|
|
621
627
|
}
|
|
622
|
-
/// Add a BranchVFGNode
|
|
628
|
+
/// Add a BranchVFGNode
|
|
623
629
|
inline void addBranchVFGNode(const BranchStmt* edge)
|
|
624
630
|
{
|
|
625
631
|
BranchVFGNode* sNode = new BranchVFGNode(totalVFGNode++, edge);
|
|
@@ -563,18 +563,22 @@ public:
|
|
|
563
563
|
//@}
|
|
564
564
|
|
|
565
565
|
/// Return the branch statement
|
|
566
|
-
const BranchStmt* getBranchStmt() const
|
|
566
|
+
const BranchStmt* getBranchStmt() const
|
|
567
|
+
{
|
|
567
568
|
return brstmt;
|
|
568
569
|
}
|
|
569
570
|
/// Successors of this branch statement
|
|
570
571
|
///@{
|
|
571
|
-
u32_t getNumSuccessors() const
|
|
572
|
+
u32_t getNumSuccessors() const
|
|
573
|
+
{
|
|
572
574
|
return brstmt->getNumSuccessors();
|
|
573
575
|
}
|
|
574
|
-
const BranchStmt::SuccAndCondPairVec& getSuccessors() const
|
|
576
|
+
const BranchStmt::SuccAndCondPairVec& getSuccessors() const
|
|
577
|
+
{
|
|
575
578
|
return brstmt->getSuccessors();
|
|
576
579
|
}
|
|
577
|
-
const ICFGNode* getSuccessor (u32_t i) const
|
|
580
|
+
const ICFGNode* getSuccessor (u32_t i) const
|
|
581
|
+
{
|
|
578
582
|
return brstmt->getSuccessor(i);
|
|
579
583
|
}
|
|
580
584
|
///@}
|
|
@@ -22,40 +22,48 @@ class MHP;
|
|
|
22
22
|
class LockAnalysis;
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
class SVFGNodeLockSpan
|
|
25
|
+
class SVFGNodeLockSpan
|
|
26
|
+
{
|
|
26
27
|
public:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
28
|
+
SVFGNodeLockSpan(const StmtSVFGNode* SVFGnode, LockAnalysis::LockSpan lockspan) :
|
|
29
|
+
SVFGNode(SVFGnode), lockSpan(lockspan) {}
|
|
30
|
+
virtual ~SVFGNodeLockSpan() {}
|
|
31
|
+
|
|
32
|
+
inline bool operator< (const SVFGNodeLockSpan& rhs) const
|
|
33
|
+
{
|
|
34
|
+
if (SVFGNode != rhs.getSVFGNode())
|
|
35
|
+
return SVFGNode < rhs.getSVFGNode();
|
|
36
|
+
return lockSpan.size() < rhs.getLockSpan().size();
|
|
37
|
+
}
|
|
38
|
+
inline SVFGNodeLockSpan& operator= (const SVFGNodeLockSpan& rhs)
|
|
39
|
+
{
|
|
40
|
+
if(*this != rhs)
|
|
41
|
+
{
|
|
42
|
+
SVFGNode = rhs.getSVFGNode();
|
|
43
|
+
lockSpan = rhs.getLockSpan();
|
|
44
|
+
}
|
|
45
|
+
return *this;
|
|
46
|
+
}
|
|
47
|
+
inline bool operator== (const SVFGNodeLockSpan& rhs) const
|
|
48
|
+
{
|
|
49
|
+
return (SVFGNode == rhs.getSVFGNode() && lockSpan == rhs.getLockSpan());
|
|
50
|
+
}
|
|
51
|
+
inline bool operator!= (const SVFGNodeLockSpan& rhs) const
|
|
52
|
+
{
|
|
53
|
+
return !(*this == rhs);
|
|
54
|
+
}
|
|
55
|
+
inline const StmtSVFGNode* getSVFGNode() const
|
|
56
|
+
{
|
|
57
|
+
return SVFGNode;
|
|
58
|
+
}
|
|
59
|
+
inline const LockAnalysis::LockSpan getLockSpan() const
|
|
60
|
+
{
|
|
61
|
+
return lockSpan;
|
|
62
|
+
}
|
|
55
63
|
private:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
};
|
|
64
|
+
const StmtSVFGNode* SVFGNode;
|
|
65
|
+
LockAnalysis::LockSpan lockSpan;
|
|
66
|
+
};
|
|
59
67
|
|
|
60
68
|
/*!
|
|
61
69
|
* SVFG builder for DDA
|
|
@@ -73,7 +81,7 @@ public:
|
|
|
73
81
|
typedef Set<const Instruction*> InstSet;
|
|
74
82
|
typedef std::pair<NodeID,NodeID> NodeIDPair;
|
|
75
83
|
typedef Map<SVFGNodeLockSpan, bool> PairToBoolMap;
|
|
76
|
-
|
|
84
|
+
|
|
77
85
|
/// Constructor
|
|
78
86
|
MTASVFGBuilder(MHP* m, LockAnalysis* la) : SVFGBuilder(), mhp(m), lockana(la)
|
|
79
87
|
{
|
|
@@ -183,11 +191,12 @@ public:
|
|
|
183
191
|
|
|
184
192
|
/// Initialize analysis
|
|
185
193
|
void initialize(SVFModule* module);
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
194
|
+
|
|
195
|
+
inline SVFIR* getPAG()
|
|
196
|
+
{
|
|
197
|
+
return mhp->getTCT()->getPTA()->getPAG();
|
|
198
|
+
}
|
|
199
|
+
|
|
191
200
|
/// Create signle instance of flow-sensitive pointer analysis
|
|
192
201
|
static FSMPTA* createFSMPTA(SVFModule* module, MHP* m, LockAnalysis* la)
|
|
193
202
|
{
|
|
@@ -222,12 +231,14 @@ private:
|
|
|
222
231
|
|
|
223
232
|
} // End namespace SVF
|
|
224
233
|
|
|
225
|
-
template <> struct std::hash<SVF::SVFGNodeLockSpan>
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
234
|
+
template <> struct std::hash<SVF::SVFGNodeLockSpan>
|
|
235
|
+
{
|
|
236
|
+
size_t operator()(const SVF::SVFGNodeLockSpan &cs) const
|
|
237
|
+
{
|
|
238
|
+
std::hash<SVF::StmtSVFGNode* >h;
|
|
239
|
+
SVF::StmtSVFGNode* node = const_cast<SVF::StmtSVFGNode* > (cs.getSVFGNode());
|
|
240
|
+
return h(node);
|
|
241
|
+
}
|
|
231
242
|
};
|
|
232
243
|
|
|
233
244
|
#endif /* FSPTANALYSIS_H_ */
|
|
@@ -224,10 +224,11 @@ public:
|
|
|
224
224
|
}
|
|
225
225
|
return find;
|
|
226
226
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
227
|
+
|
|
228
|
+
CxtStmtToCxtLockSet getCSTCLS()
|
|
229
|
+
{
|
|
230
|
+
return cxtStmtToCxtLockSet;
|
|
231
|
+
}
|
|
231
232
|
/// Touch this context statement
|
|
232
233
|
inline void touchCxtStmt(CxtStmt& cts)
|
|
233
234
|
{
|
|
@@ -297,11 +298,12 @@ public:
|
|
|
297
298
|
}
|
|
298
299
|
/// Print locks and spans
|
|
299
300
|
void printLocks(const CxtStmt& cts);
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
301
|
+
|
|
302
|
+
/// Get tct
|
|
303
|
+
TCT* getTCT()
|
|
304
|
+
{
|
|
305
|
+
return tct;
|
|
306
|
+
}
|
|
305
307
|
private:
|
|
306
308
|
/// Handle fork
|
|
307
309
|
void handleFork(const CxtStmt& cts);
|
|
@@ -13,53 +13,61 @@
|
|
|
13
13
|
|
|
14
14
|
/* Validate the result of lock analysis */
|
|
15
15
|
|
|
16
|
-
namespace SVF
|
|
17
|
-
|
|
16
|
+
namespace SVF
|
|
17
|
+
{
|
|
18
|
+
class LockResultValidator
|
|
19
|
+
{
|
|
18
20
|
public:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
typedef Set<std::string> CxtLockSetStr;
|
|
22
|
+
typedef Map<const Instruction*, CxtLockSetStr> CxtStmtToCxtLockS;
|
|
23
|
+
|
|
24
|
+
typedef unsigned LOCK_FLAG;
|
|
25
|
+
|
|
26
|
+
LockResultValidator(LockAnalysis* la) : _la(la)
|
|
27
|
+
{
|
|
28
|
+
_mod = _la->getTCT()->getSVFModule();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
~LockResultValidator() {}
|
|
32
|
+
|
|
33
|
+
void analyze();
|
|
34
|
+
|
|
35
|
+
inline SVFModule* getModule() const
|
|
36
|
+
{
|
|
37
|
+
return _mod;
|
|
38
|
+
}
|
|
35
39
|
private:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
// Get CallICFGNode
|
|
41
|
+
inline CallICFGNode* getCBN(const Instruction* inst)
|
|
42
|
+
{
|
|
43
|
+
return _la->getTCT()->getCallICFGNode(inst);
|
|
44
|
+
}
|
|
45
|
+
const Instruction *getPreviousMemoryAccessInst( const Instruction *I)
|
|
46
|
+
{
|
|
41
47
|
I = I->getPrevNode();
|
|
42
48
|
while (I)
|
|
43
49
|
{
|
|
44
50
|
if (SVFUtil::isa<LoadInst>(I) || SVFUtil::isa<StoreInst>(I))
|
|
45
51
|
return I;
|
|
46
52
|
SVFFunction* callee = nullptr;
|
|
47
|
-
|
|
48
|
-
if(SVFUtil::isa<CallInst> (I))
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
53
|
+
|
|
54
|
+
if(SVFUtil::isa<CallInst> (I))
|
|
55
|
+
{
|
|
56
|
+
PTACallGraph::FunctionSet callees;
|
|
57
|
+
_la->getTCT()->getThreadCallGraph()->getCallees(getCBN(I), callees);
|
|
58
|
+
|
|
59
|
+
for(PTACallGraph::FunctionSet::const_iterator cit = callees.begin(),
|
|
60
|
+
ecit = callees.end(); cit!=ecit; cit++)
|
|
61
|
+
{
|
|
62
|
+
if(*cit != nullptr)
|
|
63
|
+
{
|
|
64
|
+
callee = const_cast<SVFFunction*> (*cit);
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
|
-
|
|
70
|
+
|
|
63
71
|
if (callee)
|
|
64
72
|
{
|
|
65
73
|
if (ExtAPI::EFT_L_A0__A0R_A1R == ExtAPI::getExtAPI()->get_type(callee)
|
|
@@ -70,39 +78,41 @@ private:
|
|
|
70
78
|
}
|
|
71
79
|
return nullptr;
|
|
72
80
|
}
|
|
73
|
-
|
|
74
|
-
inline bool inFilter(std::string name)
|
|
75
|
-
|
|
81
|
+
|
|
82
|
+
inline bool inFilter(std::string name)
|
|
83
|
+
{
|
|
84
|
+
return filterFun.find(name) != filterFun.end();
|
|
76
85
|
}
|
|
77
|
-
|
|
78
|
-
inline bool match(std::string lockName, CxtLockSetStr LS)
|
|
79
|
-
|
|
86
|
+
|
|
87
|
+
inline bool match(std::string lockName, CxtLockSetStr LS)
|
|
88
|
+
{
|
|
89
|
+
return LS.find(lockName) != LS.end();
|
|
80
90
|
}
|
|
81
|
-
|
|
91
|
+
|
|
82
92
|
Set<std::string> &split(const std::string &s, char delim, Set<std::string> &elems);
|
|
83
93
|
Set<std::string> split(const std::string &s, char delim);
|
|
84
|
-
|
|
94
|
+
|
|
85
95
|
std::string getOutput(const char* scenario, LOCK_FLAG analysisRes);
|
|
86
|
-
|
|
96
|
+
|
|
87
97
|
Set<std::string> getStringArg(const Instruction* inst, unsigned int arg_num);
|
|
88
|
-
|
|
98
|
+
|
|
89
99
|
bool collectLockTargets();
|
|
90
100
|
LOCK_FLAG validateStmtInLock();
|
|
91
|
-
|
|
101
|
+
|
|
92
102
|
CxtStmtToCxtLockS instToCxtLockSet;
|
|
93
103
|
LockAnalysis::CxtStmtToCxtLockSet cxtStmtToCxtLockSet;
|
|
94
104
|
LockAnalysis::CxtLockSet cxtLockSet;
|
|
95
|
-
|
|
105
|
+
|
|
96
106
|
LockAnalysis* _la;
|
|
97
107
|
SVFModule* _mod;
|
|
98
|
-
|
|
108
|
+
|
|
99
109
|
static const LOCK_FLAG LOCK_TRUE = 0x01;
|
|
100
110
|
static const LOCK_FLAG LOCK_IMPRECISE = 0x02;
|
|
101
111
|
static const LOCK_FLAG LOCK_UNSOUND = 0x04;
|
|
102
|
-
|
|
112
|
+
|
|
103
113
|
static constexpr char const *LOCK = "LOCK";
|
|
104
|
-
|
|
114
|
+
|
|
105
115
|
Set<std::string> filterFun = {"LOCK", "INTERLEV_ACCESS", "PAUSE", "CXT_THREAD", "TCT_ACCESS"};
|
|
106
|
-
};
|
|
116
|
+
};
|
|
107
117
|
} // End namespace SVF
|
|
108
118
|
#endif /* LOCKRESULTVALIDATOR_H_ */
|
|
@@ -60,11 +60,12 @@ public:
|
|
|
60
60
|
{
|
|
61
61
|
return tct;
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
63
|
+
|
|
64
|
+
// Get CallICFGNode
|
|
65
|
+
inline CallICFGNode* getCBN(const Instruction* inst)
|
|
66
|
+
{
|
|
67
|
+
return tct->getCallICFGNode(inst);
|
|
68
|
+
}
|
|
68
69
|
|
|
69
70
|
/// Whether the function is connected from main function in thread call graph
|
|
70
71
|
bool isConnectedfromMain(const Function* fun);
|
|
@@ -115,11 +116,12 @@ public:
|
|
|
115
116
|
void printInterleaving();
|
|
116
117
|
|
|
117
118
|
private:
|
|
118
|
-
|
|
119
|
-
|
|
119
|
+
|
|
120
|
+
inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees)
|
|
121
|
+
{
|
|
120
122
|
tcg->getCallees(getCBN(inst), callees);
|
|
121
123
|
return callees;
|
|
122
|
-
|
|
124
|
+
}
|
|
123
125
|
/// Update non-candidate functions' interleaving.
|
|
124
126
|
/// Copy interleaving threads of the entry inst to other insts.
|
|
125
127
|
void updateNonCandidateFunInterleaving();
|
|
@@ -380,9 +382,10 @@ private:
|
|
|
380
382
|
return tct->getPTA()->alias(getForkedThread(forkSite), getJoinedThread(joinSite)) && isSameSCEV(forkSite,joinSite);
|
|
381
383
|
}
|
|
382
384
|
// Get CallICFGNode
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
385
|
+
inline CallICFGNode* getCBN(const Instruction* inst)
|
|
386
|
+
{
|
|
387
|
+
return tct->getCallICFGNode(inst);
|
|
388
|
+
}
|
|
386
389
|
/// Mark thread flags for cxtStmt
|
|
387
390
|
//@{
|
|
388
391
|
/// Get the flag for a cxtStmt
|
|
@@ -485,10 +488,11 @@ private:
|
|
|
485
488
|
{
|
|
486
489
|
return getTCG()->getThreadAPI()->getJoinedThread(call);
|
|
487
490
|
}
|
|
488
|
-
inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees)
|
|
491
|
+
inline const PTACallGraph::FunctionSet& getCallee(const Instruction* inst, PTACallGraph::FunctionSet& callees)
|
|
492
|
+
{
|
|
489
493
|
getTCG()->getCallees(getCBN(inst), callees);
|
|
490
494
|
return callees;
|
|
491
|
-
|
|
495
|
+
}
|
|
492
496
|
/// ThreadCallGraph
|
|
493
497
|
inline ThreadCallGraph* getTCG() const
|
|
494
498
|
{
|
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
* Validate the result of context-sensitive analysis, including context-sensitive
|
|
15
15
|
* thread detection and thread interleaving.
|
|
16
16
|
*/
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
namespace SVF
|
|
18
|
+
{
|
|
19
|
+
typedef unsigned NodeID;
|
|
20
|
+
|
|
20
21
|
class MTAResultValidator
|
|
21
22
|
{
|
|
22
23
|
|
|
@@ -36,9 +37,10 @@ public:
|
|
|
36
37
|
|
|
37
38
|
// Analysis
|
|
38
39
|
void analyze();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
inline SVFModule* getModule() const
|
|
41
|
+
{
|
|
42
|
+
return mod;
|
|
43
|
+
}
|
|
42
44
|
protected:
|
|
43
45
|
|
|
44
46
|
/*
|
|
@@ -132,12 +134,12 @@ private:
|
|
|
132
134
|
ThreadAPI* tdAPI;
|
|
133
135
|
ThreadCallGraph* tcg;
|
|
134
136
|
MHP* mhp;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
vthdToCxtMap vthdToCxt;
|
|
138
|
+
vthdTorthdMap vthdTorthd;
|
|
139
|
+
rthdTovthdMap rthdTovthd;
|
|
140
|
+
csnumToInst csnumToInstMap;
|
|
141
|
+
rthdToChildrenMap rthdToChildren;
|
|
142
|
+
SVFModule* mod;
|
|
141
143
|
/// Constant INTERLEV_FLAG values
|
|
142
144
|
//@{
|
|
143
145
|
static const INTERLEV_FLAG INTERLEV_TRUE = 0x01;
|
|
@@ -274,13 +276,15 @@ protected:
|
|
|
274
276
|
// Collect call sites of all RC_ACCESS function calls.
|
|
275
277
|
std::vector<const CallInst*> csInsts;
|
|
276
278
|
const Function *F = nullptr;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
279
|
+
for(auto it = M->llvmFunBegin(); it != M->llvmFunEnd(); it++)
|
|
280
|
+
{
|
|
281
|
+
const std::string fName = (*it)->getName().str();
|
|
282
|
+
if(fName.find(RC_ACCESS) != std::string::npos)
|
|
283
|
+
{
|
|
284
|
+
F = (*it);
|
|
285
|
+
break;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
284
288
|
if (!F) return;
|
|
285
289
|
|
|
286
290
|
for (Value::const_use_iterator it = F->use_begin(), ie =
|
|
@@ -409,7 +413,7 @@ private:
|
|
|
409
413
|
{
|
|
410
414
|
if (SVFUtil::isa<LoadInst>(I) || SVFUtil::isa<StoreInst>(I))
|
|
411
415
|
return I;
|
|
412
|
-
|
|
416
|
+
|
|
413
417
|
if (const SVFFunction *callee = SVFUtil::getCallee(I))
|
|
414
418
|
{
|
|
415
419
|
if (ExtAPI::EFT_L_A0__A0R_A1R == ExtAPI::getExtAPI()->get_type(callee)
|
|
@@ -122,13 +122,15 @@ public:
|
|
|
122
122
|
virtual ~PCG()
|
|
123
123
|
{
|
|
124
124
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
125
|
+
|
|
126
|
+
CallICFGNode* getCallICFGNode(const Instruction* inst)
|
|
127
|
+
{
|
|
128
|
+
return pta->getICFG()->getCallICFGNode(inst);
|
|
129
|
+
}
|
|
130
|
+
const SVFFunction* getSVFFun(const Function* fun) const
|
|
131
|
+
{
|
|
132
|
+
return LLVMModuleSet::getLLVMModuleSet()->getSVFFunction(fun);
|
|
133
|
+
}
|
|
132
134
|
/// Interface to query whether two function may happen-in-parallel
|
|
133
135
|
virtual bool mayHappenInParallel(const Instruction* i1, const Instruction* i2) const;
|
|
134
136
|
bool mayHappenInParallelBetweenFunctions(const Function* fun1, const Function* fun2) const;
|