svf-lib 1.0.1239 → 1.0.1241
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/lib/libSvf.a +0 -0
- package/SVF-linux/include/CFL/CFLAlias.h +31 -0
- package/SVF-linux/include/CFL/CFLGramGraphChecker.h +3 -0
- package/SVF-linux/include/CFL/CFLGraphBuilder.h +22 -0
- package/SVF-linux/include/CFL/CFLSolver.h +6 -1
- package/SVF-linux/include/CFL/CFLStat.h +88 -0
- package/SVF-linux/include/CFL/CFLVF.h +77 -0
- package/SVF-linux/include/CFL/VFG.txt +6 -0
- package/SVF-linux/include/Util/Options.h +1 -0
- package/SVF-osx/Release-build/lib/libSvf.a +0 -0
- package/SVF-osx/include/CFL/CFLAlias.h +31 -0
- package/SVF-osx/include/CFL/CFLGramGraphChecker.h +3 -0
- package/SVF-osx/include/CFL/CFLGraphBuilder.h +22 -0
- package/SVF-osx/include/CFL/CFLSolver.h +6 -1
- package/SVF-osx/include/CFL/CFLStat.h +88 -0
- package/SVF-osx/include/CFL/CFLVF.h +77 -0
- package/SVF-osx/include/CFL/VFG.txt +6 -0
- package/SVF-osx/include/Util/Options.h +1 -0
- package/package.json +1 -1
|
Binary file
|
|
@@ -38,10 +38,13 @@
|
|
|
38
38
|
#include "MemoryModel/PointerAnalysis.h"
|
|
39
39
|
#include "Graphs/ConsG.h"
|
|
40
40
|
#include "Util/Options.h"
|
|
41
|
+
#include "CFL/CFLStat.h"
|
|
41
42
|
|
|
42
43
|
namespace SVF
|
|
43
44
|
{
|
|
44
45
|
|
|
46
|
+
class CFLStat;
|
|
47
|
+
|
|
45
48
|
class CFLAlias : public BVDataPTAImpl
|
|
46
49
|
{
|
|
47
50
|
|
|
@@ -138,6 +141,34 @@ public:
|
|
|
138
141
|
void connectCaller2CalleeParams(CallSite cs, const SVFFunction* F);
|
|
139
142
|
|
|
140
143
|
void heapAllocatorViaIndCall(CallSite cs);
|
|
144
|
+
|
|
145
|
+
/// Get CFL graph
|
|
146
|
+
CFLGraph* getCFLGraph()
|
|
147
|
+
{
|
|
148
|
+
return graph;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/// Statistics
|
|
152
|
+
//@{
|
|
153
|
+
static u32_t numOfProcessedAddr; /// Number of processed Addr edge
|
|
154
|
+
static u32_t numOfProcessedCopy; /// Number of processed Copy edge
|
|
155
|
+
static u32_t numOfProcessedGep; /// Number of processed Gep edge
|
|
156
|
+
static u32_t numOfProcessedLoad; /// Number of processed Load edge
|
|
157
|
+
static u32_t numOfProcessedStore; /// Number of processed Store edge
|
|
158
|
+
static u32_t numOfSfrs;
|
|
159
|
+
static u32_t numOfFieldExpand;
|
|
160
|
+
|
|
161
|
+
static u32_t numOfSCCDetection;
|
|
162
|
+
static double timeOfSCCDetection;
|
|
163
|
+
static double timeOfSCCMerges;
|
|
164
|
+
static double timeOfCollapse;
|
|
165
|
+
static u32_t AveragePointsToSetSize;
|
|
166
|
+
static u32_t MaxPointsToSetSize;
|
|
167
|
+
static double timeOfProcessCopyGep;
|
|
168
|
+
static double timeOfProcessLoadStore;
|
|
169
|
+
static double timeOfUpdateCallGraph;
|
|
170
|
+
//@}
|
|
171
|
+
|
|
141
172
|
private:
|
|
142
173
|
CallSite2DummyValPN callsite2DummyValPN; ///< Map an instruction to a dummy obj which created at an indirect callsite, which invokes a heap allocator
|
|
143
174
|
SVFIR* svfir;
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
* Created on: May 23, 2022
|
|
27
27
|
* Author: Pei Xu
|
|
28
28
|
*/
|
|
29
|
+
#ifndef INCLUDE_CFL_CFLGRAMGRAPHCHECKER_H_
|
|
30
|
+
#define INCLUDE_CFL_CFLGRAMGRAPHCHECKER_H_
|
|
29
31
|
|
|
30
32
|
#include "CFL/CFLGrammar.h"
|
|
31
33
|
#include "Graphs/CFLGraph.h"
|
|
@@ -69,3 +71,4 @@ public:
|
|
|
69
71
|
|
|
70
72
|
}// SVF
|
|
71
73
|
|
|
74
|
+
#endif /* INCLUDE_CFL_CFLGRAMGRAPHCHECKER_H_*/
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
|
|
33
33
|
#include "CFL/CFLGrammar.h"
|
|
34
34
|
#include "Graphs/CFLGraph.h"
|
|
35
|
+
#include "Graphs/SVFG.h"
|
|
36
|
+
|
|
35
37
|
namespace SVF
|
|
36
38
|
{
|
|
37
39
|
|
|
@@ -166,6 +168,26 @@ private:
|
|
|
166
168
|
void addBiGepCFLEdge(CFLGraph *cflGraph, ConstraintNode* src, ConstraintNode* dst, CFLGrammar::Attribute attri);
|
|
167
169
|
};
|
|
168
170
|
|
|
171
|
+
class VFCFLGraphBuilder : public CFLGraphBuilder
|
|
172
|
+
{
|
|
173
|
+
public:
|
|
174
|
+
/// Build Bidirectional graph by copying nodes and edges from const graph inherited from GenericGraph
|
|
175
|
+
CFLGraph* buildBigraph(SVFG *graph, Kind startKind, GrammarBase *grammar);
|
|
176
|
+
|
|
177
|
+
/// Build Bidirectional graph by copying nodes and edges from any graph inherited from GenericGraph
|
|
178
|
+
/// And transfer Load Store to copy edge and address edge to construct PEG style CFG
|
|
179
|
+
CFLGraph* buildBiPEGgraph(ConstraintGraph *graph, Kind startKind, GrammarBase *grammar, SVFIR* pag);
|
|
180
|
+
|
|
181
|
+
private:
|
|
182
|
+
void connectVGep(CFLGraph *cflGraph, ConstraintGraph *graph, ConstraintNode *src, ConstraintNode *dst, u32_t level, SVFIR* pag);
|
|
183
|
+
|
|
184
|
+
/// Handle edge except for the GEP
|
|
185
|
+
void addBiCFLEdge(CFLGraph *cflGraph, ConstraintNode* src, ConstraintNode* dst, CFLGrammar::Kind label);
|
|
186
|
+
|
|
187
|
+
/// Add Bidirectional GEP edge with attribute
|
|
188
|
+
void addBiGepCFLEdge(CFLGraph *cflGraph, ConstraintNode* src, ConstraintNode* dst, CFLGrammar::Attribute attri);
|
|
189
|
+
};
|
|
190
|
+
|
|
169
191
|
}// SVF
|
|
170
192
|
|
|
171
193
|
#endif /* INCLUDE_CFL_CFLGRAPHBUILDER_H_*/
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
* Author: Yulei Sui
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
#ifndef INCLUDE_CFL_CFLSolver_H_
|
|
31
|
+
#define INCLUDE_CFL_CFLSolver_H_
|
|
32
|
+
|
|
30
33
|
#include "Graphs/CFLGraph.h"
|
|
31
34
|
#include "CFL/CFLGrammar.h"
|
|
32
35
|
#include "Util/WorkList.h"
|
|
@@ -99,4 +102,6 @@ private:
|
|
|
99
102
|
|
|
100
103
|
};
|
|
101
104
|
|
|
102
|
-
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
#endif /* INCLUDE_CFL_CFLSolver_H_*/
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//===- CFLStat.h -- CFL statistics--------------------------------------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-2017> <Yulei Sui>
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// This program is free software: you can redistribute it and/or modify
|
|
9
|
+
// it under the terms of the GNU General Public License as published by
|
|
10
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
// (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
// This program is distributed in the hope that it will be useful,
|
|
14
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
// GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* CFLStat.h
|
|
26
|
+
*
|
|
27
|
+
* Created on: 17/9/2022
|
|
28
|
+
* Author: Pei Xu
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
#ifndef CFL_CFLSTAT_H_
|
|
32
|
+
#define CFL_CFLSTAT_H_
|
|
33
|
+
|
|
34
|
+
#include "Util/PTAStat.h"
|
|
35
|
+
#include "CFL/CFLAlias.h"
|
|
36
|
+
|
|
37
|
+
namespace SVF
|
|
38
|
+
{
|
|
39
|
+
|
|
40
|
+
class CFLAlias;
|
|
41
|
+
class SVFIR;
|
|
42
|
+
class ConstraintGraph;
|
|
43
|
+
|
|
44
|
+
/*!
|
|
45
|
+
* Statistics of CFL's analysis
|
|
46
|
+
*/
|
|
47
|
+
class CFLStat : public PTAStat
|
|
48
|
+
{
|
|
49
|
+
|
|
50
|
+
private:
|
|
51
|
+
CFLAlias* pta;
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
static const char* CollapseTime;
|
|
55
|
+
|
|
56
|
+
static u32_t _MaxPtsSize;
|
|
57
|
+
static u32_t _NumOfCycles;
|
|
58
|
+
static u32_t _NumOfPWCCycles;
|
|
59
|
+
static u32_t _NumOfNodesInCycles;
|
|
60
|
+
static u32_t _MaxNumOfNodesInSCC;
|
|
61
|
+
u32_t _NumOfNullPtr;
|
|
62
|
+
u32_t _NumOfConstantPtr;
|
|
63
|
+
u32_t _NumOfBlackholePtr;
|
|
64
|
+
|
|
65
|
+
/// CFL Stat
|
|
66
|
+
u32_t _NumofCFLGraphNode;
|
|
67
|
+
|
|
68
|
+
CFLStat(CFLAlias* p);
|
|
69
|
+
|
|
70
|
+
virtual ~CFLStat()
|
|
71
|
+
{
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
virtual void performStat();
|
|
76
|
+
|
|
77
|
+
void collectCycleInfo(ConstraintGraph* consCG);
|
|
78
|
+
|
|
79
|
+
void collectCFLInfo(CFLGraph* CFLGraph);
|
|
80
|
+
|
|
81
|
+
void statNullPtr();
|
|
82
|
+
|
|
83
|
+
void constraintGraphStat();
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
} // End namespace SVF
|
|
87
|
+
|
|
88
|
+
#endif /* FLOWSENSITIVESTAT_H_ */
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//===----- CFLVF.h -- CFL Value-Flow Client--------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-> <Yulei Sui>
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// This program is free software: you can redistribute it and/or modify
|
|
9
|
+
// it under the terms of the GNU General Public License as published by
|
|
10
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
// (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
// This program is distributed in the hope that it will be useful,
|
|
14
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
// GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* CFLVF.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: September 5, 2022
|
|
27
|
+
* Author: Pei Xu
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef INCLUDE_CFL_CFLVF_H_
|
|
31
|
+
#define INCLUDE_CFL_CFLVF_H_
|
|
32
|
+
|
|
33
|
+
#include "CFL/CFLSolver.h"
|
|
34
|
+
#include "CFL/CFGNormalizer.h"
|
|
35
|
+
#include "CFL/GrammarBuilder.h"
|
|
36
|
+
#include "CFL/CFLGraphBuilder.h"
|
|
37
|
+
#include "CFL/CFLGramGraphChecker.h"
|
|
38
|
+
#include "MemoryModel/PointerAnalysis.h"
|
|
39
|
+
#include "Graphs/ConsG.h"
|
|
40
|
+
#include "Util/Options.h"
|
|
41
|
+
#include "SABER/SaberSVFGBuilder.h"
|
|
42
|
+
|
|
43
|
+
namespace SVF
|
|
44
|
+
{
|
|
45
|
+
|
|
46
|
+
class CFLVF : public BVDataPTAImpl
|
|
47
|
+
{
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
typedef OrderedMap<CallSite, NodeID> CallSite2DummyValPN;
|
|
51
|
+
|
|
52
|
+
CFLVF(SVFIR* ir) : BVDataPTAImpl(ir, PointerAnalysis::CFLFSCS_WPA, false), svfir(ir), graph(nullptr), grammar(nullptr), solver(nullptr)
|
|
53
|
+
{
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/// Destructor
|
|
57
|
+
virtual ~CFLVF()
|
|
58
|
+
{
|
|
59
|
+
delete solver;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// Start Analysis here (main part of pointer analysis).
|
|
63
|
+
virtual void analyze();
|
|
64
|
+
|
|
65
|
+
private:
|
|
66
|
+
CallSite2DummyValPN callsite2DummyValPN; ///< Map an instruction to a dummy obj which created at an indirect callsite, which invokes a heap allocator
|
|
67
|
+
SVFIR* svfir;
|
|
68
|
+
CFLGraph* graph;
|
|
69
|
+
CFLGrammar* grammar;
|
|
70
|
+
CFLSolver *solver;
|
|
71
|
+
SaberSVFGBuilder memSSA;
|
|
72
|
+
SVFG* svfg;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // End namespace SVF
|
|
76
|
+
|
|
77
|
+
#endif /* INCLUDE_CFL_CFLVF_H_*/
|
|
@@ -254,6 +254,7 @@ public:
|
|
|
254
254
|
static const llvm::cl::opt<bool> PrintCFL;
|
|
255
255
|
static const llvm::cl::opt<bool> FlexSymMap;
|
|
256
256
|
static const llvm::cl::opt<bool> PEGTransfer;
|
|
257
|
+
static const llvm::cl::opt<bool> CFLSVFG;
|
|
257
258
|
|
|
258
259
|
// Loop Analysis
|
|
259
260
|
static const llvm::cl::opt<bool> LoopAnalysis;
|
|
Binary file
|
|
@@ -38,10 +38,13 @@
|
|
|
38
38
|
#include "MemoryModel/PointerAnalysis.h"
|
|
39
39
|
#include "Graphs/ConsG.h"
|
|
40
40
|
#include "Util/Options.h"
|
|
41
|
+
#include "CFL/CFLStat.h"
|
|
41
42
|
|
|
42
43
|
namespace SVF
|
|
43
44
|
{
|
|
44
45
|
|
|
46
|
+
class CFLStat;
|
|
47
|
+
|
|
45
48
|
class CFLAlias : public BVDataPTAImpl
|
|
46
49
|
{
|
|
47
50
|
|
|
@@ -138,6 +141,34 @@ public:
|
|
|
138
141
|
void connectCaller2CalleeParams(CallSite cs, const SVFFunction* F);
|
|
139
142
|
|
|
140
143
|
void heapAllocatorViaIndCall(CallSite cs);
|
|
144
|
+
|
|
145
|
+
/// Get CFL graph
|
|
146
|
+
CFLGraph* getCFLGraph()
|
|
147
|
+
{
|
|
148
|
+
return graph;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/// Statistics
|
|
152
|
+
//@{
|
|
153
|
+
static u32_t numOfProcessedAddr; /// Number of processed Addr edge
|
|
154
|
+
static u32_t numOfProcessedCopy; /// Number of processed Copy edge
|
|
155
|
+
static u32_t numOfProcessedGep; /// Number of processed Gep edge
|
|
156
|
+
static u32_t numOfProcessedLoad; /// Number of processed Load edge
|
|
157
|
+
static u32_t numOfProcessedStore; /// Number of processed Store edge
|
|
158
|
+
static u32_t numOfSfrs;
|
|
159
|
+
static u32_t numOfFieldExpand;
|
|
160
|
+
|
|
161
|
+
static u32_t numOfSCCDetection;
|
|
162
|
+
static double timeOfSCCDetection;
|
|
163
|
+
static double timeOfSCCMerges;
|
|
164
|
+
static double timeOfCollapse;
|
|
165
|
+
static u32_t AveragePointsToSetSize;
|
|
166
|
+
static u32_t MaxPointsToSetSize;
|
|
167
|
+
static double timeOfProcessCopyGep;
|
|
168
|
+
static double timeOfProcessLoadStore;
|
|
169
|
+
static double timeOfUpdateCallGraph;
|
|
170
|
+
//@}
|
|
171
|
+
|
|
141
172
|
private:
|
|
142
173
|
CallSite2DummyValPN callsite2DummyValPN; ///< Map an instruction to a dummy obj which created at an indirect callsite, which invokes a heap allocator
|
|
143
174
|
SVFIR* svfir;
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
* Created on: May 23, 2022
|
|
27
27
|
* Author: Pei Xu
|
|
28
28
|
*/
|
|
29
|
+
#ifndef INCLUDE_CFL_CFLGRAMGRAPHCHECKER_H_
|
|
30
|
+
#define INCLUDE_CFL_CFLGRAMGRAPHCHECKER_H_
|
|
29
31
|
|
|
30
32
|
#include "CFL/CFLGrammar.h"
|
|
31
33
|
#include "Graphs/CFLGraph.h"
|
|
@@ -69,3 +71,4 @@ public:
|
|
|
69
71
|
|
|
70
72
|
}// SVF
|
|
71
73
|
|
|
74
|
+
#endif /* INCLUDE_CFL_CFLGRAMGRAPHCHECKER_H_*/
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
|
|
33
33
|
#include "CFL/CFLGrammar.h"
|
|
34
34
|
#include "Graphs/CFLGraph.h"
|
|
35
|
+
#include "Graphs/SVFG.h"
|
|
36
|
+
|
|
35
37
|
namespace SVF
|
|
36
38
|
{
|
|
37
39
|
|
|
@@ -166,6 +168,26 @@ private:
|
|
|
166
168
|
void addBiGepCFLEdge(CFLGraph *cflGraph, ConstraintNode* src, ConstraintNode* dst, CFLGrammar::Attribute attri);
|
|
167
169
|
};
|
|
168
170
|
|
|
171
|
+
class VFCFLGraphBuilder : public CFLGraphBuilder
|
|
172
|
+
{
|
|
173
|
+
public:
|
|
174
|
+
/// Build Bidirectional graph by copying nodes and edges from const graph inherited from GenericGraph
|
|
175
|
+
CFLGraph* buildBigraph(SVFG *graph, Kind startKind, GrammarBase *grammar);
|
|
176
|
+
|
|
177
|
+
/// Build Bidirectional graph by copying nodes and edges from any graph inherited from GenericGraph
|
|
178
|
+
/// And transfer Load Store to copy edge and address edge to construct PEG style CFG
|
|
179
|
+
CFLGraph* buildBiPEGgraph(ConstraintGraph *graph, Kind startKind, GrammarBase *grammar, SVFIR* pag);
|
|
180
|
+
|
|
181
|
+
private:
|
|
182
|
+
void connectVGep(CFLGraph *cflGraph, ConstraintGraph *graph, ConstraintNode *src, ConstraintNode *dst, u32_t level, SVFIR* pag);
|
|
183
|
+
|
|
184
|
+
/// Handle edge except for the GEP
|
|
185
|
+
void addBiCFLEdge(CFLGraph *cflGraph, ConstraintNode* src, ConstraintNode* dst, CFLGrammar::Kind label);
|
|
186
|
+
|
|
187
|
+
/// Add Bidirectional GEP edge with attribute
|
|
188
|
+
void addBiGepCFLEdge(CFLGraph *cflGraph, ConstraintNode* src, ConstraintNode* dst, CFLGrammar::Attribute attri);
|
|
189
|
+
};
|
|
190
|
+
|
|
169
191
|
}// SVF
|
|
170
192
|
|
|
171
193
|
#endif /* INCLUDE_CFL_CFLGRAPHBUILDER_H_*/
|
|
@@ -27,6 +27,9 @@
|
|
|
27
27
|
* Author: Yulei Sui
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
#ifndef INCLUDE_CFL_CFLSolver_H_
|
|
31
|
+
#define INCLUDE_CFL_CFLSolver_H_
|
|
32
|
+
|
|
30
33
|
#include "Graphs/CFLGraph.h"
|
|
31
34
|
#include "CFL/CFLGrammar.h"
|
|
32
35
|
#include "Util/WorkList.h"
|
|
@@ -99,4 +102,6 @@ private:
|
|
|
99
102
|
|
|
100
103
|
};
|
|
101
104
|
|
|
102
|
-
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
#endif /* INCLUDE_CFL_CFLSolver_H_*/
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
//===- CFLStat.h -- CFL statistics--------------------------------------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-2017> <Yulei Sui>
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// This program is free software: you can redistribute it and/or modify
|
|
9
|
+
// it under the terms of the GNU General Public License as published by
|
|
10
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
// (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
// This program is distributed in the hope that it will be useful,
|
|
14
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
// GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* CFLStat.h
|
|
26
|
+
*
|
|
27
|
+
* Created on: 17/9/2022
|
|
28
|
+
* Author: Pei Xu
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
#ifndef CFL_CFLSTAT_H_
|
|
32
|
+
#define CFL_CFLSTAT_H_
|
|
33
|
+
|
|
34
|
+
#include "Util/PTAStat.h"
|
|
35
|
+
#include "CFL/CFLAlias.h"
|
|
36
|
+
|
|
37
|
+
namespace SVF
|
|
38
|
+
{
|
|
39
|
+
|
|
40
|
+
class CFLAlias;
|
|
41
|
+
class SVFIR;
|
|
42
|
+
class ConstraintGraph;
|
|
43
|
+
|
|
44
|
+
/*!
|
|
45
|
+
* Statistics of CFL's analysis
|
|
46
|
+
*/
|
|
47
|
+
class CFLStat : public PTAStat
|
|
48
|
+
{
|
|
49
|
+
|
|
50
|
+
private:
|
|
51
|
+
CFLAlias* pta;
|
|
52
|
+
|
|
53
|
+
public:
|
|
54
|
+
static const char* CollapseTime;
|
|
55
|
+
|
|
56
|
+
static u32_t _MaxPtsSize;
|
|
57
|
+
static u32_t _NumOfCycles;
|
|
58
|
+
static u32_t _NumOfPWCCycles;
|
|
59
|
+
static u32_t _NumOfNodesInCycles;
|
|
60
|
+
static u32_t _MaxNumOfNodesInSCC;
|
|
61
|
+
u32_t _NumOfNullPtr;
|
|
62
|
+
u32_t _NumOfConstantPtr;
|
|
63
|
+
u32_t _NumOfBlackholePtr;
|
|
64
|
+
|
|
65
|
+
/// CFL Stat
|
|
66
|
+
u32_t _NumofCFLGraphNode;
|
|
67
|
+
|
|
68
|
+
CFLStat(CFLAlias* p);
|
|
69
|
+
|
|
70
|
+
virtual ~CFLStat()
|
|
71
|
+
{
|
|
72
|
+
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
virtual void performStat();
|
|
76
|
+
|
|
77
|
+
void collectCycleInfo(ConstraintGraph* consCG);
|
|
78
|
+
|
|
79
|
+
void collectCFLInfo(CFLGraph* CFLGraph);
|
|
80
|
+
|
|
81
|
+
void statNullPtr();
|
|
82
|
+
|
|
83
|
+
void constraintGraphStat();
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
} // End namespace SVF
|
|
87
|
+
|
|
88
|
+
#endif /* FLOWSENSITIVESTAT_H_ */
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//===----- CFLVF.h -- CFL Value-Flow Client--------------//
|
|
2
|
+
//
|
|
3
|
+
// SVF: Static Value-Flow Analysis
|
|
4
|
+
//
|
|
5
|
+
// Copyright (C) <2013-> <Yulei Sui>
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// This program is free software: you can redistribute it and/or modify
|
|
9
|
+
// it under the terms of the GNU General Public License as published by
|
|
10
|
+
// the Free Software Foundation, either version 3 of the License, or
|
|
11
|
+
// (at your option) any later version.
|
|
12
|
+
|
|
13
|
+
// This program is distributed in the hope that it will be useful,
|
|
14
|
+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
// GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
// You should have received a copy of the GNU General Public License
|
|
19
|
+
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
20
|
+
//
|
|
21
|
+
//===----------------------------------------------------------------------===//
|
|
22
|
+
|
|
23
|
+
/*
|
|
24
|
+
* CFLVF.h
|
|
25
|
+
*
|
|
26
|
+
* Created on: September 5, 2022
|
|
27
|
+
* Author: Pei Xu
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
#ifndef INCLUDE_CFL_CFLVF_H_
|
|
31
|
+
#define INCLUDE_CFL_CFLVF_H_
|
|
32
|
+
|
|
33
|
+
#include "CFL/CFLSolver.h"
|
|
34
|
+
#include "CFL/CFGNormalizer.h"
|
|
35
|
+
#include "CFL/GrammarBuilder.h"
|
|
36
|
+
#include "CFL/CFLGraphBuilder.h"
|
|
37
|
+
#include "CFL/CFLGramGraphChecker.h"
|
|
38
|
+
#include "MemoryModel/PointerAnalysis.h"
|
|
39
|
+
#include "Graphs/ConsG.h"
|
|
40
|
+
#include "Util/Options.h"
|
|
41
|
+
#include "SABER/SaberSVFGBuilder.h"
|
|
42
|
+
|
|
43
|
+
namespace SVF
|
|
44
|
+
{
|
|
45
|
+
|
|
46
|
+
class CFLVF : public BVDataPTAImpl
|
|
47
|
+
{
|
|
48
|
+
|
|
49
|
+
public:
|
|
50
|
+
typedef OrderedMap<CallSite, NodeID> CallSite2DummyValPN;
|
|
51
|
+
|
|
52
|
+
CFLVF(SVFIR* ir) : BVDataPTAImpl(ir, PointerAnalysis::CFLFSCS_WPA, false), svfir(ir), graph(nullptr), grammar(nullptr), solver(nullptr)
|
|
53
|
+
{
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/// Destructor
|
|
57
|
+
virtual ~CFLVF()
|
|
58
|
+
{
|
|
59
|
+
delete solver;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// Start Analysis here (main part of pointer analysis).
|
|
63
|
+
virtual void analyze();
|
|
64
|
+
|
|
65
|
+
private:
|
|
66
|
+
CallSite2DummyValPN callsite2DummyValPN; ///< Map an instruction to a dummy obj which created at an indirect callsite, which invokes a heap allocator
|
|
67
|
+
SVFIR* svfir;
|
|
68
|
+
CFLGraph* graph;
|
|
69
|
+
CFLGrammar* grammar;
|
|
70
|
+
CFLSolver *solver;
|
|
71
|
+
SaberSVFGBuilder memSSA;
|
|
72
|
+
SVFG* svfg;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
} // End namespace SVF
|
|
76
|
+
|
|
77
|
+
#endif /* INCLUDE_CFL_CFLVF_H_*/
|
|
@@ -254,6 +254,7 @@ public:
|
|
|
254
254
|
static const llvm::cl::opt<bool> PrintCFL;
|
|
255
255
|
static const llvm::cl::opt<bool> FlexSymMap;
|
|
256
256
|
static const llvm::cl::opt<bool> PEGTransfer;
|
|
257
|
+
static const llvm::cl::opt<bool> CFLSVFG;
|
|
257
258
|
|
|
258
259
|
// Loop Analysis
|
|
259
260
|
static const llvm::cl::opt<bool> LoopAnalysis;
|