svf-tools 1.0.981 → 1.0.982
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/AEDetector.h +1 -13
- package/svf/include/Graphs/ICFGNode.h +33 -0
- package/svf/include/Graphs/VFGNode.h +0 -6
- package/svf/include/MTA/LockAnalysis.h +1 -1
- package/svf/include/MTA/TCT.h +1 -10
- package/svf/include/SABER/SaberCondAllocator.h +5 -5
- package/svf/include/Util/SVFBugReport.h +2 -2
- package/svf/include/Util/SVFUtil.h +6 -1
- package/svf/lib/Graphs/IRGraph.cpp +2 -4
- package/svf/lib/MTA/LockAnalysis.cpp +4 -4
- package/svf/lib/MTA/MHP.cpp +2 -2
- package/svf/lib/MTA/MTA.cpp +0 -1
- package/svf/lib/MTA/TCT.cpp +4 -4
- package/svf/lib/MemoryModel/PointerAnalysis.cpp +6 -9
- package/svf/lib/SABER/DoubleFreeChecker.cpp +1 -1
- package/svf/lib/SABER/FileChecker.cpp +2 -5
- package/svf/lib/SABER/LeakChecker.cpp +2 -2
- package/svf/lib/SABER/ProgSlice.cpp +2 -2
- package/svf/lib/SABER/SaberCondAllocator.cpp +2 -2
- package/svf/lib/Util/SVFBugReport.cpp +1 -1
- package/svf/lib/Util/SVFUtil.cpp +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svf-tools",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.982",
|
|
4
4
|
"description": "* <b>[TypeClone](https://github.com/SVF-tools/SVF/wiki/TypeClone) published in our [ECOOP paper](https://yuleisui.github.io/publications/ecoop20.pdf) is now available in SVF </b> * <b>SVF now uses a single script for its build. Just type [`source ./build.sh`](https://github.com/SVF-tools/SVF/blob/master/build.sh) in your terminal, that's it!</b> * <b>SVF now supports LLVM-10.0.0! </b> * <b>We thank [bsauce](https://github.com/bsauce) for writing a user manual of SVF ([link1](https://www.jianshu.com/p/068a08ec749c) and [link2](https://www.jianshu.com/p/777c30d4240e)) in Chinese </b> * <b>SVF now supports LLVM-9.0.0 (Thank [Byoungyoung Lee](https://github.com/SVF-tools/SVF/issues/142) for his help!). </b> * <b>SVF now supports a set of [field-sensitive pointer analyses](https://yuleisui.github.io/publications/sas2019a.pdf). </b> * <b>[Use SVF as an external lib](https://github.com/SVF-tools/SVF/wiki/Using-SVF-as-a-lib-in-your-own-tool) for your own project (Contributed by [Hongxu Chen](https://github.com/HongxuChen)). </b> * <b>SVF now supports LLVM-7.0.0. </b> * <b>SVF now supports Docker. [Try SVF in Docker](https://github.com/SVF-tools/SVF/wiki/Try-SVF-in-Docker)! </b> * <b>SVF now supports [LLVM-6.0.0](https://github.com/svf-tools/SVF/pull/38) (Contributed by [Jack Anthony](https://github.com/jackanth)). </b> * <b>SVF now supports [LLVM-4.0.0](https://github.com/svf-tools/SVF/pull/23) (Contributed by Jared Carlson. Thank [Jared](https://github.com/jcarlson23) and [Will](https://github.com/dtzWill) for their in-depth [discussions](https://github.com/svf-tools/SVF/pull/18) about updating SVF!) </b> * <b>SVF now supports analysis for C++ programs.</b> <br />",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -218,21 +218,9 @@ public:
|
|
|
218
218
|
*/
|
|
219
219
|
void addBugToReporter(const AEException& e, const ICFGNode* node)
|
|
220
220
|
{
|
|
221
|
-
const SVFInstruction* inst = nullptr;
|
|
222
|
-
|
|
223
|
-
// Determine the instruction associated with the ICFG node
|
|
224
|
-
if (const CallICFGNode* call = SVFUtil::dyn_cast<CallICFGNode>(node))
|
|
225
|
-
{
|
|
226
|
-
inst = call->getCallSite(); // If the node is a call node, get the call site instruction
|
|
227
|
-
}
|
|
228
|
-
else
|
|
229
|
-
{
|
|
230
|
-
inst = node->getSVFStmts().back()->getInst(); // Otherwise, get the last instruction of the node's
|
|
231
|
-
// statements
|
|
232
|
-
}
|
|
233
221
|
|
|
234
222
|
GenericBug::EventStack eventStack;
|
|
235
|
-
SVFBugEvent sourceInstEvent(SVFBugEvent::EventType::SourceInst,
|
|
223
|
+
SVFBugEvent sourceInstEvent(SVFBugEvent::EventType::SourceInst, node);
|
|
236
224
|
eventStack.push_back(sourceInstEvent); // Add the source instruction event to the event stack
|
|
237
225
|
|
|
238
226
|
if (eventStack.empty())
|
|
@@ -132,6 +132,8 @@ public:
|
|
|
132
132
|
|
|
133
133
|
virtual const std::string toString() const;
|
|
134
134
|
|
|
135
|
+
virtual const std::string getSourceLoc() const = 0;
|
|
136
|
+
|
|
135
137
|
void dump() const;
|
|
136
138
|
|
|
137
139
|
protected:
|
|
@@ -172,6 +174,11 @@ public:
|
|
|
172
174
|
//@}
|
|
173
175
|
|
|
174
176
|
virtual const std::string toString() const;
|
|
177
|
+
|
|
178
|
+
virtual const std::string getSourceLoc() const
|
|
179
|
+
{
|
|
180
|
+
return "Global ICFGNode";
|
|
181
|
+
}
|
|
175
182
|
};
|
|
176
183
|
|
|
177
184
|
/*!
|
|
@@ -218,6 +225,11 @@ public:
|
|
|
218
225
|
//@}
|
|
219
226
|
|
|
220
227
|
const std::string toString() const;
|
|
228
|
+
|
|
229
|
+
virtual const std::string getSourceLoc() const
|
|
230
|
+
{
|
|
231
|
+
return inst->getSourceLoc();
|
|
232
|
+
}
|
|
221
233
|
};
|
|
222
234
|
|
|
223
235
|
class InterICFGNode : public ICFGNode
|
|
@@ -252,6 +264,7 @@ public:
|
|
|
252
264
|
|| node->getNodeKind() == FunRetBlock;
|
|
253
265
|
}
|
|
254
266
|
//@}
|
|
267
|
+
virtual const std::string getSourceLoc() const = 0;
|
|
255
268
|
};
|
|
256
269
|
|
|
257
270
|
|
|
@@ -316,6 +329,11 @@ public:
|
|
|
316
329
|
//@}
|
|
317
330
|
|
|
318
331
|
const virtual std::string toString() const;
|
|
332
|
+
|
|
333
|
+
virtual const std::string getSourceLoc() const
|
|
334
|
+
{
|
|
335
|
+
return "function entry: " + fun->getSourceLoc();
|
|
336
|
+
}
|
|
319
337
|
};
|
|
320
338
|
|
|
321
339
|
/*!
|
|
@@ -377,6 +395,11 @@ public:
|
|
|
377
395
|
//@}
|
|
378
396
|
|
|
379
397
|
virtual const std::string toString() const;
|
|
398
|
+
|
|
399
|
+
virtual const std::string getSourceLoc() const
|
|
400
|
+
{
|
|
401
|
+
return "function ret: " + fun->getSourceLoc();
|
|
402
|
+
}
|
|
380
403
|
};
|
|
381
404
|
|
|
382
405
|
/*!
|
|
@@ -478,6 +501,11 @@ public:
|
|
|
478
501
|
//@}
|
|
479
502
|
|
|
480
503
|
virtual const std::string toString() const;
|
|
504
|
+
|
|
505
|
+
virtual const std::string getSourceLoc() const
|
|
506
|
+
{
|
|
507
|
+
return "CallICFGNode: " + cs->getSourceLoc();
|
|
508
|
+
}
|
|
481
509
|
};
|
|
482
510
|
|
|
483
511
|
|
|
@@ -554,6 +582,11 @@ public:
|
|
|
554
582
|
//@}
|
|
555
583
|
|
|
556
584
|
virtual const std::string toString() const;
|
|
585
|
+
|
|
586
|
+
virtual const std::string getSourceLoc() const
|
|
587
|
+
{
|
|
588
|
+
return "RetICFGNode: " + cs->getSourceLoc();
|
|
589
|
+
}
|
|
557
590
|
};
|
|
558
591
|
|
|
559
592
|
} // End namespace SVF
|
|
@@ -181,12 +181,6 @@ public:
|
|
|
181
181
|
|| node->getNodeKind() == Store
|
|
182
182
|
|| node->getNodeKind() == Load;
|
|
183
183
|
}
|
|
184
|
-
|
|
185
|
-
inline const SVFInstruction* getInst() const
|
|
186
|
-
{
|
|
187
|
-
/// should return a valid instruction unless it is a global PAGEdge
|
|
188
|
-
return pagEdge->getInst();
|
|
189
|
-
}
|
|
190
184
|
//@}
|
|
191
185
|
|
|
192
186
|
const SVFValue* getValue() const override;
|
|
@@ -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 CallGraphEdge* cgEdge,
|
|
342
|
+
void handleCallRelation(CxtLockProc& clp, const CallGraphEdge* cgEdge, const CallICFGNode* call);
|
|
343
343
|
|
|
344
344
|
/// Return true it a lock matches an unlock
|
|
345
345
|
bool isAliasedLocks(const CxtLock& cl1, const CxtLock& cl2)
|
package/svf/include/MTA/TCT.h
CHANGED
|
@@ -167,15 +167,6 @@ public:
|
|
|
167
167
|
{
|
|
168
168
|
destroy();
|
|
169
169
|
}
|
|
170
|
-
/// Get CallICFGNode given inst
|
|
171
|
-
CallICFGNode* getCallICFGNode(const SVFInstruction* inst)
|
|
172
|
-
{
|
|
173
|
-
return pta->getICFG()->getCallICFGNode(inst);
|
|
174
|
-
}
|
|
175
|
-
const ICFGNode* getICFGNode(const SVFInstruction* inst)
|
|
176
|
-
{
|
|
177
|
-
return pta->getICFG()->getICFGNode(inst);
|
|
178
|
-
}
|
|
179
170
|
|
|
180
171
|
/// Get SVFFModule
|
|
181
172
|
SVFModule* getSVFModule() const
|
|
@@ -497,7 +488,7 @@ private:
|
|
|
497
488
|
//@}
|
|
498
489
|
|
|
499
490
|
/// Handle call relations
|
|
500
|
-
void handleCallRelation(CxtThreadProc& ctp, const CallGraphEdge* cgEdge,
|
|
491
|
+
void handleCallRelation(CxtThreadProc& ctp, const CallGraphEdge* cgEdge, const CallICFGNode* call);
|
|
501
492
|
|
|
502
493
|
/// Get or create a tct node based on CxtThread
|
|
503
494
|
//@{
|
|
@@ -49,7 +49,7 @@ class SaberCondAllocator
|
|
|
49
49
|
public:
|
|
50
50
|
|
|
51
51
|
typedef Z3Expr Condition; /// z3 condition
|
|
52
|
-
typedef Map<u32_t, const
|
|
52
|
+
typedef Map<u32_t, const ICFGNode*> IndexToTermInstMap; /// id to instruction map for z3
|
|
53
53
|
typedef Map<u32_t,Condition> CondPosMap; ///< map a branch to its Condition
|
|
54
54
|
typedef Map<const SVFBasicBlock*, CondPosMap > BBCondMap; /// map bb to a Condition
|
|
55
55
|
typedef Set<const SVFBasicBlock*> BasicBlockSet;
|
|
@@ -118,21 +118,21 @@ public:
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/// Allocate a new condition
|
|
121
|
-
Condition newCond(const
|
|
121
|
+
Condition newCond(const ICFGNode* inst);
|
|
122
122
|
|
|
123
123
|
/// Perform path allocation
|
|
124
124
|
void allocate(const SVFModule* module);
|
|
125
125
|
|
|
126
126
|
/// Get/Set instruction based on Z3 expression id
|
|
127
127
|
//{@
|
|
128
|
-
inline const
|
|
128
|
+
inline const ICFGNode* getCondInst(u32_t id) const
|
|
129
129
|
{
|
|
130
130
|
IndexToTermInstMap::const_iterator it = idToTermInstMap.find(id);
|
|
131
131
|
assert(it != idToTermInstMap.end() && "this should be a fresh condition");
|
|
132
132
|
return it->second;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
inline void setCondInst(const Condition &condition, const
|
|
135
|
+
inline void setCondInst(const Condition &condition, const ICFGNode* inst)
|
|
136
136
|
{
|
|
137
137
|
assert(idToTermInstMap.find(condition.id()) == idToTermInstMap.end() && "this should be a fresh condition");
|
|
138
138
|
idToTermInstMap[condition.id()] = inst;
|
|
@@ -235,7 +235,7 @@ public:
|
|
|
235
235
|
|
|
236
236
|
|
|
237
237
|
/// mark neg Z3 expression
|
|
238
|
-
inline void setNegCondInst(const Condition &condition, const
|
|
238
|
+
inline void setNegCondInst(const Condition &condition, const ICFGNode* inst)
|
|
239
239
|
{
|
|
240
240
|
setCondInst(condition, inst);
|
|
241
241
|
negConds.set(condition.id());
|
|
@@ -62,10 +62,10 @@ public:
|
|
|
62
62
|
|
|
63
63
|
protected:
|
|
64
64
|
u32_t typeAndInfoFlag;
|
|
65
|
-
const
|
|
65
|
+
const ICFGNode *eventInst;
|
|
66
66
|
|
|
67
67
|
public:
|
|
68
|
-
SVFBugEvent(u32_t typeAndInfoFlag, const
|
|
68
|
+
SVFBugEvent(u32_t typeAndInfoFlag, const ICFGNode *eventInst): typeAndInfoFlag(typeAndInfoFlag), eventInst(eventInst) { };
|
|
69
69
|
virtual ~SVFBugEvent() = default;
|
|
70
70
|
|
|
71
71
|
inline u32_t getEventType() const
|
|
@@ -206,7 +206,12 @@ inline bool isNonInstricCallSite(const ICFGNode* inst)
|
|
|
206
206
|
return isCallSite(inst);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
/// Return callsite given an instruction
|
|
212
|
+
CallSite getSVFCallSite(const ICFGNode* inst);
|
|
213
|
+
|
|
214
|
+
/// Return callsite given an instruction
|
|
210
215
|
inline CallSite getSVFCallSite(const SVFInstruction* inst)
|
|
211
216
|
{
|
|
212
217
|
assert(isCallSite(inst) && "not a callsite?");
|
|
@@ -273,13 +273,11 @@ struct DOTGraphTraits<IRGraph*> : public DefaultDOTGraphTraits
|
|
|
273
273
|
assert(edge && "No edge found!!");
|
|
274
274
|
if(const CallPE* calledge = SVFUtil::dyn_cast<CallPE>(edge))
|
|
275
275
|
{
|
|
276
|
-
|
|
277
|
-
return callInst->getSourceLoc();
|
|
276
|
+
return calledge->getCallSite()->getSourceLoc();
|
|
278
277
|
}
|
|
279
278
|
else if(const RetPE* retedge = SVFUtil::dyn_cast<RetPE>(edge))
|
|
280
279
|
{
|
|
281
|
-
|
|
282
|
-
return callInst->getSourceLoc();
|
|
280
|
+
return retedge->getCallSite()->getSourceLoc();
|
|
283
281
|
}
|
|
284
282
|
return "";
|
|
285
283
|
}
|
|
@@ -286,7 +286,7 @@ void LockAnalysis::collectCxtLock()
|
|
|
286
286
|
DBOUT(DMTA,
|
|
287
287
|
outs() << "\nCollecting CxtLocks: handling direct call:" << **cit << "\t" << cgEdge->getSrcNode()->getFunction()->getName()
|
|
288
288
|
<< "-->" << cgEdge->getDstNode()->getFunction()->getName() << "\n");
|
|
289
|
-
handleCallRelation(clp, cgEdge,
|
|
289
|
+
handleCallRelation(clp, cgEdge, *cit);
|
|
290
290
|
}
|
|
291
291
|
for (CallGraphEdge::CallInstSet::const_iterator ind = cgEdge->indirectCallsBegin(), eind = cgEdge->indirectCallsEnd();
|
|
292
292
|
ind != eind; ++ind)
|
|
@@ -295,7 +295,7 @@ void LockAnalysis::collectCxtLock()
|
|
|
295
295
|
outs() << "\nCollecting CxtLocks: handling indirect call:" << **ind << "\t"
|
|
296
296
|
<< cgEdge->getSrcNode()->getFunction()->getName() << "-->" << cgEdge->getDstNode()->getFunction()->getName()
|
|
297
297
|
<< "\n");
|
|
298
|
-
handleCallRelation(clp, cgEdge,
|
|
298
|
+
handleCallRelation(clp, cgEdge, *ind);
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
}
|
|
@@ -305,11 +305,11 @@ void LockAnalysis::collectCxtLock()
|
|
|
305
305
|
/*!
|
|
306
306
|
* Handling call relations when collecting context-sensitive locks
|
|
307
307
|
*/
|
|
308
|
-
void LockAnalysis::handleCallRelation(CxtLockProc& clp, const CallGraphEdge* cgEdge,
|
|
308
|
+
void LockAnalysis::handleCallRelation(CxtLockProc& clp, const CallGraphEdge* cgEdge, const CallICFGNode* cs)
|
|
309
309
|
{
|
|
310
310
|
|
|
311
311
|
CallStrCxt cxt(clp.getContext());
|
|
312
|
-
const ICFGNode* curNode =
|
|
312
|
+
const ICFGNode* curNode = cs;
|
|
313
313
|
if (isTDAcquire(curNode))
|
|
314
314
|
{
|
|
315
315
|
addCxtLock(cxt,curNode);
|
package/svf/lib/MTA/MHP.cpp
CHANGED
|
@@ -912,7 +912,7 @@ void ForkJoinAnalysis::handleRet(const CxtStmt& cts)
|
|
|
912
912
|
cit != ecit; ++cit)
|
|
913
913
|
{
|
|
914
914
|
CallStrCxt newCxt = curCxt;
|
|
915
|
-
const ICFGNode* curNode =
|
|
915
|
+
const ICFGNode* curNode = (*cit);
|
|
916
916
|
if (matchCxt(newCxt, SVFUtil::cast<CallICFGNode>(curNode), curFunNode->getFunction()))
|
|
917
917
|
{
|
|
918
918
|
for(const ICFGEdge* outEdge : curNode->getOutEdges())
|
|
@@ -930,7 +930,7 @@ void ForkJoinAnalysis::handleRet(const CxtStmt& cts)
|
|
|
930
930
|
cit != ecit; ++cit)
|
|
931
931
|
{
|
|
932
932
|
CallStrCxt newCxt = curCxt;
|
|
933
|
-
const ICFGNode* curNode =
|
|
933
|
+
const ICFGNode* curNode = (*cit);
|
|
934
934
|
|
|
935
935
|
if (matchCxt(newCxt, SVFUtil::cast<CallICFGNode>(curNode), curFunNode->getFunction()))
|
|
936
936
|
{
|
package/svf/lib/MTA/MTA.cpp
CHANGED
|
@@ -135,7 +135,6 @@ void MTA::detect(SVFModule* module)
|
|
|
135
135
|
SVFIR* pag = SVFIR::getPAG();
|
|
136
136
|
PointerAnalysis* pta = AndersenWaveDiff::createAndersenWaveDiff(pag);
|
|
137
137
|
|
|
138
|
-
Set<const SVFInstruction*> needcheckinst;
|
|
139
138
|
// Add symbols for all of the functions and the instructions in them.
|
|
140
139
|
for (const SVFFunction* F : module->getFunctionSet())
|
|
141
140
|
{
|
package/svf/lib/MTA/TCT.cpp
CHANGED
|
@@ -240,13 +240,13 @@ void TCT::collectMultiForkedThreads()
|
|
|
240
240
|
/*!
|
|
241
241
|
* Handle call relations
|
|
242
242
|
*/
|
|
243
|
-
void TCT::handleCallRelation(CxtThreadProc& ctp, const CallGraphEdge* cgEdge,
|
|
243
|
+
void TCT::handleCallRelation(CxtThreadProc& ctp, const CallGraphEdge* cgEdge, const CallICFGNode* cs)
|
|
244
244
|
{
|
|
245
245
|
const SVFFunction* callee = cgEdge->getDstNode()->getFunction();
|
|
246
246
|
|
|
247
247
|
CallStrCxt cxt(ctp.getContext());
|
|
248
248
|
CallStrCxt oldCxt = cxt;
|
|
249
|
-
const CallICFGNode* callNode =
|
|
249
|
+
const CallICFGNode* callNode = cs;
|
|
250
250
|
pushCxt(cxt,callNode,callee);
|
|
251
251
|
|
|
252
252
|
if(cgEdge->getEdgeKind() == CallGraphEdge::CallRetEdge)
|
|
@@ -416,13 +416,13 @@ void TCT::build()
|
|
|
416
416
|
ecit = cgEdge->directCallsEnd(); cit!=ecit; ++cit)
|
|
417
417
|
{
|
|
418
418
|
DBOUT(DMTA,outs() << "\nTCT handling direct call:" << **cit << "\t" << cgEdge->getSrcNode()->getFunction()->getName() << "-->" << cgEdge->getDstNode()->getFunction()->getName() << "\n");
|
|
419
|
-
handleCallRelation(ctp,cgEdge
|
|
419
|
+
handleCallRelation(ctp,cgEdge,*cit);
|
|
420
420
|
}
|
|
421
421
|
for(CallGraphEdge::CallInstSet::const_iterator ind = cgEdge->indirectCallsBegin(),
|
|
422
422
|
eind = cgEdge->indirectCallsEnd(); ind!=eind; ++ind)
|
|
423
423
|
{
|
|
424
424
|
DBOUT(DMTA,outs() << "\nTCT handling indirect call:" << **ind << "\t" << cgEdge->getSrcNode()->getFunction()->getName() << "-->" << cgEdge->getDstNode()->getFunction()->getName() << "\n");
|
|
425
|
-
handleCallRelation(ctp,cgEdge
|
|
425
|
+
handleCallRelation(ctp,cgEdge,*ind);
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
}
|
|
@@ -509,11 +509,9 @@ void PointerAnalysis::validateSuccessTests(std::string fun)
|
|
|
509
509
|
|
|
510
510
|
for(const CallICFGNode* callNode : pag->getCallSiteSet())
|
|
511
511
|
{
|
|
512
|
-
|
|
513
|
-
if (SVFUtil::getCallee(svfInst) == checkFun)
|
|
512
|
+
if (SVFUtil::getCallee(callNode) == checkFun)
|
|
514
513
|
{
|
|
515
|
-
|
|
516
|
-
CallSite cs(svfInst);
|
|
514
|
+
CallSite cs = SVFUtil::getSVFCallSite(callNode);
|
|
517
515
|
assert(cs.getNumArgOperands() == 2
|
|
518
516
|
&& "arguments should be two pointers!!");
|
|
519
517
|
const SVFValue* V1 = cs.getArgOperand(0);
|
|
@@ -551,12 +549,12 @@ void PointerAnalysis::validateSuccessTests(std::string fun)
|
|
|
551
549
|
|
|
552
550
|
if (checkSuccessful)
|
|
553
551
|
outs() << sucMsg("\t SUCCESS :") << fun << " check <id:" << id1 << ", id:" << id2 << "> at ("
|
|
554
|
-
<<
|
|
552
|
+
<< callNode->getSourceLoc() << ")\n";
|
|
555
553
|
else
|
|
556
554
|
{
|
|
557
555
|
SVFUtil::errs() << errMsg("\t FAILURE :") << fun
|
|
558
556
|
<< " check <id:" << id1 << ", id:" << id2
|
|
559
|
-
<< "> at (" <<
|
|
557
|
+
<< "> at (" << callNode->getSourceLoc() << ")\n";
|
|
560
558
|
assert(false && "test case failed!");
|
|
561
559
|
}
|
|
562
560
|
}
|
|
@@ -577,10 +575,9 @@ void PointerAnalysis::validateExpectedFailureTests(std::string fun)
|
|
|
577
575
|
|
|
578
576
|
for(const CallICFGNode* callNode : pag->getCallSiteSet())
|
|
579
577
|
{
|
|
580
|
-
|
|
581
|
-
if (SVFUtil::getCallee(svfInst) == checkFun)
|
|
578
|
+
if (SVFUtil::getCallee(callNode) == checkFun)
|
|
582
579
|
{
|
|
583
|
-
CallSite call = getSVFCallSite(
|
|
580
|
+
CallSite call = getSVFCallSite(callNode);
|
|
584
581
|
assert(call.arg_size() == 2
|
|
585
582
|
&& "arguments should be two pointers!!");
|
|
586
583
|
const SVFValue* V1 = call.getArgOperand(0);
|
|
@@ -42,7 +42,7 @@ void DoubleFreeChecker::reportBug(ProgSlice* slice)
|
|
|
42
42
|
GenericBug::EventStack eventStack;
|
|
43
43
|
slice->evalFinalCond2Event(eventStack);
|
|
44
44
|
eventStack.push_back(
|
|
45
|
-
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())
|
|
45
|
+
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())));
|
|
46
46
|
report.addSaberBug(GenericBug::DOUBLEFREE, eventStack);
|
|
47
47
|
}
|
|
48
48
|
if(Options::ValidateTests())
|
|
@@ -39,10 +39,7 @@ void FileChecker::reportBug(ProgSlice* slice)
|
|
|
39
39
|
if(isAllPathReachable() == false && isSomePathReachable() == false)
|
|
40
40
|
{
|
|
41
41
|
// full leakage
|
|
42
|
-
GenericBug::EventStack eventStack =
|
|
43
|
-
{
|
|
44
|
-
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())->getCallSite())
|
|
45
|
-
};
|
|
42
|
+
GenericBug::EventStack eventStack = { SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())) };
|
|
46
43
|
report.addSaberBug(GenericBug::FILENEVERCLOSE, eventStack);
|
|
47
44
|
}
|
|
48
45
|
else if (isAllPathReachable() == false && isSomePathReachable() == true)
|
|
@@ -50,7 +47,7 @@ void FileChecker::reportBug(ProgSlice* slice)
|
|
|
50
47
|
GenericBug::EventStack eventStack;
|
|
51
48
|
slice->evalFinalCond2Event(eventStack);
|
|
52
49
|
eventStack.push_back(
|
|
53
|
-
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())
|
|
50
|
+
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())));
|
|
54
51
|
report.addSaberBug(GenericBug::FILEPARTIALCLOSE, eventStack);
|
|
55
52
|
}
|
|
56
53
|
}
|
|
@@ -154,7 +154,7 @@ void LeakChecker::reportBug(ProgSlice* slice)
|
|
|
154
154
|
// full leakage
|
|
155
155
|
GenericBug::EventStack eventStack =
|
|
156
156
|
{
|
|
157
|
-
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())
|
|
157
|
+
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource()))
|
|
158
158
|
};
|
|
159
159
|
report.addSaberBug(GenericBug::NEVERFREE, eventStack);
|
|
160
160
|
}
|
|
@@ -164,7 +164,7 @@ void LeakChecker::reportBug(ProgSlice* slice)
|
|
|
164
164
|
GenericBug::EventStack eventStack;
|
|
165
165
|
slice->evalFinalCond2Event(eventStack);
|
|
166
166
|
eventStack.push_back(
|
|
167
|
-
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())
|
|
167
|
+
SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())));
|
|
168
168
|
report.addSaberBug(GenericBug::PARTIALLEAK, eventStack);
|
|
169
169
|
}
|
|
170
170
|
|
|
@@ -198,7 +198,7 @@ void ProgSlice::evalFinalCond2Event(GenericBug::EventStack &eventStack) const
|
|
|
198
198
|
NodeBS elems = pathAllocator->exactCondElem(finalCond);
|
|
199
199
|
for(NodeBS::iterator it = elems.begin(), eit = elems.end(); it!=eit; ++it)
|
|
200
200
|
{
|
|
201
|
-
const
|
|
201
|
+
const ICFGNode* tinst = pathAllocator->getCondInst(*it);
|
|
202
202
|
if(pathAllocator->isNegCond(*it))
|
|
203
203
|
eventStack.push_back(SVFBugEvent(
|
|
204
204
|
SVFBugEvent::Branch|((((u32_t)false) << 4) & BRANCHFLAGMASK), tinst));
|
|
@@ -226,7 +226,7 @@ std::string ProgSlice::evalFinalCond() const
|
|
|
226
226
|
|
|
227
227
|
for(NodeBS::iterator it = elems.begin(), eit = elems.end(); it!=eit; ++it)
|
|
228
228
|
{
|
|
229
|
-
const
|
|
229
|
+
const ICFGNode* tinst = pathAllocator->getCondInst(*it);
|
|
230
230
|
if(pathAllocator->isNegCond(*it))
|
|
231
231
|
locations.insert(tinst->getSourceLoc()+"|False");
|
|
232
232
|
else
|
|
@@ -99,7 +99,7 @@ void SaberCondAllocator::allocateForBB(const SVFBasicBlock &bb)
|
|
|
99
99
|
std::vector<Condition> condVec;
|
|
100
100
|
for (u32_t i = 0; i < bit_num; i++)
|
|
101
101
|
{
|
|
102
|
-
const
|
|
102
|
+
const IntraICFGNode* svfInst = cast<IntraICFGNode>(bb.back());
|
|
103
103
|
condVec.push_back(newCond(svfInst));
|
|
104
104
|
}
|
|
105
105
|
|
|
@@ -593,7 +593,7 @@ void SaberCondAllocator::printPathCond()
|
|
|
593
593
|
}
|
|
594
594
|
|
|
595
595
|
/// Allocate a new condition
|
|
596
|
-
SaberCondAllocator::Condition SaberCondAllocator::newCond(const
|
|
596
|
+
SaberCondAllocator::Condition SaberCondAllocator::newCond(const ICFGNode* inst)
|
|
597
597
|
{
|
|
598
598
|
u32_t condCountIdx = totalCondNum++;
|
|
599
599
|
Condition expr = Condition::getContext().bool_const(("c" + std::to_string(condCountIdx)).c_str());
|
|
@@ -276,7 +276,7 @@ void PartialNullPtrDereferenceBug::printBugToTerminal() const
|
|
|
276
276
|
|
|
277
277
|
const std::string SVFBugEvent::getFuncName() const
|
|
278
278
|
{
|
|
279
|
-
return eventInst->
|
|
279
|
+
return eventInst->getFun()->getName();
|
|
280
280
|
}
|
|
281
281
|
|
|
282
282
|
const std::string SVFBugEvent::getEventLoc() const
|
package/svf/lib/Util/SVFUtil.cpp
CHANGED
|
@@ -330,6 +330,13 @@ bool SVFUtil::isCallSite(const ICFGNode* inst)
|
|
|
330
330
|
return SVFUtil::isa<CallICFGNode>(inst);
|
|
331
331
|
}
|
|
332
332
|
|
|
333
|
+
CallSite SVFUtil::getSVFCallSite(const ICFGNode* inst)
|
|
334
|
+
{
|
|
335
|
+
assert(isCallSite(inst) && "not a callsite?");
|
|
336
|
+
CallSite cs(cast<CallICFGNode>(inst)->getCallSite());
|
|
337
|
+
return cs;
|
|
338
|
+
}
|
|
339
|
+
|
|
333
340
|
bool SVFUtil::isIntrinsicInst(const ICFGNode* inst)
|
|
334
341
|
{
|
|
335
342
|
if (const CallICFGNode* call = SVFUtil::dyn_cast<CallICFGNode>(inst))
|