|
Static Value-Flow Analysis
|
#include <LeakChecker.h>
Public Types | |
| enum | LEAK_TYPE { NEVER_FREE_LEAK , CONTEXT_LEAK , PATH_LEAK , GLOBAL_LEAK } |
| typedef Map< const SVFGNode *, const CallICFGNode * > | SVFGNodeToCSIDMap |
| typedef FIFOWorkList< const CallICFGNode * > | CSWorkList |
| typedef ProgSlice::VFWorkList | WorkList |
| typedef NodeBS | SVFGNodeBS |
| Public Types inherited from SVF::SrcSnkDDA | |
| typedef ProgSlice::SVFGNodeSet | SVFGNodeSet |
| typedef Map< const SVFGNode *, ProgSlice * > | SVFGNodeToSliceMap |
| typedef SVFGNodeSet::const_iterator | SVFGNodeSetIter |
| typedef CxtDPItem | DPIm |
| typedef Set< DPIm > | DPImSet |
| dpitem set | |
| typedef Map< const SVFGNode *, DPImSet > | SVFGNodeToDPItemsMap |
| map a SVFGNode to its visited dpitems | |
| typedef Set< const CallICFGNode * > | CallSiteSet |
| typedef NodeBS | SVFGNodeBS |
| typedef ProgSlice::VFWorkList | WorkList |
| Public Types inherited from SVF::GraphReachSolver< SVFG *, CxtDPItem > | |
| typedef SVF::GenericGraphTraits< SVFG * > | GTraits |
| Define the GTraits and node iterator. | |
| typedef GTraits::NodeType | GNODE |
| typedef GTraits::EdgeType | GEDGE |
| typedef GTraits::nodes_iterator | node_iterator |
| typedef GTraits::ChildIteratorType | child_iterator |
| typedef SVF::GenericGraphTraits< SVF::Inverse< GNODE * > > | InvGTraits |
| Define inverse GTraits and note iterator. | |
| typedef InvGTraits::ChildIteratorType | inv_child_iterator |
| typedef FIFOWorkList< CxtDPItem > | WorkList |
| Define worklist. | |
Public Member Functions | |
| LeakChecker () | |
| Constructor. | |
| virtual | ~LeakChecker () |
| Destructor. | |
| virtual bool | runOnModule (SVFIR *pag) |
| We start from here. | |
| virtual void | initSrcs () override |
| Initialize sources and sinks. | |
| virtual void | initSnks () override |
| virtual bool | isSourceLikeFun (const FunObjVar *fun) override |
| Whether the function is a heap allocator/reallocator (allocate memory). | |
| virtual bool | isSinkLikeFun (const FunObjVar *fun) override |
| Whether the function is a heap deallocator (free/release memory). | |
| Public Member Functions inherited from SVF::SrcSnkDDA | |
| SrcSnkDDA () | |
| Bug Reporter. | |
| ~SrcSnkDDA () override | |
| Destructor. | |
| virtual void | analyze () |
| Start analysis here. | |
| virtual void | initialize () |
| Initialize analysis. | |
| virtual void | finalize () |
| Finalize analysis. | |
| SVFIR * | getPAG () const |
| Get SVFIR. | |
| const SVFG * | getSVFG () const |
| Get SVFG. | |
| CallGraph * | getCallgraph () const |
| Get Callgraph. | |
| bool | isGlobalSVFGNode (const SVFGNode *node) const |
| Whether this svfg node may access global variable. | |
| virtual void | setCurSlice (const SVFGNode *src) |
| Slice operations. | |
| ProgSlice * | getCurSlice () const |
| void | addSinkToCurSlice (const SVFGNode *node) |
| bool | isInCurForwardSlice (const SVFGNode *node) |
| bool | isInCurBackwardSlice (const SVFGNode *node) |
| void | addToCurForwardSlice (const SVFGNode *node) |
| void | addToCurBackwardSlice (const SVFGNode *node) |
| bool | isInAWrapper (const SVFGNode *src, CallSiteSet &csIdSet) |
| Identify allocation wrappers. | |
| const SVFGNodeSet & | getSources () const |
| Get sources/sinks. | |
| SVFGNodeSetIter | sourcesBegin () const |
| SVFGNodeSetIter | sourcesEnd () const |
| void | addToSources (const SVFGNode *node) |
| const SVFGNodeSet & | getSinks () const |
| SVFGNodeSetIter | sinksBegin () const |
| SVFGNodeSetIter | sinksEnd () const |
| void | addToSinks (const SVFGNode *node) |
| SaberCondAllocator * | getSaberCondAllocator () const |
| Get saber condition allocator. | |
| const SVFBugReport & | getBugReport () const |
| bool | isSource (const SVFGNode *node) const |
| bool | isSink (const SVFGNode *node) const |
Protected Member Functions | |
| virtual void | reportBug (ProgSlice *slice) override |
| Report leaks. | |
| void | testsValidation (const ProgSlice *slice) |
| Validate test cases for regression test purpose. | |
| void | validateSuccessTests (const SVFGNode *source, const FunObjVar *fun) |
| void | validateExpectedFailureTests (const SVFGNode *source, const FunObjVar *fun) |
| void | addSrcToCSID (const SVFGNode *src, const CallICFGNode *cs) |
| Record a source to its callsite. | |
| const CallICFGNode * | getSrcCSID (const SVFGNode *src) |
| Protected Member Functions inherited from SVF::SrcSnkDDA | |
| void | FWProcessCurNode (const DPIm &item) override |
| Forward traverse. | |
| void | BWProcessCurNode (const DPIm &item) override |
| Backward traverse. | |
| void | FWProcessOutgoingEdge (const DPIm &item, SVFGEdge *edge) override |
| Propagate information forward by matching context. | |
| void | BWProcessIncomingEdge (const DPIm &item, SVFGEdge *edge) override |
| Propagate information backward without matching context, as forward analysis already did it. | |
| bool | forwardVisited (const SVFGNode *node, const DPIm &item) |
| Whether has been visited or not, in order to avoid recursion on SVFG. | |
| void | addForwardVisited (const SVFGNode *node, const DPIm &item) |
| bool | backwardVisited (const SVFGNode *node) |
| void | addBackwardVisited (const SVFGNode *node) |
| void | clearVisitedMap () |
| virtual bool | isAllPathReachable () |
| Whether it is all path reachable from a source. | |
| virtual bool | isSomePathReachable () |
| Whether it is some path reachable from a source. | |
| void | dumpSlices () |
| Dump SVFG with annotated slice information. | |
| void | annotateSlice (ProgSlice *slice) |
| void | printZ3Stat () |
| Protected Member Functions inherited from SVF::GraphReachSolver< SVFG *, CxtDPItem > | |
| GraphReachSolver () | |
| Constructor. | |
| virtual | ~GraphReachSolver () |
| Destructor. | |
| const SVFG * | graph () const |
| Get/Set graph methods. | |
| void | setGraph (SVFG *g) |
| GNODE * | getNode (NodeID id) const |
| virtual NodeID | getNodeIDFromItem (const CxtDPItem &item) const |
| virtual void | forwardTraverse (CxtDPItem &it) |
| CFL forward traverse solve. | |
| virtual void | backwardTraverse (CxtDPItem &it) |
| CFL forward traverse solve. | |
| virtual void | FWProcessOutgoingEdge (const CxtDPItem &item, GEDGE *edge) |
| Propagation for the solving, to be implemented in the child class. | |
| virtual void | BWProcessIncomingEdge (const CxtDPItem &item, GEDGE *edge) |
| CxtDPItem | popFromWorklist () |
| Worklist operations. | |
| bool | pushIntoWorklist (CxtDPItem &item) |
| bool | isWorklistEmpty () |
| bool | isInWorklist (CxtDPItem &item) |
Private Attributes | |
| SVFGNodeToCSIDMap | srcToCSIDMap |
Additional Inherited Members | |
| Protected Attributes inherited from SVF::SrcSnkDDA | |
| SaberSVFGBuilder | memSSA |
| SVFG * | svfg |
| CallGraph * | callgraph |
| SVFBugReport | report |
Static Memory Leak Detector
Definition at line 42 of file LeakChecker.h.
| typedef FIFOWorkList<const CallICFGNode*> SVF::LeakChecker::CSWorkList |
Definition at line 47 of file LeakChecker.h.
| typedef NodeBS SVF::LeakChecker::SVFGNodeBS |
Definition at line 49 of file LeakChecker.h.
| typedef Map<const SVFGNode*,const CallICFGNode*> SVF::LeakChecker::SVFGNodeToCSIDMap |
Definition at line 46 of file LeakChecker.h.
Definition at line 48 of file LeakChecker.h.
| Enumerator | |
|---|---|
| NEVER_FREE_LEAK | |
| CONTEXT_LEAK | |
| PATH_LEAK | |
| GLOBAL_LEAK | |
Definition at line 50 of file LeakChecker.h.
|
inline |
|
inlinevirtual |
|
inlineprotected |
Record a source to its callsite.
Definition at line 105 of file LeakChecker.h.
|
inlineprotected |
Definition at line 109 of file LeakChecker.h.
|
overridevirtual |
Initialize sinks
we only choose pointer parameters among all the actual parameters
Implements SVF::SrcSnkDDA.
Definition at line 105 of file LeakChecker.cpp.
|
overridevirtual |
Initialize sources and sinks.
Initialize sources and sinks
Initialize sources
if this callsite return reside in a dead function then we do not care about its leaks for example instruction int* p = malloc(size) is in a dead function, then program won't allocate this memory for example a customized malloc int p = malloc() returns an integer value, then program treat it as a system malloc
Implements SVF::SrcSnkDDA.
Definition at line 40 of file LeakChecker.cpp.
|
inlineoverridevirtual |
Whether the function is a heap deallocator (free/release memory).
Reimplemented from SVF::SrcSnkDDA.
Reimplemented in SVF::FileChecker.
Definition at line 86 of file LeakChecker.h.
|
inlineoverridevirtual |
Whether the function is a heap allocator/reallocator (allocate memory).
Reimplemented from SVF::SrcSnkDDA.
Reimplemented in SVF::FileChecker.
Definition at line 81 of file LeakChecker.h.
|
overrideprotectedvirtual |
Report leaks.
Implements SVF::SrcSnkDDA.
Reimplemented in SVF::DoubleFreeChecker, and SVF::FileChecker.
Definition at line 148 of file LeakChecker.cpp.
|
inlinevirtual |
We start from here.
start analysis
Reimplemented in SVF::DoubleFreeChecker, and SVF::FileChecker.
Definition at line 68 of file LeakChecker.h.
|
protected |
Validate test cases for regression test purpose.
Validate test cases for regression test purpose
Definition at line 178 of file LeakChecker.cpp.
|
protected |
Definition at line 261 of file LeakChecker.cpp.
Definition at line 191 of file LeakChecker.cpp.
|
private |
Definition at line 117 of file LeakChecker.h.