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. 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 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
-
Nested Class Summary
Nested classes/interfaces inherited from interface soot.jimple.infoflow.memory.IMemoryBoundedSolver
IMemoryBoundedSolver.IMemoryBoundedSolverStatusNotification -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanprotected final MyConcurrentHashMap<heros.solver.Pair<soot.SootMethod,D>, Set<EndSummary<N, D>>> protected InterruptableExecutorprotected final heros.FlowFunctionCache<soot.Unit,D, soot.SootMethod> protected final heros.FlowFunctions<soot.Unit,D, soot.SootMethod> protected final booleanprotected final Iprotected final MyConcurrentHashMap<heros.solver.Pair<soot.SootMethod,D>, MyConcurrentHashMap<soot.Unit, Map<D, D>>> protected MyConcurrentHashMap<heros.solver.PathEdge<soot.SootMethod,D>, D> protected static final org.slf4j.Loggerprotected IMemoryManager<D,N> protected intlongprotected final DFields inherited from class soot.jimple.infoflow.solver.AbstractIFDSSolver
shorteningMode -
Constructor Summary
ConstructorsConstructorDescriptionFlowInsensitiveSolver(heros.IFDSTabulationProblem<soot.Unit, D, soot.SootMethod, I> tabulationProblem) Creates a solver for the given problem, which caches flow functions and edge functions.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 givenCacheBuilder. -
Method Summary
Modifier and TypeMethodDescriptionaddFunction(heros.solver.PathEdge<soot.SootMethod, D> edge) Records a jump function.protected booleanaddIncoming(soot.SootMethod m, D d3, soot.Unit n, D d1, D d2) voidAdds a new listener that will be notified of status changes in the solverprotected voidapplyEndSummaryOnCall(D d1, soot.Unit n, D d2, Collection<soot.Unit> 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, soot.Unit callSite, Collection<D> callerSideDs) Computes the return flow function for the given set of caller-side abstractions.protected 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 consumptionprotected booleanIn case this solver was killed before it could complete its task, this method returns the reason for the abortion.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(D d1, soot.Unit n, D d2) Lines 21-32 of the algorithm.protected voidpropagate(D sourceVal, soot.SootMethod target, D targetVal, soot.Unit relatedCallSite, boolean isUnbalancedReturn) Propagates the flow further down the exploded super graph.protected voidpropagate(D sourceVal, soot.SootMethod target, D targetVal, soot.Unit relatedCallSite, boolean isUnbalancedReturn, boolean schedule) 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(heros.solver.PathEdge<soot.SootMethod, D> edge) 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 abstractionsprotected voidsetSolverId(boolean solverId) voidsolve()Runs the solver on the configured problem.protected voidSchedules the processing of initial seeds, initiating the analysis.Methods 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 MyConcurrentHashMap<heros.solver.PathEdge<soot.SootMethod,D extends FastSolverLinkedNode<D, jumpFunctionsN>>, D extends FastSolverLinkedNode<D, N>> -
icfg
protected final I extends soot.jimple.toolkits.ide.icfg.BiDiInterproceduralCFG<soot.Unit,soot.SootMethod> icfg -
endSummary
protected final MyConcurrentHashMap<heros.solver.Pair<soot.SootMethod,D extends FastSolverLinkedNode<D, endSummaryN>>, Set<EndSummary<N extends soot.Unit, D extends FastSolverLinkedNode<D, N>>>> -
incoming
protected final MyConcurrentHashMap<heros.solver.Pair<soot.SootMethod,D extends FastSolverLinkedNode<D, incomingN>>, MyConcurrentHashMap<soot.Unit, Map<D extends FastSolverLinkedNode<D, N>, D extends FastSolverLinkedNode<D, N>>>> -
flowFunctions
protected final heros.FlowFunctions<soot.Unit,D extends FastSolverLinkedNode<D, flowFunctionsN>, soot.SootMethod> -
initialSeeds
-
propagationCount
public long propagationCount -
zeroValue
-
ffCache
protected final heros.FlowFunctionCache<soot.Unit,D extends FastSolverLinkedNode<D, ffCacheN>, soot.SootMethod> -
followReturnsPastSeeds
protected final boolean followReturnsPastSeeds -
memoryManager
-
-
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 callingsolve(). -
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 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
-
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
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
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, 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 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, 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 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 ofFlowInsensitiveSolver)isUnbalancedReturn-trueif this edge is propagating an unbalanced return (this value is not used within this implementation but may be useful for subclasses ofFlowInsensitiveSolver)
-
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 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 ofFlowInsensitiveSolver)isUnbalancedReturn-trueif this edge is propagating an unbalanced return (this value is not used within this implementation but may be useful for subclasses ofFlowInsensitiveSolver)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
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)
-