|
Static Value-Flow Analysis
|
#include <ProgSlice.h>
Public Types | |
| typedef Set< const SVFGNode * > | SVFGNodeSet |
| typedef SVFGNodeSet::const_iterator | SVFGNodeSetIter |
| typedef SaberCondAllocator::Condition | Condition |
| typedef Map< const SVFGNode *, Condition > | SVFGNodeToCondMap |
| map a SVFGNode to its condition during value-flow guard computation | |
| typedef FIFOWorkList< const SVFGNode * > | VFWorkList |
| worklist for value-flow guard computation | |
| typedef FIFOWorkList< const SVFBasicBlock * > | CFWorkList |
| worklist for control-flow guard computation | |
| typedef SaberCondAllocator::SVFGNodeToSVFGNodeSetMap | SVFGNodeToSVFGNodeSetMap |
Private Attributes | |
| SVFGNodeSet | forwardslice |
| the forward slice | |
| SVFGNodeSet | backwardslice |
| the backward slice | |
| SVFGNodeSet | sinks |
| a set of sink nodes | |
| const SVFGNode * | root |
| root node on the slice | |
| SVFGNodeToCondMap | svfgNodeToCondMap |
| map a SVFGNode to its path condition starting from root | |
| bool | partialReachable |
| reachable from some paths | |
| bool | fullReachable |
| reachable from all paths | |
| bool | reachGlob |
| Whether slice reach a global. | |
| SaberCondAllocator * | pathAllocator |
| path condition allocator | |
| const SVFGNode * | _curSVFGNode |
| current svfg node during guard computation | |
| Condition | finalCond |
| final condition | |
| const SVFG * | svfg |
| SVFG. | |
Definition at line 48 of file ProgSlice.h.
worklist for control-flow guard computation
Definition at line 58 of file ProgSlice.h.
Definition at line 54 of file ProgSlice.h.
Definition at line 52 of file ProgSlice.h.
| typedef SVFGNodeSet::const_iterator SVF::ProgSlice::SVFGNodeSetIter |
Definition at line 53 of file ProgSlice.h.
map a SVFGNode to its condition during value-flow guard computation
Definition at line 55 of file ProgSlice.h.
Definition at line 60 of file ProgSlice.h.
worklist for value-flow guard computation
Definition at line 57 of file ProgSlice.h.
|
inline |
Constructor.
Definition at line 64 of file ProgSlice.h.
|
inlinevirtual |
Definition at line 90 of file ProgSlice.h.
Forward and backward slice operations.
Definition at line 86 of file ProgSlice.h.
Definition at line 126 of file ProgSlice.h.
| bool ProgSlice::AllPathReachableSolve | ( | ) |
Guarded reachability solve.
Compute path conditions for nodes on the backward slice path condition of each node is calculated starting from root node (source) Given a SVFGNode n, its path condition C is allocated (path_i stands for one of m program paths reaches n)
C = \bigvee Guard(path_i), 0 < i < m Guard(path_i) = \bigwedge VFGGuard(x,y), suppose (x,y) are two SVFGNode nodes on path_i
mark source node conditions to be true
clean up the control flow conditions for next round guard computation
Definition at line 43 of file ProgSlice.cpp.
|
inline |
Definition at line 110 of file ProgSlice.h.
|
inline |
Definition at line 114 of file ProgSlice.h.
|
inlineprotected |
Clear Control flow conditions before each VF computation.
TODO: how to clean z3 memory
Definition at line 220 of file ProgSlice.h.
|
inlineprotected |
Definition at line 255 of file ProgSlice.h.
|
inlineprotected |
Definition at line 259 of file ProgSlice.h.
|
inlineprotected |
Compute guards for value-flows.
Definition at line 251 of file ProgSlice.h.
|
protected |
Compute invalid branch condition stemming from removed strong update value-flow edges.
Compute invalid branch condition stemming from removed strong update value-flow edges
Fix issue: https://github.com/SVF-tools/SVF/issues/1306 Line 11->13 is removed due to a strong update at Line 13, which means Line 11 is unreachable to Line 13 on the value flow graph. However on the control flow graph they are still considered as reachable, making the vf guard on Line 11 -> Line 15 a true condition (should consider the infeasible branch Line 11 -> Line 13) Therefore, we collect this infeasible branch condition (condition on Line 11 -> Line 13, a == b) as an invalid condition (invalidCond), and add the negation of invalidCond when computing value flow guard starting from the source of the SU. In this example, we add a != b on Line 11 -> Line 15.
| cur | current SVFG node |
Definition at line 108 of file ProgSlice.cpp.
Condition operations.
Definition at line 181 of file ProgSlice.h.
Definition at line 189 of file ProgSlice.h.
Definition at line 185 of file ProgSlice.h.
|
protected |
Definition at line 201 of file ProgSlice.h.
| std::string ProgSlice::evalFinalCond | ( | ) | const |
Evaluate final condition.
Evaluate Atoms of a condition TODO: for now we only evaluate one path, evaluate every single path
Atom – a propositional variable: a, b, c Literal – an atom or its negation: a, ~a Clause – A disjunction of some literals: a \vee b CNF formula – a conjunction of some clauses: (a \vee b ) \wedge (c \vee d)
print leak path after eliminating duplicated element
Definition at line 220 of file ProgSlice.cpp.
| void ProgSlice::evalFinalCond2Event | ( | GenericBug::EventStack & | eventStack | ) | const |
Add final condition to eventStack.
Definition at line 196 of file ProgSlice.cpp.
|
inline |
Definition at line 102 of file ProgSlice.h.
|
inline |
Definition at line 106 of file ProgSlice.h.
|
inline |
Definition at line 80 of file ProgSlice.h.
| const CallICFGNode * ProgSlice::getCallSite | ( | const SVFGEdge * | edge | ) | const |
Get callsite ID and get returnsiteID from SVFGEdge.
Definition at line 179 of file ProgSlice.cpp.
Get/set current SVFG node.
Definition at line 285 of file ProgSlice.h.
|
inline |
Definition at line 197 of file ProgSlice.h.
|
inline |
Definition at line 76 of file ProgSlice.h.
|
inlineprotected |
Definition at line 304 of file ProgSlice.h.
| const CallICFGNode * ProgSlice::getRetSite | ( | const SVFGEdge * | edge | ) | const |
Definition at line 187 of file ProgSlice.cpp.
|
inline |
Definition at line 130 of file ProgSlice.h.
Definition at line 212 of file ProgSlice.h.
|
inlineprotected |
Return the basic block where a SVFGNode resides in a SVFGNode may not in a basic block if it is not a program statement (e.g. SVFStmt is an global assignment or NullPtrSVFGNode)
Definition at line 273 of file ProgSlice.h.
|
inline |
Definition at line 193 of file ProgSlice.h.
Get/set VF (value-flow) and CF (control-flow) conditions.
Definition at line 228 of file ProgSlice.h.
Definition at line 98 of file ProgSlice.h.
Definition at line 94 of file ProgSlice.h.
|
inline |
Definition at line 158 of file ProgSlice.h.
|
inlineprotected |
Definition at line 265 of file ProgSlice.h.
|
inline |
Definition at line 154 of file ProgSlice.h.
|
inline |
Definition at line 162 of file ProgSlice.h.
| bool ProgSlice::isSatisfiableForAll | ( | ) |
Solve by computing disjunction of conditions from all sinks (e.g., memory leak)
Definition at line 142 of file ProgSlice.cpp.
| bool ProgSlice::isSatisfiableForPairs | ( | ) |
Solve by analysing each pair of sinks (e.g., double free)
Definition at line 158 of file ProgSlice.cpp.
|
inline |
Definition at line 146 of file ProgSlice.h.
Definition at line 289 of file ProgSlice.h.
Set final condition after all path reachability analysis.
Definition at line 296 of file ProgSlice.h.
|
inline |
Definition at line 142 of file ProgSlice.h.
|
inline |
Definition at line 150 of file ProgSlice.h.
Definition at line 237 of file ProgSlice.h.
|
inline |
Definition at line 134 of file ProgSlice.h.
|
inline |
Definition at line 138 of file ProgSlice.h.
current svfg node during guard computation
Definition at line 319 of file ProgSlice.h.
|
private |
the backward slice
Definition at line 311 of file ProgSlice.h.
|
private |
final condition
Definition at line 320 of file ProgSlice.h.
|
private |
the forward slice
Definition at line 310 of file ProgSlice.h.
|
private |
reachable from all paths
Definition at line 316 of file ProgSlice.h.
|
private |
reachable from some paths
Definition at line 315 of file ProgSlice.h.
|
private |
path condition allocator
Definition at line 318 of file ProgSlice.h.
|
private |
Whether slice reach a global.
Definition at line 317 of file ProgSlice.h.
root node on the slice
Definition at line 313 of file ProgSlice.h.
|
private |
a set of sink nodes
Definition at line 312 of file ProgSlice.h.
SVFG.
Definition at line 321 of file ProgSlice.h.
|
private |
map a SVFGNode to its path condition starting from root
Definition at line 314 of file ProgSlice.h.