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.fastSolver.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,IStrategyBasedParallelSolver<N,D>
- 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, IStrategyBasedParallelSolver<N,D>
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 ClassesModifier and TypeClassDescriptionprotected classstatic enumNested 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>, Map<EndSummary<N, D>, EndSummary<N, D>>> protected InterruptableExecutorprotected final booleanprotected final Iprotected final soot.util.ConcurrentHashMultiMap<heros.solver.Pair<soot.SootMethod,D>, IncomingRecord<N, D>> protected MyConcurrentHashMap<heros.solver.PathEdge<N,D>, D> protected ISolverTerminationReasonprotected static final org.slf4j.Loggerprotected intprotected intprotected intprotected IMemoryManager<D,N> protected intlongprotected ISchedulingStrategy<N,D> protected booleanprotected final DFields inherited from class soot.jimple.infoflow.solver.AbstractIFDSSolver
shorteningMode -
Constructor Summary
ConstructorsConstructorDescriptionIFDSSolver(heros.IFDSTabulationProblem<N, D, soot.SootMethod, I> tabulationProblem) 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 TypeMethodDescriptionprotected booleanaddEndSummary(soot.SootMethod m, D d1, N eP, D d2) addFunction(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 voidapplyEndSummaryOnCall(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 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.protected voidonEndSummaryApplied(N n, soot.SootMethod sCalledProc, D d3) Callback to notify derived classes that an end summary has been appliedvoidprotected voidprocessCall(heros.solver.PathEdge<N, D> edge) Lines 13-20 of the algorithm; processing a call site in the caller's context.protected voidprocessExit(heros.solver.PathEdge<N, D> edge) Lines 21-32 of the algorithm.protected voidprocessNormalFlow(heros.solver.PathEdge<N, D> edge) Lines 33-37 of the algorithm.protected voidpropagate(D sourceVal, N target, D targetVal, N relatedCallSite, boolean isUnbalancedReturn, IFDSSolver.ScheduleTarget scheduleTarget) 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<N, D> edge, IFDSSolver.ScheduleTarget scheduleTarget) 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 abstractionsvoidsetSchedulingStrategy(ISchedulingStrategy<N, D> strategy) Sets the strategy for scheduling edgesvoidsetSolverId(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<N,D extends FastSolverLinkedNode<D, jumpFunctionsN>>, D extends FastSolverLinkedNode<D, N>> -
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
public long propagationCount -
zeroValue
-
ffCache
protected final heros.FlowFunctionCache<N,D extends FastSolverLinkedNode<D, ffCacheN>, soot.SootMethod> -
followReturnsPastSeeds
protected final boolean followReturnsPastSeeds -
maxJoinPointAbstractions
protected int maxJoinPointAbstractions -
memoryManager
-
solverId
protected boolean solverId -
killFlag
-
maxCalleesPerCallSite
protected int maxCalleesPerCallSite -
maxAbstractionPathLength
protected int maxAbstractionPathLength -
schedulingStrategy
-
-
Constructor Details
-
IFDSSolver
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
-
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(heros.solver.PathEdge<N, D> edge, IFDSSolver.ScheduleTarget scheduleTarget) Dispatch the processing of a given edge. It may be executed in a different thread.- Parameters:
edge- the edge to processscheduleTarget-
-
processCall
Lines 13-20 of the algorithm; processing a call site in the caller's context. For each possible callee, registers incoming call edges. Also propagates call-to-return flows and summarized callee flows within the caller.- Parameters:
edge- an edge whose target node resembles a method call
-
onEndSummaryApplied
Callback to notify derived classes that an end summary has been applied- Parameters:
n- The call site where the end summary has been appliedsCalledProc- The calleed3- The callee-side incoming taint abstraction
-
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
-
processNormalFlow
Lines 33-37 of the algorithm. Simply propagate normal, intra-procedural flows.- Parameters:
edge-
-
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, IFDSSolver.ScheduleTarget scheduleTarget) 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)
-
addFunction
Records a jump function. The source statement is implicit.- See Also:
-
PathEdge
-
endSummary
-
addEndSummary
-
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) -
setSchedulingStrategy
Description copied from interface:IStrategyBasedParallelSolverSets the strategy for scheduling edges- Specified by:
setSchedulingStrategyin interfaceIStrategyBasedParallelSolver<N,D extends FastSolverLinkedNode<D, N>> - Parameters:
strategy- The strategy for scheduling edges
-