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

public class InfoflowCFG extends Object implements IInfoflowCFG
Interprocedural control-flow graph for the infoflow solver
Author:
Steven Arzt, Eric Bodden
  • 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

      protected final Map<soot.SootMethod,Map<soot.SootField,InfoflowCFG.StaticFieldUse>> staticFieldUses
    • methodSideEffects

      protected final Map<soot.SootMethod,Boolean> 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

      public IInfoflowCFG.UnitContainer getPostdominatorOf(soot.Unit u)
      Description copied from interface: IInfoflowCFG
      Gets 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:
      getPostdominatorOf in interface IInfoflowCFG
      Parameters:
      u - The unit for which to get the postdominator.
      Returns:
      The postdominator of the given unit
    • getDominatorOf

      public IInfoflowCFG.UnitContainer getDominatorOf(soot.Unit u)
      Description copied from interface: IInfoflowCFG
      Gets 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:
      getDominatorOf in interface IInfoflowCFG
      Parameters:
      u - The unit for which to get the postdominator.
      Returns:
      The postdominator of the given unit
    • getAllDominators

      public List<soot.Unit> getAllDominators(soot.Unit u)
      Description copied from interface: IInfoflowCFG
      Get all dominators of the given unit.
      Specified by:
      getAllDominators in interface IInfoflowCFG
      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:
      getMethodOf in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • getSuccsOf

      public List<soot.Unit> getSuccsOf(soot.Unit u)
      Specified by:
      getSuccsOf in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • isExitStmt

      public boolean isExitStmt(soot.Unit u)
      Specified by:
      isExitStmt in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • isStartPoint

      public boolean isStartPoint(soot.Unit u)
      Specified by:
      isStartPoint in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • isFallThroughSuccessor

      public boolean isFallThroughSuccessor(soot.Unit u, soot.Unit succ)
      Specified by:
      isFallThroughSuccessor in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • isBranchTarget

      public boolean isBranchTarget(soot.Unit u, soot.Unit succ)
      Specified by:
      isBranchTarget in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • getStartPointsOf

      public Collection<soot.Unit> getStartPointsOf(soot.SootMethod m)
      Specified by:
      getStartPointsOf in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • isCallStmt

      public boolean isCallStmt(soot.Unit u)
      Specified by:
      isCallStmt in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • allNonCallStartNodes

      public Set<soot.Unit> allNonCallStartNodes()
      Specified by:
      allNonCallStartNodes in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • getCalleesOfCallAt

      public Collection<soot.SootMethod> getCalleesOfCallAt(soot.Unit u)
      Specified by:
      getCalleesOfCallAt in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • getCallersOf

      public Collection<soot.Unit> getCallersOf(soot.SootMethod m)
      Specified by:
      getCallersOf in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • getReturnSitesOfCallAt

      public Collection<soot.Unit> getReturnSitesOfCallAt(soot.Unit u)
      Specified by:
      getReturnSitesOfCallAt in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • getCallsFromWithin

      public Set<soot.Unit> getCallsFromWithin(soot.SootMethod m)
      Specified by:
      getCallsFromWithin in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • getPredsOf

      public List<soot.Unit> getPredsOf(soot.Unit u)
      Specified by:
      getPredsOf in interface soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
      Specified by:
      getPredsOf in interface heros.InterproceduralCFG<soot.Unit,soot.SootMethod>
    • getEndPointsOf

      public Collection<soot.Unit> getEndPointsOf(soot.SootMethod m)
      Specified by:
      getEndPointsOf in interface soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
    • getPredsOfCallAt

      public List<soot.Unit> getPredsOfCallAt(soot.Unit u)
      Specified by:
      getPredsOfCallAt in interface soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
    • allNonCallEndNodes

      public Set<soot.Unit> allNonCallEndNodes()
      Specified by:
      allNonCallEndNodes in interface soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
    • getOrCreateUnitGraph

      public soot.toolkits.graph.DirectedGraph<soot.Unit> getOrCreateUnitGraph(soot.SootMethod m)
      Specified by:
      getOrCreateUnitGraph in interface soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
    • getParameterRefs

      public List<soot.Value> getParameterRefs(soot.SootMethod m)
      Specified by:
      getParameterRefs in interface soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
    • isReturnSite

      public boolean isReturnSite(soot.Unit n)
      Specified by:
      isReturnSite in interface soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
    • isStaticFieldRead

      public boolean isStaticFieldRead(soot.SootMethod method, soot.SootField variable)
      Description copied from interface: IInfoflowCFG
      Checks whether the given static field is read inside the given method or one of its transitive callees.
      Specified by:
      isStaticFieldRead in interface IInfoflowCFG
      Parameters:
      method - The method to check
      variable - 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: IInfoflowCFG
      Checks whether the given static field is used (read or written) inside the given method or one of its transitive callees.
      Specified by:
      isStaticFieldUsed in interface IInfoflowCFG
      Parameters:
      method - The method to check
      variable - 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: IInfoflowCFG
      Checks whether the given method or any of its transitive callees has side effects
      Specified by:
      hasSideEffects in interface IInfoflowCFG
      Parameters:
      method - The method to check
      Returns:
      True if the given method or one of its transitive callees has side effects, otherwise false
    • hasSideEffects

      protected boolean hasSideEffects(soot.SootMethod method, Set<soot.SootMethod> runList, int depth)
    • notifyMethodChanged

      public void notifyMethodChanged(soot.SootMethod m)
      Description copied from interface: IInfoflowCFG
      Re-initializes the mapping between statements and owning methods after a method has changed.
      Specified by:
      notifyMethodChanged in interface IInfoflowCFG
      Parameters:
      m - The method for which to re-initialize the mapping
    • notifyNewBody

      public void notifyNewBody(soot.Body b)
      Description copied from interface: IInfoflowCFG
      Initializes the mapping between statements and owning body.
      Specified by:
      notifyNewBody in interface IInfoflowCFG
      Parameters:
      b - The body for which to initialize the mapping
    • methodReadsValue

      public boolean methodReadsValue(soot.SootMethod m, soot.Value v)
      Description copied from interface: IInfoflowCFG
      Checks whether the given method reads the given value
      Specified by:
      methodReadsValue in interface IInfoflowCFG
      Parameters:
      m - The method to check
      v - 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: IInfoflowCFG
      Checks whether the given method writes the given value
      Specified by:
      methodWritesValue in interface IInfoflowCFG
      Parameters:
      m - The method to check
      v - 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: IInfoflowCFG
      Gets whether the two given units are connected by an exceptional control flow edge
      Specified by:
      isExceptionalEdgeBetween in interface IInfoflowCFG
      Parameters:
      u1 - The first unit
      u2 - The second unit
      Returns:
      True if the two given units are directly connected by an exceptional control flow edge, otherwise false
    • getConditionalBranchIntraprocedural

      public List<soot.Unit> getConditionalBranchIntraprocedural(soot.Unit callSite)
      Description copied from interface: IInfoflowCFG
      Reconstructs if the unit is inside a conditional. Needed for implicit backwards on an unbalanced return into a method.
      Specified by:
      getConditionalBranchIntraprocedural in interface IInfoflowCFG
      Parameters:
      callSite - The unit to start the search at
      Returns:
      The same-level conditional
    • getConditionalBranchesInterprocedural

      public List<soot.Unit> getConditionalBranchesInterprocedural(soot.Unit unit)
      Description copied from interface: IInfoflowCFG
      Reconstructs the conditionals a taint could possibly reach. Needed for implicit backward flows to model sink calls inside a callee
      Specified by:
      getConditionalBranchesInterprocedural in interface IInfoflowCFG
      Parameters:
      unit - start unit, possibly a sink
      Returns:
      List of units with the context appended
    • isReachable

      public boolean isReachable(soot.Unit u)
      Specified by:
      isReachable in interface soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>
    • isExecutorExecute

      public boolean isExecutorExecute(soot.jimple.InvokeExpr ie, soot.SootMethod dest)
      Description copied from interface: IInfoflowCFG
      Checks whether the given call is a call to Executor.execute() or AccessController.doPrivileged() and whether the callee matches the expected method signature
      Specified by:
      isExecutorExecute in interface IInfoflowCFG
      Parameters:
      ie - The invocation expression to check
      dest - 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

      public Collection<soot.SootMethod> getOrdinaryCalleesOfCallAt(soot.Unit u)
      Description copied from interface: IInfoflowCFG
      Gets all ordinary callees of the call at call site u, i.e., those that are not \<clinit\> or a fake edge.
      Specified by:
      getOrdinaryCalleesOfCallAt in interface IInfoflowCFG
      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: IInfoflowCFG
      Checks whether the given call site is a reflective method call
      Specified by:
      isReflectiveCallSite in interface IInfoflowCFG
      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: IInfoflowCFG
      Checks whether the given call site is a reflective method call
      Specified by:
      isReflectiveCallSite in interface IInfoflowCFG
      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: IInfoflowCFG
      Clears all caches and temporary data from memory. This method has no effect on the functional behavior of the class.
      Specified by:
      purge in interface IInfoflowCFG