[Wala-wala] Recovery static assignment instructions from the SSA IR

87 views
Skip to first unread message

Edward X. Wu

unread,
Mar 6, 2013, 4:08:22 PM3/6/13
to wala...@lists.sourceforge.net
Hi,

I am wondering if there's a way to recover assignment instructions from the ssa IR. For example:

int x=src(); 
int y=0;
if (rand>3){
    y=x+3;
}

The phi node merging "y=x+3" and "y=0" hints "y=0" instruction must be before the phi bb, but it can't distinguish between:

int x=src(); 
int y=0;

and 

int y=0;
int x=src(); 

I am currently building a static analysis that will need to convey some information to the dynamic analysis. As a result, the ordering of the instructions is crucial and having these static assignment instructions in the right places in cfg is needed. Thanks in advance for your responses.

Best,

Edward Wu

Manu Sridharan

unread,
Mar 6, 2013, 6:44:44 PM3/6/13
to WALA discussion and Q&A

Hi Edward,

I don't think you can recover such source-level information from the WALA SSA IR, unfortunately.  We do have source locations available:

http://wala.sourceforge.net/wiki/index.php/UserGuide:MappingToSourceCode

You might be able to rig something up based on that.

--Manu

-------------------------------------------
Manu Sridharan
IBM T.J. Watson Research Center
http://researcher.ibm.com/view.php?person=us-msridhar


Inactive hide details for "Edward X. Wu" ---03/06/2013 03:40:33 PM---Hi, I am wondering if there's a way to recover assignment "Edward X. Wu" ---03/06/2013 03:40:33 PM---Hi, I am wondering if there's a way to recover assignment instructions from the

Edward Wu------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to
tackle endpoint security challenges, access the full report.
http://p.sf.net/sfu/symantec-dev2dev_______________________________________________
Wala-wala mailing list
Wala...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wala-wala

Edward X. Wu

unread,
Mar 6, 2013, 8:55:44 PM3/6/13
to WALA discussion and Q&A
Hi Manu,

Sorry about not being very clear in my first post. I was talking about the missing constant assignment instruction that wala's ssa ir eliminated. I would like to recover these contant assignment instructions in the control flow graph. I played around a bit and it seems in the case of

int x=src();
int y=x+3;
if (rand>3){
    y=0;
}

while "y=0"'s basic block still exists there is no ssa instruction in it. Do you believe there is a way to recover these contant assignment instructions by looking for these patterns?

Thanks,

Edward Wu


On Wed, Mar 6, 2013 at 3:44 PM, Manu Sridharan <msri...@us.ibm.com> wrote:
>
> Hi Edward,
>
> I don't think you can recover such source-level information from the WALA SSA IR, unfortunately.  We do have source locations available:
>
> http://wala.sourceforge.net/wiki/index.php/UserGuide:MappingToSourceCode
>
> You might be able to rig something up based on that.
>
> --Manu
>
> -------------------------------------------
> Manu Sridharan
> IBM T.J. Watson Research Center
> http://researcher.ibm.com/view.php?person=us-msridhar
>

Julian Dolby

unread,
Mar 6, 2013, 9:21:44 PM3/6/13
to WALA discussion and Q&A

Edward,

  Are you working with the bytecode version of WALA, or are you using the CAst source front end?  

  If you are using the source front end, there is a mechanism to undo copy propagation.  It is in the SSA info of the IR, and you can call undoCopyPropagation(instructionIndex, useNumber) to recover assignment statements.  

  Note that this mechanism is used for rewriting IRs in case of lexically-scoped writes to state, and it leaves the IR in a state that WALA analysis will not deal with.  However, you could probably use it to recover the information you want.

-- Julian

Inactive hide details for "Edward X. Wu" ---03/06/2013 08:56:46 PM---Hi Manu, Sorry about not being very clear in my first post"Edward X. Wu" ---03/06/2013 08:56:46 PM---Hi Manu, Sorry about not being very clear in my first post. I was talking about the


    From:

"Edward X. Wu" <edwa...@cs.washington.edu>

    To:

"WALA discussion and Q&A" <wala...@lists.sourceforge.net>,

    Date:

03/06/2013 08:56 PM

    Subject:

Re: [Wala-wala] Recovery static assignment instructions from the SSA IR

Edward X. Wu

unread,
Mar 7, 2013, 12:54:10 AM3/7/13
to WALA discussion and Q&A
Hi Julian,

Thanks for the pointers! I am actually using wala to analyze java bytecode, will that API also work?

Thanks,

Edward Wu
graycol.gif
ecblank.gif

Julian Dolby

unread,
Mar 7, 2013, 9:12:24 AM3/7/13
to WALA discussion and Q&A, WALA discussion and Q&A

That functionality only works for the source front end.  For bytecode, it is not clear that the information still exists anyway, since the Java compiler can move stuff like constant assignments around.  You could try looking at the Shrike IR rather than the WALA one, and mapping those bytecode instructions back to source code.

-- Julian

Inactive hide details for "Edward X. Wu" ---03/07/2013 12:55:14 AM---Hi Julian, Thanks for the pointers! I am actually using wa"Edward X. Wu" ---03/07/2013 12:55:14 AM---Hi Julian, Thanks for the pointers! I am actually using wala to analyze java bytecode,


    From:

"Edward X. Wu" <edwa...@cs.washington.edu>

    To:

"WALA discussion and Q&A" <wala...@lists.sourceforge.net>,


    Date:

03/07/2013 12:55 AM

Reply all
Reply to author
Forward
0 new messages