[Soot-list] FlowDroid: patching of class Thread

Steven Arzt Steven.Arzt at cased.de
Thu Mar 31 11:19:30 EDT 2016


Hi Denis,

 

In general, loading an external Jimple file would also have been a possible design choice. We decided against it to be more generic. With the patching approach, we can inject the desired behavior even if the Thread class is already loaded, e.g., from an Android stub JAR file that only contains the signatures, but no actual implementations.

 

Not loading the Thread class at all would have not solved the problem of the missing behavior we want to inject. If we chose to never load the Thread class from disk and always replace it with the contents of a specific Jimple file,  we lose the possibility of merging existing behavior with what we need.

 

Best regards,

  Steven

 

Von: Denis Bogdanas [mailto:denis.bogdanas at gmail.com] 
Gesendet: Dienstag, 29. März 2016 19:57
An: Steven Arzt
Cc: soot-list at cs.mcgill.ca
Betreff: Re: [Soot-list] FlowDroid: patching of class Thread

 

Reading patched classes behavior is very hard, and I guess tedious and error-prone to write as well. Is it possible to:

- Instruct Soot not to load a particular class?

- Write a class in Jimple format and load it?

thanks,

Denis

 

On 29 March 2016 at 01:27, Steven Arzt <Steven.Arzt at cased.de> wrote:

Hi Denis,

 

This code is implemented in a very defensive way. We might already have a class java.lang.Thread in our Soot scene. In that case, we only want to extend that class to provide the minimum functionality we need. Since we cannot make any assumptions on how a private field is named in the various implementations of the JDK (Oracle, OpenJDK, Android, etc.), we just take a name that’s still free and use that to implement the behavior we want.

 

Best regards,

  Steven 

 

Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von Denis Bogdanas
Gesendet: Sonntag, 27. März 2016 23:58
An: soot-list at cs.mcgill.ca; Steven Arzt
Betreff: [Soot-list] FlowDroid: patching of class Thread

 

Hi Steven,

In LibraryCalssPatcher.patchThreadImplementation() you have the following code:

SootClass sc = Scene.v().getSootClassUnsafe("java.lang.Thread");

...

while ((fldTarget = sc.getFieldByNameUnsafe("target" + fieldIdx)) != null)
   fieldIdx++;
fldTarget = new SootField("target" + fieldIdx, runnable.getType());

 

Here you create a field with name "thread+<some number>" inside Thread. Why don't you name it simply "thread", as it is in JDK?

thanks,

-- 

Denis




-- 

Denis

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20160331/b31c9a43/attachment-0001.html 


More information about the Soot-list mailing list