svf-tools 1.0.976 → 1.0.977
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/package.json +1 -1
- package/svf/include/AE/Svfexe/AbstractInterpretation.h +1 -1
- package/svf/include/DDA/ContextDDA.h +2 -2
- package/svf/include/DDA/DDAVFSolver.h +5 -5
- package/svf/include/DDA/FlowDDA.h +1 -1
- package/svf/include/Graphs/ICFG.h +2 -2
- package/svf/include/Graphs/{CallGraph.h → PTACallGraph.h} +41 -41
- package/svf/include/Graphs/ThreadCallGraph.h +24 -24
- package/svf/include/Graphs/VFG.h +4 -4
- package/svf/include/MSSA/MemRegion.h +4 -4
- package/svf/include/MTA/LockAnalysis.h +1 -1
- package/svf/include/MTA/MHP.h +2 -2
- package/svf/include/MTA/PCG.h +3 -3
- package/svf/include/MTA/TCT.h +7 -7
- package/svf/include/MemoryModel/PointerAnalysis.h +13 -13
- package/svf/include/SABER/SaberSVFGBuilder.h +1 -1
- package/svf/include/SABER/SrcSnkDDA.h +7 -7
- package/svf/include/Util/CallGraphBuilder.h +5 -5
- package/svf/lib/AE/Svfexe/AbstractInterpretation.cpp +1 -1
- package/svf/lib/CFL/CFLSVFGBuilder.cpp +1 -1
- package/svf/lib/DDA/ContextDDA.cpp +9 -9
- package/svf/lib/DDA/DDAClient.cpp +3 -3
- package/svf/lib/DDA/DDAPass.cpp +4 -4
- package/svf/lib/DDA/FlowDDA.cpp +2 -2
- package/svf/lib/Graphs/ICFG.cpp +6 -6
- package/svf/lib/Graphs/{CallGraph.cpp → PTACallGraph.cpp} +66 -66
- package/svf/lib/Graphs/SVFG.cpp +7 -7
- package/svf/lib/Graphs/SVFGReadWrite.cpp +6 -6
- package/svf/lib/Graphs/SVFGStat.cpp +1 -1
- package/svf/lib/Graphs/ThreadCallGraph.cpp +17 -17
- package/svf/lib/Graphs/VFG.cpp +1 -1
- package/svf/lib/MSSA/MemRegion.cpp +7 -7
- package/svf/lib/MTA/LockAnalysis.cpp +18 -18
- package/svf/lib/MTA/MHP.cpp +19 -19
- package/svf/lib/MTA/MTA.cpp +1 -1
- package/svf/lib/MTA/PCG.cpp +12 -12
- package/svf/lib/MTA/TCT.cpp +23 -23
- package/svf/lib/MemoryModel/PointerAnalysis.cpp +12 -12
- package/svf/lib/SABER/LeakChecker.cpp +4 -4
- package/svf/lib/SABER/SaberSVFGBuilder.cpp +4 -4
- package/svf/lib/SABER/SrcSnkDDA.cpp +1 -1
- package/svf/lib/Util/CallGraphBuilder.cpp +2 -2
- package/svf/lib/Util/PTAStat.cpp +7 -7
- package/svf/lib/WPA/VersionedFlowSensitive.cpp +2 -2
- package/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +1 -1
- package/svf-llvm/lib/SVFIRBuilder.cpp +5 -5
- package/svf-llvm/tools/AE/ae.cpp +1 -1
- package/svf-llvm/tools/Example/svf-ex.cpp +1 -1
- package/svf-llvm/tools/MTA/LockResultValidator.cpp +2 -2
|
@@ -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
|
|
|
@@ -131,7 +131,7 @@ void AbstractInterpretation::initWTO()
|
|
|
131
131
|
// Detect if the call graph has cycles by finding its strongly connected components (SCC)
|
|
132
132
|
Andersen::CallGraphSCC* callGraphScc = ander->getCallGraphSCC();
|
|
133
133
|
callGraphScc->find();
|
|
134
|
-
auto callGraph = ander->
|
|
134
|
+
auto callGraph = ander->getPTACallGraph();
|
|
135
135
|
|
|
136
136
|
// Iterate through the call graph
|
|
137
137
|
for (auto it = callGraph->begin(); it != callGraph->end(); it++)
|
|
@@ -63,7 +63,7 @@ void ContextDDA::initialize()
|
|
|
63
63
|
{
|
|
64
64
|
CondPTAImpl<ContextCond>::initialize();
|
|
65
65
|
buildSVFG(pag);
|
|
66
|
-
setCallGraph(
|
|
66
|
+
setCallGraph(getPTACallGraph());
|
|
67
67
|
setCallGraphSCC(getCallGraphSCC());
|
|
68
68
|
stat = setDDAStat(new DDAStat(this));
|
|
69
69
|
flowDDA->initialize();
|
|
@@ -219,9 +219,9 @@ CallSiteID ContextDDA::getCSIDAtCall(CxtLocDPItem&, const SVFGEdge* edge)
|
|
|
219
219
|
const CallICFGNode* cbn = getSVFG()->getCallSite(svfg_csId);
|
|
220
220
|
const SVFFunction* callee = edge->getDstNode()->getFun();
|
|
221
221
|
|
|
222
|
-
if(
|
|
222
|
+
if(getPTACallGraph()->hasCallSiteID(cbn,callee))
|
|
223
223
|
{
|
|
224
|
-
return
|
|
224
|
+
return getPTACallGraph()->getCallSiteID(cbn,callee);
|
|
225
225
|
}
|
|
226
226
|
|
|
227
227
|
return 0;
|
|
@@ -243,9 +243,9 @@ CallSiteID ContextDDA::getCSIDAtRet(CxtLocDPItem&, const SVFGEdge* edge)
|
|
|
243
243
|
const CallICFGNode* cbn = getSVFG()->getCallSite(svfg_csId);
|
|
244
244
|
const SVFFunction* callee = edge->getSrcNode()->getFun();
|
|
245
245
|
|
|
246
|
-
if(
|
|
246
|
+
if(getPTACallGraph()->hasCallSiteID(cbn,callee))
|
|
247
247
|
{
|
|
248
|
-
return
|
|
248
|
+
return getPTACallGraph()->getCallSiteID(cbn,callee);
|
|
249
249
|
}
|
|
250
250
|
|
|
251
251
|
return 0;
|
|
@@ -265,8 +265,8 @@ bool ContextDDA::handleBKCondition(CxtLocDPItem& dpm, const SVFGEdge* edge)
|
|
|
265
265
|
|
|
266
266
|
if(isEdgeInRecursion(csId))
|
|
267
267
|
{
|
|
268
|
-
DBOUT(DDDA,outs() << "\t\t call edge " <<
|
|
269
|
-
"=>" <<
|
|
268
|
+
DBOUT(DDDA,outs() << "\t\t call edge " << getPTACallGraph()->getCallerOfCallSite(csId)->getName() <<
|
|
269
|
+
"=>" << getPTACallGraph()->getCalleeOfCallSite(csId)->getName() << "in recursion \n");
|
|
270
270
|
popRecursiveCallSites(dpm);
|
|
271
271
|
}
|
|
272
272
|
else
|
|
@@ -293,8 +293,8 @@ bool ContextDDA::handleBKCondition(CxtLocDPItem& dpm, const SVFGEdge* edge)
|
|
|
293
293
|
|
|
294
294
|
if(isEdgeInRecursion(csId))
|
|
295
295
|
{
|
|
296
|
-
DBOUT(DDDA,outs() << "\t\t return edge " <<
|
|
297
|
-
"=>" <<
|
|
296
|
+
DBOUT(DDDA,outs() << "\t\t return edge " << getPTACallGraph()->getCalleeOfCallSite(csId)->getName() <<
|
|
297
|
+
"=>" << getPTACallGraph()->getCallerOfCallSite(csId)->getName() << "in recursion \n");
|
|
298
298
|
popRecursiveCallSites(dpm);
|
|
299
299
|
}
|
|
300
300
|
else
|
|
@@ -115,7 +115,7 @@ void FunptrDDAClient::performStat(PointerAnalysis* pta)
|
|
|
115
115
|
const PointsTo& ddaPts = pta->getPts(vtptr);
|
|
116
116
|
const PointsTo& anderPts = ander->getPts(vtptr);
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
PTACallGraph* callgraph = ander->getPTACallGraph();
|
|
119
119
|
const CallICFGNode* cbn = nIter->second;
|
|
120
120
|
|
|
121
121
|
if(!callgraph->hasIndCSCallees(cbn))
|
|
@@ -124,7 +124,7 @@ void FunptrDDAClient::performStat(PointerAnalysis* pta)
|
|
|
124
124
|
continue;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
const
|
|
127
|
+
const PTACallGraph::FunctionSet& callees = callgraph->getIndCSCallees(cbn);
|
|
128
128
|
totalCallsites++;
|
|
129
129
|
if(callees.size() == 0)
|
|
130
130
|
zeroTargetCallsites++;
|
|
@@ -162,7 +162,7 @@ void FunptrDDAClient::performStat(PointerAnalysis* pta)
|
|
|
162
162
|
outs() << "=================================================\n";
|
|
163
163
|
outs() << "Total virtual callsites: " << vtableToCallSiteMap.size() << "\n";
|
|
164
164
|
outs() << "Total analyzed virtual callsites: " << totalCallsites << "\n";
|
|
165
|
-
outs() << "Indirect call map size: " << ander->
|
|
165
|
+
outs() << "Indirect call map size: " << ander->getPTACallGraph()->getIndCallMap().size() << "\n";
|
|
166
166
|
outs() << "Precise callsites: " << morePreciseCallsites << "\n";
|
|
167
167
|
outs() << "Zero target callsites: " << zeroTargetCallsites << "\n";
|
|
168
168
|
outs() << "One target callsites: " << oneTargetCallsites << "\n";
|
package/svf/lib/DDA/DDAPass.cpp
CHANGED
|
@@ -239,8 +239,8 @@ void DDAPass::collectCxtInsenEdgeForVFCycle(PointerAnalysis* pta, const SVFG* sv
|
|
|
239
239
|
|
|
240
240
|
if(srcFun && dstFun)
|
|
241
241
|
{
|
|
242
|
-
NodeID src = pta->
|
|
243
|
-
NodeID dst = pta->
|
|
242
|
+
NodeID src = pta->getPTACallGraph()->getCallGraphNode(srcFun)->getId();
|
|
243
|
+
NodeID dst = pta->getPTACallGraph()->getCallGraphNode(dstFun)->getId();
|
|
244
244
|
insensitvefunPairs.insert(std::make_pair(src,dst));
|
|
245
245
|
insensitvefunPairs.insert(std::make_pair(dst,src));
|
|
246
246
|
}
|
|
@@ -266,8 +266,8 @@ void DDAPass::collectCxtInsenEdgeForVFCycle(PointerAnalysis* pta, const SVFG* sv
|
|
|
266
266
|
|
|
267
267
|
if(srcFun && dstFun)
|
|
268
268
|
{
|
|
269
|
-
NodeID src = pta->
|
|
270
|
-
NodeID dst = pta->
|
|
269
|
+
NodeID src = pta->getPTACallGraph()->getCallGraphNode(srcFun)->getId();
|
|
270
|
+
NodeID dst = pta->getPTACallGraph()->getCallGraphNode(dstFun)->getId();
|
|
271
271
|
if(insensitvefunPairs.find(std::make_pair(src,dst))!=insensitvefunPairs.end())
|
|
272
272
|
insensitveEdges.insert(edge);
|
|
273
273
|
else if(insensitvefunPairs.find(std::make_pair(dst,src))!=insensitvefunPairs.end())
|
package/svf/lib/DDA/FlowDDA.cpp
CHANGED
|
@@ -85,9 +85,9 @@ bool FlowDDA::testIndCallReachability(LocDPItem&, const SVFFunction* callee, Cal
|
|
|
85
85
|
|
|
86
86
|
if(getPAG()->isIndirectCallSites(cbn))
|
|
87
87
|
{
|
|
88
|
-
if(
|
|
88
|
+
if(getPTACallGraph()->hasIndCSCallees(cbn))
|
|
89
89
|
{
|
|
90
|
-
const FunctionSet& funset =
|
|
90
|
+
const FunctionSet& funset = getPTACallGraph()->getIndCSCallees(cbn);
|
|
91
91
|
if(funset.find(callee)!=funset.end())
|
|
92
92
|
return true;
|
|
93
93
|
}
|
package/svf/lib/Graphs/ICFG.cpp
CHANGED
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
#include "SVFIR/SVFModule.h"
|
|
32
32
|
#include "Graphs/ICFG.h"
|
|
33
33
|
#include "SVFIR/SVFIR.h"
|
|
34
|
-
#include "Graphs/
|
|
34
|
+
#include "Graphs/PTACallGraph.h"
|
|
35
35
|
|
|
36
36
|
using namespace SVF;
|
|
37
37
|
using namespace SVFUtil;
|
|
@@ -460,17 +460,17 @@ void ICFG::view()
|
|
|
460
460
|
/*!
|
|
461
461
|
* Update ICFG for indirect calls
|
|
462
462
|
*/
|
|
463
|
-
void ICFG::updateCallGraph(
|
|
463
|
+
void ICFG::updateCallGraph(PTACallGraph* callgraph)
|
|
464
464
|
{
|
|
465
|
-
|
|
466
|
-
|
|
465
|
+
PTACallGraph::CallEdgeMap::const_iterator iter = callgraph->getIndCallMap().begin();
|
|
466
|
+
PTACallGraph::CallEdgeMap::const_iterator eiter = callgraph->getIndCallMap().end();
|
|
467
467
|
for (; iter != eiter; iter++)
|
|
468
468
|
{
|
|
469
469
|
const CallICFGNode* callBlock = iter->first;
|
|
470
470
|
const SVFInstruction* cs = callBlock->getCallSite();
|
|
471
471
|
assert(callBlock->isIndirectCall() && "this is not an indirect call?");
|
|
472
|
-
const
|
|
473
|
-
for (
|
|
472
|
+
const PTACallGraph::FunctionSet & functions = iter->second;
|
|
473
|
+
for (PTACallGraph::FunctionSet::const_iterator func_iter = functions.begin(); func_iter != functions.end(); func_iter++)
|
|
474
474
|
{
|
|
475
475
|
const SVFFunction* callee = *func_iter;
|
|
476
476
|
CallICFGNode* callBlockNode = getCallICFGNode(cs);
|