Class FlowInsensitiveSolver<N extends soot.Unit,D extends FastSolverLinkedNode<D,N>,I extends soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>>

java.lang.Object
soot.jimple.infoflow.solver.AbstractIFDSSolver<N,D>
soot.jimple.infoflow.solver.fastSolver.flowInsensitive.FlowInsensitiveSolver<N,D,I>
Type Parameters:
N - The type of nodes in the interprocedural control-flow graph. Typically Unit.
D - The type of data-flow facts to be computed by the tabulation problem.
I - The type of inter-procedural control-flow graph being used.
All Implemented Interfaces:
IMemoryBoundedSolver
Direct Known Subclasses:
InfoflowSolver

public class FlowInsensitiveSolver<N extends soot.Unit,D extends FastSolverLinkedNode<D,N>,I extends soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod>> extends AbstractIFDSSolver<N,D> implements IMemoryBoundedSolver
A solver for an IFDSTabulationProblem. This solver is not based on the IDESolver implementation in Heros for performance reasons.
See Also:
  • IFDSTabulationProblem
  • Field Details

  • Constructor Details

    • FlowInsensitiveSolver

      public FlowInsensitiveSolver(heros.IFDSTabulationProblem<soot.Unit,D,soot.SootMethod,I> tabulationProblem)
      Creates a solver for the given problem, which caches flow functions and edge functions. The solver must then be started by calling solve().
    • FlowInsensitiveSolver

      public FlowInsensitiveSolver(heros.IFDSTabulationProblem<soot.Unit,D,soot.SootMethod,I> tabulationProblem, com.google.common.cache.CacheBuilder flowFunctionCacheBuilder)
      Creates a solver for the given problem, constructing caches with the given CacheBuilder. The solver must then be started by calling solve().
      Parameters:
      tabulationProblem - The tabulation problem to solve
      flowFunctionCacheBuilder - A valid CacheBuilder or null if no caching is to be used for flow functions.
  • Method Details

    • solve

      public void solve()
      Runs the solver on the configured problem. This can take some time.
    • submitInitialSeeds

      protected void submitInitialSeeds()
      Schedules the processing of initial seeds, initiating the analysis. Clients should only call this methods if performing synchronization on their own. Normally, solve() should be called instead.
    • awaitCompletionComputeValuesAndShutdown

      protected void awaitCompletionComputeValuesAndShutdown()
      Awaits the completion of the exploded super graph. When complete, computes result values, shuts down the executor and returns.
    • getSolverId

      protected boolean getSolverId()
    • setSolverId

      protected void setSolverId(boolean solverId)
    • scheduleEdgeProcessing

      protected void scheduleEdgeProcessing(heros.solver.PathEdge<soot.SootMethod,D> edge)
      Dispatch the processing of a given edge. It may be executed in a different thread.
      Parameters:
      edge - the edge to process
    • applyEndSummaryOnCall

      protected void applyEndSummaryOnCall(D d1, soot.Unit n, D d2, Collection<soot.Unit> returnSiteNs, soot.SootMethod sCalledProcN, D d3)
    • computeCallFlowFunction

      protected Set<D> computeCallFlowFunction(heros.FlowFunction<D> callFlowFunction, D d1, D d2)
      Computes the call flow function for the given call-site abstraction
      Parameters:
      callFlowFunction - The call flow function to compute
      d1 - The abstraction at the current method's start node.
      d2 - The abstraction at the call site
      Returns:
      The set of caller-side abstractions at the callee's start node
    • computeCallToReturnFlowFunction

      protected Set<D> computeCallToReturnFlowFunction(heros.FlowFunction<D> callToReturnFlowFunction, D d1, D d2)
      Computes the call-to-return flow function for the given call-site abstraction
      Parameters:
      callToReturnFlowFunction - The call-to-return flow function to compute
      d1 - The abstraction at the current method's start node.
      d2 - The abstraction at the call site
      Returns:
      The set of caller-side abstractions at the return site
    • processExit

      protected void processExit(D d1, soot.Unit n, D d2)
      Lines 21-32 of the algorithm. Stores callee-side summaries. Also, at the side of the caller, propagates intra-procedural flows to return sites using those newly computed summaries.
      Parameters:
      edge - an edge whose target node resembles a method exits
    • computeReturnFlowFunction

      protected Set<D> computeReturnFlowFunction(heros.FlowFunction<D> retFunction, D d1, D d2, soot.Unit callSite, Collection<D> callerSideDs)
      Computes the return flow function for the given set of caller-side abstractions.
      Parameters:
      retFunction - The return flow function to compute
      d1 - The abstraction at the beginning of the callee
      d2 - The abstraction at the exit node in the callee
      callSite - The call site
      callerSideDs - The abstractions at the call site
      Returns:
      The set of caller-side abstractions at the return site
    • computeNormalFlowFunction

      protected Set<D> computeNormalFlowFunction(heros.FlowFunction<D> flowFunction, D d1, D d2)
      Computes the normal flow function for the given set of start and end abstractions.
      Parameters:
      flowFunction - The normal flow function to compute
      d1 - The abstraction at the method's start node
      d2 - The abstraction at the current node
      Returns:
      The set of abstractions at the successor node
    • propagate

      protected void propagate(D sourceVal, soot.SootMethod target, D targetVal, soot.Unit relatedCallSite, boolean isUnbalancedReturn)
      Propagates the flow further down the exploded super graph.
      Parameters:
      sourceVal - the source value of the propagated summary edge
      target - the target statement
      targetVal - the target value at the target statement
      relatedCallSite - for call and return flows the related call statement, null otherwise (this value is not used within this implementation but may be useful for subclasses of FlowInsensitiveSolver)
      isUnbalancedReturn - true if this edge is propagating an unbalanced return (this value is not used within this implementation but may be useful for subclasses of FlowInsensitiveSolver)
    • propagate

      protected void propagate(D sourceVal, soot.SootMethod target, D targetVal, soot.Unit relatedCallSite, boolean isUnbalancedReturn, boolean schedule)
      Propagates the flow further down the exploded super graph.
      Parameters:
      sourceVal - the source value of the propagated summary edge
      target - the target statement
      targetVal - the target value at the target statement
      relatedCallSite - for call and return flows the related call statement, null otherwise (this value is not used within this implementation but may be useful for subclasses of FlowInsensitiveSolver)
      isUnbalancedReturn - true if this edge is propagating an unbalanced return (this value is not used within this implementation but may be useful for subclasses of FlowInsensitiveSolver)
      forceRegister - True if the jump function must always be registered with jumpFn . This can happen when externally injecting edges that don't come out of this solver.
    • addFunction

      public D addFunction(heros.solver.PathEdge<soot.SootMethod,D> edge)
      Records a jump function. The source statement is implicit.
      See Also:
      • PathEdge
    • endSummary

      protected Set<EndSummary<N,D>> endSummary(soot.SootMethod m, D d3)
    • incoming

      protected Map<soot.Unit,Map<D,D>> incoming(D d1, soot.SootMethod m)
    • addIncoming

      protected boolean addIncoming(soot.SootMethod m, D d3, soot.Unit n, D d1, D d2)
    • getExecutor

      protected InterruptableExecutor getExecutor()
      Factory method for this solver's thread-pool executor.
    • getDebugName

      protected String getDebugName()
      Returns a String used to identify the output of this solver in debug mode. Subclasses can overwrite this string to distinguish the output from different solvers.
    • printStats

      public void printStats()
    • setMaxJoinPointAbstractions

      public void setMaxJoinPointAbstractions(int maxJoinPointAbstractions)
      Sets the maximum number of abstractions that shall be recorded per join point. In other words, enabling this option disables the recording of neighbors beyond the given count.
      Parameters:
      maxJoinPointAbstractions - The maximum number of abstractions per join point, or -1 to record an arbitrary number of join point abstractions
    • setMemoryManager

      public void setMemoryManager(IMemoryManager<D,N> memoryManager)
      Sets the memory manager that shall be used to manage the abstractions
      Parameters:
      memoryManager - The memory manager that shall be used to manage the abstractions
    • getMemoryManager

      public IMemoryManager<D,N> getMemoryManager()
      Gets the memory manager used by this solver to reduce memory consumption
      Returns:
      The memory manager registered with this solver
    • forceTerminate

      public void forceTerminate(ISolverTerminationReason reason)
      Description copied from interface: IMemoryBoundedSolver
      Forces the solver to terminate its tasks and stop processing new tasks. This will kill the solver.
      Specified by:
      forceTerminate in interface IMemoryBoundedSolver
      Parameters:
      reason - The reason why the solver is terminated
    • isTerminated

      public boolean isTerminated()
      Description copied from interface: IMemoryBoundedSolver
      Checks whether this solver is terminated, either by forced termination, or because it has finished all of its work.
      Specified by:
      isTerminated in interface IMemoryBoundedSolver
      Returns:
      True if this solver is terminated, otherwise false
    • isKilled

      public boolean isKilled()
      Description copied from interface: IMemoryBoundedSolver
      Checks whether this solver was killed before it could complete its tasks
      Specified by:
      isKilled in interface IMemoryBoundedSolver
      Returns:
      True if this solver was killed before it could complete its tasks, otherwise false
    • reset

      public void reset()
      Description copied from interface: IMemoryBoundedSolver
      Resets the solver to its initial state after it has been forcefully terminated. After calling this method, the solver is expected to accept new tasks.
      Specified by:
      reset in interface IMemoryBoundedSolver
    • addStatusListener

      public void addStatusListener(IMemoryBoundedSolver.IMemoryBoundedSolverStatusNotification listener)
      Description copied from interface: IMemoryBoundedSolver
      Adds a new listener that will be notified of status changes in the solver
      Specified by:
      addStatusListener in interface IMemoryBoundedSolver
      Parameters:
      listener - The listener that will be notified when the status of the solver changes
    • getTerminationReason

      public ISolverTerminationReason getTerminationReason()
      Description copied from interface: IMemoryBoundedSolver
      In case this solver was killed before it could complete its task, this method returns the reason for the abortion. Otherwise, this method returns null.
      Specified by:
      getTerminationReason in interface IMemoryBoundedSolver
      Returns:
      The reason for the abortion in case the solver was killed, otherwise null
    • setMaxCalleesPerCallSite

      public void setMaxCalleesPerCallSite(int maxCalleesPerCallSite)
    • setMaxAbstractionPathLength

      public void setMaxAbstractionPathLength(int maxAbstractionPathLength)