Skip to content

Miri subtree update #129230

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

Merged
merged 85 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
2c166f4
Make unused states of Reserved unrepresentable
Vanille-N Jul 18, 2024
2431949
Preparing for merge from rustc
Aug 6, 2024
ac3e349
Merge from rustc
Aug 6, 2024
5b2cdc1
Auto merge of #3791 - rust-lang:rustup-2024-08-06, r=RalfJung
bors Aug 6, 2024
7d066c4
add return-place-protection tail-call test, and fix previous test
RalfJung Aug 6, 2024
c755314
Auto merge of #3792 - RalfJung:test-typo, r=RalfJung
bors Aug 6, 2024
0475bdd
Preparing for merge from rustc
Aug 7, 2024
630ad88
Merge from rustc
Aug 7, 2024
384f858
Auto merge of #3793 - rust-lang:rustup-2024-08-07, r=RalfJung
bors Aug 7, 2024
deeccf9
remove some SSE/SSE2 intrinsics that are no longer used by stdarch
RalfJung Jul 13, 2024
2f405eb
Auto merge of #3747 - RalfJung:sse-cleanup, r=RalfJung
bors Aug 7, 2024
d480954
allow all code to call getuid()
RalfJung Aug 7, 2024
dc9f4e8
Auto merge of #3794 - RalfJung:getuid, r=RalfJung
bors Aug 7, 2024
21f9175
Don't panic on `miri_print_borrow_state()` under `-Zmiri-disable-stac…
zachs18 Aug 8, 2024
6552a82
throw_unsup_format for alignment greater than 2^29 and refactor non-p…
tiif Aug 9, 2024
dc54f1d
miri_print_borrow_state: show error when AllocId is invalid
RalfJung Aug 9, 2024
d36e157
Auto merge of #3797 - zachs18:no-borrow-no-panic, r=RalfJung
bors Aug 9, 2024
bb04eab
Auto merge of #3795 - tiif:ice-layout-limit, r=RalfJung
bors Aug 10, 2024
f7c938a
miri-script: use --remap-path-prefix to print errors relative to the …
RalfJung Aug 9, 2024
d2e0970
update suggested RA config; the './miri cargo' command is not needed …
RalfJung Aug 9, 2024
118be41
add './miri doc' command
RalfJung Aug 9, 2024
8197f07
miri-script: pass around the relative crate dir, not the absolute pat…
RalfJung Aug 10, 2024
feab324
CI: we now need the nightly toolchain as well
RalfJung Aug 10, 2024
1156d58
josh: wait until the socket is ready
RalfJung Aug 10, 2024
3456432
Auto merge of #3799 - RalfJung:josh-wait, r=RalfJung
bors Aug 10, 2024
2b83935
josh-proxy: fix wait-for-josh logic
RalfJung Aug 12, 2024
3652011
Preparing for merge from rustc
RalfJung Aug 12, 2024
c0c6f28
Merge from rustc
RalfJung Aug 12, 2024
7383401
clippy fix
RalfJung Aug 12, 2024
14f9284
fix tree borrows Unique test
RalfJung Aug 12, 2024
a25ec22
Auto merge of #3801 - RalfJung:rustup, r=RalfJung
bors Aug 12, 2024
dd600ef
Auto merge of #3798 - RalfJung:miri-script-remap-path-prefix, r=saethlin
bors Aug 12, 2024
10cb5aa
borrow_tracker: update comments regarding protectors
RalfJung Aug 13, 2024
7db942b
remove the concept of a Call ID
RalfJung Aug 13, 2024
6ff09af
Auto merge of #3802 - RalfJung:no-more-call-id, r=RalfJung
bors Aug 13, 2024
ef91e65
Preparing for merge from rustc
RalfJung Aug 14, 2024
b65cdff
Merge from rustc
RalfJung Aug 14, 2024
c964938
fmt
RalfJung Aug 14, 2024
db3f921
CI: need nightly toolchain for auto-rustup PR
RalfJung Aug 14, 2024
f25ca7e
Auto merge of #3803 - RalfJung:rustup, r=RalfJung
bors Aug 14, 2024
607c4f5
Implement epoll shim
tiif Aug 14, 2024
86783be
Auto merge of #3712 - tiif:feat/epoll, r=oli-obk
bors Aug 14, 2024
293be46
add 'project' process guidlines for larger contributions
RalfJung Aug 15, 2024
17cfbc6
FD: remove big surrounding RefCell, simplify socketpair
RalfJung Aug 16, 2024
82c39ff
buf_has_writer is not needed any more
RalfJung Aug 16, 2024
34aec7c
make ecx.check_and_update_readiness a truly private helper function
RalfJung Aug 16, 2024
b4ab820
epoll test cleanup
RalfJung Aug 16, 2024
edd1efb
comment and test regarding notifications on writes that dont change r…
RalfJung Aug 16, 2024
9184eb5
more epoll test cleanup
RalfJung Aug 16, 2024
883e477
explain the behavior on closed peers
RalfJung Aug 16, 2024
1a51dd9
Auto merge of #3754 - Vanille-N:master, r=RalfJung
bors Aug 16, 2024
83f1b38
Auto merge of #3809 - RalfJung:fd-refcell, r=oli-obk
bors Aug 16, 2024
0951107
Add epoll EPOLLHUP flag support
tiif Aug 16, 2024
f9a7d6e
Move epoll_ready_events.epollhup = true up
tiif Aug 17, 2024
23b57e8
Preparing for merge from rustc
Aug 17, 2024
dc0faec
Merge from rustc
Aug 17, 2024
94e57fc
Auto merge of #3807 - RalfJung:projects, r=oli-obk
bors Aug 17, 2024
cab81d3
extend comments on HUP vs RDHUP
RalfJung Aug 17, 2024
78dfb8a
Auto merge of #3814 - tiif:epollhup, r=RalfJung
bors Aug 17, 2024
99d742e
implement pipe and pipe2
RalfJung Aug 16, 2024
5402be8
socketpair: test behavior when one end got closed
RalfJung Aug 17, 2024
5d59bde
test cleanup
RalfJung Aug 17, 2024
02a1166
SocketPair -> AnonSocket, because a single FD is not a pair
RalfJung Aug 17, 2024
db9a97f
Auto merge of #3817 - rust-lang:rustup-2024-08-17, r=RalfJung
bors Aug 17, 2024
465df56
epoll test: further clean up check_epoll_wait
RalfJung Aug 17, 2024
a4222b9
Auto merge of #3815 - RalfJung:pipe, r=RalfJung
bors Aug 17, 2024
0058752
Auto merge of #3819 - RalfJung:epoll-test, r=RalfJung
bors Aug 17, 2024
34e8245
tls_leak_main_thread_allowed: make test check target_thread_local
RalfJung Aug 17, 2024
bd4ef64
run TLS tests on Solarish
RalfJung Aug 17, 2024
3e698d0
Auto merge of #3822 - RalfJung:tls, r=RalfJung
bors Aug 17, 2024
7c81120
simplify synchronization object creation logic
RalfJung Aug 17, 2024
6ac5bbb
Auto merge of #3823 - RalfJung:sync, r=RalfJung
bors Aug 17, 2024
56eee8e
Apply test fix
tiif Aug 16, 2024
8821108
Auto merge of #3813 - tiif:epollfix, r=RalfJung
bors Aug 17, 2024
c0e799d
Set EINVAL for epoll_wait maxevent value 0
tiif Aug 17, 2024
8ae118d
Move the maxevents.try_into().unwrap() after value check
tiif Aug 18, 2024
f918de8
make sure we read all arguments before returning early
RalfJung Aug 18, 2024
aea3cfd
Auto merge of #3824 - tiif:maxeventeinval, r=RalfJung
bors Aug 18, 2024
e614d7d
epoll test_socketpair_read: explicitly check real and Miri behavior
RalfJung Aug 18, 2024
8f2768b
Auto merge of #3825 - RalfJung:epoll-miri, r=RalfJung
bors Aug 18, 2024
6702f15
epoll: iterate through output buffer then fetch an event from ready list
tiif Aug 17, 2024
9370020
Auto merge of #3818 - tiif:loseevents, r=RalfJung
bors Aug 18, 2024
483120d
Add EPOLLER support
tiif Aug 17, 2024
c74ffd8
Auto merge of #3820 - tiif:epoller, r=RalfJung
bors Aug 18, 2024
0708b28
fix build with bootstrap compiler
RalfJung Aug 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/tools/miri/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[unstable]
profile-rustflags = true

# Add back the containing directory of the packages we have to refer to using --manifest-path.
# Per-package profiles avoid adding this to build dependencies.
[profile.dev.package."cargo-miri"]
rustflags = ["--remap-path-prefix", "=cargo-miri"]
[profile.dev.package."miri-script"]
rustflags = ["--remap-path-prefix", "=miri-script"]
4 changes: 3 additions & 1 deletion src/tools/miri/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: clippy (all features)
run: ./miri clippy --all-features -- -D warnings
- name: rustdoc
run: RUSTDOCFLAGS="-Dwarnings" ./miri cargo doc --document-private-items
run: RUSTDOCFLAGS="-Dwarnings" ./miri doc --document-private-items

# These jobs doesn't actually test anything, but they're only used to tell
# bors the build completed, as there is no practical way to detect when a
Expand Down Expand Up @@ -123,6 +123,8 @@ jobs:
run: |
git config --global user.name 'The Miri Cronjob Bot'
git config --global user.email 'miri@cron.bot'
- name: Install nightly toolchain
run: rustup toolchain install nightly --profile minimal
- name: get changes from rustc
run: ./miri rustc-pull
- name: Install rustup-toolchain-install-master
Expand Down
4 changes: 4 additions & 0 deletions src/tools/miri/.github/workflows/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ runs:
run: cargo install -f rustup-toolchain-install-master hyperfine
shell: bash

- name: Install nightly toolchain
run: rustup toolchain install nightly --profile minimal
shell: bash

- name: Install "master" toolchain
run: |
if [[ ${{ github.event_name }} == 'schedule' ]]; then
Expand Down
44 changes: 39 additions & 5 deletions src/tools/miri/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,43 @@ find useful.
Check out the issues on this GitHub repository for some ideas. In particular,
look for the green `E-*` labels which mark issues that should be rather
well-suited for onboarding. For more ideas or help with hacking on Miri, you can
contact us (`oli-obk` and `RalfJ`) on the [Rust Zulip].
contact us on the [Rust Zulip]. See the [Rust website](https://www.rust-lang.org/governance/teams/compiler#team-miri)
for a list of Miri maintainers.

[Rust Zulip]: https://rust-lang.zulipchat.com

### Larger-scale contributions

If you are thinking about making a larger-scale contribution -- in particular anything that needs
more than can reasonably fit in a single PR to be feature-complete -- then please talk to us before
writing significant amounts of code. Generally, we will ask that you follow a three-step "project"
process for such contributions:

1. Clearly define the **goal** of the project. This defines the scope of the project, i.e. which
part of which APIs should be supported. If this involves functions that expose a big API surface
with lots of flags, the project may want to support only a tiny subset of flags; that should be
documented. A good way to express the goal is with one or more test cases that Miri should be
able to successfully execute when the project is completed. It is a good idea to get feedback
from team members already at this stage to ensure that the project is reasonably scoped and
aligns with our interests.
2. Make a **design** for how to realize the goal. A larger project will likely have to do global
changes to Miri, like adding new global state to the `Machine` type or new methods to the
`FileDescription` trait. Often we have to iterate on those changes, which can quite substantially
change how the final implementation looks like.

The design should be reasonably concrete, i.e. for new global state or methods the corresponding
Rust types and method signatures should be spelled out. We realize that it can be hard to make a
design without doing implementation work, in particular if you are not yet familiar with the
codebase. Doing draft implementations in phase 2 of this process is perfectly fine, just please
be aware that we might request fundamental changes that can require significantly reworking what
you already did. If you open a PR in this stage, please clearly indicate that this project is
still in the design stage.

3. Finish the **implementation** and have it reviewed.

This process is largely informal, and its primary goal is to more clearly communicate expectations.
Please get in touch with us if you have any questions!

## Preparing the build environment

Miri heavily relies on internal and unstable rustc interfaces to execute MIR,
Expand Down Expand Up @@ -173,24 +206,24 @@ to `.vscode/settings.json` in your local Miri clone:
"cargo-miri/Cargo.toml",
"miri-script/Cargo.toml",
],
"rust-analyzer.check.invocationLocation": "root",
"rust-analyzer.check.invocationStrategy": "once",
"rust-analyzer.check.overrideCommand": [
"env",
"MIRI_AUTO_OPS=no",
"./miri",
"cargo",
"clippy", // make this `check` when working with a locally built rustc
"--message-format=json",
"--all-targets",
],
// Contrary to what the name suggests, this also affects proc macros.
"rust-analyzer.cargo.buildScripts.invocationLocation": "root",
"rust-analyzer.cargo.buildScripts.invocationStrategy": "once",
"rust-analyzer.cargo.buildScripts.overrideCommand": [
"env",
"MIRI_AUTO_OPS=no",
"./miri",
"cargo",
"check",
"--message-format=json",
"--all-targets",
],
}
```
Expand Down Expand Up @@ -309,6 +342,7 @@ anyone but Miri itself. They are used to communicate between different Miri
binaries, and as such worth documenting:

* `CARGO_EXTRA_FLAGS` is understood by `./miri` and passed to all host cargo invocations.
It is reserved for CI usage; setting the wrong flags this way can easily confuse the script.
* `MIRI_BE_RUSTC` can be set to `host` or `target`. It tells the Miri driver to
actually not interpret the code but compile it like rustc would. With `target`, Miri sets
some compiler flags to prepare the code for interpretation; with `host`, this is not done.
Expand Down
4 changes: 0 additions & 4 deletions src/tools/miri/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -414,10 +414,6 @@ to Miri failing to detect cases of undefined behavior in a program.
being allocated or freed. This helps in debugging memory leaks and
use after free bugs. Specifying this argument multiple times does not overwrite the previous
values, instead it appends its values to the list. Listing an id multiple times has no effect.
* `-Zmiri-track-call-id=<id1>,<id2>,...` shows a backtrace when the given call ids are
assigned to a stack frame. This helps in debugging UB related to Stacked
Borrows "protectors". Specifying this argument multiple times does not overwrite the previous
values, instead it appends its values to the list. Listing an id multiple times has no effect.
* `-Zmiri-track-pointer-tag=<tag1>,<tag2>,...` shows a backtrace when a given pointer tag
is created and when (if ever) it is popped from a borrow stack (which is where the tag becomes invalid
and any future use of it will error). This helps you in finding out why UB is
Expand Down
4 changes: 0 additions & 4 deletions src/tools/miri/cargo-miri/miri

This file was deleted.

7 changes: 2 additions & 5 deletions src/tools/miri/cargo-miri/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,9 @@ pub fn find_miri() -> PathBuf {
if let Some(path) = env::var_os("MIRI") {
return path.into();
}
// Assume it is in the same directory as ourselves.
let mut path = std::env::current_exe().expect("current executable path invalid");
if cfg!(windows) {
path.set_file_name("miri.exe");
} else {
path.set_file_name("miri");
}
path.set_file_name(format!("miri{}", env::consts::EXE_SUFFIX));
path
}

Expand Down
4 changes: 2 additions & 2 deletions src/tools/miri/ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ case $HOST_TARGET in
UNIX="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
TEST_TARGET=x86_64-unknown-freebsd run_tests_minimal $BASIC $UNIX threadname libc-time fs
TEST_TARGET=i686-unknown-freebsd run_tests_minimal $BASIC $UNIX threadname libc-time fs
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX threadname pthread-sync available-parallelism libc-time
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX threadname pthread-sync available-parallelism libc-time
TEST_TARGET=x86_64-unknown-illumos run_tests_minimal $BASIC $UNIX threadname pthread-sync available-parallelism libc-time tls
TEST_TARGET=x86_64-pc-solaris run_tests_minimal $BASIC $UNIX threadname pthread-sync available-parallelism libc-time tls
TEST_TARGET=aarch64-linux-android run_tests_minimal $BASIC $UNIX
TEST_TARGET=wasm32-wasip2 run_tests_minimal empty_main wasm heap_alloc libc-mem
TEST_TARGET=wasm32-unknown-unknown run_tests_minimal empty_main wasm
Expand Down
13 changes: 10 additions & 3 deletions src/tools/miri/miri
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
#!/usr/bin/env bash
set -e
# We want to call the binary directly, so we need to know where it ends up.
MIRI_SCRIPT_TARGET_DIR="$(dirname "$0")"/miri-script/target
# If stdout is not a terminal and we are not on CI, assume that we are being invoked by RA, and use JSON output.
if ! [ -t 1 ] && [ -z "$CI" ]; then
MESSAGE_FORMAT="--message-format=json"
fi
# We need a nightly toolchain, for the `profile-rustflags` cargo feature.
cargo +nightly build $CARGO_EXTRA_FLAGS --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml \
-q --target-dir "$MIRI_SCRIPT_TARGET_DIR" $MESSAGE_FORMAT || \
( echo "Failed to build miri-script. Is the 'nightly' toolchain installed?"; exit 1 )
# Instead of doing just `cargo run --manifest-path .. $@`, we invoke miri-script binary directly. Invoking `cargo run` goes through
# rustup (that sets it's own environmental variables), which is undesirable.
MIRI_SCRIPT_TARGET_DIR="$(dirname "$0")"/miri-script/target
cargo +stable build $CARGO_EXTRA_FLAGS -q --target-dir "$MIRI_SCRIPT_TARGET_DIR" --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml || \
( echo "Failed to build miri-script. Is the 'stable' toolchain installed?"; exit 1 )
"$MIRI_SCRIPT_TARGET_DIR"/debug/miri-script "$@"
4 changes: 0 additions & 4 deletions src/tools/miri/miri-script/miri

This file was deleted.

Loading
Loading