Skip to content

Commit f3b9234

Browse files
committed
Merge branch 'master' into capstone-5-dev
* 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) ...
2 parents 9405a92 + 7144c73 commit f3b9234

79 files changed

Lines changed: 18508 additions & 15966 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
jobs:
1313
# needs to run only on pull_request
1414
lint:
15-
runs-on: ubuntu-latest
15+
runs-on: ubuntu-18.04
1616
steps:
1717
- uses: actions/checkout@v2
1818
- name: Set up Python 3.6
@@ -39,7 +39,7 @@ jobs:
3939
mypy --version
4040
mypy
4141
tests:
42-
runs-on: ubuntu-latest
42+
runs-on: ubuntu-18.04
4343
strategy:
4444
matrix:
4545
type: ["ethereum_truffle", "ethereum_bench", "examples", "ethereum", "ethereum_vm", "native", "wasm", "wasm_sym", "other"]
@@ -57,18 +57,34 @@ jobs:
5757
env:
5858
TEST_TYPE: ${{ matrix.type }}
5959
run: |
60+
#install utils
61+
pip install coveralls
62+
pip install -e ".[dev-noks]"
6063
#install cvc4
6164
sudo wget -O /usr/bin/cvc4 https://github.com/CVC4/CVC4/releases/download/1.7/cvc4-1.7-x86_64-linux-opt
6265
sudo chmod +x /usr/bin/cvc4
6366
#install yices
6467
sudo add-apt-repository ppa:sri-csl/formal-methods
6568
sudo apt-get update
6669
sudo apt-get install yices2
70+
#install boolector
71+
mkdir -p /tmp/build
72+
cd /tmp/build
73+
git clone https://github.com/boolector/boolector.git
74+
cd boolector
75+
# Version 3.2.1
76+
git checkout "f61c0dcf4a76e2f7766a6358bfb9c16ca8217224"
77+
git log -1 --oneline > ../boolector.commit
78+
./contrib/setup-lingeling.sh
79+
./contrib/setup-btor2tools.sh
80+
./configure.sh
81+
cd build
82+
make -j4
83+
mkdir -p /tmp/boolector
84+
sudo make DESTDIR=/usr install
6785
# Install solc unconditionally because it only takes a second or two
6886
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.4.24/solc-static-linux
6987
sudo chmod +x /usr/bin/solc
70-
pip install coveralls
71-
pip install -e ".[dev-noks]"
7288
- name: Run Tests
7389
env:
7490
TEST_TYPE: ${{ matrix.type }}
@@ -77,22 +93,22 @@ jobs:
7793
./run_tests.sh
7894
- name: Coveralls Parallel
7995
run: |
80-
coveralls
96+
coveralls --service=github
8197
env:
8298
COVERALLS_PARALLEL: true
8399
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84100
# Send notification when all tests have finished to combine coverage results
85101
coverage-finish:
86102
needs: tests
87-
runs-on: ubuntu-latest
103+
runs-on: ubuntu-18.04
88104
steps:
89105
- name: Coveralls Finished
90-
uses: coverallsapp/github-action@v1.1.1
106+
uses: coverallsapp/github-action@v1.1.2
91107
with:
92108
github-token: ${{ secrets.GITHUB_TOKEN }}
93109
parallel-finished: true
94110
upload:
95-
runs-on: ubuntu-latest
111+
runs-on: ubuntu-18.04
96112
if: github.event_name == 'schedule'
97113
needs: tests
98114
steps:

.github/workflows/osx.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ jobs:
3131
- name: Install Mac Dependencies
3232
run: |
3333
brew install bash
34-
brew tap ethereum/ethereum
35-
brew install solidity@4
3634
brew install wabt
3735
brew install SRI-CSL/sri-csl/yices2
3836
brew tap cvc4/cvc4
3937
brew install cvc4/cvc4/cvc4
38+
pip install solc-select
39+
solc-select install 0.4.26
40+
solc-select use 0.4.26
4041
- name: Run Tests
4142
env:
4243
TEST_TYPE: ${{ matrix.type }}

.github/workflows/release.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Upload to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
tests:
9+
runs-on: ubuntu-18.04
10+
strategy:
11+
matrix:
12+
type: ["ethereum_truffle", "ethereum_bench", "examples", "ethereum", "ethereum_vm", "native", "wasm", "wasm_sym", "other"]
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Set up Python 3.6
16+
uses: actions/setup-python@v1
17+
with:
18+
python-version: 3.6
19+
- name: Install NPM
20+
uses: actions/setup-node@v1
21+
with:
22+
node-version: '13.x'
23+
- name: Install dependencies
24+
env:
25+
TEST_TYPE: ${{ matrix.type }}
26+
run: |
27+
#install utils
28+
pip install coveralls
29+
pip install -e ".[dev-noks]"
30+
#install cvc4
31+
sudo wget -O /usr/bin/cvc4 https://github.com/CVC4/CVC4/releases/download/1.7/cvc4-1.7-x86_64-linux-opt
32+
sudo chmod +x /usr/bin/cvc4
33+
#install yices
34+
sudo add-apt-repository ppa:sri-csl/formal-methods
35+
sudo apt-get update
36+
sudo apt-get install yices2
37+
#install boolector
38+
mkdir -p /tmp/build
39+
cd /tmp/build
40+
git clone https://github.com/boolector/boolector.git
41+
cd boolector
42+
# Version 3.2.1
43+
git checkout "f61c0dcf4a76e2f7766a6358bfb9c16ca8217224"
44+
git log -1 --oneline > ../boolector.commit
45+
./contrib/setup-lingeling.sh
46+
./contrib/setup-btor2tools.sh
47+
./configure.sh
48+
cd build
49+
make -j4
50+
mkdir -p /tmp/boolector
51+
sudo make DESTDIR=/usr install
52+
# Install solc unconditionally because it only takes a second or two
53+
sudo wget -O /usr/bin/solc https://github.com/ethereum/solidity/releases/download/v0.4.24/solc-static-linux
54+
sudo chmod +x /usr/bin/solc
55+
- name: Run Tests
56+
env:
57+
TEST_TYPE: ${{ matrix.type }}
58+
run: |
59+
cp scripts/run_tests.sh .
60+
./run_tests.sh
61+
62+
upload:
63+
runs-on: ubuntu-18.04
64+
needs: tests
65+
steps:
66+
- uses: actions/checkout@v2
67+
- name: Set up Python 3.6
68+
uses: actions/setup-python@v1
69+
with:
70+
python-version: 3.6
71+
- name: Build Dist
72+
run: |
73+
python3 -m pip install wheel
74+
python3 setup.py sdist bdist_wheel
75+
- name: Upload to PyPI
76+
uses: pypa/gh-action-pypi-publish@v1.2.2
77+
with:
78+
password: ${{ secrets.PYPI_UPLOAD }}

CHANGELOG.md

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,61 @@
11
# Change Log
22

3-
## [Unreleased](https://github.com/trailofbits/manticore/compare/0.3.4...HEAD)
3+
## [Unreleased](https://github.com/trailofbits/manticore/compare/0.3.6...HEAD)
4+
5+
## 0.3.6 - 2021-06-09
6+
7+
Thanks to our external contributors!
8+
- [timgates42](https://github.com/trailofbits/manticore/commits?author=timgates42)
9+
10+
### Ethereum
11+
* **[Changed API]** Default to quick mode: disable detectors and gas [#2457](https://github.com/trailofbits/manticore/pull/2457)
12+
* Allow symbolic balances from the beginning of execution [#1818](https://github.com/trailofbits/manticore/pull/1818)
13+
* Disable EVM Events in Testcases [#2417](https://github.com/trailofbits/manticore/pull/2417)
14+
15+
### Native
16+
* **[Added API]** Syscall-specific hooks [#2389](https://github.com/trailofbits/manticore/pull/2389)
17+
* Fix wildcard behavior in symbolic files [#2454](https://github.com/trailofbits/manticore/pull/2454)
18+
* Bugfixes for control transfer between Manticore & Unicorn [#1796](https://github.com/trailofbits/manticore/pull/1796)
19+
20+
### Other
21+
* Run multiple SMT solvers in parallel, take the fastest response [#2420](https://github.com/trailofbits/manticore/pull/2420)
22+
* Add socket for TUI [#1620](https://github.com/trailofbits/manticore/pull/1620)
23+
* Memory usage improvements in expression system [#2394](https://github.com/trailofbits/manticore/pull/2394)
24+
* Support for Boolector [#2410](https://github.com/trailofbits/manticore/pull/2410)
25+
* Solver Statistics API [#2415](https://github.com/trailofbits/manticore/pull/2415)
26+
* Allow duplicated config options [#2397](https://github.com/trailofbits/manticore/pull/2397)
27+
28+
29+
## 0.3.5 - 2020-11-06
30+
31+
Thanks to our external contributors!
32+
- [wolfo](https://github.com/trailofbits/manticore/commits?author=wolfo)
33+
- [geohot](https://github.com/trailofbits/manticore/commits?author=geohot)
34+
- [romits800](https://github.com/trailofbits/manticore/commits?author=romits800)
35+
36+
### Ethereum
37+
* Made EVM module ignore runtime gas calculations by default [#1816](https://github.com/trailofbits/manticore/pull/1816)
38+
* Updated gas calculations for calls to empty accounts [#1774](https://github.com/trailofbits/manticore/pull/1774)
39+
* Fixed account existence checks for `selfdestruct` and `call` [#1801](https://github.com/trailofbits/manticore/pull/1801)
40+
41+
### Native
42+
* **[Added API]** new `strlen` models [#1725](https://github.com/trailofbits/manticore/pull/1725)
43+
* **[Added API]** State-specific hooks [#1777](https://github.com/trailofbits/manticore/pull/1777)
44+
* Improved system call argument handling [#1785](https://github.com/trailofbits/manticore/pull/1785)
45+
* Improved `stat` support for file descriptors [#1780](https://github.com/trailofbits/manticore/pull/1780)
46+
* Support symbolic-length reads from sockets [#1786](https://github.com/trailofbits/manticore/pull/1786)
47+
* Add stubs for `sendto` [#1791](https://github.com/trailofbits/manticore/pull/1791)
48+
49+
### WASM
50+
* Fix type confusion when importing external functions [#1803](https://github.com/trailofbits/manticore/pull/1803)
51+
52+
### Other
53+
* Made [Yices2](https://yices.csl.sri.com/) the default SMT Solver [#1820](https://github.com/trailofbits/manticore/pull/1820)
54+
* **[Added API]** Added an API for introspecting live states [#1775](https://github.com/trailofbits/manticore/pull/1775)
55+
* Changed default multiprocessing type to threading [#1779](https://github.com/trailofbits/manticore/pull/1779)
56+
* Improved array serialization performance [#1756](https://github.com/trailofbits/manticore/pull/1756)
57+
* Fix name collisions in SMT variables [#1792](https://github.com/trailofbits/manticore/pull/1792)
58+
459

560
## 0.3.4 - 2020-06-26
661

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ Option 2: Installing from PyPI, with extra dependencies needed to execute native
4646
pip install "manticore[native]"
4747
```
4848

49-
Option 3: Installing a nightly development build (fill in the latest version from [the PyPI history](https://pypi.org/project/manticore/#history)):
49+
Option 3: Installing a nightly development build:
5050

5151
```bash
52-
pip install "manticore[native]==0.x.x.devYYMMDD"
52+
pip install --pre "manticore[native]"
5353
```
5454

5555
Option 4: Installing from the `master` branch:
@@ -229,10 +229,10 @@ for idx, val_list in enumerate(m.collect_returns()):
229229
* We're still in the process of implementing full support for the EVM Istanbul instruction semantics, so certain opcodes may not be supported.
230230
In a pinch, you can try compiling with Solidity 0.4.x to avoid generating those instructions.
231231

232-
## Using a different solver (Z3, Yices, CVC4)
232+
## Using a different solver (Yices, Z3, CVC4)
233233
Manticore relies on an external solver supporting smtlib2. Currently Z3, Yices and CVC4 are supported and can be selected via commandline or configuration settings.
234-
By default Manticore will use Z3. Once you've installed a different solver, you can choose which one to use like this:
235-
```manticore --smt.solver yices```
234+
If Yices is available, Manticore will use it by default. If not, it will fall back to Z3 or CVC4. If you want to manually choose which solver to use, you can do so like this:
235+
```manticore --smt.solver Z3```
236236
### Installing CVC4
237237
For more details go to https://cvc4.github.io/. Otherwise just get the binary and use it.
238238

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@
5454
# built documents.
5555
#
5656
# The short X.Y version.
57-
version = "0.3.4"
57+
version = "0.3.6"
5858
# The full version, including alpha/beta/rc tags.
59-
release = "0.3.4"
59+
release = "0.3.6"
6060

6161
# The language for content autogenerated by Sphinx. Refer to documentation
6262
# for a list of supported languages.

examples/evm/minimal.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
}
2525
}
2626
"""
27-
28-
user_account = m.create_account(balance=1000, name="user_account")
27+
user_account = m.create_account(balance=m.make_symbolic_value(), name="user_account")
2928
print("[+] Creating a user account", user_account.name_)
3029

3130
contract_account = m.solidity_create_contract(

examples/linux/introspect_state.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@
99
description="Explore a binary with Manticore and print the tree of states"
1010
)
1111
parser.add_argument(
12-
"binary", type=str, nargs="?", default="binaries/multiple-styles", help="The program to run",
12+
"binary",
13+
type=str,
14+
nargs="?",
15+
default="binaries/multiple-styles",
16+
help="The program to run",
1317
)
1418
args = parser.parse_args()
1519

examples/script/concolic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def eq(a, b):
109109

110110

111111
def perm(lst, func):
112-
""" Produce permutations of `lst`, where permutations are mutated by `func`. Used for flipping constraints. highly
112+
"""Produce permutations of `lst`, where permutations are mutated by `func`. Used for flipping constraints. highly
113113
possible that returned constraints can be unsat this does it blindly, without any attention to the constraints
114114
themselves
115115

examples/script/symbolic_file.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env python
2+
3+
"""
4+
Example to show usage of introducing a file with symbolic contents
5+
6+
This script should be the equivalent of:
7+
$ echo "+++++++++++++" > symbolic_file.txt
8+
$ manticore -v --file symbolic_file.txt ../linux/fileio symbolic_file.txt
9+
"""
10+
import copy
11+
import glob
12+
import os
13+
import pathlib
14+
import sys
15+
import tempfile
16+
17+
from manticore.__main__ import main
18+
19+
20+
def test_symbolic_file(tmp_path):
21+
# Run this file with Manticore
22+
filepath = pathlib.Path(__file__).resolve().parent.parent / pathlib.Path("linux/fileio")
23+
assert filepath.exists(), f"Please run the Makefile in {filepath.parent} to build {filepath}"
24+
25+
# Temporary workspace for Manticore
26+
workspace_dir = tmp_path / "mcore_workspace"
27+
workspace_dir.mkdir(parents=True, exist_ok=True)
28+
assert (
29+
len(os.listdir(workspace_dir)) == 0
30+
), f"Manticore workspace {workspace_dir} should be empty before running"
31+
32+
# Manticore will search for and read this partially symbolic file
33+
sym_file_name = "symbolic_file.txt"
34+
sym_file = tmp_path / sym_file_name
35+
sym_file.write_text("+++++++++++++")
36+
37+
# Program arguments that would be passed to Manticore via CLI
38+
manticore_args = [
39+
# Show some progress
40+
"-v",
41+
# Register our symbolic file with Manticore
42+
"--file",
43+
str(sym_file),
44+
# Setup workspace, for this test, or omit to use current directory
45+
"--workspace",
46+
str(workspace_dir),
47+
# Manticore will execute our file here with arguments
48+
str(filepath),
49+
str(sym_file),
50+
]
51+
52+
# Bad hack to workaround passing the above arguments like we do on command
53+
# line and have them parsed with argparse
54+
backup_argv = copy.deepcopy(sys.argv[1:])
55+
del sys.argv[1:]
56+
sys.argv.extend(manticore_args)
57+
58+
# Call Manticore's main with our new argv list for argparse
59+
main()
60+
61+
del sys.argv[1:]
62+
sys.argv.extend(backup_argv)
63+
64+
# Manticore will write out the concretized contents of our symbolic file for
65+
# each path in the program
66+
all_concretized_sym_files = glob.glob(str(workspace_dir / f"*{sym_file_name}"))
67+
assert (
68+
len(all_concretized_sym_files) > 1
69+
), "Should have found more than 1 path through the program"
70+
assert any(
71+
map(lambda f: b"open sesame" in pathlib.Path(f).read_bytes(), all_concretized_sym_files)
72+
), "Could not find 'open sesame' in our concretized symbolic file"
73+
74+
75+
if __name__ == "__main__":
76+
with tempfile.TemporaryDirectory() as workspace:
77+
test_symbolic_file(pathlib.Path(workspace))

0 commit comments

Comments
 (0)