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 49 of file ProgSlice.h.
worklist for control-flow guard computation
Definition at line 59 of file ProgSlice.h.
Definition at line 55 of file ProgSlice.h.
Definition at line 53 of file ProgSlice.h.
typedef SVFGNodeSet::const_iterator SVF::ProgSlice::SVFGNodeSetIter |
Definition at line 54 of file ProgSlice.h.
map a SVFGNode to its condition during value-flow guard computation
Definition at line 56 of file ProgSlice.h.
Definition at line 61 of file ProgSlice.h.
worklist for value-flow guard computation
Definition at line 58 of file ProgSlice.h.
|
inline |
Constructor.
Definition at line 65 of file ProgSlice.h.
|
inlinevirtual |
Definition at line 91 of file ProgSlice.h.
Forward and backward slice operations.
Definition at line 87 of file ProgSlice.h.
Definition at line 127 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 111 of file ProgSlice.h.
|
inline |
Definition at line 115 of file ProgSlice.h.
|
inlineprotected |
Clear Control flow conditions before each VF computation.
TODO: how to clean z3 memory
Definition at line 221 of file ProgSlice.h.
|
inlineprotected |
Definition at line 256 of file ProgSlice.h.
|
inlineprotected |
Definition at line 260 of file ProgSlice.h.
|
inlineprotected |
Compute guards for value-flows.
Definition at line 252 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 182 of file ProgSlice.h.
Definition at line 190 of file ProgSlice.h.
Definition at line 186 of file ProgSlice.h.
|
protected |
Definition at line 202 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 103 of file ProgSlice.h.
|
inline |
Definition at line 107 of file ProgSlice.h.
|
inline |
Definition at line 81 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 286 of file ProgSlice.h.
|
inline |
Definition at line 198 of file ProgSlice.h.
|
inline |
Definition at line 77 of file ProgSlice.h.
|
inlineprotected |
Definition at line 305 of file ProgSlice.h.
const CallICFGNode * ProgSlice::getRetSite | ( | const SVFGEdge * | edge | ) | const |
Definition at line 187 of file ProgSlice.cpp.
|
inline |
Definition at line 131 of file ProgSlice.h.
Definition at line 213 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. PAGEdge is an global assignment or NullPtrSVFGNode)
Definition at line 274 of file ProgSlice.h.
|
inline |
Definition at line 194 of file ProgSlice.h.
Get/set VF (value-flow) and CF (control-flow) conditions.
Definition at line 229 of file ProgSlice.h.
Definition at line 99 of file ProgSlice.h.
Definition at line 95 of file ProgSlice.h.
|
inline |
Definition at line 159 of file ProgSlice.h.
|
inlineprotected |
Definition at line 266 of file ProgSlice.h.
|
inline |
Definition at line 155 of file ProgSlice.h.
|
inline |
Definition at line 163 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 147 of file ProgSlice.h.
Definition at line 290 of file ProgSlice.h.
Set final condition after all path reachability analysis.
Definition at line 297 of file ProgSlice.h.
|
inline |
Definition at line 143 of file ProgSlice.h.
|
inline |
Definition at line 151 of file ProgSlice.h.
Definition at line 238 of file ProgSlice.h.
|
inline |
Definition at line 135 of file ProgSlice.h.
|
inline |
Definition at line 139 of file ProgSlice.h.
current svfg node during guard computation
Definition at line 320 of file ProgSlice.h.
|
private |
the backward slice
Definition at line 312 of file ProgSlice.h.
|
private |
final condition
Definition at line 321 of file ProgSlice.h.
|
private |
the forward slice
Definition at line 311 of file ProgSlice.h.
|
private |
reachable from all paths
Definition at line 317 of file ProgSlice.h.
|
private |
reachable from some paths
Definition at line 316 of file ProgSlice.h.
|
private |
path condition allocator
Definition at line 319 of file ProgSlice.h.
|
private |
Whether slice reach a global.
Definition at line 318 of file ProgSlice.h.
root node on the slice
Definition at line 314 of file ProgSlice.h.
|
private |
a set of sink nodes
Definition at line 313 of file ProgSlice.h.
SVFG.
Definition at line 322 of file ProgSlice.h.
|
private |
map a SVFGNode to its path condition starting from root
Definition at line 315 of file ProgSlice.h.