[Soot-list] Pattern matching in bytecode

Patrick Lam plam at sable.mcgill.ca
Wed Oct 29 10:26:11 EDT 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Silviu ANDRICA wrote:
> Hello everybody,
>    this list has been extremely helpful in the past so I decided to ask
> for help again.
> What I want to do is: given an instruction in java bytecode, say
> monitorenter, and a list of
> instructions that should precede it and a list of instructions that
> should follow it, I want to check
> if a real java app respects this.
> 
> By way of an example,
> say I have <before1 before2 before3 monitorenter after1 after2> the
> sequence of instructions that
> should be in a real code.
> 
> My main concern, and the reason I'm writing to you, is that soot changes
> the bytecode. What I mean is
> that if I load a class and then I want to write it back, the bytecode of
> the two versions differ, rendering
> my analysis useless.

Hi Silviu,

You can't make Soot not change the order of instructions in bytecode;
there are options which disable the internal optimizations, but then you
still get something different than what you started with, because we
convert stack code to three-address code. It's not clear to me that
there's a unique mapping between Jimple and bytecode, anyway. Also, a
pattern-matching analysis like the one you propose would be sensitive to
the compiler version used to emit the code.

You might want to consider the following publication:

M. Kawahito et al. A New Idiom Recognition Framework for Exploiting
Hardware-Assist Instructions. ASPLOS '06.

It proposes a generalization of pattern-matching which might be closer
to what you want. Of course, you'd have to implement it. We accept patches!

pat
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkkIcoMACgkQNTVxnNGEyOheYACgjPvbSYaYQo20c/adWC3ZHBom
qM8AoKz357uZM+R5Ye4pnG/cNQiB1rhk
=XuTy
-----END PGP SIGNATURE-----


More information about the Soot-list mailing list