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. TypicallyUnit.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
-
Nested Class Summary
Nested classes/interfaces inherited from interface soot.jimple.infoflow.memory.IMemoryBoundedSolver
IMemoryBoundedSolver.IMemoryBoundedSolverStatusNotification -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AbstrationDependencyGraph<D>static final booleanprotected final MyConcurrentHashMap<heros.solver.Pair<soot.SootMethod,D>, Map<EndSummary<N, D>, EndSummary<N, D>>> protected InterruptableExecutorprotected final booleanprotected IGarbageCollector<N,D> protected final Iprotected final soot.util.ConcurrentHashMultiMap<heros.solver.Pair<soot.SootMethod,D>, IncomingRecord<N, D>> protected soot.util.ConcurrentHashMultiMap<heros.solver.Pair<soot.SootMethod,D>, heros.solver.PathEdge<N, D>> protected static final org.slf4j.Loggerprotected IMemoryManager<D,N> protected intprotected intprotected booleanprotected ISolverPeerGroupprotected final DFields inherited from class soot.jimple.infoflow.solver.AbstractIFDSSolver
shorteningMode -
Constructor Summary
ConstructorsConstructorDescriptionIFDSSolver(heros.IFDSTabulationProblem<N, D, soot.SootMethod, I> tabulationProblem, int sleepTime) Creates a solver for the given problem, which caches flow functions and edge functions.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 givenCacheBuilder. -
Method Summary
Modifier and TypeMethodDescriptionaddFunction(heros.solver.PathEdge<N, D> edge) Records a jump function.protected booleanaddIncoming(soot.SootMethod m, D d3, N n, D d1, D d2) voidAdds a new listener that will be notified of status changes in the solverprotected booleanapplyEndSummaryOnCall(D d1, N n, D d2, Collection<N> returnSiteNs, soot.SootMethod sCalledProcN, D d3) protected voidAwaits the completion of the exploded super graph.computeCallFlowFunction(heros.FlowFunction<D> callFlowFunction, D d1, D d2) Computes the call flow function for the given call-site abstractioncomputeCallToReturnFlowFunction(heros.FlowFunction<D> callToReturnFlowFunction, D d1, D d2) Computes the call-to-return flow function for the given call-site abstractioncomputeNormalFlowFunction(heros.FlowFunction<D> flowFunction, D d1, D d2) Computes the normal flow function for the given set of start and end abstractions.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.protected IGarbageCollector<N,D> Factory method for creating an instance of the garbage collectorprotected Set<EndSummary<N,D>> endSummary(soot.SootMethod m, D d3) voidForces the solver to terminate its tasks and stop processing new tasks.protected StringReturns a String used to identify the output of this solver in debug mode.protected InterruptableExecutorFactory method for this solver's thread-pool executor.Gets the memory manager used by this solver to reduce memory consumptionIn case this solver was killed before it could complete its task, this method returns the reason for the abortion.protected Set<IncomingRecord<N,D>> booleanisKilled()Checks whether this solver was killed before it could complete its tasksbooleanChecks whether this solver is terminated, either by forced termination, or because it has finished all of its work.voidprotected voidprocessExit(heros.solver.PathEdge<N, D> edge) Lines 21-32 of the algorithm.protected voidpropagate(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.voidreset()Resets the solver to its initial state after it has been forcefully terminated.protected voidscheduleEdgeProcessing(boolean newSelfLoop, heros.solver.PathEdge<N, D> edge, heros.solver.Pair<soot.SootMethod, D> orgSrc) Dispatch the processing of a given edge.voidsetMaxAbstractionPathLength(int maxAbstractionPathLength) voidsetMaxCalleesPerCallSite(int maxCalleesPerCallSite) voidsetMaxJoinPointAbstractions(int maxJoinPointAbstractions) Sets the maximum number of abstractions that shall be recorded per join point.voidsetMemoryManager(IMemoryManager<D, N> memoryManager) Sets the memory manager that shall be used to manage the abstractionsvoidsetPeerGroup(ISolverPeerGroup solverPeerGroup) Sets the peer group in which this solver operates.voidsetSolverId(boolean solverId) voidsolve()Runs the solver on the configured problem.protected voidSchedules the processing of initial seeds, initiating the analysis.voidNotifies the solver that no further edges will be scheduledMethods inherited from class soot.jimple.infoflow.solver.AbstractIFDSSolver
setPredecessorShorteningMode, shortenPredecessors
-
Field Details
-
DEFAULT_CACHE_BUILDER
-
logger
protected static final org.slf4j.Logger logger -
DEBUG
public static final boolean DEBUG -
executor
-
numThreads
protected int numThreads -
jumpFunctions
protected soot.util.ConcurrentHashMultiMap<heros.solver.Pair<soot.SootMethod,D extends FastSolverLinkedNode<D, jumpFunctionsN>>, heros.solver.PathEdge<N, D extends FastSolverLinkedNode<D, N>>> -
garbageCollector
-
icfg
-
endSummary
protected final MyConcurrentHashMap<heros.solver.Pair<soot.SootMethod,D extends FastSolverLinkedNode<D, endSummaryN>>, Map<EndSummary<N, D extends FastSolverLinkedNode<D, N>>, EndSummary<N, D extends FastSolverLinkedNode<D, N>>>> -
incoming
protected final soot.util.ConcurrentHashMultiMap<heros.solver.Pair<soot.SootMethod,D extends FastSolverLinkedNode<D, incomingN>>, IncomingRecord<N, D extends FastSolverLinkedNode<D, N>>> -
flowFunctions
protected final heros.FlowFunctions<N,D extends FastSolverLinkedNode<D, flowFunctionsN>, soot.SootMethod> -
initialSeeds
-
propagationCount
-
zeroValue
-
ffCache
protected final heros.FlowFunctionCache<N,D extends FastSolverLinkedNode<D, ffCacheN>, soot.SootMethod> -
followReturnsPastSeeds
protected final boolean followReturnsPastSeeds -
memoryManager
-
solverId
protected boolean solverId -
solverPeerGroup
-
abstDependencyGraph
-
sleepTime
protected int sleepTime
-
-
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 callingsolve(). -
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 givenCacheBuilder. The solver must then be started by callingsolve().- Parameters:
tabulationProblem- The tabulation problem to solveflowFunctionCacheBuilder- A validCacheBuilderornullif no caching is to be used for flow functions.
-
-
Method Details
-
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 processorgSrc- used for building abstraction dependency graph.
-
applyEndSummaryOnCall
-
computeCallFlowFunction
Computes the call flow function for the given call-site abstraction- Parameters:
callFlowFunction- The call flow function to computed1- 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 computed1- 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
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 computed1- The abstraction at the beginning of the calleed2- The abstraction at the exit node in the calleecallSite- The call sitecallerSideDs- The abstractions at the call site- Returns:
- The set of caller-side abstractions at the return site
-
computeNormalFlowFunction
Computes the normal flow function for the given set of start and end abstractions.- Parameters:
flowFunction- The normal flow function to computed1- The abstraction at the method's start noded2- 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 edgetarget- the target statementtargetVal- the target value at the target statementrelatedCallSite- for call and return flows the related call statement,nullotherwise (this value is not used within this implementation but may be useful for subclasses ofIFDSSolver)isUnbalancedReturn-trueif this edge is propagating an unbalanced return (this value is not used within this implementation but may be useful for subclasses ofIFDSSolver)orgSrc- extended for building abstraction dependency graph.
-
addFunction
Records a jump function. The source statement is implicit.- See Also:
-
PathEdge
-
endSummary
-
incoming
-
addIncoming
-
getExecutor
Factory method for this solver's thread-pool executor. -
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
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
Gets the memory manager used by this solver to reduce memory consumption- Returns:
- The memory manager registered with this solver
-
forceTerminate
Description copied from interface:IMemoryBoundedSolverForces the solver to terminate its tasks and stop processing new tasks. This will kill the solver.- Specified by:
forceTerminatein interfaceIMemoryBoundedSolver- Parameters:
reason- The reason why the solver is terminated
-
isTerminated
public boolean isTerminated()Description copied from interface:IMemoryBoundedSolverChecks whether this solver is terminated, either by forced termination, or because it has finished all of its work.- Specified by:
isTerminatedin interfaceIMemoryBoundedSolver- Returns:
- True if this solver is terminated, otherwise false
-
isKilled
public boolean isKilled()Description copied from interface:IMemoryBoundedSolverChecks whether this solver was killed before it could complete its tasks- Specified by:
isKilledin interfaceIMemoryBoundedSolver- Returns:
- True if this solver was killed before it could complete its tasks, otherwise false
-
reset
public void reset()Description copied from interface:IMemoryBoundedSolverResets 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:
resetin interfaceIMemoryBoundedSolver
-
addStatusListener
Description copied from interface:IMemoryBoundedSolverAdds a new listener that will be notified of status changes in the solver- Specified by:
addStatusListenerin interfaceIMemoryBoundedSolver- Parameters:
listener- The listener that will be notified when the status of the solver changes
-
getTerminationReason
Description copied from interface:IMemoryBoundedSolverIn 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:
getTerminationReasonin interfaceIMemoryBoundedSolver- 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
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
-