Skip to content
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

Can I build an IRSB from a combination of instructions and IR? #41

Closed
Nixtron opened this issue Sep 16, 2016 · 4 comments
Closed

Can I build an IRSB from a combination of instructions and IR? #41

Nixtron opened this issue Sep 16, 2016 · 4 comments

Comments

@Nixtron
Copy link

Nixtron commented Sep 16, 2016

So, I am running instructions, and between instructions I want to set some registers & memory locations to fix values - these are known before generation of the IRSB.

I know I can use the breakpoints to do what I want, but I was hoping to do it without breakpoints - mainly because I don't want to keep track of where in the execution I am - but also because I hope to gain speed.

I could probably add extra instructions, but this would require me to also modify the instruction pointer after each added instruction - probably creating more problems. Also, it would make me bound to a specific instruction set.

So, my hope is to, given a list of normal instructions in binary format, and some points where I want to change register data, build a list of normal instructions and single registry/memory modifying IR instructions that can be used to build one IRSB.

Is this possible and how?

@zardus
Copy link
Member

zardus commented Sep 16, 2016

Are you doing this in the context of angr, or in a separate system? In angr, the easiest thing would be to make a hook at the address in question (using project.hook, as described here: http://angr.io/api-doc/angr.html#angr.project.Project.hook), and have the hook modify your state as you wish.

If you're doing this outside of angr, the IRSBs themselves can certainly be modified, but how to do that depends on the framework you're using.

@rhelmot
Copy link
Member

rhelmot commented Sep 16, 2016

The main problem is that there's no way right now to construct any of the PyVEX classes manually - all of the IRStmt, IRExpr, etc classes have constructors that require a pointer into a libVEX native object. We'd have to add alternate constructors that allow manual construction.

@Nixtron
Copy link
Author

Nixtron commented Sep 18, 2016

Okay, so I guess its not currently possible. I am using angr, but on a lower level [i.e not using the binary loader or such]. I am using simuvex and irsbs to execute my instructions.

@zardus
Copy link
Member

zardus commented Sep 19, 2016

Yeah, then I think the only way would be SimInspect breakpoints, or implement the functionality in whatever wrapper you have around simuvex...

I'll close this issue for now; please reopen it if you have further questions!

@zardus zardus closed this as completed Sep 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants