Skip to content

Commit 5d404e0

Browse files
authored
Rollup merge of #146740 - RalfJung:miri, r=RalfJung
miri subtree update Subtree update of `miri` to rust-lang/miri@5a14200. Created using https://github.com/rust-lang/josh-sync. r? ``@ghost``
2 parents a2c7008 + 1db74d4 commit 5d404e0

File tree

175 files changed

+7466
-1749
lines changed

Some content is hidden

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

175 files changed

+7466
-1749
lines changed

Cargo.lock

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ checksum = "fe6d2e5af09e8c8ad56c969f2157a3d4238cebc7c55f0a517728c38f7b200f81"
674674
dependencies = [
675675
"serde",
676676
"termcolor",
677-
"unicode-width 0.1.14",
677+
"unicode-width 0.2.1",
678678
]
679679

680680
[[package]]
@@ -937,23 +937,24 @@ dependencies = [
937937

938938
[[package]]
939939
name = "cxx"
940-
version = "1.0.168"
940+
version = "1.0.185"
941941
source = "registry+https://github.com/rust-lang/crates.io-index"
942-
checksum = "7aa144b12f11741f0dab5b4182896afad46faa0598b6a061f7b9d17a21837ba7"
942+
checksum = "2f81de88da10862f22b5b3a60f18f6f42bbe7cb8faa24845dd7b1e4e22190e77"
943943
dependencies = [
944944
"cc",
945+
"cxx-build",
945946
"cxxbridge-cmd",
946947
"cxxbridge-flags",
947948
"cxxbridge-macro",
948-
"foldhash",
949+
"foldhash 0.2.0",
949950
"link-cplusplus",
950951
]
951952

952953
[[package]]
953954
name = "cxx-build"
954-
version = "1.0.168"
955+
version = "1.0.185"
955956
source = "registry+https://github.com/rust-lang/crates.io-index"
956-
checksum = "12d3cbb84fb003242941c231b45ca9417e786e66e94baa39584bd99df3a270b6"
957+
checksum = "5edd58bf75c3fdfc80d79806403af626570662f7b6cc782a7fabe156166bd6d6"
957958
dependencies = [
958959
"cc",
959960
"codespan-reporting",
@@ -966,9 +967,9 @@ dependencies = [
966967

967968
[[package]]
968969
name = "cxxbridge-cmd"
969-
version = "1.0.168"
970+
version = "1.0.185"
970971
source = "registry+https://github.com/rust-lang/crates.io-index"
971-
checksum = "3fa36b7b249d43f67a3f54bd65788e35e7afe64bbc671396387a48b3e8aaea94"
972+
checksum = "fd46bf2b541a4e0c2d5abba76607379ee05d68e714868e3cb406dc8d591ce2d2"
972973
dependencies = [
973974
"clap",
974975
"codespan-reporting",
@@ -980,15 +981,15 @@ dependencies = [
980981

981982
[[package]]
982983
name = "cxxbridge-flags"
983-
version = "1.0.168"
984+
version = "1.0.185"
984985
source = "registry+https://github.com/rust-lang/crates.io-index"
985-
checksum = "77707c70f6563edc5429618ca34a07241b75ebab35bd01d46697c75d58f8ddfe"
986+
checksum = "2c79b68f6a3a8f809d39b38ae8af61305a6113819b19b262643b9c21353b92d9"
986987

987988
[[package]]
988989
name = "cxxbridge-macro"
989-
version = "1.0.168"
990+
version = "1.0.185"
990991
source = "registry+https://github.com/rust-lang/crates.io-index"
991-
checksum = "ede6c0fb7e318f0a11799b86ee29dcf17b9be2960bd379a6c38e1a96a6010fff"
992+
checksum = "862b7fdb048ff9ef0779a0d0a03affd09746c4c875543746b640756be9cff2af"
992993
dependencies = [
993994
"indexmap",
994995
"proc-macro2",
@@ -1388,6 +1389,12 @@ version = "0.1.5"
13881389
source = "registry+https://github.com/rust-lang/crates.io-index"
13891390
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
13901391

1392+
[[package]]
1393+
name = "foldhash"
1394+
version = "0.2.0"
1395+
source = "registry+https://github.com/rust-lang/crates.io-index"
1396+
checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
1397+
13911398
[[package]]
13921399
name = "form_urlencoded"
13931400
version = "1.2.1"
@@ -1567,7 +1574,7 @@ checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"
15671574
dependencies = [
15681575
"allocator-api2",
15691576
"equivalent",
1570-
"foldhash",
1577+
"foldhash 0.1.5",
15711578
"serde",
15721579
]
15731580

@@ -2160,9 +2167,9 @@ dependencies = [
21602167

21612168
[[package]]
21622169
name = "link-cplusplus"
2163-
version = "1.0.10"
2170+
version = "1.0.12"
21642171
source = "registry+https://github.com/rust-lang/crates.io-index"
2165-
checksum = "4a6f6da007f968f9def0d65a05b187e2960183de70c160204ecfccf0ee330212"
2172+
checksum = "7f78c730aaa7d0b9336a299029ea49f9ee53b0ed06e9202e8cb7db9bae7b8c82"
21662173
dependencies = [
21672174
"cc",
21682175
]

src/tools/miri/.github/workflows/ci.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,22 @@ jobs:
3131
os: ubuntu-24.04-arm
3232
multiarch: armhf
3333
gcc_cross: arm-linux-gnueabihf
34-
- host_target: riscv64gc-unknown-linux-gnu
35-
os: ubuntu-latest
36-
multiarch: riscv64
37-
gcc_cross: riscv64-linux-gnu
38-
qemu: true
39-
- host_target: s390x-unknown-linux-gnu
40-
os: ubuntu-latest
41-
multiarch: s390x
42-
gcc_cross: s390x-linux-gnu
43-
qemu: true
44-
- host_target: powerpc64le-unknown-linux-gnu
45-
os: ubuntu-latest
46-
multiarch: ppc64el
47-
gcc_cross: powerpc64le-linux-gnu
48-
qemu: true
34+
# Disabled due to Ubuntu repo trouble
35+
# - host_target: riscv64gc-unknown-linux-gnu
36+
# os: ubuntu-latest
37+
# multiarch: riscv64
38+
# gcc_cross: riscv64-linux-gnu
39+
# qemu: true
40+
# - host_target: s390x-unknown-linux-gnu
41+
# os: ubuntu-latest
42+
# multiarch: s390x
43+
# gcc_cross: s390x-linux-gnu
44+
# qemu: true
45+
# - host_target: powerpc64le-unknown-linux-gnu
46+
# os: ubuntu-latest
47+
# multiarch: ppc64el
48+
# gcc_cross: powerpc64le-linux-gnu
49+
# qemu: true
4950
- host_target: aarch64-apple-darwin
5051
os: macos-latest
5152
- host_target: i686-pc-windows-msvc
@@ -67,7 +68,7 @@ jobs:
6768
- name: install multiarch
6869
if: ${{ matrix.multiarch != '' }}
6970
run: |
70-
# s390x, ppc64el need Ubuntu Ports to be in the mirror list
71+
# s390x, ppc64el, riscv64 need Ubuntu Ports to be in the mirror list
7172
sudo bash -c "echo 'https://ports.ubuntu.com/ priority:4' >> /etc/apt/apt-mirrors.txt"
7273
# Add architecture
7374
sudo dpkg --add-architecture ${{ matrix.multiarch }}

src/tools/miri/Cargo.lock

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -363,9 +363,9 @@ dependencies = [
363363

364364
[[package]]
365365
name = "cxx"
366-
version = "1.0.161"
366+
version = "1.0.173"
367367
source = "registry+https://github.com/rust-lang/crates.io-index"
368-
checksum = "a3523cc02ad831111491dd64b27ad999f1ae189986728e477604e61b81f828df"
368+
checksum = "6c64ed3da1c337cbaae7223cdcff8b4dddf698d188cd3eaddd1116f6b0295950"
369369
dependencies = [
370370
"cc",
371371
"cxxbridge-cmd",
@@ -377,9 +377,9 @@ dependencies = [
377377

378378
[[package]]
379379
name = "cxx-build"
380-
version = "1.0.161"
380+
version = "1.0.173"
381381
source = "registry+https://github.com/rust-lang/crates.io-index"
382-
checksum = "212b754247a6f07b10fa626628c157593f0abf640a3dd04cce2760eca970f909"
382+
checksum = "ae0a26a75a05551f5ae3d75b3557543d06682284eaa7419113162d602cb45766"
383383
dependencies = [
384384
"cc",
385385
"codespan-reporting",
@@ -392,9 +392,9 @@ dependencies = [
392392

393393
[[package]]
394394
name = "cxxbridge-cmd"
395-
version = "1.0.161"
395+
version = "1.0.173"
396396
source = "registry+https://github.com/rust-lang/crates.io-index"
397-
checksum = "f426a20413ec2e742520ba6837c9324b55ffac24ead47491a6e29f933c5b135a"
397+
checksum = "952d408b6002b7db4b36da07c682a9cbb34f2db0efa03e976ae50a388414e16c"
398398
dependencies = [
399399
"clap",
400400
"codespan-reporting",
@@ -406,15 +406,15 @@ dependencies = [
406406

407407
[[package]]
408408
name = "cxxbridge-flags"
409-
version = "1.0.161"
409+
version = "1.0.173"
410410
source = "registry+https://github.com/rust-lang/crates.io-index"
411-
checksum = "a258b6069020b4e5da6415df94a50ee4f586a6c38b037a180e940a43d06a070d"
411+
checksum = "ccbd201b471c75c6abb6321cace706d1982d270e308b891c11a3262d320f5265"
412412

413413
[[package]]
414414
name = "cxxbridge-macro"
415-
version = "1.0.161"
415+
version = "1.0.173"
416416
source = "registry+https://github.com/rust-lang/crates.io-index"
417-
checksum = "e8dec184b52be5008d6eaf7e62fc1802caf1ad1227d11b3b7df2c409c7ffc3f4"
417+
checksum = "2bea8b915bbc4cb4288f242aa7ca18b23ecc6965e4d6e7c1b07905e3fe2e0c41"
418418
dependencies = [
419419
"indexmap",
420420
"proc-macro2",
@@ -501,9 +501,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"
501501

502502
[[package]]
503503
name = "foldhash"
504-
version = "0.1.5"
504+
version = "0.2.0"
505505
source = "registry+https://github.com/rust-lang/crates.io-index"
506-
checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"
506+
checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"
507507

508508
[[package]]
509509
name = "form_urlencoded"

src/tools/miri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ harness = false
7070

7171
[features]
7272
default = ["stack-cache", "native-lib"]
73-
genmc = ["dep:genmc-sys"] # this enables a GPL dependency!
73+
genmc = ["dep:genmc-sys"]
7474
stack-cache = []
7575
stack-cache-consistency-check = ["stack-cache"]
7676
tracing = ["serde_json"]

src/tools/miri/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ degree documented below):
220220
- `solaris` / `illumos`: maintained by @devnexen. Supports the entire test suite.
221221
- `freebsd`: maintained by @YohDeadfall and @LorrensP-2158466. Supports the entire test suite.
222222
- `android`: **maintainer wanted**. Support very incomplete, but a basic "hello world" works.
223-
- `wasi`: **maintainer wanted**. Support very incomplete, not even standard output works, but an empty `main` function works.
223+
- `wasi`: **maintainer wanted**. Support very incomplete, but a basic "hello world" works.
224224
- For targets on other operating systems, Miri might fail before even reaching the `main` function.
225225

226226
However, even for targets that we do support, the degree of support for accessing platform APIs

src/tools/miri/ci/ci.sh

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ function run_tests_minimal {
137137

138138
# In particular, fully cover all tier 1 targets.
139139
# We also want to run the many-seeds tests on all tier 1 targets.
140+
# We run GC_STRESS only once for each tier 1 OS.
140141
case $HOST_TARGET in
141142
x86_64-unknown-linux-gnu)
142143
# Host
@@ -147,29 +148,31 @@ case $HOST_TARGET in
147148
;;
148149
i686-unknown-linux-gnu)
149150
# Host
150-
# Without GC_STRESS as this is a slow runner.
151151
MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
152152
# Partially supported targets (tier 2)
153153
BASIC="empty_main integer heap_alloc libc-mem vec string btreemap" # ensures we have the basics: pre-main code, system allocator
154154
UNIX="hello panic/panic panic/unwind concurrency/simple atomic libc-mem libc-misc libc-random env num_cpus" # the things that are very similar across all Unixes, and hence easily supported there
155155
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX time hashmap random thread sync concurrency epoll eventfd
156-
TEST_TARGET=wasm32-wasip2 run_tests_minimal $BASIC wasm
156+
TEST_TARGET=wasm32-wasip2 run_tests_minimal $BASIC hello wasm
157157
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal no_std empty_main wasm # this target doesn't really have std
158158
TEST_TARGET=thumbv7em-none-eabihf run_tests_minimal no_std
159159
;;
160160
aarch64-unknown-linux-gnu)
161161
# Host
162-
GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
162+
MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
163163
# Extra tier 2
164164
MANY_SEEDS=16 TEST_TARGET=arm-unknown-linux-gnueabi run_tests # 32bit ARM
165165
MANY_SEEDS=16 TEST_TARGET=aarch64-pc-windows-gnullvm run_tests # gnullvm ABI
166166
MANY_SEEDS=16 TEST_TARGET=s390x-unknown-linux-gnu run_tests # big-endian architecture of choice
167-
# Custom target JSON file
168-
TEST_TARGET=tests/x86_64-unknown-kernel.json MIRI_NO_STD=1 run_tests_minimal no_std
167+
# Not officially supported tier 2
168+
MANY_SEEDS=16 TEST_TARGET=x86_64-unknown-freebsd run_tests
169+
MANY_SEEDS=16 TEST_TARGET=i686-unknown-freebsd run_tests
169170
;;
170171
armv7-unknown-linux-gnueabihf)
171172
# Host
172-
GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
173+
MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
174+
# Custom target JSON file
175+
TEST_TARGET=tests/x86_64-unknown-kernel.json MIRI_NO_STD=1 run_tests_minimal no_std
173176
;;
174177
aarch64-apple-darwin)
175178
# Host
@@ -181,12 +184,9 @@ case $HOST_TARGET in
181184
MANY_SEEDS=16 TEST_TARGET=mips-unknown-linux-gnu run_tests # a 32bit big-endian target, and also a target without 64bit atomics
182185
MANY_SEEDS=16 TEST_TARGET=x86_64-unknown-illumos run_tests
183186
MANY_SEEDS=16 TEST_TARGET=x86_64-pc-solaris run_tests
184-
MANY_SEEDS=16 TEST_TARGET=x86_64-unknown-freebsd run_tests
185-
MANY_SEEDS=16 TEST_TARGET=i686-unknown-freebsd run_tests
186187
;;
187188
i686-pc-windows-msvc)
188189
# Host
189-
# Without GC_STRESS as this is a very slow runner.
190190
MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 run_tests
191191
# Extra tier 1
192192
# We really want to ensure a Linux target works on a Windows host,
@@ -195,8 +195,7 @@ case $HOST_TARGET in
195195
;;
196196
aarch64-pc-windows-msvc)
197197
# Host
198-
# Without GC_STRESS as this is a very slow runner.
199-
MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
198+
GC_STRESS=1 MIR_OPT=1 MANY_SEEDS=64 TEST_BENCH=1 CARGO_MIRI_ENV=1 run_tests
200199
# Extra tier 1
201200
MANY_SEEDS=64 TEST_TARGET=i686-unknown-linux-gnu run_tests
202201
;;

src/tools/miri/doc/genmc.md

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ Miri-GenMC integrates that model checker into Miri.
99

1010
## Usage
1111

12-
**IMPORTANT: The license of GenMC and thus the `genmc-sys` crate in the Miri repo is currently "GPL-3.0-or-later", so a binary produced with the `genmc` feature is subject to the requirements of the GPL. As long as that remains the case, the `genmc` feature of Miri is OFF-BY-DEFAULT and must be OFF for all Miri releases.**
13-
14-
For testing/developing Miri-GenMC (while keeping in mind the licensing issues):
12+
For testing/developing Miri-GenMC:
1513
- clone the Miri repo.
1614
- build Miri-GenMC with `./miri build --features=genmc`.
1715
- OR: install Miri-GenMC in the current system with `./miri install --features=genmc`
@@ -21,7 +19,30 @@ Basic usage:
2119
MIRIFLAGS="-Zmiri-genmc" cargo miri run
2220
```
2321

24-
<!-- FIXME(genmc): explain options. -->
22+
Note that `cargo miri test` in GenMC mode is currently not supported.
23+
24+
### Supported Parameters
25+
26+
- `-Zmiri-genmc`: Enable GenMC mode (not required if any other GenMC options are used).
27+
- `-Zmiri-genmc-estimate`: This enables estimation of the concurrent execution space and verification time, before running the full verification. This should help users detect when their program is too complex to fully verify in a reasonable time. This will explore enough executions to make a good estimation, but at least 10 and at most `estimation-max` executions.
28+
- `-Zmiri-genmc-estimation-max={MAX_ITERATIONS}`: Set the maximum number of executions that will be explored during estimation (default: 1000).
29+
- `-Zmiri-genmc-print-exec-graphs={none,explored,blocked,all}`: Make GenMC print the execution graph of the program after every explored, every blocked, or after every execution (default: None).
30+
- `-Zmiri-genmc-print-exec-graphs`: Shorthand for suffix `=explored`.
31+
- `-Zmiri-genmc-print-genmc-output`: Print the output that GenMC provides. NOTE: this output is quite verbose and the events in the printed execution graph are hard to map back to the Rust code location they originate from.
32+
- `-Zmiri-genmc-log=LOG_LEVEL`: Change the log level for GenMC. Default: `warning`.
33+
- `quiet`: Disable logging.
34+
- `error`: Print errors.
35+
- `warning`: Print errors and warnings.
36+
- `tip`: Print errors, warnings and tips.
37+
- If Miri is built with debug assertions, there are additional log levels available (downgraded to `tip` without debug assertions):
38+
- `debug1`: Print revisits considered by GenMC.
39+
- `debug2`: Print the execution graph after every memory access.
40+
- `debug3`: Print reads-from values considered by GenMC.
41+
- `-Zmiri-genmc-verbose`: Show more information, such as estimated number of executions, and time taken for verification.
42+
43+
#### Regular Miri parameters useful for GenMC mode
44+
45+
- `-Zmiri-disable-weak-memory-emulation`: Disable any weak memory effects (effectively upgrading all atomic orderings in the program to `SeqCst`). This option may reduce the number of explored program executions, but any bugs related to weak memory effects will be missed. This option can help determine if an error is caused by weak memory effects (i.e., if it disappears with this option enabled).
2546

2647
<!-- FIXME(genmc): explain Miri-GenMC specific functions. -->
2748

@@ -57,6 +78,15 @@ The process for obtaining them is as follows:
5778
If you place this directory inside the Miri folder, it is recommended to call it `genmc-src` as that tells `./miri fmt` to avoid
5879
formatting the Rust files inside that folder.
5980

81+
### Formatting the C++ code
82+
83+
For formatting the C++ code we provide a `.clang-format` file in the `genmc-sys` directory.
84+
With `clang-format` installed, run this command to format the c++ files (replace the `-i` with `--dry-run` to just see the changes.):
85+
```
86+
find ./genmc-sys/cpp/ -name "*.cpp" -o -name "*.hpp" | xargs clang-format --style=file:"./genmc-sys/.clang-format" -i
87+
```
88+
NOTE: this is currently not done automatically on pull requests to Miri.
89+
6090
<!-- FIXME(genmc): explain how submitting code to GenMC should be handled. -->
6191

6292
<!-- FIXME(genmc): explain development. -->

0 commit comments

Comments
 (0)