Skip to content

Commit

Permalink
Add TaintAnalyzer and remove CpaRun classes
Browse files Browse the repository at this point in the history
Together with the already available  `ValueAnalyzer` this allows to remove completely the `CpaRun` hierarchy.

There are different ideas behind this refactor:
- since the intermediate hierarchy for `CpaRun` is not useful, since in practice it just make everything difficult to understand with an improvement in code reuse that is insignificant, this flattens all components of `JvmTaintMemoryLocationBamCpaRun` in a unique utility
- configuration options that are in practice not very useful have been removed. In case of more advanced use cases these options can either be reintroduced in the future, or the analysis can be run directly with the CPA classes without the need for a utility
- the old CpaRun code made not possible, or at best clunky and not clear, running different analyses while using the same cache to share the results. These changes allow explicitly to either build a new analyzer with a fresh cache, or to run the same analyzer several times with the same cache

The behavior that is not too clean at the moment is how all results use the same cache (without a snapshot) and so subsequent run will also update past results. For the same reason at the moment, if multiple runs happen on the same `TaintAnalyzer`, it would be better to reconstruct traces just once in the end to not repeat work. Both these behaviors have been extensively documented.
  • Loading branch information
capoz authored and JorenHannes committed Jan 13, 2025
1 parent 32e2503 commit ff1e868
Show file tree
Hide file tree
Showing 24 changed files with 1,112 additions and 1,868 deletions.
170 changes: 0 additions & 170 deletions base/src/main/java/proguard/analysis/cpa/defaults/BamCpaRun.java

This file was deleted.

78 changes: 0 additions & 78 deletions base/src/main/java/proguard/analysis/cpa/defaults/CpaRun.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,12 @@ public Collection<AbstractStateT> asCollection() {
}

@Override
public Collection<? extends AbstractState> getReached(AbstractState abstractState) {
public Collection<AbstractStateT> getReached(AbstractState abstractState) {
return getReached(((AbstractStateT) abstractState).getProgramLocation());
}

/** Returns a collection of abstract states belonging to the given {@code location}. */
public Collection<? extends AbstractState> getReached(CfaNodeT location) {
public Collection<AbstractStateT> getReached(CfaNodeT location) {
return locationToStates.getOrDefault(location, Collections.emptySet());
}
}

This file was deleted.

Loading

0 comments on commit ff1e868

Please sign in to comment.