[Soot-list] Problem of mapping runnable object to its caller method

Bodden, Eric eric.bodden at sit.fraunhofer.de
Thu Feb 12 05:37:51 EST 2015


Hi Xinxin.

The problem is that InterproceduralCFG, by default, is based on a context-insensitive call graph. Thus call edges get merged by callee, and different calling contexts are not distinguished.

To handle the problem you explained, one would need a call graph, that is 1-context-sensitive at least for the call to Thread.start.

The way I see it, currently Soot does not support an easy workaround for this. One possibility is to create a general 1-context-sensitive or 1-object-sensitive call graph using paddle, and subclass InterproceduralCFG to use that kind of call graph. (http://www.sable.mcgill.ca/paddle/)

Ideally, I guess, we would like to have some special treatment of calls for Thread.start(). If anyone would volunteer to contribute such a patch then I would be happy to incorporate it.

Cheers,
Eric

> On 12.02.2015, at 05:40, Xinxin Jin <xinxin at cs.ucsd.edu> wrote:
> 
> Hi all,
> 
> I have a problem in tracing a runnable object's caller method. To make it clear, I simplified my code as follows:
> 
> public class A {
>     public void Foo () {
>         Thread t = new Thread(new MyFirstHandler());
>     }
> 
>     private class MyFirstHandler implements Runnable {
>          @Override
>          public void run() {
>              CreateFile();
>         }
>     }
> }
> 
> public class B {
>     public void Bar () {
>         Thread t = new Thread(new MySecondHandler());
>     }
>     ....
> }
> 
> ​My problem is : Given method CreateFile(), I want to trace back to get its caller method. Ideally I should get "A.Foo()".
> 
> My algorithm is to use InterproceduralCFG.getCallersOf() provided by heros, starting from createFile() and tracing backwards level by level:
> (1) Get ​<java.lang.Thread: void run()> as the only caller of CreateFile()
> ​(2) ​Continue to get the callers of ​<java.lang.Thread: void run()>.
>  Now you may guess what happens: Because both A.Foo() and B.Bar() call ​<java.lang.Thread: void run()>, I get A.Foo() and B.Bar() as createFile()'s caller methods.
> 
> ​So my question is how to remove B.Bar() from my results ?
> 
> Thanks a lot !​
> 
> 
> --
> Xinxin Jin
> Ph.D. student, Computer Science
> University of California, San Diego
> http://cseweb.ucsd.edu/~x7jin/
> 
> _______________________________________________
> Soot-list mailing list
> Soot-list at CS.McGill.CA
> https://mailman.CS.McGill.CA/mailman/listinfo/soot-list

--
Prof. Eric Bodden, Ph.D., http://sse.ec-spride.de/ http://bodden.de/
Head of Secure Software Engineering at Fraunhofer SIT, TU Darmstadt and EC SPRIDE
Tel: +49 6151 16-75422    Fax: +49 6151 869-127
Room B5.11, Fraunhofer SIT, Rheinstraße 75, 64295 Darmstadt

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150212/b400875e/attachment.bin 


More information about the Soot-list mailing list