secure-software-engineering/tamiflex

Exceptions when following "Step 2: Running Soot" in tutorial "DaCapoAndSoot"

Opened this issue · 1 comments

I followed the tutorial "DaCapoAndSoot".
When doing "Step 2: Running Soot", after executing

java \ 
-Xmx10G \                                            # use 10GB heap space
-cp soot-2.4.0.jar soot.Main \                       # run Soot
-w -app -p cg.spark enabled \                        # enable Spark
-p cg reflection-log:out/refl.log \     # use the given reflection log
-cp ${JRE}/jce.jar:${JRE}/rt.jar:out \  # classes that Soot should analyze
-include org.apache. -include org.w3c. \             # include given packages (see below)
-main-class Harness \                                # use Harness as entry point for call graph
-d sootified/avrora-small \                          # place transformed classes here
Harness                                              # analyze program starting at Harness

the following exceptions occur:

Exception in thread "main" java.lang.RuntimeException: Line: 'Array.newInstance;java.lang.String[];java.util.Arrays.copyOf;3212;;'
    at soot.Scene.addReflectionTraceClasses(Scene.java:991)
    at soot.Scene.loadBasicClasses(Scene.java:955)
    at soot.Scene.loadNecessaryClasses(Scene.java:1018)
    at soot.Main.run(Main.java:167)
    at soot.Main.main(Main.java:141)
Caused by: java.lang.RuntimeException: Unknown entry kind: Array.newInstance
    at soot.Scene.addReflectionTraceClasses(Scene.java:988)
    ... 4 more

What happened? How to deal with it?

(

  1. The libraries I used are: dacapo-9.12-bach.jar; pia-2.0.3.jar, poa-2.0.3.jar; soot-2.4.0.jar
  2. I used Oracle JDK1.8 ($ java -version yields java version "1.8.0_101") in Ubuntu 14.04 LTS, and set JRE=/usr/lib/jvm/java-8-oracle/jre/lib temporarily before running the long command.
    )

Thank you!

See https://groups.google.com/forum/#!topic/tamiflex-discuss/6q6ShId_TIw

In short, Soot is behind Tamiflex and cannot handle this 'new' reflection mechanism.

In ~/.tamiflex/poa.properties, remove the lines that look for these mechanisms. Delete all the output of the POA run, and re-run.

With soot-2.5.0, I ended up with these transformations:

transformations =\
			de.bodden.tamiflex.playout.transformation.clazz.ClassForNameTransformation \
			de.bodden.tamiflex.playout.transformation.clazz.ClassNewInstanceTransformation \
			de.bodden.tamiflex.playout.transformation.constructor.ConstructorNewInstanceTransformation \
			de.bodden.tamiflex.playout.transformation.method.MethodInvokeTransformation \
			de.bodden.tamiflex.playout.transformation.array.ArrayMultiNewInstanceTransformation \
			de.bodden.tamiflex.playout.transformation.clazz.ClassGetDeclaredMethodsTransformation \
			de.bodden.tamiflex.playout.transformation.clazz.ClassGetDeclaredMethodTransformation \
			de.bodden.tamiflex.playout.transformation.clazz.ClassGetFieldTransformation \
			de.bodden.tamiflex.playout.transformation.clazz.ClassGetFieldsTransformation \
			de.bodden.tamiflex.playout.transformation.constructor.ConstructorToGenericStringTransformation \
			de.bodden.tamiflex.playout.transformation.constructor.ConstructorToStringTransformation \
			de.bodden.tamiflex.playout.transformation.field.FieldGetDeclaringClassTransformation \
			de.bodden.tamiflex.playout.transformation.field.FieldGetModifiersTransformation \
			de.bodden.tamiflex.playout.transformation.field.FieldGetTransformation \
			de.bodden.tamiflex.playout.transformation.field.FieldSetTransformation \
			de.bodden.tamiflex.playout.transformation.field.FieldToGenericStringTransformation \
			de.bodden.tamiflex.playout.transformation.field.FieldToStringTransformation \
			de.bodden.tamiflex.playout.transformation.method.MethodGetDeclaringClassTransformation \
			de.bodden.tamiflex.playout.transformation.method.MethodToGenericStringTransformation \
			de.bodden.tamiflex.playout.transformation.method.MethodToStringTransformation