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

java.lang.Object
soot.jimple.infoflow.solver.AbstractIFDSSolver<N,D>
soot.jimple.infoflow.solver.gcSolver.fpc.IFDSSolver<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 IFDSSolver<N,D extends FastSolverLinkedNode<D,N>,I extends soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<N,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

    • IFDSSolver

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

      public IFDSSolver(heros.IFDSTabulationProblem<N,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

    • createGarbageCollector

      protected IGarbageCollector<N,D> createGarbageCollector()
      Factory method for creating an instance of the garbage collector
      Returns:
      The new garbage collector
    • setSolverId

      public void setSolverId(boolean solverId)
    • 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.
    • scheduleEdgeProcessing

      protected void scheduleEdgeProcessing(boolean newSelfLoop, heros.solver.PathEdge<N,D> edge, heros.solver.Pair<soot.SootMethod,D> orgSrc)
      Dispatch the processing of a given edge. It may be executed in a different thread.
      Parameters:
      newSelfLoop - indicate that this path edge is a self-loop edge like <s, d>--><s, d>.
      edge - the edge to process
      orgSrc - used for building abstraction dependency graph.
    • applyEndSummaryOnCall

      protected boolean applyEndSummaryOnCall(D d1, N n, D d2, Collection<N> 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(heros.solver.PathEdge<N,D> edge)
      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, N 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, N target, D targetVal, N relatedCallSite, boolean isUnbalancedReturn, heros.solver.Pair<soot.SootMethod,D> orgSrc)
      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 IFDSSolver)
      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 IFDSSolver)
      orgSrc - extended for building abstraction dependency graph.
    • addFunction

      public D addFunction(heros.solver.PathEdge<N,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 Set<IncomingRecord<N,D>> incoming(D d1, soot.SootMethod m)
    • addIncoming

      protected boolean addIncoming(soot.SootMethod m, D d3, N 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)
    • setPeerGroup

      public void setPeerGroup(ISolverPeerGroup solverPeerGroup)
      Sets the peer group in which this solver operates. Peer groups allow for synchronization between solvers
      Parameters:
      solverPeerGroup - The solver peer group
    • terminate

      public void terminate()
      Notifies the solver that no further edges will be scheduled