[Soot-list] cha, rta: ok but vta fails

Eric Bodden eric.bodden at ec-spride.de
Thu Jan 17 02:57:37 EST 2013


Excellent!

On 17 January 2013 03:51, Pierre Caserta <pierre.caserta at loria.fr> wrote:
> Thank you Eric, it works.
> Now my code looks like this:
>
> //my class extends SceneTransformer
>
> //In my code I have this:
> PackManager.v().getPack("wjtp").add(new Transform("wjtp.myTransform",this));
> String[] args={"-w","-app","-soot-class-path",sootclasspath,"-p","cg.spark","vta:true","abcd.Main"};
> soot.Main.main(args);
>
> //And I implement the method:
> protected void internalTransform(String arg0, Map arg1) {
>         cg = Scene.v().getCallGraph();
>         File f = new File(outputDir.getAbsolutePath()+"/test_cg_"+type+".txt");
>         try {
>                 writeCallGraph(f.getAbsolutePath(), cg);
>         } catch (IOException e) {
>                 // TODO Auto-generated catch block
>                 e.printStackTrace();
>         }
>
> }
>
> Best,
> Pierre
>
> ----- Mail original -----
>> De: "Eric Bodden" <eric.bodden at ec-spride.de>
>> À: "Pierre Caserta" <pierre.caserta at loria.fr>
>> Cc: "Soot List" <soot-list at sable.mcgill.ca>
>> Envoyé: Mardi 8 Janvier 2013 11:02:00
>> Objet: Re: [Soot-list] cha, rta: ok but vta fails
>>
>> Hi Pierre.
>>
>> Try to remove *everything* from your main method except for:
>>
>> PackManager.v().getPack("wjtp").add(
>>     new Transform("wjtp.myTransform", new SceneTransformer() {
>>         protected void internalTransform(String phaseName, Map
>>         options) {
>>             //access call graph here with Scene.v().getCallGraph()
>>         }
>> }));
>>
>> soot.Main.main(args);
>>
>> Then simply set all required options on the command line you use to
>> call your main class. If you really do with to hard-code those then
>> modify the "args" array you pass to Soot's main method.
>>
>> Eric
>>
>> On 7 January 2013 19:54, Pierre Caserta <pierre.caserta at loria.fr>
>> wrote:
>> > Hi Eric,
>> > Thank you for your answer.
>> >
>> > To be able to explain correctly, I've written the code I have right
>> > bellow.
>> > Now my code look like this:
>> >
>> > soot.options.Options.v().set_keep_line_number(true);
>> > soot.options.Options.v().allow_phantom_refs();
>> > soot.options.Options.v().set_whole_program(true);
>> > soot.options.Options.v().setPhaseOption("cg","verbose:true");
>> > soot.options.Options.v().setPhaseOption("cg","safe-forname:false");
>> > soot.options.Options.v().setPhaseOption("cg","safe-newinstance:false");
>> >
>> > Scene.v().setSootClassPath(myClassPath);
>> >
>> > //pseudo code for this example (just to get the idea)
>> > for(all classes s) {
>> >         Scene.v().addBasicClass(s);
>> >         Scene.v().loadClassAndSupport(s);
>> > }
>> >
>> > //pseudo code for this example (just to get the idea)
>> > for(all jars j){
>> >     Scene.v().setSootClassPath(Scene.v().getSootClassPath() +
>> >     File.pathSeparator + j);
>> > }
>> >
>> > Scene.v().loadNecessaryClasses();
>> > Scene.v().loadBasicClasses();
>> >
>> > if(  type.compareTo("cha") == 0   ){
>> >
>> >         CHATransformer.v().transform();
>> >
>> > }else{
>> >         //When type="rta" OR type="vta"
>> >
>> >                 HashMap opt = new HashMap();
>> >                 opt.put("on-fly-cg","false");
>> >                 opt.put("vta","false");
>> >                 opt.put("rta","false");
>> >
>> >                 opt.put( type   ,"true");
>> >
>> >                 opt.put("enabled","true");
>> >                 opt.put("propagator","worklist"); //worklist iter
>> >                 none
>> >                 opt.put("set-impl","double");
>> >                 opt.put("double-set-old","hybrid");
>> >                 opt.put("double-set-new","hybrid");
>> >                 //SparkTransformer.v().transform("",opt);
>> >
>> > }
>> >
>> > //I'm not very confident about that
>> > PackManager.v().getPack("wjtp").add(
>> >     new Transform("wjtp.myTransform", new SceneTransformer() {
>> >         protected void internalTransform(String phaseName, Map
>> >         options) {
>> >             System.err.println(Scene.v().getApplicationClasses());
>> >         }
>> > }));
>> > String[] mainClasses = {"abcd.Main"};
>> > soot.Main.main(mainClasses);
>> >
>> > CallGraph cg = Scene.v().getCallGraph();
>> >
>> > ---------
>> > If I remove the line: SparkTransformer.v().transform("",opt);
>> > I obtain the same result with type="cha", type="rta" and
>> > type="vta".
>> >
>> > So now that I've removed the line:
>> > SparkTransformer.v().transform("",opt);
>> > How do I specify that I want a call graph RTA or VTA ?
>> >
>> > ---------
>> > If I left the line: SparkTransformer.v().transform("",opt);
>> > I obtain:
>> >
>> > java.lang.NullPointerException
>> >         at
>> >         soot.SootMethod.getBodyFromMethodSource(SootMethod.java:82)
>> >         at soot.SootMethod.retrieveActiveBody(SootMethod.java:315)
>> >         at
>> >         soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processNewMethod(OnFlyCallGraphBuilder.java:526)
>> >         at
>> >         soot.jimple.toolkits.callgraph.OnFlyCallGraphBuilder.processReachables(OnFlyCallGraphBuilder.java:426)
>> >         at
>> >         soot.jimple.toolkits.callgraph.CallGraphBuilder.build(CallGraphBuilder.java:84)
>> >         at
>> >         soot.jimple.spark.builder.ContextInsensitiveBuilder.build(ContextInsensitiveBuilder.java:80)
>> >         at
>> >         soot.jimple.spark.SparkTransformer.internalTransform(SparkTransformer.java:83)
>> >         at
>> >         soot.SceneTransformer.transform(SceneTransformer.java:39)
>> >         at
>> >         callgraph.BuildCG.setSparkPointsToAnalysis(BuildCG.java:256)
>> >         at callgraph.BuildCG.startAnalysis(BuildCG.java:185)
>> >         at callgraph.BuildCG.analyse(BuildCG.java:118)
>> >         at
>> >         callgraph.SootCallGraphGeneration.<init>(SootCallGraphGeneration.java:190)
>> >         at
>> >         callgraph.SootCallGraphGeneration.main(SootCallGraphGeneration.java:121)
>> >
>> > I think it is due to the soot.Main.main(mainClasses); instruction.
>> > ---------
>> >
>> > Any idea?
>> >
>> > Best,
>> > Pierre
>> >
>> > ----- Mail original -----
>> >> De: "Eric Bodden" <eric.bodden at ec-spride.de>
>> >> À: "Pierre Caserta" <pierre.caserta at loria.fr>
>> >> Cc: "Soot List" <soot-list at sable.mcgill.ca>
>> >> Envoyé: Jeudi 3 Janvier 2013 16:05:13
>> >> Objet: Re: [Soot-list] cha, rta: ok but vta fails
>> >>
>> >> Hi Pierre.
>> >>
>> >> You are right, the result is incorrect. The question is why this
>> >> is
>> >> so. Looking at your code, it seems that you never call
>> >> soot.Main.main(...). This may be an issue. My recommendation is to
>> >> write code that:
>> >>
>> >> 1.) Sets arguments, as you do now.
>> >> 2.) Inserts a SceneTransformer into the wjtp pack.
>> >> 3.) Calls soot.Main.main(...) with your arguments.
>> >>
>> >> The SceneTransformer can then simply access the call graph via
>> >> Scene.v().getCallGraph() - no call to
>> >> SparkTransformer.v().transform("",opt) is necessary.
>> >>
>> >> Eric
>> >>
>> >> On 27 December 2012 11:47, Pierre Caserta
>> >> <pierre.caserta at loria.fr>
>> >> wrote:
>> >> > I've clearly described my problem at this url:
>> >> > http://www.loria.fr/~casertap/vta_problem.html
>> >> >
>> >> > Can someone help me please?
>> >> > Best,
>> >> > Pierre
>> >> >
>> >> > ----- Mail original -----
>> >> >> De: "Pierre Caserta" <pierre.caserta at loria.fr>
>> >> >> À: "Quentin Sabah" <quentin.sabah at inria.fr>
>> >> >> Cc: "Soot List" <soot-list at sable.mcgill.ca>
>> >> >> Envoyé: Lundi 24 Décembre 2012 14:31:49
>> >> >> Objet: Re: [Soot-list] cha, rta: ok but vta fails
>> >> >>
>> >> >> Hi Quentin,
>> >> >> Thank you for your reply.
>> >> >>
>> >> >> I changed a little bit my example to introduce a virtual call
>> >> >> inside
>> >> >> the method m but the vta analysis still does not work.
>> >> >>
>> >> >> I've updated my web page to include the new example with the
>> >> >> resulting call graphs.
>> >> >>
>> >> >>
>> >> >> ----- Mail original -----
>> >> >> > De: "Quentin Sabah" <quentin.sabah at inria.fr>
>> >> >> > À: "Soot List" <soot-list at sable.mcgill.ca>
>> >> >> > Envoyé: Lundi 24 Décembre 2012 11:57:28
>> >> >> > Objet: Re: [Soot-list] cha, rta: ok but vta fails
>> >> >> >
>> >> >> > Hi Pierre,
>> >> >> >
>> >> >> > > Hi everybody,
>> >> >> > > I'm able to generate cha and rta call graphs but vta is not
>> >> >> > > working.
>> >> >> > >
>> >> >> > > To clearly expose my problem, I created a web page:
>> >> >> > >
>> >> >> > > http://www.loria.fr/~casertap/vta_problem.html
>> >> >> >
>> >> >> > First, I'm not familiar with the VTA implementation in Soot.
>> >> >> > What I can see is that virtual call edges to m(), and to
>> >> >> > initializers, are missing in the VTA analysis result. I can
>> >> >> > also
>> >> >> > see
>> >> >> > that these methods have an empty body.
>> >> >> >
>> >> >> > Would the VTA performs some kind of side-effect analysis and
>> >> >> > deduce
>> >> >> > these edges may be omitted? Or, because these methods provide
>> >> >> > no
>> >> >> > typing information at all, the VTA is not reporting them as
>> >> >> > they
>> >> >> > should be ?
>> >> >> >
>> >> >> > Have you the same kind of results when the methods are filled
>> >> >> > with
>> >> >> > useful statements ?
>> >> >> >
>> >> >> > --
>> >> >> > Quentin Sabah, CIFRE Ph.D. student
>> >> >> > Grenoble University
>> >> >> > INRIA-SARDES                   | STMicroelectronics/AST
>> >> >> > Montbonnot, France             | Grenoble, France
>> >> >> > mailto:quentin.sabah at inria.fr  | mailto:quentin.sabah at st.com
>> >> >> > phone: +33 476 61 52 42        | phone: +33 476 58 44 14
>> >> >> >
>> >> >> > _______________________________________________
>> >> >> > Soot-list mailing list
>> >> >> > Soot-list at sable.mcgill.ca
>> >> >> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>> >> >> >
>> >> >> _______________________________________________
>> >> >> Soot-list mailing list
>> >> >> Soot-list at sable.mcgill.ca
>> >> >> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>> >> >>
>> >> > _______________________________________________
>> >> > Soot-list mailing list
>> >> > Soot-list at sable.mcgill.ca
>> >> > http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>> >>
>> >>
>> >>
>> >> --
>> >> Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
>> >> Head of Secure Software Engineering Group at EC SPRIDE
>> >> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
>> >> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
>> >>
>>
>>
>>
>> --
>> Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
>> Head of Secure Software Engineering Group at EC SPRIDE
>> Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
>> Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt
>>



-- 
Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt


More information about the Soot-list mailing list