-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Modifies the Unicorn emulator module to allow it to be used for "preloading" large binaries. It uses Unicorn to execute x64 instructions in bulk while Manticore handles IO and syscalls. State changes are aggressively written from Manticore back to Unicorn, and lazily written from Unicorn to Manticore before a syscall. Can be used to concretely execute entire binaries, but should not be used once symbolic data has been introduced. The following script demonstrates this. The user can register a plugin at startup that tells Manticore to use Unicorn to quickly execute the initialization instructions leading up to the start of `main`. The binary in question is [`multiple-styles`](https://gist.github.com/ehennenfent/a5ad9746615d1490c618a88b98769c10) from an old example. ```python from manticore.native import Manticore from manticore.core.plugin import Plugin address_of_main = 0x4009ae class concretePlugin(Plugin): def will_start_run_callback(self, state, *_args): state.cpu.emulate_until(address_of_main) m = Manticore("multiple-styles", concrete_start='coldlikeminisoda') m.register_plugin(concretePlugin()) m.run() ``` Once `main` is reached, Manticore takes over and continues execution as normal. In the case of this example, the full solution is `coldlikeminisodas`, so Manticore generates two different test cases for the remaining byte. The performance improvement for this example is only marginal because the bulk of the time is taken up by the solver, and relatively little initialization is required before executing `main`. However, more complex binaries can see very significant speedups.
- Loading branch information
1 parent
cdae2bc
commit bc77660
Showing
13 changed files
with
865 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.