-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using pyvex for transformations/instrumentation #47
Comments
This is a longstanding TODO for pyvex, unfortunately... it shouldn't be any On Sun, Oct 30, 2016 at 6:56 PM, Matt Revelle notifications@github.com
|
Glad to hear it's a TODO. There are a bunch of ways we can support creating IR component instances from the corresponding existing C structs (the current implementation) and from sub components (this is what the constructors in libvex look like). We probably don't want to break the pyvex API at this point (maybe in major version bump?), so the current implementation of init would remain. Each IR component class can also have a static method which mirrors the underlying libvex constructor. Eventually we could move the current init to a static method and then move the libvex-style constructor in init. Does adding support for libvex-style constructors via static methods attached to respective IR component classes sound reasonable to you all? |
Yes, that was exactly what I was thinking of! If you want to just do this, Unfortunately, we have to keep all the angr components version numbers in On Mon, Oct 31, 2016 at 10:52 AM, Matt Revelle notifications@github.com
|
Ok, I'm going forward with a Is it OK for us to use "ABI mode" with cffi for calling the libvex constructors? It looks like you all wrote your own wrapper (pyvex.c) which gets statically linked with libvex. Since all the libvex functions, structs, etc are included in the generated vex_ffi.py module we can reference them without making any changes. It sounds like the preferred approach is to include the current contents of pyvex.c with a C extension module generated by cffi (see "API mode"). I'm leaning towards going ahead and leaving pyvex.c alone and referencing the constructors via ABI mode, at least for now. More on the cffi modes: |
Yeah, please leave the pyvex_c stuff alone. We need to have it compiled as Interestingly enough, we decided recently that there actually would be a On Saturday, November 5, 2016, Matt Revelle notifications@github.com
|
Here's a commit showing example changes to the IRConst classes. There's now a I also added a We may later want to have a method complementary to Please let me know if there are any tweaks/critiques I should take into account and I'll then go ahead and finish making similar changes for the other IR components. Thanks! |
Hey @rhelmot, just checking in about the proposed changes so I can go ahead and wrap this up. Thanks for any feedback. Heard there was a plague going around your all's lab, hope you escaped it. =) |
Yes, this is good! Reports of a plague have been highly exaggerated, yeah everyone is sick and there's been a nasty deadline, but nobody is dead yet. It also just occurred to me that we actually have pretty much zero possibility of breaking any interfaces as long as pyvex is internally consistent - really, the only way anyone ever interacts with pyvex right now is by constructing an IRSB and then accessing properties on it and its children, which you're not planning on touching. You should be able to just fiddle with the constructors and make everything work the way it should be and none of the rest of angr should have to care. |
Hello, currently pyvex makes a call into C code to create an IRSB. That IRSB and its components (IRStmt, etc) are exposed as Python objects, but there doesn't seem to be a way to create an empty IRSB or construct IRStmt instances not backed by guest machine instructions.
I'd like to modify IRSBs, IRStmts, and IRExprs generated from code as well as programmatically generating instances without backing code. Is this functionality within the scope of pyvex? I'm happy to work on it and submit a patch, if so.
The text was updated successfully, but these errors were encountered: