-
Notifications
You must be signed in to change notification settings - Fork 471
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
Removed use of global solver from Memory #2414
Conversation
I just run the following locally with $ python
Python 3.6.13 (default, Feb 22 2021, 12:20:57)
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from manticore.core.smtlib import SelectedSolver
>>> solver = SelectedSolver.instance()
>>> solver
<manticore.core.smtlib.solver.YicesSolver object at 0x7f51d999ee48> I also tried inspecting the global solver itself and still got $ python
Python 3.6.13 (default, Feb 22 2021, 12:20:57)
[GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from manticore.native.memory import solver
>>> solver
<manticore.core.smtlib.solver.YicesSolver object at 0x7fa727dbc780> Am I missing something? |
If you apply this patch: diff --git a/manticore/core/smtlib/solver.py b/manticore/core/smtlib/solver.py
index 7e61217..208cfd3 100644
--- a/manticore/core/smtlib/solver.py
+++ b/manticore/core/smtlib/solver.py
@@ -761,4 +761,5 @@ class SelectedSolver:
cls.choice = consts.solver
SelectedSolver = {"cvc4": CVC4Solver, "yices": YicesSolver, "z3": Z3Solver}[cls.choice.name]
+ print("Calling instance() with cls.choice =", cls.choice)
return SelectedSolver.instance() you can see that running anything using the manticore cli will print |
Ahh, okay, yes I see that now. I think there's a bigger issue with the CLI options not getting parsed correctly. I'm currently looking into it. Edit: Maybe not. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay! I think I finally understand what's going on here...
The global solver
instance is initialized incorrectly because it calls SelectedSolver.instance()
before we've parsed the command line flags, due to execution upon import, and so if someone chooses to use a particular solver, it will be ignored for these global instances.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
This looks ready to merge, but again I can't do it since one check (CI / upload) was skipped. Can you merge it @ekilmer ? |
* master: Removed use of global solver from Native Memory (#2414) Support to use boolector as the SMT solver (#2410) Update CI and suggest to use pip3 instead of pip (#2409) Expressions use keyword-only arguments for init (#2395) Use Slots on all Expression objects (#2394) Allow double-adding exact same config option (#2397) Don't run OSX tests on PR Attempt to Fix solc Installation MacOS (#2392) Syscall specific hooks (#2389) TUI Support Infrastructure (#1620) Fix coveralls upload (#2387) docs: fix simple typo, straigth -> straight (#2381) Attempt to allow symbolic balances from the start (#1818) Fix state.cpu.PC member (#1825) Bump black and mypy (#1824)
* master: (22 commits) Fix the generation of EVM tests (#2426) Disabled EVM events in testcases by default (#2417) added proper timeouts for cvc4 and boolector (#2418) Removed use of global solver from Native Memory (#2414) Support to use boolector as the SMT solver (#2410) Update CI and suggest to use pip3 instead of pip (#2409) Expressions use keyword-only arguments for init (#2395) Use Slots on all Expression objects (#2394) Allow double-adding exact same config option (#2397) Don't run OSX tests on PR Attempt to Fix solc Installation MacOS (#2392) Syscall specific hooks (#2389) TUI Support Infrastructure (#1620) Fix coveralls upload (#2387) docs: fix simple typo, straigth -> straight (#2381) Attempt to allow symbolic balances from the start (#1818) Fix state.cpu.PC member (#1825) Bump black and mypy (#1824) Manticore 0.3.5 (#1808) Fix yices timeout argument (#1817) ...
* master: (35 commits) Track last_pc in StateDescriptors (#2471) Expose Result Register for Native CPU (#2470) Install pinned version of truffle to fix CI (#2467) Use fixed owner and attacker accounts in multi_tx_analysis (#2464) Manticore 0.3.6 (#2456) Fix IntrospectionAPIPlugin Name (#2459) Portfolio of parallel solvers (#2420) Replace Quick mode with Thorough mode (#2457) Fix incorrect comparison for symbolic file wildcards (#2454) Reduce the number of calls to the SMT solver in EVM (#2411) Fixes to Unicorn emulation - start/stop/resume (#1796) Add support for multiple compilation units (#2444) Basic solver stats (#2415) Fix the generation of EVM tests (#2426) Disabled EVM events in testcases by default (#2417) added proper timeouts for cvc4 and boolector (#2418) Removed use of global solver from Native Memory (#2414) Support to use boolector as the SMT solver (#2410) Update CI and suggest to use pip3 instead of pip (#2409) Expressions use keyword-only arguments for init (#2395) ...
The Memory class had a global solver hard-coded that resulted in z3 (or the solver the user has installed) always used when a native binary was executed. This PR should fix that.