Skip to content

Commit 1de6af7

Browse files
committed
removed an optimization that didn't work, added support for unbounded access paths, reduced memory consumption of ExtensibleList, and refactored a few things
1 parent ef0aeb9 commit 1de6af7

37 files changed

+457
-436
lines changed

soot-infoflow-android/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
<dependency>
9999
<groupId>heros</groupId>
100100
<artifactId>heros</artifactId>
101-
<version>1.0.0-SNAPSHOT</version>
101+
<version>1.0.1-SNAPSHOT</version>
102102
</dependency>
103103
<dependency>
104104
<groupId>ca.mcgill.sable</groupId>

soot-infoflow-android/src/soot/jimple/infoflow/android/SetupApplication.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1509,6 +1509,7 @@ public IMemoryManager<Abstraction, Unit> getMemoryManager(boolean tracingEnabled
15091509
}
15101510

15111511
});
1512+
info.setMemoryManagerFactory(null);
15121513

15131514
// Inject additional post-processors
15141515
info.setPostProcessors(Collections.singleton(new PostAnalysisHandler() {

soot-infoflow-cmd/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<dependency>
114114
<groupId>heros</groupId>
115115
<artifactId>heros</artifactId>
116-
<version>1.0.0-SNAPSHOT</version>
116+
<version>1.0.1-SNAPSHOT</version>
117117
</dependency>
118118
<dependency>
119119
<groupId>ca.mcgill.sable</groupId>

soot-infoflow-cmd/src/soot/jimple/infoflow/cmd/MainClass.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,7 @@ private void run(String[] args) throws Exception {
249249
/**
250250
* Initializes the taint wrapper based on the command-line parameters
251251
*
252-
* @param cmd
253-
* The command-line parameters
252+
* @param cmd The command-line parameters
254253
* @return The taint wrapper to use for the data flow analysis, or null in case
255254
* no taint wrapper shall be used
256255
*/
@@ -497,10 +496,8 @@ else if (implicitFlowMode.equalsIgnoreCase("ALL"))
497496
* Parses the given command-line options and fills the given configuration
498497
* object accordingly
499498
*
500-
* @param cmd
501-
* The command line to parse
502-
* @param config
503-
* The configuration object to fill
499+
* @param cmd The command line to parse
500+
* @param config The configuration object to fill
504501
*/
505502
private void parseCommandLineOptions(CommandLine cmd, InfoflowAndroidConfiguration config) {
506503
// Files
@@ -558,7 +555,7 @@ private void parseCommandLineOptions(CommandLine cmd, InfoflowAndroidConfigurati
558555
{
559556
Integer aplength = getIntOption(cmd, OPTION_ACCESS_PATH_LENGTH);
560557
if (aplength != null)
561-
config.setAccessPathLength(aplength);
558+
config.getAccessPathConfiguration().setAccessPathLength(aplength);
562559
}
563560
if (cmd.hasOption(OPTION_FLOW_INSENSITIVE_ALIASING))
564561
config.setFlowSensitiveAliasing(false);
@@ -662,9 +659,8 @@ private Integer getIntOption(CommandLine cmd, String option) {
662659
/**
663660
* Loads the data flow configuration from the given file
664661
*
665-
* @param configFile
666-
* The configuration file from which to load the data flow
667-
* configuration
662+
* @param configFile The configuration file from which to load the data flow
663+
* configuration
668664
* @return The loaded data flow configuration
669665
*/
670666
private InfoflowAndroidConfiguration loadConfigurationFile(String configFile) {

soot-infoflow-summaries/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
<dependency>
100100
<groupId>heros</groupId>
101101
<artifactId>heros</artifactId>
102-
<version>1.0.0-SNAPSHOT</version>
102+
<version>1.0.1-SNAPSHOT</version>
103103
</dependency>
104104
<!-- Uploaded to http://soot-build.cs.uni-paderborn.de/nexus/repository/soot-snapshot/
105105
from the nightly build server -->

soot-infoflow-summaries/src/soot/jimple/infoflow/methodSummary/generator/SummaryGenerator.java

Lines changed: 44 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,8 @@ public SummaryGenerator() {
7070
/**
7171
* Generates the summaries for the given set of classes
7272
*
73-
* @param classpath
74-
* The classpath from which to load the given classes
75-
* @param classNames
76-
* The classes for which to create summaries
73+
* @param classpath The classpath from which to load the given classes
74+
* @param classNames The classes for which to create summaries
7775
* @return The generated method summaries
7876
*/
7977
public ClassSummaries createMethodSummaries(String classpath, Collection<String> classNames) {
@@ -83,13 +81,10 @@ public ClassSummaries createMethodSummaries(String classpath, Collection<String>
8381
/**
8482
* Generates the summaries for the given set of classes
8583
*
86-
* @param classpath
87-
* The classpath from which to load the given classes
88-
* @param classNames
89-
* The classes for which to create summaries
90-
* @param handler
91-
* The handler that shall be invoked when all methods inside one
92-
* class have been summarized
84+
* @param classpath The classpath from which to load the given classes
85+
* @param classNames The classes for which to create summaries
86+
* @param handler The handler that shall be invoked when all methods inside
87+
* one class have been summarized
9388
* @return The generated method summaries
9489
*/
9590
public ClassSummaries createMethodSummaries(String classpath, Collection<String> classNames,
@@ -201,12 +196,8 @@ public ClassSummaries createMethodSummaries(String classpath, Collection<String>
201196
curSummaries.merge(newSums);
202197
}
203198

204-
System.out.println("Class summaries for "
205-
+ entry.getKey()
206-
+ " done in "
207-
+ (System.nanoTime() - nanosBeforeClass) / 1E9
208-
+ " seconds for "
209-
+ curSummaries.getFlowCount()
199+
System.out.println("Class summaries for " + entry.getKey() + " done in "
200+
+ (System.nanoTime() - nanosBeforeClass) / 1E9 + " seconds for " + curSummaries.getFlowCount()
210201
+ " summaries");
211202
}
212203

@@ -227,13 +218,11 @@ public ClassSummaries createMethodSummaries(String classpath, Collection<String>
227218
}
228219

229220
/**
230-
* Checks whether the given method is to be included in the summary
231-
* generation. If so, it is added to the set of classes to be analyzed
221+
* Checks whether the given method is to be included in the summary generation.
222+
* If so, it is added to the set of classes to be analyzed
232223
*
233-
* @param classes
234-
* The set of classes to be analyzed
235-
* @param className
236-
* The class to check
224+
* @param classes The set of classes to be analyzed
225+
* @param className The class to check
237226
*/
238227
private void checkAndAdd(Set<String> classes, String className) {
239228
if (config.getExcludes() != null)
@@ -250,13 +239,12 @@ private void checkAndAdd(Set<String> classes, String className) {
250239
}
251240

252241
/**
253-
* Gets all classes that are sub-classes of the given class / implementors
254-
* of the given interface
242+
* Gets all classes that are sub-classes of the given class / implementors of
243+
* the given interface
255244
*
256-
* @param sc
257-
* The class or interface of which to get the implementors
258-
* @return The concrete implementors of the given interface / subclasses of
259-
* the given parent class
245+
* @param sc The class or interface of which to get the implementors
246+
* @return The concrete implementors of the given interface / subclasses of the
247+
* given parent class
260248
*/
261249
private Collection<? extends String> getImplementorsOf(SootClass sc) {
262250
Set<String> classes = new HashSet<>();
@@ -284,8 +272,7 @@ private Collection<? extends String> getImplementorsOf(SootClass sc) {
284272
/**
285273
* Calculates the external dependencies of the given summary set
286274
*
287-
* @param summaries
288-
* The summary set for which to calculate the dependencies
275+
* @param summaries The summary set for which to calculate the dependencies
289276
*/
290277
private void calculateDependencies(ClassSummaries summaries) {
291278
for (MethodFlow flow : summaries.getAllFlows()) {
@@ -307,8 +294,7 @@ private void calculateDependencies(ClassSummaries summaries) {
307294
/**
308295
* Gets the name of the field type from a field definition
309296
*
310-
* @param apElement
311-
* The field definition to parse
297+
* @param apElement The field definition to parse
312298
* @return The type name in the field definition
313299
*/
314300
private String getTypeFromFieldDef(String apElement) {
@@ -324,17 +310,15 @@ private String getTypeFromFieldDef(String apElement) {
324310
/**
325311
* Creates a method summary for the method m
326312
*
327-
* It is assumed that only the default constructor of c is executed before m
328-
* is called.
313+
* It is assumed that only the default constructor of c is executed before m is
314+
* called.
329315
*
330-
* The result of that assumption is that some fields of c may be null. A
331-
* null field is not identified as a source and there for will not create a
332-
* Field -> X flow.
316+
* The result of that assumption is that some fields of c may be null. A null
317+
* field is not identified as a source and there for will not create a Field ->
318+
* X flow.
333319
*
334-
* @param classpath
335-
* The classpath containing the classes to summarize
336-
* @param methodSig
337-
* method for which a summary will be created
320+
* @param classpath The classpath containing the classes to summarize
321+
* @param methodSig method for which a summary will be created
338322
* @return summary of method m
339323
*/
340324
public MethodSummaries createMethodSummary(String classpath, String methodSig) {
@@ -344,29 +328,26 @@ public MethodSummaries createMethodSummary(String classpath, String methodSig) {
344328
/**
345329
* Creates a method summary for the method m.
346330
*
347-
* It is assumed that all method in mDependencies and the default
348-
* constructor of c is executed before m is executed.
331+
* It is assumed that all method in mDependencies and the default constructor of
332+
* c is executed before m is executed.
349333
*
350334
* That allows e.g. to call a setter before a getter method is analyzed and
351335
* there for the getter field is not null.
352336
*
353-
* @param classpath
354-
* The classpath containing the classes to summarize
355-
* @param methodSig
356-
* method for which a summary will be created
357-
* @param parentClass
358-
* The parent class on which the method to be analyzed shall be
359-
* invoked
360-
* @param gapManager
361-
* The gap manager to be used for creating new gaps
337+
* @param classpath The classpath containing the classes to summarize
338+
* @param methodSig method for which a summary will be created
339+
* @param parentClass The parent class on which the method to be analyzed shall
340+
* be invoked
341+
* @param gapManager The gap manager to be used for creating new gaps
362342
* @return summary of method m
363343
*/
364344
private MethodSummaries createMethodSummary(String classpath, final String methodSig, final String parentClass,
365345
final GapManager gapManager) {
366346
System.out.println("Computing method summary for " + methodSig);
367347
long nanosBeforeMethod = System.nanoTime();
368348

369-
final SourceSinkFactory sourceSinkFactory = new SourceSinkFactory(config.getAccessPathLength());
349+
final SourceSinkFactory sourceSinkFactory = new SourceSinkFactory(
350+
config.getAccessPathConfiguration().getAccessPathLength());
370351
final SummarySourceSinkManager sourceSinkManager = new SummarySourceSinkManager(methodSig, parentClass,
371352
sourceSinkFactory);
372353
final MethodSummaries summaries = new MethodSummaries();
@@ -407,11 +388,8 @@ public void onResultsAvailable(IInfoflowCFG cfg, InfoflowResults results) {
407388
throw e;
408389
}
409390

410-
System.out.println("Method summary for "
411-
+ methodSig
412-
+ " done in "
413-
+ (System.nanoTime() - nanosBeforeMethod) / 1E9
414-
+ " seconds");
391+
System.out.println("Method summary for " + methodSig + " done in "
392+
+ (System.nanoTime() - nanosBeforeMethod) / 1E9 + " seconds");
415393
return summaries;
416394
}
417395

@@ -447,13 +425,11 @@ public boolean supportsPathReconstruction() {
447425
}
448426

449427
/**
450-
* Initializes the taint wrapper to be used for constructing gaps during
451-
* summary generation
428+
* Initializes the taint wrapper to be used for constructing gaps during summary
429+
* generation
452430
*
453-
* @param summaries
454-
* The summary data object to receive the flows
455-
* @param gapManager
456-
* The gap manager to be used when handling callbacks
431+
* @param summaries The summary data object to receive the flows
432+
* @param gapManager The gap manager to be used when handling callbacks
457433
* @return The taint wrapper to be used during summary generation
458434
*/
459435
protected SummaryGenerationTaintWrapper createTaintWrapper(MethodSummaries summaries, GapManager gapManager) {
@@ -463,10 +439,8 @@ protected SummaryGenerationTaintWrapper createTaintWrapper(MethodSummaries summa
463439
/**
464440
* Initializes the data flow tracker
465441
*
466-
* @param summaries
467-
* The summary data object to receive the flows
468-
* @param gapManager
469-
* The gap manager to be used when handling callbacks
442+
* @param summaries The summary data object to receive the flows
443+
* @param gapManager The gap manager to be used when handling callbacks
470444
* @return The initialized data flow engine
471445
*/
472446
protected Infoflow initInfoflow(MethodSummaries summaries, GapManager gapManager) {
@@ -582,8 +556,7 @@ public SummaryGeneratorConfiguration getConfig() {
582556
/**
583557
* Sets the configuration object to be used when generating summaries
584558
*
585-
* @param config
586-
* The configuration object to be used when generating summaries
559+
* @param config The configuration object to be used when generating summaries
587560
*/
588561
public void setConfig(SummaryGeneratorConfiguration config) {
589562
this.config = config;

soot-infoflow-summaries/src/soot/jimple/infoflow/methodSummary/generator/SummaryGeneratorFactory.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ public class SummaryGeneratorFactory {
2525
*/
2626
public SummaryGenerator initSummaryGenerator() {
2727
SummaryGenerator s = new SummaryGenerator();
28-
s.getConfig().setAccessPathLength(accessPathLength);
29-
s.getConfig().setUseRecursiveAccessPaths(useRecursiveAccessPaths);
28+
s.getConfig().getAccessPathConfiguration().setAccessPathLength(accessPathLength);
29+
s.getConfig().getAccessPathConfiguration().setUseRecursiveAccessPaths(useRecursiveAccessPaths);
3030
s.getConfig().setEnableExceptionTracking(enableExceptionTracking);
3131
s.getConfig().setImplicitFlowMode(
3232
enableImplicitFlows ? ImplicitFlowMode.AllImplicitFlows : ImplicitFlowMode.NoImplicitFlows);

soot-infoflow-summaries/test/soot/jimple/infoflow/test/methodSummary/junit/ApiTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,8 @@ protected SummaryGenerator getSummary() {
583583
List<String> sub = new LinkedList<String>();
584584
sub.add("java.util.ArrayList");
585585
sg.setSubstitutedWith(sub);
586-
sg.getConfig().setAccessPathLength(5);
587-
sg.getConfig().setUseRecursiveAccessPaths(true);
586+
sg.getConfig().getAccessPathConfiguration().setAccessPathLength(5);
587+
sg.getConfig().getAccessPathConfiguration().setUseRecursiveAccessPaths(true);
588588
return sg;
589589
}
590590

soot-infoflow-summaries/test/soot/jimple/infoflow/test/methodSummary/junit/ArbitraryAccessPathTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ protected SummaryGenerator getSummary() {
214214
List<String> sub = new LinkedList<String>();
215215
sub.add("java.util.ArrayList");
216216
sg.setSubstitutedWith(sub);
217-
sg.getConfig().setUseRecursiveAccessPaths(false);
218-
sg.getConfig().setAccessPathLength(6);
217+
sg.getConfig().getAccessPathConfiguration().setUseRecursiveAccessPaths(false);
218+
sg.getConfig().getAccessPathConfiguration().setAccessPathLength(6);
219219
return sg;
220220
}
221221
}

soot-infoflow-summaries/test/soot/jimple/infoflow/test/methodSummary/junit/CallbackTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,8 @@ protected SummaryGenerator getSummary() {
213213
List<String> sub = new LinkedList<String>();
214214
sub.add("java.util.ArrayList");
215215
sg.setSubstitutedWith(sub);
216-
sg.getConfig().setAccessPathLength(5);
217-
sg.getConfig().setUseRecursiveAccessPaths(true);
216+
sg.getConfig().getAccessPathConfiguration().setAccessPathLength(5);
217+
sg.getConfig().getAccessPathConfiguration().setUseRecursiveAccessPaths(true);
218218
sg.setSootConfig(new DefaultSummaryConfig() {
219219

220220
@Override

0 commit comments

Comments
 (0)