[Soot-list] Missing callgraph edges with Spark

Faridah Akinotcho faridath.akinotcho at yahoo.fr
Fri May 13 15:09:56 EDT 2022


 Hello Prof. Dr. Arzt, Prof.Dr.Bodden,
I reproduced the issue of edges missing for fragment lifecycles using Flowdroid 2.11-SNAPSHOT as well. Looking into AndroidEntryPointCreator, as you recommended, it seems method active bodies (and thus outgoing edges), will only be resolved for added fragments (i.e for which transactions and the correct type were identified by the CallbackAnalyzer ) but not for any other fragment class i.e classes within the app's namespace which extend android.app.Fragment or Support Library fragments.
Is this assumption correct? 
If that is the case, I guess one would either need to refine the fragment identifcation for those missing fragments or somehow modify the analysis to resolve active bodies for any fragment lifecycle as long as the fragment is within the app package.
Best regards,Faridah Akinotcho
    Le mardi 10 mai 2022, 12:31:51 UTC−7, Arzt, Steven <steven.arzt at sit.fraunhofer.de> a écrit :  
 
 Dear Faridah,

FlowDroid applies a precise model for app components including fragments. You may want to look into the "AndroidEntryPointCreator" to identify any missing parts. Maybe there is a bug. Feel free to open merge request if you find something.

Best regards,
  Steven


-----Original Message-----
From: Faridah Akinotcho <faridath.akinotcho at yahoo.fr> 
Sent: Dienstag, 10. Mai 2022 21:28
To: Eric Bodden <eric.bodden at uni-paderborn.de>; Arzt, Steven <steven.arzt at sit.fraunhofer.de>
Cc: Soot-list <soot-list at cs.mcgill.ca>
Subject: Re: [Soot-list] Missing callgraph edges with Spark

Hi Prof. Dr. Arzt, Prof. Dr. Bodden,

I followed your recommendations of using Flowdroid and preprocessors, instead of Soot, for which I thank you once again.

While it did provide me with a much more precise callgraph on the example I showed before, some of the edges that were found previously by Soot are now missing, and from a first look, it seems those are all within fragment lifecycles (e.g onViewCreated). Is there anything regarding how fragment classes are handled by Flowdroid which you believe could explain this behavior?

Best regards,
Faridah Akinotcho 

Le lundi 9 mai 2022, 19:27:11 UTC−7, Faridah Akinotcho <faridath.akinotcho at yahoo.fr> a écrit : 


Thank you for clarifying this! I'll try setting up my analysis within this Flowdroid callback instead.


Best regards,
Faridah Akinotcho


Le lundi 9 mai 2022, 12:12:00 UTC−7, Arzt, Steven <steven.arzt at sit.fraunhofer.de> a écrit : 


Dear Faridah,

You can call SetupApplication.addPreprocessor() to add a callback that gets invoked once the callgraph construction is done in FlowDroid. The interface has two methods, one before and one after callgraph construction. You just need to use the FlowDroid API, i.e., the SetupApplication class. That should be fairly simple.

Best regards,
  Steven

-----Original Message-----
From: Soot-list <soot-list-bounces at CS.McGill.CA <mailto:soot-list-bounces at CS.McGill.CA> > On Behalf Of Faridah Akinotcho
Sent: Montag, 9. Mai 2022 21:11
To: Eric Bodden <eric.bodden at uni-paderborn.de <mailto:eric.bodden at uni-paderborn.de> >
Cc: Soot-list <soot-list at cs.mcgill.ca <mailto:soot-list at cs.mcgill.ca> >
Subject: Re: [Soot-list] Missing callgraph edges with Spark

Hi Prof. Dr. Bodden,

Thank you for the reply! I am using bare Soot because I am trying to add a wjtp subphase and I couldn't figure out how to do with Flowdroid without having to extend it and override constructCallgraph. Would there be a way for me to this with Flowdroid?

Best regards,
Faridah Akinotcho

Le lundi 9 mai 2022, 05:20:22 UTC−7, Eric Bodden <eric.bodden at uni-paderborn.de <mailto:eric.bodden at uni-paderborn.de> > a écrit : 


Hi Faridah. 


When creating callgraphs for Android you should be using our Soot-extension FlowDroid because it models Android’s lifecycle. When you use bare Soot then the callgraph will be very incomplete. Are you using FlowDroid already?


Cheers
Eric



    On 9. May 2022, at 00:11, Faridah Akinotcho <faridath.akinotcho at yahoo.fr <mailto:faridath.akinotcho at yahoo.fr>  <mailto:faridath.akinotcho at yahoo.fr <mailto:faridath.akinotcho at yahoo.fr> > > wrote:

    Hi,

    I am using Soot (org.soot.oss 4.2.1) to perform an interprocedural analysis on Android methods (in the wjtp phase). To this end, I am extracting reachable methods from Android lifecycles using Scene.v().getCallgraph().edgesOutOf(method). However, I noticed that some virtual and special edges seem to always be missing from the returned set. For e.g, given:

    class B extends A{
        void onCreate(...){
            setContentView(C0027R.layout.merge);
            super.onCreate(bundle);
            setNextActivity(C.class);
        }
    }
    
    class A{
        public void setNextActivity(){
            ...
        }
    }

    When computing the reachable methods for B.onCreate(), neither setContentView, super.onCreate or setNextActivity are included as targets for the outgoing edges (only clinit is returned). However, when using CHA instead of Spark, these are part of the returned set (along other overapproximations), so I am assuming there might be some issue when performing the points-to analysis. Here are the options I am using:

    Options.v().set_src_prec(Options.src_prec_apk);
    Options.v().set_output_format(Options.output_format_none);

    Options.v().set_no_bodies_for_excluded(true);
    Options.v().set_allow_phantom_refs(true);
    Options.v().set_android_jars(androidJar);

    Options.v().set_process_dir(Collections.singletonList(apkPath));
    Options.v().set_soot_classpath(androidJar);
    Options.v().set_process_multiple_dex(true);

    Options.v().set_whole_program(true);
    Options.v().setPhaseOption("cg", "all-reachable:true");
    Options.v().setPhaseOption("cg.spark", "on");
    Options.v().setPhaseOption("cg.spark", "verbose:true");
    Options.v().setPhaseOption("cg.spark", "string-constants:true");

    Options.v().setPhaseOption("jb.ulp", "off");
    
    Main.v().autoSetOptions();
    Scene.v().loadNecessaryClasses();



    I would greatly appreciate any pointers about what I might be missing (maybe an option that wasn't set properly) or what the problem could be.

    Best regards,
    Faridah Akinotcho

    _______________________________________________
    Soot-list mailing list
    Soot-list at CS.McGill.CA <mailto:Soot-list at CS.McGill.CA>  <mailto:Soot-list at CS.McGill.CA <mailto:Soot-list at CS.McGill.CA> > 

    https://mailman.CS.McGill.CA/mailman/listinfo/soot-list
    



  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20220513/53baa93c/attachment-0001.html>


More information about the Soot-list mailing list