svf-lib 1.0.1820 → 1.0.1822
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/svf/libSvfCore.a +0 -0
- package/SVF-linux/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-linux/svf/include/SVFIR/SVFType.h +27 -7
- package/SVF-osx/Release-build/svf/libSvfCore.a +0 -0
- package/SVF-osx/Release-build/svf-llvm/libSvfLLVM.a +0 -0
- package/SVF-osx/svf/include/AbstractExecution/BoundedZ3Expr.h +2 -0
- package/SVF-osx/svf/include/AbstractExecution/CFBasicBlockGWTO.h +83 -0
- package/SVF-osx/svf/include/AbstractExecution/ConsExeState.h +8 -0
- package/SVF-osx/svf/include/AbstractExecution/ExeState.h +8 -0
- package/SVF-osx/svf/include/AbstractExecution/ICFGWTO.h +78 -0
- package/SVF-osx/svf/include/AbstractExecution/IntervalExeState.h +7 -0
- package/SVF-osx/svf/include/AbstractExecution/IntervalValue.h +3 -0
- package/SVF-osx/svf/include/AbstractExecution/NumericLiteral.h +2 -0
- package/SVF-osx/svf/include/AbstractExecution/RelExeState.h +1 -0
- package/SVF-osx/svf/include/AbstractExecution/RelationSolver.h +1 -0
- package/SVF-osx/svf/include/AbstractExecution/SVFIR2ConsExeState.h +1 -0
- package/SVF-osx/svf/include/AbstractExecution/SVFIR2ItvExeState.h +4 -0
- package/SVF-osx/svf/include/AbstractExecution/SingleAbsValue.h +2 -0
- package/SVF-osx/svf/include/AbstractExecution/SymState.h +4 -0
- package/SVF-osx/svf/include/CFL/CFGrammar.h +4 -0
- package/SVF-osx/svf/include/CFL/CFLAlias.h +1 -0
- package/SVF-osx/svf/include/CFL/CFLGraphBuilder.h +1 -0
- package/SVF-osx/svf/include/CFL/CFLStat.h +1 -0
- package/SVF-osx/svf/include/CFL/CFLVF.h +1 -0
- package/SVF-osx/svf/include/DDA/ContextDDA.h +1 -0
- package/SVF-osx/svf/include/DDA/DDAClient.h +5 -0
- package/SVF-osx/svf/include/DDA/DDAPass.h +3 -2
- package/SVF-osx/svf/include/DDA/DDAVFSolver.h +2 -2
- package/SVF-osx/svf/include/FastCluster/fastcluster.h +1 -0
- package/SVF-osx/svf/include/Graphs/CDG.h +3 -0
- package/SVF-osx/svf/include/Graphs/CFBasicBlockG.h +3 -0
- package/SVF-osx/svf/include/Graphs/CFLGraph.h +1 -0
- package/SVF-osx/svf/include/Graphs/CHG.h +4 -2
- package/SVF-osx/svf/include/Graphs/ConsGEdge.h +5 -0
- package/SVF-osx/svf/include/Graphs/ConsGNode.h +1 -0
- package/SVF-osx/svf/include/Graphs/DOTGraphTraits.h +1 -0
- package/SVF-osx/svf/include/Graphs/GenericGraph.h +1 -0
- package/SVF-osx/svf/include/Graphs/GraphPrinter.h +3 -0
- package/SVF-osx/svf/include/Graphs/GraphTraits.h +2 -2
- package/SVF-osx/svf/include/Graphs/ICFG.h +1 -0
- package/SVF-osx/svf/include/Graphs/ICFGNode.h +3 -0
- package/SVF-osx/svf/include/Graphs/ICFGStat.h +2 -0
- package/SVF-osx/svf/include/Graphs/IRGraph.h +1 -0
- package/SVF-osx/svf/include/Graphs/PTACallGraph.h +3 -0
- package/SVF-osx/svf/include/Graphs/SCC.h +354 -0
- package/SVF-osx/svf/include/Graphs/SVFG.h +2 -0
- package/SVF-osx/svf/include/Graphs/SVFGEdge.h +1 -0
- package/SVF-osx/svf/include/Graphs/SVFGNode.h +7 -0
- package/SVF-osx/svf/include/Graphs/SVFGOPT.h +3 -0
- package/SVF-osx/svf/include/Graphs/SVFGStat.h +3 -1
- package/SVF-osx/svf/include/Graphs/ThreadCallGraph.h +3 -0
- package/SVF-osx/svf/include/Graphs/VFG.h +2 -0
- package/SVF-osx/svf/include/Graphs/VFGEdge.h +3 -0
- package/SVF-osx/svf/include/Graphs/VFGNode.h +8 -0
- package/SVF-osx/svf/include/Graphs/WTO.h +859 -0
- package/SVF-osx/svf/include/MSSA/MSSAMuChi.h +4 -0
- package/SVF-osx/svf/include/MSSA/MemPartition.h +1 -0
- package/SVF-osx/svf/include/MSSA/MemRegion.h +4 -3
- package/SVF-osx/svf/include/MSSA/MemSSA.h +1 -0
- package/SVF-osx/svf/include/MTA/FSMPTA.h +6 -0
- package/SVF-osx/svf/include/MTA/LockAnalysis.h +5 -0
- package/SVF-osx/svf/include/MTA/MHP.h +3 -0
- package/SVF-osx/svf/include/MTA/MTA.h +1 -0
- package/SVF-osx/svf/include/MTA/MTAResultValidator.h +2 -0
- package/SVF-osx/svf/include/MTA/TCT.h +3 -2
- package/SVF-osx/svf/include/MemoryModel/AbstractPointsToDS.h +2 -0
- package/SVF-osx/svf/include/MemoryModel/AccessPath.h +5 -0
- package/SVF-osx/svf/include/MemoryModel/ConditionalPT.h +5 -0
- package/SVF-osx/svf/include/MemoryModel/PersistentPointsToDS.h +1 -0
- package/SVF-osx/svf/include/MemoryModel/PointerAnalysis.h +6 -5
- package/SVF-osx/svf/include/MemoryModel/PointerAnalysisImpl.h +1 -0
- package/SVF-osx/svf/include/MemoryModel/PointsTo.h +1 -0
- package/SVF-osx/svf/include/SABER/DoubleFreeChecker.h +1 -0
- package/SVF-osx/svf/include/SABER/ProgSlice.h +1 -0
- package/SVF-osx/svf/include/SABER/SaberCondAllocator.h +4 -0
- package/SVF-osx/svf/include/SABER/SaberSVFGBuilder.h +1 -0
- package/SVF-osx/svf/include/SVFIR/SVFIR.h +2 -0
- package/SVF-osx/svf/include/SVFIR/SVFStatements.h +2 -0
- package/SVF-osx/svf/include/SVFIR/SVFType.h +2 -0
- package/SVF-osx/svf/include/SVFIR/SVFValue.h +3 -0
- package/SVF-osx/svf/include/SVFIR/SVFVariables.h +5 -0
- package/SVF-osx/svf/include/SVFIR/SymbolTableInfo.h +5 -0
- package/SVF-osx/svf/include/Util/CDGBuilder.h +8 -0
- package/SVF-osx/svf/include/Util/CallGraphBuilder.h +2 -0
- package/SVF-osx/svf/include/Util/Casting.h +2 -1
- package/SVF-osx/svf/include/Util/CommandLine.h +1 -0
- package/SVF-osx/svf/include/Util/CxtStmt.h +4 -0
- package/SVF-osx/svf/include/Util/DPItem.h +2 -0
- package/SVF-osx/svf/include/Util/NodeIDAllocator.h +2 -2
- package/SVF-osx/svf/include/Util/PTAStat.h +1 -0
- package/SVF-osx/svf/include/Util/SVFBugReport.h +1 -0
- package/SVF-osx/svf/include/Util/SVFStat.h +1 -0
- package/SVF-osx/svf/include/Util/SVFUtil.h +1 -0
- package/SVF-osx/svf/include/Util/ThreadAPI.h +1 -0
- package/SVF-osx/svf/include/Util/WorkList.h +1 -0
- package/SVF-osx/svf/include/Util/Z3Expr.h +4 -0
- package/SVF-osx/svf/include/Util/iterator.h +2 -2
- package/SVF-osx/svf/include/WPA/Andersen.h +6 -0
- package/SVF-osx/svf/include/WPA/AndersenPWC.h +3 -0
- package/SVF-osx/svf/include/WPA/CSC.h +3 -3
- package/SVF-osx/svf/include/WPA/WPAFSSolver.h +5 -0
- package/SVF-osx/svf/include/WPA/WPAPass.h +2 -0
- package/SVF-osx/svf/include/WPA/WPASolver.h +2 -0
- package/SVF-osx/svf/include/WPA/WPAStat.h +1 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/BreakConstantExpr.h +1 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/DCHG.h +1 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/GEPTypeBridgeIterator.h +3 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/LLVMModule.h +1 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/LLVMUtil.h +1 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SVFIRBuilder.h +1 -0
- package/SVF-osx/svf-llvm/include/SVF-LLVM/SymbolTableBuilder.h +1 -0
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -243,6 +243,7 @@ class SVFType
|
|
|
243
243
|
{
|
|
244
244
|
friend class SVFIRWriter;
|
|
245
245
|
friend class SVFIRReader;
|
|
246
|
+
friend class LLVMModuleSet;
|
|
246
247
|
|
|
247
248
|
public:
|
|
248
249
|
typedef s64_t GNodeK;
|
|
@@ -258,6 +259,25 @@ public:
|
|
|
258
259
|
SVFOtherTy,
|
|
259
260
|
};
|
|
260
261
|
|
|
262
|
+
public:
|
|
263
|
+
|
|
264
|
+
inline static SVFType* getPtrTy()
|
|
265
|
+
{
|
|
266
|
+
assert(ptrTy && "ptr type not set?");
|
|
267
|
+
return ptrTy;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
inline static SVFType* getI8Ty()
|
|
271
|
+
{
|
|
272
|
+
assert(i8Ty && "int8 type not set?");
|
|
273
|
+
return i8Ty;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
private:
|
|
277
|
+
|
|
278
|
+
static SVFType* ptrTy; ///< ptr type
|
|
279
|
+
static SVFType* i8Ty; ///< 8-bit int type
|
|
280
|
+
|
|
261
281
|
private:
|
|
262
282
|
GNodeK kind; ///< used for classof
|
|
263
283
|
const SVFPointerType*
|
|
@@ -268,7 +288,7 @@ private:
|
|
|
268
288
|
///< array
|
|
269
289
|
|
|
270
290
|
protected:
|
|
271
|
-
SVFType(bool svt, SVFTyKind k, u32_t Sz)
|
|
291
|
+
SVFType(bool svt, SVFTyKind k, u32_t Sz = 1)
|
|
272
292
|
: kind(k), getPointerToTy(nullptr), typeinfo(nullptr),
|
|
273
293
|
isSingleValTy(svt), byteSize(Sz)
|
|
274
294
|
{
|
|
@@ -357,7 +377,7 @@ private:
|
|
|
357
377
|
const SVFType* ptrElementType;
|
|
358
378
|
|
|
359
379
|
public:
|
|
360
|
-
SVFPointerType(u32_t byteSize)
|
|
380
|
+
SVFPointerType(u32_t byteSize = 1)
|
|
361
381
|
: SVFType(true, SVFPointerTy, byteSize), ptrElementType(nullptr)
|
|
362
382
|
{
|
|
363
383
|
}
|
|
@@ -389,7 +409,7 @@ private:
|
|
|
389
409
|
short signAndWidth; ///< For printing
|
|
390
410
|
|
|
391
411
|
public:
|
|
392
|
-
SVFIntegerType(u32_t byteSize) : SVFType(true, SVFIntegerTy, byteSize) {}
|
|
412
|
+
SVFIntegerType(u32_t byteSize = 1) : SVFType(true, SVFIntegerTy, byteSize) {}
|
|
393
413
|
static inline bool classof(const SVFType* node)
|
|
394
414
|
{
|
|
395
415
|
return node->getKind() == SVFIntegerTy;
|
|
@@ -418,7 +438,7 @@ private:
|
|
|
418
438
|
|
|
419
439
|
public:
|
|
420
440
|
SVFFunctionType(const SVFType* rt)
|
|
421
|
-
: SVFType(false, SVFFunctionTy,
|
|
441
|
+
: SVFType(false, SVFFunctionTy, 1), retTy(rt)
|
|
422
442
|
{
|
|
423
443
|
}
|
|
424
444
|
static inline bool classof(const SVFType* node)
|
|
@@ -443,7 +463,7 @@ private:
|
|
|
443
463
|
std::string name;
|
|
444
464
|
|
|
445
465
|
public:
|
|
446
|
-
SVFStructType(u32_t byteSize) : SVFType(false, SVFStructTy, byteSize) {}
|
|
466
|
+
SVFStructType(u32_t byteSize = 1) : SVFType(false, SVFStructTy, byteSize) {}
|
|
447
467
|
|
|
448
468
|
static inline bool classof(const SVFType* node)
|
|
449
469
|
{
|
|
@@ -476,7 +496,7 @@ private:
|
|
|
476
496
|
const SVFType* typeOfElement; /// For printing & debugging
|
|
477
497
|
|
|
478
498
|
public:
|
|
479
|
-
SVFArrayType(u32_t byteSize)
|
|
499
|
+
SVFArrayType(u32_t byteSize = 1)
|
|
480
500
|
: SVFType(false, SVFArrayTy, byteSize), numOfElement(0), typeOfElement(nullptr)
|
|
481
501
|
{
|
|
482
502
|
}
|
|
@@ -515,7 +535,7 @@ private:
|
|
|
515
535
|
std::string repr; /// Field representation for printing
|
|
516
536
|
|
|
517
537
|
public:
|
|
518
|
-
SVFOtherType(u32_t byteSize
|
|
538
|
+
SVFOtherType(bool isSingleValueTy, u32_t byteSize = 1) : SVFType(isSingleValueTy, SVFOtherTy, byteSize) {}
|
|
519
539
|
|
|
520
540
|
static inline bool classof(const SVFType* node)
|
|
521
541
|
{
|
|
Binary file
|
|
Binary file
|
|
@@ -63,6 +63,7 @@ public:
|
|
|
63
63
|
|
|
64
64
|
BoundedZ3Expr(BoundedZ3Expr &&z3Expr) : Z3Expr(z3Expr) {}
|
|
65
65
|
|
|
66
|
+
|
|
66
67
|
inline BoundedZ3Expr &operator=(BoundedZ3Expr &&rhs)
|
|
67
68
|
{
|
|
68
69
|
Z3Expr::operator=(rhs);
|
|
@@ -387,3 +388,4 @@ struct std::hash<SVF::BoundedZ3Expr>
|
|
|
387
388
|
}
|
|
388
389
|
};
|
|
389
390
|
#endif //SVF_BOUNDEDZ3EXPR_H
|
|
391
|
+
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//===- CFBasicBlockGWTO.h -- WTO for CFBasicBlockGraph----------------------//
|
|
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
|
+
* CFBasicBlockGWTO.h
|
|
25
|
+
*
|
|
26
|
+
* The implementation is based on F. Bourdoncle's paper:
|
|
27
|
+
* "Efficient chaotic iteration strategies with widenings", Formal
|
|
28
|
+
* Methods in Programming and Their Applications, 1993, pages 128-141.
|
|
29
|
+
*
|
|
30
|
+
* Created on: Jan 22, 2024
|
|
31
|
+
* Author: Xiao Cheng
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
#ifndef SVF_CFBASICBLOCKGWTO_H
|
|
35
|
+
#define SVF_CFBASICBLOCKGWTO_H
|
|
36
|
+
#include "Graphs/CFBasicBlockG.h"
|
|
37
|
+
#include "Graphs/WTO.h"
|
|
38
|
+
|
|
39
|
+
namespace SVF
|
|
40
|
+
{
|
|
41
|
+
typedef WTOComponent<CFBasicBlockGraph> CFBasicBlockGWTOComp;
|
|
42
|
+
typedef WTONode<CFBasicBlockGraph> CFBasicBlockGWTONode;
|
|
43
|
+
typedef WTOCycle<CFBasicBlockGraph> CFBasicBlockGWTOCycle;
|
|
44
|
+
|
|
45
|
+
class CFBasicBlockGWTO : public WTO<CFBasicBlockGraph>
|
|
46
|
+
{
|
|
47
|
+
public:
|
|
48
|
+
typedef WTO<CFBasicBlockGraph> Base;
|
|
49
|
+
typedef WTOComponentVisitor<CFBasicBlockGraph>::WTONodeT
|
|
50
|
+
CFBasicBlockGWTONode;
|
|
51
|
+
|
|
52
|
+
explicit CFBasicBlockGWTO(CFBasicBlockGraph* graph,
|
|
53
|
+
const CFBasicBlockNode* node)
|
|
54
|
+
: Base(graph, node)
|
|
55
|
+
{
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
inline void forEachSuccessor(
|
|
59
|
+
const CFBasicBlockNode* node,
|
|
60
|
+
std::function<void(const CFBasicBlockNode*)> func) const override
|
|
61
|
+
{
|
|
62
|
+
if (const auto* callNode =
|
|
63
|
+
SVFUtil::dyn_cast<CallICFGNode>(node->getICFGNodes().front()))
|
|
64
|
+
{
|
|
65
|
+
const CFBasicBlockNode* succ = _graph->getCFBasicBlockNode(
|
|
66
|
+
callNode->getRetICFGNode()->getId());
|
|
67
|
+
func(succ);
|
|
68
|
+
}
|
|
69
|
+
else
|
|
70
|
+
{
|
|
71
|
+
for (const auto& e : node->getOutEdges())
|
|
72
|
+
{
|
|
73
|
+
if (e->getICFGEdge() &&
|
|
74
|
+
(!e->getICFGEdge()->isIntraCFGEdge() ||
|
|
75
|
+
node->getFunction() != e->getDstNode()->getFunction()))
|
|
76
|
+
continue;
|
|
77
|
+
func(e->getDstNode());
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
} // namespace SVF
|
|
83
|
+
#endif // SVF_CFBASICBLOCKGWTO_H
|
|
@@ -57,6 +57,7 @@ public:
|
|
|
57
57
|
public:
|
|
58
58
|
ConsExeState(): ExeState(ExeState::SingleValueK) {}
|
|
59
59
|
|
|
60
|
+
|
|
60
61
|
/// Constructor
|
|
61
62
|
ConsExeState(VarToValMap varToValMap, LocToValMap locToValMap) : ExeState(ExeState::SingleValueK), _varToVal(
|
|
62
63
|
SVFUtil::move(varToValMap)), _locToVal(SVFUtil::move(locToValMap)) {}
|
|
@@ -360,6 +361,8 @@ public:
|
|
|
360
361
|
|
|
361
362
|
public:
|
|
362
363
|
|
|
364
|
+
|
|
365
|
+
|
|
363
366
|
s64_t getNumber(u32_t lhs);
|
|
364
367
|
|
|
365
368
|
static inline SingleAbsValue getIntOneZ3Expr()
|
|
@@ -406,11 +409,14 @@ public:
|
|
|
406
409
|
/// Whether two var to value map is equivalent
|
|
407
410
|
static bool eqVarToValMap(const VarToValMap &pre, const VarToValMap &nxt);
|
|
408
411
|
|
|
412
|
+
|
|
409
413
|
/// Whether lhs is less than rhs
|
|
410
414
|
static bool lessThanVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs);
|
|
411
415
|
|
|
416
|
+
|
|
412
417
|
private:
|
|
413
418
|
|
|
419
|
+
|
|
414
420
|
static bool assign(SingleAbsValue &lhs, const SingleAbsValue &rhs);
|
|
415
421
|
|
|
416
422
|
inline bool store(u32_t objId, const SingleAbsValue &z3Expr)
|
|
@@ -440,4 +446,6 @@ struct std::hash<SVF::ConsExeState>
|
|
|
440
446
|
}
|
|
441
447
|
};
|
|
442
448
|
|
|
449
|
+
|
|
450
|
+
|
|
443
451
|
#endif // SVF_CONSEXESTATE_H
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
|
|
30
31
|
#ifndef Z3_EXAMPLE_EXESTATE_H
|
|
31
32
|
#define Z3_EXAMPLE_EXESTATE_H
|
|
32
33
|
|
|
@@ -89,6 +90,7 @@ public:
|
|
|
89
90
|
return *this;
|
|
90
91
|
}
|
|
91
92
|
|
|
93
|
+
|
|
92
94
|
protected:
|
|
93
95
|
VarToAddrs _varToAddrs{{0, getVirtualMemAddress(0)}}; ///< Map a variable (symbol) to its memory addresses
|
|
94
96
|
VarToAddrs _locToAddrs; ///< Map a memory address to its stored memory addresses
|
|
@@ -113,6 +115,7 @@ public:
|
|
|
113
115
|
return _locToAddrs.find(id) != _locToAddrs.end();
|
|
114
116
|
}
|
|
115
117
|
|
|
118
|
+
|
|
116
119
|
inline virtual const VarToAddrs &getVarToAddrs() const
|
|
117
120
|
{
|
|
118
121
|
return _varToAddrs;
|
|
@@ -145,6 +148,8 @@ public:
|
|
|
145
148
|
return _kind;
|
|
146
149
|
}
|
|
147
150
|
|
|
151
|
+
|
|
152
|
+
|
|
148
153
|
public:
|
|
149
154
|
inline virtual void storeAddrs(u32_t addr, const Addrs &vaddrs)
|
|
150
155
|
{
|
|
@@ -280,8 +285,11 @@ public:
|
|
|
280
285
|
return AddressValue::getInternalID(idx);
|
|
281
286
|
}
|
|
282
287
|
|
|
288
|
+
|
|
283
289
|
}; // end class ExeState
|
|
284
290
|
|
|
291
|
+
|
|
292
|
+
|
|
285
293
|
} // end namespace SVF
|
|
286
294
|
|
|
287
295
|
template<>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//===--------------- ICFGWTO.h -- WTO for ICFG----------------------//
|
|
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
|
+
* ICFGWTO.h
|
|
25
|
+
*
|
|
26
|
+
* The implementation is based on F. Bourdoncle's paper:
|
|
27
|
+
* "Efficient chaotic iteration strategies with widenings", Formal
|
|
28
|
+
* Methods in Programming and Their Applications, 1993, pages 128-141.
|
|
29
|
+
*
|
|
30
|
+
* Created on: Jan 22, 2024
|
|
31
|
+
* Author: Xiao Cheng
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
#ifndef SVF_ICFGWTO_H
|
|
35
|
+
#define SVF_ICFGWTO_H
|
|
36
|
+
|
|
37
|
+
#include "Graphs/ICFG.h"
|
|
38
|
+
#include "Graphs/WTO.h"
|
|
39
|
+
|
|
40
|
+
namespace SVF
|
|
41
|
+
{
|
|
42
|
+
|
|
43
|
+
typedef WTOComponent<ICFG> ICFGWTOComp;
|
|
44
|
+
typedef WTONode<ICFG> ICFGWTONode;
|
|
45
|
+
typedef WTOCycle<ICFG> ICFGWTOCycle;
|
|
46
|
+
|
|
47
|
+
class ICFGWTO : public WTO<ICFG>
|
|
48
|
+
{
|
|
49
|
+
public:
|
|
50
|
+
typedef WTO<ICFG> Base;
|
|
51
|
+
typedef WTOComponentVisitor<ICFG>::WTONodeT ICFGWTONode;
|
|
52
|
+
|
|
53
|
+
explicit ICFGWTO(ICFG* graph, const ICFGNode* node) : Base(graph, node) {}
|
|
54
|
+
|
|
55
|
+
inline void forEachSuccessor(
|
|
56
|
+
const ICFGNode* node,
|
|
57
|
+
std::function<void(const ICFGNode*)> func) const override
|
|
58
|
+
{
|
|
59
|
+
if (const auto* callNode = SVFUtil::dyn_cast<CallICFGNode>(node))
|
|
60
|
+
{
|
|
61
|
+
const ICFGNode* succ = callNode->getRetICFGNode();
|
|
62
|
+
func(succ);
|
|
63
|
+
}
|
|
64
|
+
else
|
|
65
|
+
{
|
|
66
|
+
for (const auto& e : node->getOutEdges())
|
|
67
|
+
{
|
|
68
|
+
if (!e->isIntraCFGEdge() ||
|
|
69
|
+
node->getFun() != e->getDstNode()->getFun())
|
|
70
|
+
continue;
|
|
71
|
+
func(e->getDstNode());
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
} // namespace SVF
|
|
77
|
+
|
|
78
|
+
#endif // SVF_ICFGWTO_H
|
|
@@ -77,6 +77,7 @@ public:
|
|
|
77
77
|
|
|
78
78
|
virtual ~IntervalESBase() = default;
|
|
79
79
|
|
|
80
|
+
|
|
80
81
|
IntervalESBase &operator=(const IntervalESBase &rhs)
|
|
81
82
|
{
|
|
82
83
|
if (rhs != *this)
|
|
@@ -216,6 +217,7 @@ public:
|
|
|
216
217
|
/// domain meet with other, important! other widen this.
|
|
217
218
|
void meetWith(const IntervalESBase &other);
|
|
218
219
|
|
|
220
|
+
|
|
219
221
|
/// Return int value from an expression if it is a numeral, otherwise return an approximate value
|
|
220
222
|
inline s32_t Interval2NumValue(const IntervalValue &e) const
|
|
221
223
|
{
|
|
@@ -335,6 +337,7 @@ public:
|
|
|
335
337
|
return true;
|
|
336
338
|
}
|
|
337
339
|
|
|
340
|
+
|
|
338
341
|
static bool lessThanVarToValMap(const VarToValMap &lhs, const VarToValMap &rhs)
|
|
339
342
|
{
|
|
340
343
|
if (lhs.empty()) return !rhs.empty();
|
|
@@ -380,6 +383,7 @@ public:
|
|
|
380
383
|
return !(*this >= rhs);
|
|
381
384
|
}
|
|
382
385
|
|
|
386
|
+
|
|
383
387
|
bool operator>=(const IntervalESBase &rhs) const
|
|
384
388
|
{
|
|
385
389
|
return geqVarToValMap(_varToItvVal, rhs.getVarToVal()) && geqVarToValMap(_locToItvVal, rhs.getLocToVal());
|
|
@@ -393,6 +397,7 @@ public:
|
|
|
393
397
|
_varToAddrs.clear();
|
|
394
398
|
}
|
|
395
399
|
|
|
400
|
+
|
|
396
401
|
protected:
|
|
397
402
|
void printTable(const VarToValMap &table, std::ostream &oss) const;
|
|
398
403
|
|
|
@@ -421,6 +426,7 @@ public:
|
|
|
421
426
|
|
|
422
427
|
virtual ~IntervalExeState() = default;
|
|
423
428
|
|
|
429
|
+
|
|
424
430
|
IntervalExeState &operator=(const IntervalExeState &rhs)
|
|
425
431
|
{
|
|
426
432
|
IntervalESBase::operator=(rhs);
|
|
@@ -622,6 +628,7 @@ public:
|
|
|
622
628
|
return !(*this >= rhs);
|
|
623
629
|
}
|
|
624
630
|
|
|
631
|
+
|
|
625
632
|
bool operator>=(const IntervalExeState &rhs) const
|
|
626
633
|
{
|
|
627
634
|
return geqVarToValMap(_varToItvVal, rhs.getVarToVal()) && geqVarToValMap(_locToItvVal, rhs._locToItvVal);
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
*
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
|
+
|
|
30
31
|
#ifndef Z3_EXAMPLE_IntervalValue_H
|
|
31
32
|
#define Z3_EXAMPLE_IntervalValue_H
|
|
32
33
|
|
|
@@ -320,6 +321,7 @@ public:
|
|
|
320
321
|
}
|
|
321
322
|
}
|
|
322
323
|
|
|
324
|
+
|
|
323
325
|
/// Equality comparison
|
|
324
326
|
bool equals(const IntervalValue &other) const
|
|
325
327
|
{
|
|
@@ -677,6 +679,7 @@ inline IntervalValue operator<(const IntervalValue &lhs, const IntervalValue &rh
|
|
|
677
679
|
}
|
|
678
680
|
}
|
|
679
681
|
|
|
682
|
+
|
|
680
683
|
// Compare two IntervalValues for greater than or equal to
|
|
681
684
|
inline IntervalValue operator>=(const IntervalValue &lhs, const IntervalValue &rhs)
|
|
682
685
|
{
|
|
@@ -174,6 +174,7 @@ public:
|
|
|
174
174
|
return _n.geq(rhs._n).simplify().is_true();
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
|
|
177
178
|
/// Reload operator
|
|
178
179
|
//{%
|
|
179
180
|
friend NumericLiteral operator==(const NumericLiteral &lhs, const NumericLiteral &rhs)
|
|
@@ -433,6 +434,7 @@ public:
|
|
|
433
434
|
|
|
434
435
|
//%}
|
|
435
436
|
|
|
437
|
+
|
|
436
438
|
}; // end class NumericLiteral
|
|
437
439
|
} // end namespace SVF
|
|
438
440
|
|
|
@@ -86,6 +86,7 @@ public:
|
|
|
86
86
|
/// Return the offset expression of a GepStmt
|
|
87
87
|
IntervalValue getItvOfFlattenedElemIndex(const GepStmt *gep);
|
|
88
88
|
|
|
89
|
+
|
|
89
90
|
static z3::context &getContext()
|
|
90
91
|
{
|
|
91
92
|
return Z3Expr::getContext();
|
|
@@ -93,6 +94,7 @@ public:
|
|
|
93
94
|
|
|
94
95
|
void applySummary(IntervalExeState &es);
|
|
95
96
|
|
|
97
|
+
|
|
96
98
|
/// Init ObjVar
|
|
97
99
|
void initObjVar(const ObjVar *objVar, u32_t varId);
|
|
98
100
|
|
|
@@ -107,6 +109,7 @@ public:
|
|
|
107
109
|
return globalNulladdrs;
|
|
108
110
|
}
|
|
109
111
|
|
|
112
|
+
|
|
110
113
|
/// whether the variable is in varToVal table
|
|
111
114
|
inline bool inVarToValTable(u32_t id) const
|
|
112
115
|
{
|
|
@@ -119,6 +122,7 @@ public:
|
|
|
119
122
|
return _es.inVarToAddrsTable(id);
|
|
120
123
|
}
|
|
121
124
|
|
|
125
|
+
|
|
122
126
|
/// whether the memory address stores a interval value
|
|
123
127
|
inline bool inLocToValTable(u32_t id) const
|
|
124
128
|
{
|
|
@@ -135,6 +135,7 @@ public:
|
|
|
135
135
|
return (getExpr() >= rhs.getExpr()).simplify().is_true();
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
+
|
|
138
139
|
/// Reload operator
|
|
139
140
|
//{%
|
|
140
141
|
friend SingleAbsValue operator==(const SingleAbsValue &lhs, const SingleAbsValue &rhs)
|
|
@@ -472,4 +473,5 @@ struct std::hash<SVF::SingleAbsValue>
|
|
|
472
473
|
}
|
|
473
474
|
};
|
|
474
475
|
|
|
476
|
+
|
|
475
477
|
#endif //SVF_SINGLEABSVALUE_H
|
|
@@ -83,6 +83,7 @@ public:
|
|
|
83
83
|
return *this;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
|
|
86
87
|
/// Move Constructor
|
|
87
88
|
SymState(SymState &&rhs) noexcept: _exeState(SVFUtil::move(rhs._exeState)),
|
|
88
89
|
_typeState(SVFUtil::move(rhs._typeState)),
|
|
@@ -110,6 +111,7 @@ public:
|
|
|
110
111
|
return _keyNodesSet;
|
|
111
112
|
}
|
|
112
113
|
|
|
114
|
+
|
|
113
115
|
void insertKeyNode(NodeID id)
|
|
114
116
|
{
|
|
115
117
|
if (_keyNodesSet.empty())
|
|
@@ -201,6 +203,8 @@ public:
|
|
|
201
203
|
|
|
202
204
|
} // end namespace SVF
|
|
203
205
|
|
|
206
|
+
|
|
207
|
+
|
|
204
208
|
/// Specialise hash for SymState
|
|
205
209
|
template<>
|
|
206
210
|
struct std::hash<SVF::SymState>
|
|
@@ -127,6 +127,7 @@ public:
|
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
|
|
130
|
+
|
|
130
131
|
struct SymbolVectorHash
|
|
131
132
|
{
|
|
132
133
|
size_t operator()(const std::vector<Symbol> &v) const
|
|
@@ -155,6 +156,7 @@ public:
|
|
|
155
156
|
typedef std::vector<Symbol> Production;
|
|
156
157
|
typedef SymbolSet<Production> Productions;
|
|
157
158
|
|
|
159
|
+
|
|
158
160
|
inline Map<std::string, Kind>& getNonterminals()
|
|
159
161
|
{
|
|
160
162
|
return this->nonterminals;
|
|
@@ -362,6 +364,7 @@ public:
|
|
|
362
364
|
return it->second;
|
|
363
365
|
}
|
|
364
366
|
|
|
367
|
+
|
|
365
368
|
const Symbol& getLHSSymbol(const Production& prod) const
|
|
366
369
|
{
|
|
367
370
|
return prod.at(0);
|
|
@@ -381,6 +384,7 @@ public:
|
|
|
381
384
|
|
|
382
385
|
void dump(std::string fileName) const;
|
|
383
386
|
|
|
387
|
+
|
|
384
388
|
const inline u32_t num_generator()
|
|
385
389
|
{
|
|
386
390
|
return newTerminalSubscript++;
|
|
@@ -118,6 +118,7 @@ public:
|
|
|
118
118
|
/// get callsite id from return, return 0 if it is a spurious return edge
|
|
119
119
|
CallSiteID getCSIDAtRet(CxtLocDPItem& dpm, const SVFGEdge* edge);
|
|
120
120
|
|
|
121
|
+
|
|
121
122
|
/// Pop recursive callsites
|
|
122
123
|
inline virtual void popRecursiveCallSites(CxtLocDPItem& dpm)
|
|
123
124
|
{
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
//
|
|
21
21
|
//===----------------------------------------------------------------------===//
|
|
22
22
|
|
|
23
|
+
|
|
23
24
|
/*
|
|
24
25
|
* @file: DDAClient.h
|
|
25
26
|
* @author: yesen
|
|
@@ -29,6 +30,7 @@
|
|
|
29
30
|
*
|
|
30
31
|
*/
|
|
31
32
|
|
|
33
|
+
|
|
32
34
|
#ifndef DDACLIENT_H_
|
|
33
35
|
#define DDACLIENT_H_
|
|
34
36
|
|
|
@@ -116,6 +118,7 @@ private:
|
|
|
116
118
|
bool solveAll; ///< TRUE if all top level pointers are being queried
|
|
117
119
|
};
|
|
118
120
|
|
|
121
|
+
|
|
119
122
|
/**
|
|
120
123
|
* DDA client with function pointers as query candidates.
|
|
121
124
|
*/
|
|
@@ -133,6 +136,8 @@ public:
|
|
|
133
136
|
virtual void performStat(PointerAnalysis* pta);
|
|
134
137
|
};
|
|
135
138
|
|
|
139
|
+
|
|
140
|
+
|
|
136
141
|
/**
|
|
137
142
|
* DDA client with function pointers as query candidates.
|
|
138
143
|
*/
|
|
@@ -28,12 +28,13 @@
|
|
|
28
28
|
*
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
|
|
31
32
|
#ifndef DDAPASS_H_
|
|
32
33
|
#define DDAPASS_H_
|
|
33
34
|
|
|
34
|
-
#include "MemoryModel/PointerAnalysisImpl.h"
|
|
35
35
|
#include "DDA/DDAClient.h"
|
|
36
|
-
#include "
|
|
36
|
+
#include "Graphs/SCC.h"
|
|
37
|
+
#include "MemoryModel/PointerAnalysisImpl.h"
|
|
37
38
|
|
|
38
39
|
namespace SVF
|
|
39
40
|
{
|