Package soot.jimple.infoflow.solver.cfg
Class InfoflowCFG
java.lang.Object
soot.jimple.infoflow.solver.cfg.InfoflowCFG
- All Implemented Interfaces:
heros.InterproceduralCFG<soot.Unit,,soot.SootMethod> IInfoflowCFG,soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
- Direct Known Subclasses:
BackwardsInfoflowCFG
Interprocedural control-flow graph for the infoflow solver
- Author:
- Steven Arzt, Eric Bodden
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface soot.jimple.infoflow.solver.cfg.IInfoflowCFG
IInfoflowCFG.UnitContainer -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod> protected static final intprotected static final intprotected final com.google.common.cache.LoadingCache<soot.SootMethod,soot.Local[]> protected final com.google.common.cache.LoadingCache<soot.SootMethod,soot.Local[]> protected final Map<soot.SootMethod,Map<soot.SootField, InfoflowCFG.StaticFieldUse>> protected final com.google.common.cache.LoadingCache<soot.Unit,IInfoflowCFG.UnitContainer> protected final com.google.common.cache.LoadingCache<soot.Unit,soot.toolkits.graph.MHGDominatorsFinder<soot.Unit>> protected final com.google.common.cache.LoadingCache<soot.Unit,IInfoflowCFG.UnitContainer> -
Constructor Summary
ConstructorsConstructorDescriptionInfoflowCFG(soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit, soot.SootMethod> delegate) -
Method Summary
Modifier and TypeMethodDescriptionSet<soot.Unit>Set<soot.Unit>protected InfoflowCFG.StaticFieldUsecheckStaticFieldUsed(soot.SootMethod smethod, soot.SootField variable) List<soot.Unit>getAllDominators(soot.Unit u) Get all dominators of the given unit.Collection<soot.SootMethod>getCalleesOfCallAt(soot.Unit u) Collection<soot.Unit>getCallersOf(soot.SootMethod m) Set<soot.Unit>getCallsFromWithin(soot.SootMethod m) List<soot.Unit>getConditionalBranchesInterprocedural(soot.Unit unit) Reconstructs the conditionals a taint could possibly reach.List<soot.Unit>getConditionalBranchIntraprocedural(soot.Unit callSite) Reconstructs if the unit is inside a conditional.getDominatorOf(soot.Unit u) Gets the dominator of the given unit.Collection<soot.Unit>getEndPointsOf(soot.SootMethod m) soot.SootMethodgetMethodOf(soot.Unit u) soot.toolkits.graph.DirectedGraph<soot.Unit>getOrCreateUnitGraph(soot.SootMethod m) Collection<soot.SootMethod>getOrdinaryCalleesOfCallAt(soot.Unit u) Gets all ordinary callees of the call at call site u, i.e., those that are not \<clinit\> or a fake edge.List<soot.Value>getParameterRefs(soot.SootMethod m) getPostdominatorOf(soot.Unit u) Gets the postdominator of the given unit.List<soot.Unit>getPredsOf(soot.Unit u) List<soot.Unit>getPredsOfCallAt(soot.Unit u) Collection<soot.Unit>getReturnSitesOfCallAt(soot.Unit u) Collection<soot.Unit>getStartPointsOf(soot.SootMethod m) List<soot.Unit>getSuccsOf(soot.Unit u) booleanhasSideEffects(soot.SootMethod method) Checks whether the given method or any of its transitive callees has side effectsprotected booleanhasSideEffects(soot.SootMethod method, Set<soot.SootMethod> runList, int depth) booleanisBranchTarget(soot.Unit u, soot.Unit succ) booleanisCallStmt(soot.Unit u) booleanisExceptionalEdgeBetween(soot.Unit u1, soot.Unit u2) Gets whether the two given units are connected by an exceptional control flow edgebooleanisExecutorExecute(soot.jimple.InvokeExpr ie, soot.SootMethod dest) Checks whether the given call is a call to Executor.execute() or AccessController.doPrivileged() and whether the callee matches the expected method signaturebooleanisExitStmt(soot.Unit u) booleanisFallThroughSuccessor(soot.Unit u, soot.Unit succ) booleanisReachable(soot.Unit u) booleanisReflectiveCallSite(soot.jimple.InvokeExpr iexpr) Checks whether the given call site is a reflective method callbooleanisReflectiveCallSite(soot.Unit u) Checks whether the given call site is a reflective method callbooleanisReturnSite(soot.Unit n) booleanisStartPoint(soot.Unit u) booleanisStaticFieldRead(soot.SootMethod method, soot.SootField variable) Checks whether the given static field is read inside the given method or one of its transitive callees.booleanisStaticFieldUsed(soot.SootMethod method, soot.SootField variable) Checks whether the given static field is used (read or written) inside the given method or one of its transitive callees.booleanmethodReadsValue(soot.SootMethod m, soot.Value v) Checks whether the given method reads the given valuebooleanmethodWritesValue(soot.SootMethod m, soot.Value v) Checks whether the given method writes the given valuevoidnotifyMethodChanged(soot.SootMethod m) Re-initializes the mapping between statements and owning methods after a method has changed.voidnotifyNewBody(soot.Body b) Initializes the mapping between statements and owning body.voidpurge()Clears all caches and temporary data from memory.protected voidregisterStaticVariableUse(soot.SootMethod method, soot.SootField variable, InfoflowCFG.StaticFieldUse fieldUse)
-
Field Details
-
MAX_SIDE_EFFECT_ANALYSIS_DEPTH
protected static final int MAX_SIDE_EFFECT_ANALYSIS_DEPTH- See Also:
-
MAX_STATIC_USE_ANALYSIS_DEPTH
protected static final int MAX_STATIC_USE_ANALYSIS_DEPTH- See Also:
-
staticFieldUses
-
methodSideEffects
-
delegate
protected final soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod> delegate -
unitsToDominatorFinder
protected final com.google.common.cache.LoadingCache<soot.Unit,soot.toolkits.graph.MHGDominatorsFinder<soot.Unit>> unitsToDominatorFinder -
unitsToDominator
protected final com.google.common.cache.LoadingCache<soot.Unit,IInfoflowCFG.UnitContainer> unitsToDominator -
unitToPostdominator
protected final com.google.common.cache.LoadingCache<soot.Unit,IInfoflowCFG.UnitContainer> unitToPostdominator -
methodToUsedLocals
protected final com.google.common.cache.LoadingCache<soot.SootMethod,soot.Local[]> methodToUsedLocals -
methodToWrittenLocals
protected final com.google.common.cache.LoadingCache<soot.SootMethod,soot.Local[]> methodToWrittenLocals
-
-
Constructor Details
-
InfoflowCFG
public InfoflowCFG() -
InfoflowCFG
public InfoflowCFG(soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit, soot.SootMethod> delegate)
-
-
Method Details
-
getPostdominatorOf
Description copied from interface:IInfoflowCFGGets the postdominator of the given unit. If this unit is a conditional, the postdominator is the join point behind both branches of the conditional.- Specified by:
getPostdominatorOfin interfaceIInfoflowCFG- Parameters:
u- The unit for which to get the postdominator.- Returns:
- The postdominator of the given unit
-
getDominatorOf
Description copied from interface:IInfoflowCFGGets the dominator of the given unit. If this unit is a conditional, the dominator is the join point above both branches of the conditional.- Specified by:
getDominatorOfin interfaceIInfoflowCFG- Parameters:
u- The unit for which to get the postdominator.- Returns:
- The postdominator of the given unit
-
getAllDominators
Description copied from interface:IInfoflowCFGGet all dominators of the given unit.- Specified by:
getAllDominatorsin interfaceIInfoflowCFG- Parameters:
u- The unit for which tot get the dominators- Returns:
- The dominators of the given unit
-
getMethodOf
public soot.SootMethod getMethodOf(soot.Unit u) - Specified by:
getMethodOfin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
getSuccsOf
- Specified by:
getSuccsOfin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
isExitStmt
public boolean isExitStmt(soot.Unit u) - Specified by:
isExitStmtin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
isStartPoint
public boolean isStartPoint(soot.Unit u) - Specified by:
isStartPointin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
isFallThroughSuccessor
public boolean isFallThroughSuccessor(soot.Unit u, soot.Unit succ) - Specified by:
isFallThroughSuccessorin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
isBranchTarget
public boolean isBranchTarget(soot.Unit u, soot.Unit succ) - Specified by:
isBranchTargetin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
getStartPointsOf
- Specified by:
getStartPointsOfin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
isCallStmt
public boolean isCallStmt(soot.Unit u) - Specified by:
isCallStmtin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
allNonCallStartNodes
- Specified by:
allNonCallStartNodesin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
getCalleesOfCallAt
- Specified by:
getCalleesOfCallAtin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
getCallersOf
- Specified by:
getCallersOfin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
getReturnSitesOfCallAt
- Specified by:
getReturnSitesOfCallAtin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
getCallsFromWithin
- Specified by:
getCallsFromWithinin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
getPredsOf
- Specified by:
getPredsOfin interfacesoot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod> - Specified by:
getPredsOfin interfaceheros.InterproceduralCFG<soot.Unit,soot.SootMethod>
-
getEndPointsOf
- Specified by:
getEndPointsOfin interfacesoot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
-
getPredsOfCallAt
- Specified by:
getPredsOfCallAtin interfacesoot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
-
allNonCallEndNodes
- Specified by:
allNonCallEndNodesin interfacesoot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
-
getOrCreateUnitGraph
public soot.toolkits.graph.DirectedGraph<soot.Unit> getOrCreateUnitGraph(soot.SootMethod m) - Specified by:
getOrCreateUnitGraphin interfacesoot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
-
getParameterRefs
- Specified by:
getParameterRefsin interfacesoot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
-
isReturnSite
public boolean isReturnSite(soot.Unit n) - Specified by:
isReturnSitein interfacesoot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
-
isStaticFieldRead
public boolean isStaticFieldRead(soot.SootMethod method, soot.SootField variable) Description copied from interface:IInfoflowCFGChecks whether the given static field is read inside the given method or one of its transitive callees.- Specified by:
isStaticFieldReadin interfaceIInfoflowCFG- Parameters:
method- The method to checkvariable- The static field to check- Returns:
- True if the given static field is read inside the given method, otherwise false
-
isStaticFieldUsed
public boolean isStaticFieldUsed(soot.SootMethod method, soot.SootField variable) Description copied from interface:IInfoflowCFGChecks whether the given static field is used (read or written) inside the given method or one of its transitive callees.- Specified by:
isStaticFieldUsedin interfaceIInfoflowCFG- Parameters:
method- The method to checkvariable- The static field to check- Returns:
- True if the given static field is used inside the given method, otherwise false
-
checkStaticFieldUsed
protected InfoflowCFG.StaticFieldUse checkStaticFieldUsed(soot.SootMethod smethod, soot.SootField variable) -
registerStaticVariableUse
protected void registerStaticVariableUse(soot.SootMethod method, soot.SootField variable, InfoflowCFG.StaticFieldUse fieldUse) -
hasSideEffects
public boolean hasSideEffects(soot.SootMethod method) Description copied from interface:IInfoflowCFGChecks whether the given method or any of its transitive callees has side effects- Specified by:
hasSideEffectsin interfaceIInfoflowCFG- Parameters:
method- The method to check- Returns:
- True if the given method or one of its transitive callees has side effects, otherwise false
-
hasSideEffects
-
notifyMethodChanged
public void notifyMethodChanged(soot.SootMethod m) Description copied from interface:IInfoflowCFGRe-initializes the mapping between statements and owning methods after a method has changed.- Specified by:
notifyMethodChangedin interfaceIInfoflowCFG- Parameters:
m- The method for which to re-initialize the mapping
-
notifyNewBody
public void notifyNewBody(soot.Body b) Description copied from interface:IInfoflowCFGInitializes the mapping between statements and owning body.- Specified by:
notifyNewBodyin interfaceIInfoflowCFG- Parameters:
b- The body for which to initialize the mapping
-
methodReadsValue
public boolean methodReadsValue(soot.SootMethod m, soot.Value v) Description copied from interface:IInfoflowCFGChecks whether the given method reads the given value- Specified by:
methodReadsValuein interfaceIInfoflowCFG- Parameters:
m- The method to checkv- The value to check- Returns:
- True if the given method reads the given value, otherwise false
-
methodWritesValue
public boolean methodWritesValue(soot.SootMethod m, soot.Value v) Description copied from interface:IInfoflowCFGChecks whether the given method writes the given value- Specified by:
methodWritesValuein interfaceIInfoflowCFG- Parameters:
m- The method to checkv- The value to check- Returns:
- True if the given method writes the given value, otherwise false
-
isExceptionalEdgeBetween
public boolean isExceptionalEdgeBetween(soot.Unit u1, soot.Unit u2) Description copied from interface:IInfoflowCFGGets whether the two given units are connected by an exceptional control flow edge- Specified by:
isExceptionalEdgeBetweenin interfaceIInfoflowCFG- Parameters:
u1- The first unitu2- The second unit- Returns:
- True if the two given units are directly connected by an exceptional control flow edge, otherwise false
-
getConditionalBranchIntraprocedural
Description copied from interface:IInfoflowCFGReconstructs if the unit is inside a conditional. Needed for implicit backwards on an unbalanced return into a method.- Specified by:
getConditionalBranchIntraproceduralin interfaceIInfoflowCFG- Parameters:
callSite- The unit to start the search at- Returns:
- The same-level conditional
-
getConditionalBranchesInterprocedural
Description copied from interface:IInfoflowCFGReconstructs the conditionals a taint could possibly reach. Needed for implicit backward flows to model sink calls inside a callee- Specified by:
getConditionalBranchesInterproceduralin interfaceIInfoflowCFG- Parameters:
unit- start unit, possibly a sink- Returns:
- List of units with the context appended
-
isReachable
public boolean isReachable(soot.Unit u) - Specified by:
isReachablein interfacesoot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
-
isExecutorExecute
public boolean isExecutorExecute(soot.jimple.InvokeExpr ie, soot.SootMethod dest) Description copied from interface:IInfoflowCFGChecks whether the given call is a call to Executor.execute() or AccessController.doPrivileged() and whether the callee matches the expected method signature- Specified by:
isExecutorExecutein interfaceIInfoflowCFG- Parameters:
ie- The invocation expression to checkdest- The callee of the given invocation expression- Returns:
- True if the given invocation expression and callee are a valid call to Executor.execute() or AccessController.doPrivileged()
-
getOrdinaryCalleesOfCallAt
Description copied from interface:IInfoflowCFGGets all ordinary callees of the call at call site u, i.e., those that are not \<clinit\> or a fake edge.- Specified by:
getOrdinaryCalleesOfCallAtin interfaceIInfoflowCFG- Parameters:
u- The call site- Returns:
- The set of ordinary callees of the given call site
-
isReflectiveCallSite
public boolean isReflectiveCallSite(soot.Unit u) Description copied from interface:IInfoflowCFGChecks whether the given call site is a reflective method call- Specified by:
isReflectiveCallSitein interfaceIInfoflowCFG- Parameters:
u- The call site to check- Returns:
- True if the given call site contains a reflective method call, otherwise false
-
isReflectiveCallSite
public boolean isReflectiveCallSite(soot.jimple.InvokeExpr iexpr) Description copied from interface:IInfoflowCFGChecks whether the given call site is a reflective method call- Specified by:
isReflectiveCallSitein interfaceIInfoflowCFG- Parameters:
iexpr- The call site to check- Returns:
- True if the given call site contains a reflective method call, otherwise false
-
purge
public void purge()Description copied from interface:IInfoflowCFGClears all caches and temporary data from memory. This method has no effect on the functional behavior of the class.- Specified by:
purgein interfaceIInfoflowCFG
-