Skip to content

Miri subtree update #119039

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 40 commits into from
Dec 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
8907858
Fix miri script target dir and update doc link
Jefffrey Dec 3, 2023
02f0bb7
Don't explicitly warn against `semicolon_in_expressions_from_macros`
Xanewok Dec 5, 2023
02f96cc
Fix formatting
Xanewok Dec 5, 2023
aa006a3
Auto merge of #3212 - Xanewok:patch-1, r=RalfJung
bors Dec 5, 2023
b76c571
remove unnecesary `-Zunstable-options`
weihanglo Dec 6, 2023
f7af14b
Auto merge of #3213 - weihanglo:remove-cargo-unstable-options, r=Ralf…
bors Dec 6, 2023
c37f4d6
Move unary_op_* functions from `shims::x86::sse` module to `shims::x86`
eduardosm Dec 7, 2023
8c5882e
Move round_* functions from `shims::x86::sse41` module to `shims::x86`
eduardosm Dec 7, 2023
a77f220
Preparing for merge from rustc
Dec 8, 2023
120b97c
Merge from rustc
Dec 8, 2023
276ab58
Auto merge of #3215 - rust-lang:rustup-2023-12-08, r=saethlin
bors Dec 8, 2023
a0ce060
Move implementation of SSE4.1 `ptest*` into a helper function
eduardosm Dec 7, 2023
d2dac05
Move implementation of SSE4.1 dpps/dppd to helper function
eduardosm Dec 7, 2023
57935c3
Auto merge of #3214 - eduardosm:move-x86-code, r=RalfJung
bors Dec 8, 2023
d571256
Fix x86 SSE4.1 ptestnzc
eduardosm Dec 8, 2023
aa7afff
Auto merge of #3216 - eduardosm:fix-ptestnzc, r=RalfJung
bors Dec 9, 2023
e8a25b0
Preparing for merge from rustc
RalfJung Dec 10, 2023
035d865
Merge from rustc
RalfJung Dec 10, 2023
92ab9d6
Auto merge of #3217 - RalfJung:rustup, r=RalfJung
bors Dec 10, 2023
7d0994c
Auto merge of #3199 - Jefffrey:fix-doc-and-script, r=RalfJung
bors Dec 10, 2023
bebd6fb
Return MAP_FAILED when mmap fails
saethlin Dec 10, 2023
5ade852
Auto merge of #3219 - saethlin:map-failed, r=RalfJung
bors Dec 10, 2023
4d37019
use Waker::noop instead of defining our own Waker
RalfJung Dec 11, 2023
aaeb4dd
Auto merge of #3222 - RalfJung:waker-noop, r=RalfJung
bors Dec 11, 2023
86e6416
Preparing for merge from rustc
Dec 12, 2023
dd60089
Merge from rustc
Dec 12, 2023
03b7ed0
fmt
Dec 12, 2023
fda521a
Auto merge of #3223 - rust-lang:rustup-2023-12-12, r=RalfJung
bors Dec 12, 2023
205fbf4
Preparing for merge from rustc
Dec 14, 2023
7d4f92a
Merge from rustc
Dec 14, 2023
4a4a896
Auto merge of #3224 - rust-lang:rustup-2023-12-14, r=saethlin
bors Dec 14, 2023
823e2e7
add test for uninhabited saved locals in a coroutine
RalfJung Dec 14, 2023
5747646
Auto merge of #3225 - RalfJung:coroutine, r=RalfJung
bors Dec 14, 2023
7c5d692
Preparing for merge from rustc
Dec 15, 2023
b0d92a7
Merge from rustc
Dec 15, 2023
c9e0610
Auto merge of #3227 - rust-lang:rustup-2023-12-15, r=RalfJung
bors Dec 15, 2023
afcf01c
Add the test minimized from deadpool
saethlin Dec 14, 2023
fcb89b3
Auto merge of #3226 - saethlin:deadpool-test, r=RalfJung
bors Dec 15, 2023
ce4f575
Visit the AllocIds and BorTags in borrow state FrameExtra
saethlin Dec 16, 2023
00a82a5
Auto merge of #3229 - saethlin:protector-gc-ice, r=RalfJung
bors Dec 17, 2023
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
2 changes: 1 addition & 1 deletion src/tools/miri/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ to run the other checks while ignoring the ui output, use `MIRI_SKIP_UI_CHECKS=1

For more info on how to configure ui tests see [the documentation on the ui test crate][ui_test]

[ui_test]: ui_test/README.md
[ui_test]: https://github.com/oli-obk/ui_test/blob/main/README.md

### Testing `cargo miri`

Expand Down
3 changes: 0 additions & 3 deletions src/tools/miri/cargo-miri/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,6 @@ pub fn ask_to_run(mut cmd: Command, ask: bool, text: &str) {
// cargo invocation.
fn cargo_extra_flags() -> Vec<String> {
let mut flags = Vec::new();
// `-Zunstable-options` is required by `--config`.
flags.push("-Zunstable-options".to_string());

// Forward `--config` flags.
let config_flag = "--config";
for arg in get_arg_flag_values(config_flag) {
Expand Down
5 changes: 3 additions & 2 deletions src/tools/miri/miri
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
set -e
# 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.
cargo build $CARGO_EXTRA_FLAGS -q --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml
"$(dirname "$0")"/miri-script/target/debug/miri-script "$@"
MIRI_SCRIPT_TARGET_DIR="$(dirname "$0")"/miri-script/target
cargo build $CARGO_EXTRA_FLAGS -q --target-dir "$MIRI_SCRIPT_TARGET_DIR" --manifest-path "$(dirname "$0")"/miri-script/Cargo.toml
"$MIRI_SCRIPT_TARGET_DIR"/debug/miri-script "$@"
4 changes: 3 additions & 1 deletion src/tools/miri/miri-script/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ impl MiriEnv {
flags.push("-C link-args=-Wl,-rpath,");
flags.push(libdir);
// Enable rustc-specific lints (ignored without `-Zunstable-options`).
flags.push(" -Zunstable-options -Wrustc::internal -Wrust_2018_idioms -Wunused_lifetimes -Wsemicolon_in_expressions_from_macros");
flags.push(
" -Zunstable-options -Wrustc::internal -Wrust_2018_idioms -Wunused_lifetimes",
);
// Add user-defined flags.
if let Some(value) = std::env::var_os("RUSTFLAGS") {
flags.push(" ");
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
317d14a56cb8c748bf0e2f2afff89c2249ab4423
604f185fae9a4b0edf7e28f616a0f53880f8f074
16 changes: 8 additions & 8 deletions src/tools/miri/src/borrow_tracker/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub struct FrameState {
/// incremental updates of the global list of protected tags stored in the
/// `stacked_borrows::GlobalState` upon function return, and if we attempt to pop a protected
/// tag, to identify which call is responsible for protecting the tag.
/// See `Stack::item_popped` for more explanation.
/// See `Stack::item_invalidated` for more explanation.
/// Tree Borrows also needs to know which allocation these tags
/// belong to so that it can perform a read through them immediately before
/// the frame gets popped.
Expand All @@ -76,8 +76,10 @@ pub struct FrameState {
}

impl VisitProvenance for FrameState {
fn visit_provenance(&self, _visit: &mut VisitWith<'_>) {
// `protected_tags` are already recorded by `GlobalStateInner`.
fn visit_provenance(&self, visit: &mut VisitWith<'_>) {
for (id, tag) in &self.protected_tags {
visit(Some(*id), Some(*tag));
}
}
}

Expand All @@ -98,7 +100,7 @@ pub struct GlobalStateInner {
/// An item is protected if its tag is in this set, *and* it has the "protected" bit set.
/// We add tags to this when they are created with a protector in `reborrow`, and
/// we remove tags from this when the call which is protecting them returns, in
/// `GlobalStateInner::end_call`. See `Stack::item_popped` for more details.
/// `GlobalStateInner::end_call`. See `Stack::item_invalidated` for more details.
protected_tags: FxHashMap<BorTag, ProtectorKind>,
/// The pointer ids to trace
tracked_pointer_tags: FxHashSet<BorTag>,
Expand All @@ -111,10 +113,8 @@ pub struct GlobalStateInner {
}

impl VisitProvenance for GlobalStateInner {
fn visit_provenance(&self, visit: &mut VisitWith<'_>) {
for &tag in self.protected_tags.keys() {
visit(None, Some(tag));
}
fn visit_provenance(&self, _visit: &mut VisitWith<'_>) {
// All the provenance in protected_tags is also stored in FrameState, and visited there.
// The only other candidate is base_ptr_tags, and that does not need visiting since we don't ever
// GC the bottommost/root tag.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ use rustc_data_structures::fx::FxHashSet;
use rustc_span::{Span, SpanData};
use rustc_target::abi::Size;

use crate::borrow_tracker::{
AccessKind, GlobalStateInner, ProtectorKind,
};
use crate::borrow_tracker::{AccessKind, GlobalStateInner, ProtectorKind};
use crate::*;

/// Error reporting
Expand Down
3 changes: 2 additions & 1 deletion src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ use rustc_target::abi::{Abi, Size};

use crate::borrow_tracker::{
stacked_borrows::diagnostics::{AllocHistory, DiagnosticCx, DiagnosticCxBuilder},
AccessKind, GlobalStateInner, ProtectorKind,};
AccessKind, GlobalStateInner, ProtectorKind,
};
use crate::*;

use diagnostics::{RetagCause, RetagInfo};
Expand Down
4 changes: 1 addition & 3 deletions src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ use log::trace;

use rustc_target::abi::{Abi, Size};

use crate::borrow_tracker::{
AccessKind, GlobalState, GlobalStateInner, ProtectorKind,
};
use crate::borrow_tracker::{AccessKind, GlobalState, GlobalStateInner, ProtectorKind};
use rustc_middle::{
mir::{Mutability, RetagKind},
ty::{
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/src/shims/unix/linux/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
if flags & this.eval_libc_i32("MREMAP_MAYMOVE") == 0 {
// We only support MREMAP_MAYMOVE, so not passing the flag is just a failure
this.set_last_error(Scalar::from_i32(this.eval_libc_i32("EINVAL")))?;
return Ok(Scalar::from_maybe_pointer(Pointer::null(), this));
return Ok(this.eval_libc("MAP_FAILED"));
}

let old_address = Machine::ptr_from_addr_cast(this, old_address)?;
Expand Down
6 changes: 3 additions & 3 deletions src/tools/miri/src/shims/unix/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
// First, we do some basic argument validation as required by mmap
if (flags & (map_private | map_shared)).count_ones() != 1 {
this.set_last_error(Scalar::from_i32(this.eval_libc_i32("EINVAL")))?;
return Ok(Scalar::from_maybe_pointer(Pointer::null(), this));
return Ok(this.eval_libc("MAP_FAILED"));
}
if length == 0 {
this.set_last_error(Scalar::from_i32(this.eval_libc_i32("EINVAL")))?;
return Ok(Scalar::from_maybe_pointer(Pointer::null(), this));
return Ok(this.eval_libc("MAP_FAILED"));
}

// If a user tries to map a file, we want to loudly inform them that this is not going
Expand All @@ -72,7 +72,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
// Miri doesn't support MAP_FIXED or any any protections other than PROT_READ|PROT_WRITE.
if flags & map_fixed != 0 || prot != prot_read | prot_write {
this.set_last_error(Scalar::from_i32(this.eval_libc_i32("ENOTSUP")))?;
return Ok(Scalar::from_maybe_pointer(Pointer::null(), this));
return Ok(this.eval_libc("MAP_FAILED"));
}

// Miri does not support shared mappings, or any of the other extensions that for example
Expand Down
Loading