svf-lib 1.0.2078 → 1.0.2080
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-linux/Release-build/bin/ae +0 -0
- package/SVF-linux/Release-build/bin/cfl +0 -0
- package/SVF-linux/Release-build/bin/dvf +0 -0
- package/SVF-linux/Release-build/bin/llvm2svf +0 -0
- package/SVF-linux/Release-build/bin/mta +0 -0
- package/SVF-linux/Release-build/bin/saber +0 -0
- package/SVF-linux/Release-build/bin/svf-ex +0 -0
- package/SVF-linux/Release-build/bin/wpa +0 -0
- package/SVF-linux/Release-build/include/AE/Svfexe/AbstractInterpretation.h +1 -1
- package/SVF-linux/Release-build/include/DDA/ContextDDA.h +2 -2
- package/SVF-linux/Release-build/include/DDA/DDAVFSolver.h +5 -5
- package/SVF-linux/Release-build/include/DDA/FlowDDA.h +1 -1
- package/SVF-linux/Release-build/include/Graphs/ICFG.h +2 -2
- package/SVF-linux/Release-build/include/Graphs/ThreadCallGraph.h +24 -24
- package/SVF-linux/Release-build/include/Graphs/VFG.h +4 -4
- package/SVF-linux/Release-build/include/MSSA/MemRegion.h +4 -4
- package/SVF-linux/Release-build/include/MTA/LockAnalysis.h +1 -1
- package/SVF-linux/Release-build/include/MTA/MHP.h +2 -2
- package/SVF-linux/Release-build/include/MTA/PCG.h +3 -3
- package/SVF-linux/Release-build/include/MTA/TCT.h +7 -7
- package/SVF-linux/Release-build/include/MemoryModel/PointerAnalysis.h +13 -13
- package/SVF-linux/Release-build/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-linux/Release-build/include/SABER/SrcSnkDDA.h +7 -7
- package/SVF-linux/Release-build/include/SVF-LLVM/SVFIRBuilder.h +1 -1
- package/SVF-linux/Release-build/include/Util/CallGraphBuilder.h +5 -5
- package/SVF-linux/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/lib/libSvfLLVM.a +0 -0
- package/SVF-osx/Release-build/bin/ae +0 -0
- package/SVF-osx/Release-build/bin/cfl +0 -0
- package/SVF-osx/Release-build/bin/dvf +0 -0
- package/SVF-osx/Release-build/bin/llvm2svf +0 -0
- package/SVF-osx/Release-build/bin/mta +0 -0
- package/SVF-osx/Release-build/bin/saber +0 -0
- package/SVF-osx/Release-build/bin/svf-ex +0 -0
- package/SVF-osx/Release-build/bin/wpa +0 -0
- package/SVF-osx/Release-build/include/AE/Svfexe/AbstractInterpretation.h +1 -1
- package/SVF-osx/Release-build/include/DDA/ContextDDA.h +2 -2
- package/SVF-osx/Release-build/include/DDA/DDAVFSolver.h +5 -5
- package/SVF-osx/Release-build/include/DDA/FlowDDA.h +1 -1
- package/SVF-osx/Release-build/include/Graphs/ICFG.h +2 -2
- package/SVF-osx/Release-build/include/Graphs/ThreadCallGraph.h +24 -30
- package/SVF-osx/Release-build/include/Graphs/VFG.h +4 -4
- package/SVF-osx/Release-build/include/MSSA/MemRegion.h +4 -4
- package/SVF-osx/Release-build/include/MTA/LockAnalysis.h +42 -32
- package/SVF-osx/Release-build/include/MTA/MHP.h +34 -54
- package/SVF-osx/Release-build/include/MTA/MTAStat.h +1 -2
- package/SVF-osx/Release-build/include/MTA/TCT.h +43 -25
- package/SVF-osx/Release-build/include/MemoryModel/PointerAnalysis.h +13 -13
- package/SVF-osx/Release-build/include/SABER/SaberSVFGBuilder.h +1 -1
- package/SVF-osx/Release-build/include/SABER/SrcSnkDDA.h +7 -7
- package/SVF-osx/Release-build/include/SVF-LLVM/SVFIRBuilder.h +1 -1
- package/SVF-osx/Release-build/include/Util/CallGraphBuilder.h +5 -5
- package/SVF-osx/Release-build/include/Util/CxtStmt.h +13 -12
- package/SVF-osx/Release-build/include/Util/Options.h +1 -20
- package/SVF-osx/Release-build/include/Util/SVFUtil.h +8 -43
- package/SVF-osx/Release-build/include/Util/ThreadAPI.h +42 -85
- package/SVF-osx/Release-build/lib/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/lib/libSvfLLVM.a +0 -0
- package/package.json +1 -1
- package/SVF-osx/Release-build/include/MTA/FSMPTA.h +0 -270
- package/SVF-osx/Release-build/include/MTA/MTAResultValidator.h +0 -448
- package/SVF-osx/Release-build/include/MTA/PCG.h +0 -229
- /package/{SVF-osx → SVF-linux}/Release-build/include/Graphs/PTACallGraph.h +0 -0
- /package/{SVF-linux → SVF-osx}/Release-build/include/Graphs/CallGraph.h +0 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -111,7 +111,7 @@ class AbstractInterpretation
|
|
|
111
111
|
|
|
112
112
|
public:
|
|
113
113
|
enum ExtAPIType { UNCLASSIFIED, MEMCPY, MEMSET, STRCPY, STRCAT };
|
|
114
|
-
typedef SCCDetection<
|
|
114
|
+
typedef SCCDetection<PTACallGraph*> CallGraphSCC;
|
|
115
115
|
/// Constructor
|
|
116
116
|
AbstractInterpretation();
|
|
117
117
|
|
|
@@ -133,8 +133,8 @@ public:
|
|
|
133
133
|
/// Whether call/return inside recursion
|
|
134
134
|
inline virtual bool isEdgeInRecursion(CallSiteID csId)
|
|
135
135
|
{
|
|
136
|
-
const SVFFunction* caller =
|
|
137
|
-
const SVFFunction* callee =
|
|
136
|
+
const SVFFunction* caller = getPTACallGraph()->getCallerOfCallSite(csId);
|
|
137
|
+
const SVFFunction* callee = getPTACallGraph()->getCalleeOfCallSite(csId);
|
|
138
138
|
return inSameCallGraphSCC(caller, callee);
|
|
139
139
|
}
|
|
140
140
|
/// Update call graph.
|
|
@@ -49,8 +49,8 @@ class DDAVFSolver
|
|
|
49
49
|
friend class DDAStat;
|
|
50
50
|
public:
|
|
51
51
|
typedef SCCDetection<SVFG*> SVFGSCC;
|
|
52
|
-
typedef SCCDetection<
|
|
53
|
-
typedef
|
|
52
|
+
typedef SCCDetection<PTACallGraph*> CallGraphSCC;
|
|
53
|
+
typedef PTACallGraphEdge::CallInstSet CallInstSet;
|
|
54
54
|
typedef SVFIR::CallSiteSet CallSiteSet;
|
|
55
55
|
typedef OrderedSet<DPIm> DPTItemSet;
|
|
56
56
|
typedef OrderedMap<DPIm, CPtSet> DPImToCPtSetMap;
|
|
@@ -505,7 +505,7 @@ protected:
|
|
|
505
505
|
{
|
|
506
506
|
CallInstSet csSet;
|
|
507
507
|
/// use pre-analysis call graph to approximate all potential callsites
|
|
508
|
-
_ander->
|
|
508
|
+
_ander->getPTACallGraph()->getIndCallSitesInvokingCallee(fun,csSet);
|
|
509
509
|
for(CallInstSet::const_iterator it = csSet.begin(), eit = csSet.end(); it!=eit; ++it)
|
|
510
510
|
{
|
|
511
511
|
NodeID funPtr = _pag->getFunPtr(*it);
|
|
@@ -624,7 +624,7 @@ protected:
|
|
|
624
624
|
return (getSVFGSCCRepNode(edge->getSrcID()) == getSVFGSCCRepNode(edge->getDstID()));
|
|
625
625
|
}
|
|
626
626
|
/// Set callgraph
|
|
627
|
-
inline void setCallGraph (
|
|
627
|
+
inline void setCallGraph (PTACallGraph* cg)
|
|
628
628
|
{
|
|
629
629
|
_callGraph = cg;
|
|
630
630
|
}
|
|
@@ -775,7 +775,7 @@ protected:
|
|
|
775
775
|
SVFG* _svfg; ///< SVFG
|
|
776
776
|
AndersenWaveDiff* _ander; ///< Andersen's analysis
|
|
777
777
|
NodeBS candidateQueries; ///< candidate pointers;
|
|
778
|
-
|
|
778
|
+
PTACallGraph* _callGraph; ///< CallGraph
|
|
779
779
|
CallGraphSCC* _callGraphSCC; ///< SCC for CallGraph
|
|
780
780
|
SVFGSCC* _svfgSCC; ///< SCC for SVFG
|
|
781
781
|
DPTItemSet backwardVisited; ///< visited map during backward traversing
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
namespace SVF
|
|
39
39
|
{
|
|
40
40
|
|
|
41
|
-
class
|
|
41
|
+
class PTACallGraph;
|
|
42
42
|
|
|
43
43
|
/*!
|
|
44
44
|
* Interprocedural Control-Flow Graph (ICFG)
|
|
@@ -117,7 +117,7 @@ public:
|
|
|
117
117
|
void view();
|
|
118
118
|
|
|
119
119
|
/// update ICFG for indirect calls
|
|
120
|
-
void updateCallGraph(
|
|
120
|
+
void updateCallGraph(PTACallGraph* callgraph);
|
|
121
121
|
|
|
122
122
|
/// Whether node is in a loop
|
|
123
123
|
inline bool isInLoop(const ICFGNode *node)
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
#ifndef RCG_H_
|
|
31
31
|
#define RCG_H_
|
|
32
32
|
|
|
33
|
-
#include "Graphs/
|
|
33
|
+
#include "Graphs/PTACallGraph.h"
|
|
34
34
|
#include "MemoryModel/PointerAnalysisImpl.h"
|
|
35
35
|
|
|
36
36
|
namespace SVF
|
|
@@ -41,13 +41,13 @@ class ThreadAPI;
|
|
|
41
41
|
/*!
|
|
42
42
|
* PTA thread fork edge from fork site to the entry of a start routine function
|
|
43
43
|
*/
|
|
44
|
-
class ThreadForkEdge: public
|
|
44
|
+
class ThreadForkEdge: public PTACallGraphEdge
|
|
45
45
|
{
|
|
46
46
|
|
|
47
47
|
public:
|
|
48
48
|
/// Constructor
|
|
49
|
-
ThreadForkEdge(
|
|
50
|
-
|
|
49
|
+
ThreadForkEdge(PTACallGraphNode* s, PTACallGraphNode* d, CallSiteID csId) :
|
|
50
|
+
PTACallGraphEdge(s, d, PTACallGraphEdge::TDForkEdge, csId)
|
|
51
51
|
{
|
|
52
52
|
}
|
|
53
53
|
/// Destructor
|
|
@@ -61,9 +61,9 @@ public:
|
|
|
61
61
|
{
|
|
62
62
|
return true;
|
|
63
63
|
}
|
|
64
|
-
static inline bool classof(const
|
|
64
|
+
static inline bool classof(const PTACallGraphEdge *edge)
|
|
65
65
|
{
|
|
66
|
-
return edge->getEdgeKind() ==
|
|
66
|
+
return edge->getEdgeKind() == PTACallGraphEdge::TDForkEdge;
|
|
67
67
|
}
|
|
68
68
|
//@}
|
|
69
69
|
|
|
@@ -78,19 +78,19 @@ public:
|
|
|
78
78
|
return rawstr.str();
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
typedef GenericNode<
|
|
81
|
+
typedef GenericNode<PTACallGraphNode, ThreadForkEdge>::GEdgeSetTy ForkEdgeSet;
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
/*!
|
|
85
85
|
* PTA thread join edge from the exit of a start routine function to a join point of the thread
|
|
86
86
|
*/
|
|
87
|
-
class ThreadJoinEdge: public
|
|
87
|
+
class ThreadJoinEdge: public PTACallGraphEdge
|
|
88
88
|
{
|
|
89
89
|
|
|
90
90
|
public:
|
|
91
91
|
/// Constructor
|
|
92
|
-
ThreadJoinEdge(
|
|
93
|
-
|
|
92
|
+
ThreadJoinEdge(PTACallGraphNode* s, PTACallGraphNode* d, CallSiteID csId) :
|
|
93
|
+
PTACallGraphEdge(s, d, PTACallGraphEdge::TDJoinEdge, csId)
|
|
94
94
|
{
|
|
95
95
|
}
|
|
96
96
|
/// Destructor
|
|
@@ -102,9 +102,9 @@ public:
|
|
|
102
102
|
{
|
|
103
103
|
return true;
|
|
104
104
|
}
|
|
105
|
-
static inline bool classof(const
|
|
105
|
+
static inline bool classof(const PTACallGraphEdge *edge)
|
|
106
106
|
{
|
|
107
|
-
return edge->getEdgeKind() ==
|
|
107
|
+
return edge->getEdgeKind() == PTACallGraphEdge::TDJoinEdge;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
virtual const std::string toString() const
|
|
@@ -118,19 +118,19 @@ public:
|
|
|
118
118
|
return rawstr.str();
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
typedef GenericNode<
|
|
121
|
+
typedef GenericNode<PTACallGraphNode, ThreadJoinEdge>::GEdgeSetTy JoinEdgeSet;
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
/*!
|
|
125
125
|
* hare_parallel_for edge from fork site to the entry of a start routine function
|
|
126
126
|
*/
|
|
127
|
-
class HareParForEdge: public
|
|
127
|
+
class HareParForEdge: public PTACallGraphEdge
|
|
128
128
|
{
|
|
129
129
|
|
|
130
130
|
public:
|
|
131
131
|
/// Constructor
|
|
132
|
-
HareParForEdge(
|
|
133
|
-
|
|
132
|
+
HareParForEdge(PTACallGraphNode* s, PTACallGraphNode* d, CallSiteID csId) :
|
|
133
|
+
PTACallGraphEdge(s, d, PTACallGraphEdge::HareParForEdge, csId)
|
|
134
134
|
{
|
|
135
135
|
}
|
|
136
136
|
/// Destructor
|
|
@@ -144,20 +144,20 @@ public:
|
|
|
144
144
|
{
|
|
145
145
|
return true;
|
|
146
146
|
}
|
|
147
|
-
static inline bool classof(const
|
|
147
|
+
static inline bool classof(const PTACallGraphEdge *edge)
|
|
148
148
|
{
|
|
149
|
-
return edge->getEdgeKind() ==
|
|
149
|
+
return edge->getEdgeKind() == PTACallGraphEdge::HareParForEdge;
|
|
150
150
|
}
|
|
151
151
|
//@}
|
|
152
152
|
|
|
153
|
-
typedef GenericNode<
|
|
153
|
+
typedef GenericNode<PTACallGraphNode, HareParForEdge>::GEdgeSetTy ParForEdgeSet;
|
|
154
154
|
};
|
|
155
155
|
|
|
156
156
|
|
|
157
157
|
/*!
|
|
158
158
|
* Thread sensitive call graph
|
|
159
159
|
*/
|
|
160
|
-
class ThreadCallGraph: public
|
|
160
|
+
class ThreadCallGraph: public PTACallGraph
|
|
161
161
|
{
|
|
162
162
|
|
|
163
163
|
public:
|
|
@@ -186,9 +186,9 @@ public:
|
|
|
186
186
|
{
|
|
187
187
|
return true;
|
|
188
188
|
}
|
|
189
|
-
static inline bool classof(const
|
|
189
|
+
static inline bool classof(const PTACallGraph *g)
|
|
190
190
|
{
|
|
191
|
-
return g->getKind() ==
|
|
191
|
+
return g->getKind() == PTACallGraph::ThdCallGraph;
|
|
192
192
|
}
|
|
193
193
|
//@}
|
|
194
194
|
|
|
@@ -237,7 +237,7 @@ public:
|
|
|
237
237
|
assert(it != callinstToThreadJoinEdgesMap.end() && "call instruction does not have a valid callee");
|
|
238
238
|
return it->second.end();
|
|
239
239
|
}
|
|
240
|
-
inline void getJoinSites(const
|
|
240
|
+
inline void getJoinSites(const PTACallGraphNode* routine, InstSet& csSet)
|
|
241
241
|
{
|
|
242
242
|
for(CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.begin(), eit = callinstToThreadJoinEdgesMap.end(); it!=eit; ++it)
|
|
243
243
|
{
|
|
@@ -394,7 +394,7 @@ public:
|
|
|
394
394
|
}
|
|
395
395
|
|
|
396
396
|
/// has thread join edge
|
|
397
|
-
inline ThreadJoinEdge* hasThreadJoinEdge(const CallICFGNode* call,
|
|
397
|
+
inline ThreadJoinEdge* hasThreadJoinEdge(const CallICFGNode* call, PTACallGraphNode* joinFunNode, PTACallGraphNode* threadRoutineFunNode, CallSiteID csId) const
|
|
398
398
|
{
|
|
399
399
|
ThreadJoinEdge joinEdge(joinFunNode,threadRoutineFunNode, csId);
|
|
400
400
|
CallInstToJoinEdgesMap::const_iterator it = callinstToThreadJoinEdgesMap.find(call);
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
#include "SVFIR/SVFIR.h"
|
|
35
|
-
#include "Graphs/
|
|
35
|
+
#include "Graphs/PTACallGraph.h"
|
|
36
36
|
#include "Graphs/VFGNode.h"
|
|
37
37
|
#include "Graphs/VFGEdge.h"
|
|
38
38
|
|
|
@@ -100,7 +100,7 @@ protected:
|
|
|
100
100
|
FunToVFGNodesMapTy funToVFGNodesMap; ///< map a function to its VFGNodes;
|
|
101
101
|
|
|
102
102
|
GlobalVFGNodeSet globalVFGNodes; ///< set of global store VFG nodes
|
|
103
|
-
|
|
103
|
+
PTACallGraph* callgraph;
|
|
104
104
|
SVFIR* pag;
|
|
105
105
|
VFGK kind;
|
|
106
106
|
|
|
@@ -109,7 +109,7 @@ protected:
|
|
|
109
109
|
|
|
110
110
|
public:
|
|
111
111
|
/// Constructor
|
|
112
|
-
VFG(
|
|
112
|
+
VFG(PTACallGraph* callgraph, VFGK k = FULLSVFG);
|
|
113
113
|
|
|
114
114
|
/// Destructor
|
|
115
115
|
virtual ~VFG()
|
|
@@ -136,7 +136,7 @@ public:
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/// Return CallGraph
|
|
139
|
-
inline
|
|
139
|
+
inline PTACallGraph* getCallGraph() const
|
|
140
140
|
{
|
|
141
141
|
return callgraph;
|
|
142
142
|
}
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
#define MEMORYREGION_H_
|
|
36
36
|
|
|
37
37
|
#include "Graphs/ICFG.h"
|
|
38
|
-
#include "Graphs/
|
|
38
|
+
#include "Graphs/PTACallGraph.h"
|
|
39
39
|
#include "Graphs/SCC.h"
|
|
40
40
|
#include "SVFIR/SVFIR.h"
|
|
41
41
|
#include "Util/WorkList.h"
|
|
@@ -175,7 +175,7 @@ public:
|
|
|
175
175
|
/// SVFIR edge list
|
|
176
176
|
typedef SVFIR::SVFStmtList SVFStmtList;
|
|
177
177
|
/// Call Graph SCC
|
|
178
|
-
typedef SCCDetection<
|
|
178
|
+
typedef SCCDetection<PTACallGraph*> SCC;
|
|
179
179
|
|
|
180
180
|
MRSet& getMRSet()
|
|
181
181
|
{
|
|
@@ -196,7 +196,7 @@ private:
|
|
|
196
196
|
|
|
197
197
|
BVDataPTAImpl* pta;
|
|
198
198
|
SCC* callGraphSCC;
|
|
199
|
-
|
|
199
|
+
PTACallGraph* callGraph;
|
|
200
200
|
bool ptrOnlyMSSA;
|
|
201
201
|
|
|
202
202
|
/// Map a function to all its memory regions
|
|
@@ -330,7 +330,7 @@ protected:
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
/// Mod-Ref analysis for callsite invoking this callGraphNode
|
|
333
|
-
virtual void modRefAnalysis(
|
|
333
|
+
virtual void modRefAnalysis(PTACallGraphNode* callGraphNode, WorkList& worklist);
|
|
334
334
|
|
|
335
335
|
/// Get Mod-Ref of a callee function
|
|
336
336
|
virtual bool handleCallsiteModRef(NodeBS& mod, NodeBS& ref, const CallICFGNode* cs, const SVFFunction* fun);
|
|
@@ -339,7 +339,7 @@ private:
|
|
|
339
339
|
void handleIntra(const CxtStmt& cts);
|
|
340
340
|
|
|
341
341
|
/// Handle call relations
|
|
342
|
-
void handleCallRelation(CxtLockProc& clp, const
|
|
342
|
+
void handleCallRelation(CxtLockProc& clp, const PTACallGraphEdge* cgEdge, CallSite call);
|
|
343
343
|
|
|
344
344
|
/// Return true it a lock matches an unlock
|
|
345
345
|
bool isAliasedLocks(const CxtLock& cl1, const CxtLock& cl2)
|
|
@@ -140,7 +140,7 @@ public:
|
|
|
140
140
|
|
|
141
141
|
private:
|
|
142
142
|
|
|
143
|
-
inline const
|
|
143
|
+
inline const PTACallGraph::FunctionSet& getCallee(const SVFInstruction* inst, PTACallGraph::FunctionSet& callees)
|
|
144
144
|
{
|
|
145
145
|
tcg->getCallees(getCBN(inst), callees);
|
|
146
146
|
return callees;
|
|
@@ -501,7 +501,7 @@ private:
|
|
|
501
501
|
{
|
|
502
502
|
return getTCG()->getThreadAPI()->getJoinedThread(call);
|
|
503
503
|
}
|
|
504
|
-
inline const
|
|
504
|
+
inline const PTACallGraph::FunctionSet& getCallee(const SVFInstruction* inst, PTACallGraph::FunctionSet& callees)
|
|
505
505
|
{
|
|
506
506
|
getTCG()->getCallees(getCBN(inst), callees);
|
|
507
507
|
return callees;
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
#define PCG_H_
|
|
32
32
|
|
|
33
33
|
#include "Util/ThreadAPI.h"
|
|
34
|
-
#include "Graphs/
|
|
34
|
+
#include "Graphs/PTACallGraph.h"
|
|
35
35
|
#include "Util/WorkList.h"
|
|
36
36
|
#include "WPA/Andersen.h"
|
|
37
37
|
#include <set>
|
|
@@ -62,7 +62,7 @@ private:
|
|
|
62
62
|
FunSet spawnees;
|
|
63
63
|
FunSet followers;
|
|
64
64
|
FunSet mhpfuns;
|
|
65
|
-
|
|
65
|
+
PTACallGraph* callgraph;
|
|
66
66
|
SVFModule* mod;
|
|
67
67
|
PointerAnalysis* pta;
|
|
68
68
|
ThreadAPI* tdAPI;
|
|
@@ -134,7 +134,7 @@ public:
|
|
|
134
134
|
{
|
|
135
135
|
mod = pta->getModule();
|
|
136
136
|
tdAPI=ThreadAPI::getThreadAPI();
|
|
137
|
-
callgraph = pta->
|
|
137
|
+
callgraph = pta->getPTACallGraph();
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
/// We start the pass here
|
|
@@ -142,19 +142,19 @@ public:
|
|
|
142
142
|
typedef Set<const SVFFunction*> FunSet;
|
|
143
143
|
typedef std::vector<const SVFInstruction*> InstVec;
|
|
144
144
|
typedef Set<const SVFInstruction*> InstSet;
|
|
145
|
-
typedef Set<const
|
|
145
|
+
typedef Set<const PTACallGraphNode*> PTACGNodeSet;
|
|
146
146
|
typedef Map<CxtThread,TCTNode*> CxtThreadToNodeMap;
|
|
147
147
|
typedef Map<CxtThread,CallStrCxt> CxtThreadToForkCxt;
|
|
148
148
|
typedef Map<CxtThread,const SVFFunction*> CxtThreadToFun;
|
|
149
149
|
typedef Map<const SVFInstruction*, LoopBBs> InstToLoopMap;
|
|
150
150
|
typedef FIFOWorkList<CxtThreadProc> CxtThreadProcVec;
|
|
151
151
|
typedef Set<CxtThreadProc> CxtThreadProcSet;
|
|
152
|
-
typedef SCCDetection<
|
|
152
|
+
typedef SCCDetection<PTACallGraph*> ThreadCallGraphSCC;
|
|
153
153
|
|
|
154
154
|
/// Constructor
|
|
155
155
|
TCT(PointerAnalysis* p) :pta(p),TCTNodeNum(0),TCTEdgeNum(0),MaxCxtSize(0)
|
|
156
156
|
{
|
|
157
|
-
tcg = SVFUtil::cast<ThreadCallGraph>(pta->
|
|
157
|
+
tcg = SVFUtil::cast<ThreadCallGraph>(pta->getPTACallGraph());
|
|
158
158
|
tcg->updateCallGraph(pta);
|
|
159
159
|
//tcg->updateJoinEdge(pta);
|
|
160
160
|
tcgSCC = pta->getCallGraphSCC();
|
|
@@ -261,9 +261,9 @@ public:
|
|
|
261
261
|
//@}
|
|
262
262
|
|
|
263
263
|
/// Whether it is a candidate function for indirect call
|
|
264
|
-
inline bool isCandidateFun(const
|
|
264
|
+
inline bool isCandidateFun(const PTACallGraph::FunctionSet& callees) const
|
|
265
265
|
{
|
|
266
|
-
for(
|
|
266
|
+
for(PTACallGraph::FunctionSet::const_iterator cit = callees.begin(),
|
|
267
267
|
ecit = callees.end(); cit!=ecit; cit++)
|
|
268
268
|
{
|
|
269
269
|
if(candidateFuncSet.find((*cit))!=candidateFuncSet.end())
|
|
@@ -276,7 +276,7 @@ public:
|
|
|
276
276
|
return candidateFuncSet.find(fun)!=candidateFuncSet.end();
|
|
277
277
|
}
|
|
278
278
|
/// Whether two functions in the same callgraph scc
|
|
279
|
-
inline bool inSameCallGraphSCC(const
|
|
279
|
+
inline bool inSameCallGraphSCC(const PTACallGraphNode* src,const PTACallGraphNode* dst)
|
|
280
280
|
{
|
|
281
281
|
return (tcgSCC->repNode(src->getId()) == tcgSCC->repNode(dst->getId()));
|
|
282
282
|
}
|
|
@@ -479,7 +479,7 @@ private:
|
|
|
479
479
|
//@}
|
|
480
480
|
|
|
481
481
|
/// Handle call relations
|
|
482
|
-
void handleCallRelation(CxtThreadProc& ctp, const
|
|
482
|
+
void handleCallRelation(CxtThreadProc& ctp, const PTACallGraphEdge* cgEdge, CallSite call);
|
|
483
483
|
|
|
484
484
|
/// Get or create a tct node based on CxtThread
|
|
485
485
|
//@{
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
#include <signal.h>
|
|
35
35
|
|
|
36
36
|
#include "Graphs/CHG.h"
|
|
37
|
-
#include "Graphs/
|
|
37
|
+
#include "Graphs/PTACallGraph.h"
|
|
38
38
|
#include "Graphs/SCC.h"
|
|
39
39
|
#include "MemoryModel/AbstractPointsToDS.h"
|
|
40
40
|
#include "MemoryModel/ConditionalPT.h"
|
|
@@ -103,7 +103,7 @@ public:
|
|
|
103
103
|
typedef SVFIR::CallSiteToFunPtrMap CallSiteToFunPtrMap;
|
|
104
104
|
typedef Set<const SVFFunction*> FunctionSet;
|
|
105
105
|
typedef OrderedMap<const CallICFGNode*, FunctionSet> CallEdgeMap;
|
|
106
|
-
typedef SCCDetection<
|
|
106
|
+
typedef SCCDetection<PTACallGraph*> CallGraphSCC;
|
|
107
107
|
typedef Set<const SVFGlobalValue*> VTableSet;
|
|
108
108
|
typedef Set<const SVFFunction*> VFunSet;
|
|
109
109
|
//@}
|
|
@@ -148,7 +148,7 @@ protected:
|
|
|
148
148
|
/// Statistics
|
|
149
149
|
PTAStat* stat;
|
|
150
150
|
/// Call graph used for pointer analysis
|
|
151
|
-
|
|
151
|
+
PTACallGraph* ptaCallGraph;
|
|
152
152
|
/// SCC for CallGraph
|
|
153
153
|
CallGraphSCC* callGraphSCC;
|
|
154
154
|
/// Interprocedural control-flow graph
|
|
@@ -165,12 +165,12 @@ public:
|
|
|
165
165
|
/// Return number of resolved indirect call edges
|
|
166
166
|
inline u32_t getNumOfResolvedIndCallEdge() const
|
|
167
167
|
{
|
|
168
|
-
return
|
|
168
|
+
return getPTACallGraph()->getNumOfResolvedIndCallEdge();
|
|
169
169
|
}
|
|
170
170
|
/// Return call graph
|
|
171
|
-
inline
|
|
171
|
+
inline PTACallGraph* getPTACallGraph() const
|
|
172
172
|
{
|
|
173
|
-
return
|
|
173
|
+
return ptaCallGraph;
|
|
174
174
|
}
|
|
175
175
|
/// Return call graph SCC
|
|
176
176
|
inline CallGraphSCC* getCallGraphSCC() const
|
|
@@ -367,15 +367,15 @@ public:
|
|
|
367
367
|
//@{
|
|
368
368
|
inline CallEdgeMap& getIndCallMap()
|
|
369
369
|
{
|
|
370
|
-
return
|
|
370
|
+
return getPTACallGraph()->getIndCallMap();
|
|
371
371
|
}
|
|
372
372
|
inline bool hasIndCSCallees(const CallICFGNode* cs) const
|
|
373
373
|
{
|
|
374
|
-
return
|
|
374
|
+
return getPTACallGraph()->hasIndCSCallees(cs);
|
|
375
375
|
}
|
|
376
376
|
inline const FunctionSet& getIndCSCallees(const CallICFGNode* cs) const
|
|
377
377
|
{
|
|
378
|
-
return
|
|
378
|
+
return getPTACallGraph()->getIndCSCallees(cs);
|
|
379
379
|
}
|
|
380
380
|
//@}
|
|
381
381
|
|
|
@@ -388,7 +388,7 @@ public:
|
|
|
388
388
|
inline void callGraphSCCDetection()
|
|
389
389
|
{
|
|
390
390
|
if(callGraphSCC==nullptr)
|
|
391
|
-
callGraphSCC = new CallGraphSCC(
|
|
391
|
+
callGraphSCC = new CallGraphSCC(ptaCallGraph);
|
|
392
392
|
|
|
393
393
|
callGraphSCC->find();
|
|
394
394
|
}
|
|
@@ -400,13 +400,13 @@ public:
|
|
|
400
400
|
/// Return TRUE if this edge is inside a CallGraph SCC, i.e., src node and dst node are in the same SCC on the SVFG.
|
|
401
401
|
inline bool inSameCallGraphSCC(const SVFFunction* fun1,const SVFFunction* fun2)
|
|
402
402
|
{
|
|
403
|
-
const
|
|
404
|
-
const
|
|
403
|
+
const PTACallGraphNode* src = ptaCallGraph->getCallGraphNode(fun1);
|
|
404
|
+
const PTACallGraphNode* dst = ptaCallGraph->getCallGraphNode(fun2);
|
|
405
405
|
return (getCallGraphSCCRepNode(src->getId()) == getCallGraphSCCRepNode(dst->getId()));
|
|
406
406
|
}
|
|
407
407
|
inline bool isInRecursion(const SVFFunction* fun) const
|
|
408
408
|
{
|
|
409
|
-
return callGraphSCC->isInCycle(
|
|
409
|
+
return callGraphSCC->isInCycle(ptaCallGraph->getCallGraphNode(fun)->getId());
|
|
410
410
|
}
|
|
411
411
|
/// Whether a local variable is in function recursions
|
|
412
412
|
bool isLocalVarInRecursiveFun(NodeID id) const;
|
|
@@ -89,7 +89,7 @@ protected:
|
|
|
89
89
|
|
|
90
90
|
/// Add actual parameter SVFGNode for 1st argument of a deallocation like external function
|
|
91
91
|
/// In order to path sensitive leak detection
|
|
92
|
-
virtual void AddExtActualParmSVFGNodes(
|
|
92
|
+
virtual void AddExtActualParmSVFGNodes(PTACallGraph* callgraph);
|
|
93
93
|
|
|
94
94
|
/// Collect memory pointed global pointers,
|
|
95
95
|
/// note that this collection is recursively performed, for example gp-->obj-->obj'
|
|
@@ -76,13 +76,13 @@ private:
|
|
|
76
76
|
protected:
|
|
77
77
|
SaberSVFGBuilder memSSA;
|
|
78
78
|
SVFG* svfg;
|
|
79
|
-
|
|
79
|
+
PTACallGraph* ptaCallGraph;
|
|
80
80
|
SVFBugReport report; /// Bug Reporter
|
|
81
81
|
|
|
82
82
|
public:
|
|
83
83
|
|
|
84
84
|
/// Constructor
|
|
85
|
-
SrcSnkDDA() : _curSlice(nullptr), svfg(nullptr),
|
|
85
|
+
SrcSnkDDA() : _curSlice(nullptr), svfg(nullptr), ptaCallGraph(nullptr)
|
|
86
86
|
{
|
|
87
87
|
saberCondAllocator = std::make_unique<SaberCondAllocator>();
|
|
88
88
|
}
|
|
@@ -95,9 +95,9 @@ public:
|
|
|
95
95
|
_curSlice = nullptr;
|
|
96
96
|
|
|
97
97
|
/// the following shared by multiple checkers, thus can not be released.
|
|
98
|
-
//if (
|
|
99
|
-
// delete
|
|
100
|
-
//
|
|
98
|
+
//if (ptaCallGraph != nullptr)
|
|
99
|
+
// delete ptaCallGraph;
|
|
100
|
+
//ptaCallGraph = nullptr;
|
|
101
101
|
|
|
102
102
|
//if(pathCondAllocator)
|
|
103
103
|
// delete pathCondAllocator;
|
|
@@ -129,9 +129,9 @@ public:
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
/// Get Callgraph
|
|
132
|
-
inline
|
|
132
|
+
inline PTACallGraph* getCallgraph() const
|
|
133
133
|
{
|
|
134
|
-
return
|
|
134
|
+
return ptaCallGraph;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
/// Whether this svfg node may access global variable
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
#ifndef INCLUDE_SVF_FE_CALLGRAPHBUILDER_H_
|
|
32
32
|
#define INCLUDE_SVF_FE_CALLGRAPHBUILDER_H_
|
|
33
33
|
|
|
34
|
-
#include "Graphs/
|
|
34
|
+
#include "Graphs/PTACallGraph.h"
|
|
35
35
|
#include "Graphs/ThreadCallGraph.h"
|
|
36
36
|
|
|
37
37
|
namespace SVF
|
|
@@ -43,15 +43,15 @@ class CallGraphBuilder
|
|
|
43
43
|
{
|
|
44
44
|
|
|
45
45
|
protected:
|
|
46
|
-
|
|
46
|
+
PTACallGraph* callgraph;
|
|
47
47
|
ICFG* icfg;
|
|
48
48
|
public:
|
|
49
|
-
CallGraphBuilder(
|
|
49
|
+
CallGraphBuilder(PTACallGraph* cg, ICFG* i): callgraph(cg),icfg(i)
|
|
50
50
|
{
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/// Build normal callgraph
|
|
54
|
-
|
|
54
|
+
PTACallGraph* buildCallGraph(SVFModule* svfModule);
|
|
55
55
|
|
|
56
56
|
};
|
|
57
57
|
|
|
@@ -64,7 +64,7 @@ public:
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/// Build thread-aware callgraph
|
|
67
|
-
|
|
67
|
+
PTACallGraph* buildThreadCallGraph(SVFModule* svfModule);
|
|
68
68
|
|
|
69
69
|
};
|
|
70
70
|
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -111,7 +111,7 @@ class AbstractInterpretation
|
|
|
111
111
|
|
|
112
112
|
public:
|
|
113
113
|
enum ExtAPIType { UNCLASSIFIED, MEMCPY, MEMSET, STRCPY, STRCAT };
|
|
114
|
-
typedef SCCDetection<
|
|
114
|
+
typedef SCCDetection<CallGraph*> CallGraphSCC;
|
|
115
115
|
/// Constructor
|
|
116
116
|
AbstractInterpretation();
|
|
117
117
|
|