From 779d3ea8b87237143e5c512a0a9a09a030e9f2f0 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 25 Feb 2024 10:41:14 +0100 Subject: [PATCH 01/21] Preparing for merge from rustc --- src/tools/miri/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index 02ab748c44722..044f5cf9ca388 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -c5f69bdd5173a948e0131f934fa7c4cbf5e0b55f +a2f3c0cf880ad819c4eab2b320525b6a31ac6513 From ac9617cdd9bd6e52de52e9c3984bb88feea9adc8 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 25 Feb 2024 14:34:24 +0100 Subject: [PATCH 02/21] more dealing with macOS being slow --- src/tools/miri/tests/pass/shims/time.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/tests/pass/shims/time.rs b/src/tools/miri/tests/pass/shims/time.rs index 23b5ab57efa02..226f04ade0f41 100644 --- a/src/tools/miri/tests/pass/shims/time.rs +++ b/src/tools/miri/tests/pass/shims/time.rs @@ -5,7 +5,7 @@ use std::time::{Duration, Instant, SystemTime}; fn duration_sanity(diff: Duration) { // On my laptop, I observed times around 15-40ms. Add 10x lee-way both ways. assert!(diff.as_millis() > 1); - assert!(diff.as_millis() < 500); + assert!(diff.as_millis() < 1000); // macOS is very slow sometimes } fn test_sleep() { From 8bdcfb0a0a51825d4c68c5d60d07bfa819c0f3ff Mon Sep 17 00:00:00 2001 From: The Miri Conjob Bot Date: Mon, 26 Feb 2024 05:31:30 +0000 Subject: [PATCH 03/21] Preparing for merge from rustc --- src/tools/miri/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index 044f5cf9ca388..e62c61b104315 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -a2f3c0cf880ad819c4eab2b320525b6a31ac6513 +0250ef2571185b05701ed9d74fc904c17508a397 From e9c7cc2087a5bfeffdc94a87cf86d2ce8f0d2902 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 26 Feb 2024 08:55:04 +0100 Subject: [PATCH 04/21] fix clippy --- src/tools/miri/src/shims/windows/foreign_items.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/src/shims/windows/foreign_items.rs b/src/tools/miri/src/shims/windows/foreign_items.rs index fdd7fc5fad4e8..9674b9da686e0 100644 --- a/src/tools/miri/src/shims/windows/foreign_items.rs +++ b/src/tools/miri/src/shims/windows/foreign_items.rs @@ -432,7 +432,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?; let ptr = this.read_pointer(ptr)?; let len = this.read_target_usize(len)?; - this.gen_random(ptr, len.into())?; + this.gen_random(ptr, len)?; this.write_scalar(Scalar::from_i32(1), dest)?; } "BCryptGenRandom" => { From db0b49b945f56356ee495cd8b909545d566ef92e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 26 Feb 2024 08:58:21 +0100 Subject: [PATCH 05/21] add direct test for new ProcessPrng shim --- src/tools/miri/tests/pass/shims/windows-rand.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/tools/miri/tests/pass/shims/windows-rand.rs b/src/tools/miri/tests/pass/shims/windows-rand.rs index e2bcb7bd7cb77..5754a82d89050 100644 --- a/src/tools/miri/tests/pass/shims/windows-rand.rs +++ b/src/tools/miri/tests/pass/shims/windows-rand.rs @@ -6,6 +6,7 @@ use core::ptr::null_mut; // Windows API definitions. type NTSTATUS = i32; type BOOLEAN = u8; +type BOOL = i32; // yes, seriously, BOOL and BOOLEAN are very different... const BCRYPT_USE_SYSTEM_PREFERRED_RNG: u32 = 0x00000002; const BCRYPT_RNG_ALG_HANDLE: *mut c_void = 0x81 as *mut c_void; #[link(name = "bcrypt")] @@ -22,6 +23,16 @@ extern "system" { #[link_name = "SystemFunction036"] fn RtlGenRandom(RandomBuffer: *mut u8, RandomBufferLength: u32) -> BOOLEAN; } +#[cfg(target_arch = "x86")] +#[link(name = "bcryptprimitives", kind = "raw-dylib", import_name_type = "undecorated")] +extern "system" { + pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL; +} +#[cfg(not(target_arch = "x86"))] +#[link(name = "bcryptprimitives", kind = "raw-dylib")] +extern "system" { + pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL; +} fn main() { let mut key = [0u8; 24]; @@ -38,4 +49,10 @@ fn main() { let ret = unsafe { RtlGenRandom(key.as_mut_ptr(), len) }; // RtlGenRandom returns a BOOLEAN where 0 indicates an error assert_ne!(ret, 0); + + let len = key.len(); + let ret = unsafe { ProcessPrng(key.as_mut_ptr(), len) }; + // ProcessPrng is documented as always returning `TRUE`. + // https://learn.microsoft.com/en-us/windows/win32/seccng/processprng#return-value + assert_eq!(ret, 1); } From 6c945dd5a053df4d30b5808b5954069b18fc4908 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 26 Feb 2024 10:53:26 +0100 Subject: [PATCH 06/21] tree borrows: add a test to sb_fails --- .../miri/tests/pass/tree_borrows/sb_fails.rs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/tools/miri/tests/pass/tree_borrows/sb_fails.rs b/src/tools/miri/tests/pass/tree_borrows/sb_fails.rs index 5973ef01ead08..1bae30bde60c4 100644 --- a/src/tools/miri/tests/pass/tree_borrows/sb_fails.rs +++ b/src/tools/miri/tests/pass/tree_borrows/sb_fails.rs @@ -1,9 +1,10 @@ //@compile-flags: -Zmiri-tree-borrows // These tests fail Stacked Borrows, but pass Tree Borrows. -// A modified version of each is also available that fails Tree Borrows. -// They all have in common that in SB a mutable reborrow is enough to produce + +// The first four have in common that in SB a mutable reborrow is enough to produce // write access errors, but in TB an actual write is needed. +// A modified version of each is also available that fails Tree Borrows. mod fnentry_invalidation { // Copied directly from fail/stacked_borrows/fnentry_invalidation.rs @@ -73,9 +74,22 @@ mod static_memory_modification { } } +// This one is about direct writes to local variables not being in conflict +// with interior mutable reborrows. +#[allow(unused_assignments)] // spurious warning +fn interior_mut_reborrow() { + use std::cell::UnsafeCell; + + let mut c = UnsafeCell::new(42); + let ptr = c.get(); // first create interior mutable ptr + c = UnsafeCell::new(13); // then write to parent + assert_eq!(unsafe { ptr.read() }, 13); // then read through previous ptr +} + fn main() { fnentry_invalidation::main(); pass_invalid_mut::main(); return_invalid_mut::main(); static_memory_modification::main(); + interior_mut_reborrow(); } From 16c12ace3b7ded65c88656694192e74a5240407c Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 26 Feb 2024 11:32:41 +0100 Subject: [PATCH 07/21] ./miri many-seeds: support MIRI_SEED_END to control the end of the tried seed range --- src/tools/miri/miri-script/src/commands.rs | 16 +++++++++++----- src/tools/miri/miri-script/src/main.rs | 5 +++-- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/tools/miri/miri-script/src/commands.rs b/src/tools/miri/miri-script/src/commands.rs index aa43aa15485c8..88ee62fc18a1a 100644 --- a/src/tools/miri/miri-script/src/commands.rs +++ b/src/tools/miri/miri-script/src/commands.rs @@ -356,11 +356,17 @@ impl Command { .unwrap_or_else(|_| "0".into()) .parse() .context("failed to parse MIRI_SEED_START")?; - let seed_count: u64 = env::var("MIRI_SEEDS") - .unwrap_or_else(|_| "256".into()) - .parse() - .context("failed to parse MIRI_SEEDS")?; - let seed_end = seed_start + seed_count; + let seed_end: u64 = match (env::var("MIRI_SEEDS"), env::var("MIRI_SEED_END")) { + (Ok(_), Ok(_)) => bail!("Only one of MIRI_SEEDS and MIRI_SEED_END may be set"), + (Ok(seeds), Err(_)) => + seed_start + seeds.parse::().context("failed to parse MIRI_SEEDS")?, + (Err(_), Ok(seed_end)) => seed_end.parse().context("failed to parse MIRI_SEED_END")?, + (Err(_), Err(_)) => seed_start + 256, + }; + if seed_end <= seed_start { + bail!("the end of the seed range must be larger than the start."); + } + let Some((command_name, trailing_args)) = command.split_first() else { bail!("expected many-seeds command to be non-empty"); }; diff --git a/src/tools/miri/miri-script/src/main.rs b/src/tools/miri/miri-script/src/main.rs index 41b82cfc47278..712180be2825a 100644 --- a/src/tools/miri/miri-script/src/main.rs +++ b/src/tools/miri/miri-script/src/main.rs @@ -113,8 +113,9 @@ sysroot, to prevent conflicts with other toolchains. ./miri many-seeds : Runs over and over again with different seeds for Miri. The MIRIFLAGS variable is set to its original value appended with ` -Zmiri-seed=$SEED` for -many different seeds. The MIRI_SEEDS variable controls how many seeds are being -tried; MIRI_SEED_START controls the first seed to try. +many different seeds. MIRI_SEED_START controls the first seed to try (default: 0). +MIRI_SEEDS controls how many seeds are being tried (default: 256); +alternatively, MIRI_SEED_END controls the end of the (exclusive) seed range to try. ./miri bench : Runs the benchmarks from bench-cargo-miri in hyperfine. hyperfine needs to be installed. From 28c10d6f2235e0d3eef8c86df14edbddb86aff52 Mon Sep 17 00:00:00 2001 From: Ross Smyth Date: Mon, 26 Feb 2024 14:16:04 -0500 Subject: [PATCH 08/21] Fix miri.bat not bailing early on error --- src/tools/miri/miri.bat | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/miri/miri.bat b/src/tools/miri/miri.bat index 91e8a6e8f3b25..959e54d8844dc 100644 --- a/src/tools/miri/miri.bat +++ b/src/tools/miri/miri.bat @@ -2,7 +2,10 @@ :: Windows will not execute the bash script, and select this. @echo off set MIRI_SCRIPT_TARGET_DIR=%0\..\miri-script\target -cargo build %CARGO_EXTRA_FLAGS% -q --target-dir %MIRI_SCRIPT_TARGET_DIR% --manifest-path %0\..\miri-script\Cargo.toml + +:: If any other steps are added, the "|| exit /b" must be appended to early +:: return from the script. If not, it will continue execution. +cargo build %CARGO_EXTRA_FLAGS% -q --target-dir %MIRI_SCRIPT_TARGET_DIR% --manifest-path %0\..\miri-script\Cargo.toml || exit /b :: Forwards all arguments to this file to the executable. :: We invoke the binary directly to avoid going through rustup, which would set some extra From 42ce2e563aaa2fc3ebf710fd43c0e071cf90a20c Mon Sep 17 00:00:00 2001 From: The Miri Conjob Bot Date: Tue, 27 Feb 2024 04:59:39 +0000 Subject: [PATCH 09/21] Preparing for merge from rustc --- src/tools/miri/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index e62c61b104315..37273d9183a05 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -0250ef2571185b05701ed9d74fc904c17508a397 +71ffdf7ff7ac6df5f9f64de7e780b8345797e8a0 From c764aba15b09474dbaabf91243c316b0445557ab Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 27 Feb 2024 07:07:22 +0100 Subject: [PATCH 10/21] add mpsc memory leak to trophy case --- src/tools/miri/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/miri/README.md b/src/tools/miri/README.md index 944d2bbe87941..2b5ffb1a33d22 100644 --- a/src/tools/miri/README.md +++ b/src/tools/miri/README.md @@ -588,6 +588,7 @@ Definite bugs found: * [Dropping with unaligned pointers in `vec::IntoIter`](https://github.com/rust-lang/rust/pull/106084) * [Deallocating with the wrong layout in new specializations for in-place `Iterator::collect`](https://github.com/rust-lang/rust/pull/118460) * [Incorrect offset computation for highly-aligned types in `portable-atomic-util`](https://github.com/taiki-e/portable-atomic/pull/138) +* [Occasional memory leak in `std::mpsc` channels](https://github.com/rust-lang/rust/issues/121582) (original code in [crossbeam](https://github.com/crossbeam-rs/crossbeam/pull/1084)) Violations of [Stacked Borrows] found that are likely bugs (but Stacked Borrows is currently just an experiment): From a676afafa5d7d49451bde58fb385afef97cc50ae Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 28 Feb 2024 07:41:50 +0100 Subject: [PATCH 11/21] remove a wrong bitwise negation --- src/tools/miri/src/shims/tls.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/src/shims/tls.rs b/src/tools/miri/src/shims/tls.rs index 84c1feb88e959..7f929d9a91e42 100644 --- a/src/tools/miri/src/shims/tls.rs +++ b/src/tools/miri/src/shims/tls.rs @@ -354,7 +354,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { state.last_key = Some(key); trace!("Running TLS dtor {:?} on {:?} at {:?}", instance, ptr, active_thread); assert!( - !ptr.to_target_usize(this).unwrap() != 0, + ptr.to_target_usize(this).unwrap() != 0, "data can't be NULL when dtor is called!" ); From f43c07c037f64791c6d2a7c69088bd7312454bf2 Mon Sep 17 00:00:00 2001 From: The Miri Conjob Bot Date: Thu, 29 Feb 2024 04:55:07 +0000 Subject: [PATCH 12/21] Preparing for merge from rustc --- src/tools/miri/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index 37273d9183a05..2c5cd796af73e 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -71ffdf7ff7ac6df5f9f64de7e780b8345797e8a0 +d3d145ea1cae47ad392173f890577788117da3d9 From 96edeb898982a24c8e3874bc37241fe26c2cebb6 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 29 Feb 2024 19:40:27 +0100 Subject: [PATCH 13/21] Preparing for merge from rustc --- src/tools/miri/rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/rust-version b/src/tools/miri/rust-version index 2c5cd796af73e..75124dc8ff519 100644 --- a/src/tools/miri/rust-version +++ b/src/tools/miri/rust-version @@ -1 +1 @@ -d3d145ea1cae47ad392173f890577788117da3d9 +1a1876c9790f168fb51afa335a7ba3e6fc267d75 From 2a376ceb8dc0aaef39b43eada02b9c94e0d51656 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 29 Feb 2024 19:45:14 +0100 Subject: [PATCH 14/21] add regression test --- src/tools/miri/tests/fail/rustc-error2.rs | 16 ++++++++++++++++ src/tools/miri/tests/fail/rustc-error2.stderr | 9 +++++++++ 2 files changed, 25 insertions(+) create mode 100644 src/tools/miri/tests/fail/rustc-error2.rs create mode 100644 src/tools/miri/tests/fail/rustc-error2.stderr diff --git a/src/tools/miri/tests/fail/rustc-error2.rs b/src/tools/miri/tests/fail/rustc-error2.rs new file mode 100644 index 0000000000000..fd2c53933856d --- /dev/null +++ b/src/tools/miri/tests/fail/rustc-error2.rs @@ -0,0 +1,16 @@ +// Regression test for https://github.com/rust-lang/rust/issues/121508. +struct Struct(T); + +impl std::ops::Deref for Struct { + type Target = dyn Fn(T); + fn deref(&self) -> &assert_mem_uninitialized_valid::Target { + //~^ERROR: undeclared crate or module + unimplemented!() + } +} + +fn main() { + let f = Struct(Default::default()); + f(0); + f(0); +} diff --git a/src/tools/miri/tests/fail/rustc-error2.stderr b/src/tools/miri/tests/fail/rustc-error2.stderr new file mode 100644 index 0000000000000..de2861a019c69 --- /dev/null +++ b/src/tools/miri/tests/fail/rustc-error2.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: use of undeclared crate or module `assert_mem_uninitialized_valid` + --> $DIR/rustc-error2.rs:LL:CC + | +LL | fn deref(&self) -> &assert_mem_uninitialized_valid::Target { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `assert_mem_uninitialized_valid` + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0433`. From fe9dede3e2f7c753c654e9c7e88094beca9aa6d0 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 2 Mar 2024 15:33:53 +0100 Subject: [PATCH 15/21] print thread name in miri error backtraces --- src/tools/miri/src/concurrency/data_race.rs | 4 +-- src/tools/miri/src/concurrency/thread.rs | 25 ++++++++++++++----- src/tools/miri/src/diagnostics.rs | 18 ++++++++----- src/tools/miri/src/shims/unix/thread.rs | 3 ++- src/tools/miri/tests/compiletest.rs | 2 ++ .../libc_pthread_create_too_few_args.stderr | 2 +- .../libc_pthread_create_too_many_args.stderr | 2 +- .../concurrency/libc_pthread_join_main.stderr | 2 +- .../libc_pthread_join_multiple.stderr | 2 +- .../concurrency/libc_pthread_join_self.stderr | 2 +- .../concurrency/unwind_top_of_stack.stderr | 2 +- .../shims/env-set_var-data-race.stderr | 6 ++--- .../sync/libc_pthread_mutex_deadlock.stderr | 1 + .../libc_pthread_mutex_normal_deadlock.stderr | 1 + .../libc_pthread_mutex_wrong_owner.stderr | 2 +- ...k_read_write_deadlock_single_thread.stderr | 1 + ...ibc_pthread_rwlock_read_wrong_owner.stderr | 2 +- ..._pthread_rwlock_write_read_deadlock.stderr | 1 + ...k_write_read_deadlock_single_thread.stderr | 1 + ...pthread_rwlock_write_write_deadlock.stderr | 1 + ..._write_write_deadlock_single_thread.stderr | 1 + ...bc_pthread_rwlock_write_wrong_owner.stderr | 2 +- .../both_borrows/retag_data_race_write.rs | 2 +- .../retag_data_race_write.stack.stderr | 6 ++--- .../retag_data_race_write.tree.stderr | 6 ++--- src/tools/miri/tests/fail/breakpoint.stderr | 1 + .../tests/fail/data_race/alloc_read_race.rs | 2 +- .../fail/data_race/alloc_read_race.stderr | 6 ++--- .../tests/fail/data_race/alloc_write_race.rs | 2 +- .../fail/data_race/alloc_write_race.stderr | 6 ++--- .../data_race/atomic_read_na_write_race1.rs | 2 +- .../atomic_read_na_write_race1.stderr | 6 ++--- .../data_race/atomic_read_na_write_race2.rs | 2 +- .../atomic_read_na_write_race2.stderr | 6 ++--- .../data_race/atomic_write_na_read_race1.rs | 2 +- .../atomic_write_na_read_race1.stderr | 6 ++--- .../data_race/atomic_write_na_read_race2.rs | 2 +- .../atomic_write_na_read_race2.stderr | 6 ++--- .../data_race/atomic_write_na_write_race1.rs | 2 +- .../atomic_write_na_write_race1.stderr | 6 ++--- .../data_race/atomic_write_na_write_race2.rs | 2 +- .../atomic_write_na_write_race2.stderr | 6 ++--- .../data_race/dangling_thread_async_race.rs | 2 +- .../dangling_thread_async_race.stderr | 6 ++--- .../fail/data_race/dangling_thread_race.rs | 2 +- .../data_race/dangling_thread_race.stderr | 4 +-- .../fail/data_race/dealloc_read_race1.rs | 2 +- .../fail/data_race/dealloc_read_race1.stderr | 6 ++--- .../fail/data_race/dealloc_read_race2.rs | 2 +- .../fail/data_race/dealloc_read_race2.stderr | 2 +- .../fail/data_race/dealloc_read_race_stack.rs | 2 +- .../data_race/dealloc_read_race_stack.stderr | 6 ++--- .../fail/data_race/dealloc_write_race1.rs | 2 +- .../fail/data_race/dealloc_write_race1.stderr | 6 ++--- .../fail/data_race/dealloc_write_race2.rs | 2 +- .../fail/data_race/dealloc_write_race2.stderr | 2 +- .../data_race/dealloc_write_race_stack.rs | 2 +- .../data_race/dealloc_write_race_stack.stderr | 6 ++--- .../data_race/enable_after_join_to_main.rs | 2 +- .../enable_after_join_to_main.stderr | 6 ++--- .../tests/fail/data_race/fence_after_load.rs | 2 +- .../fail/data_race/fence_after_load.stderr | 4 +-- .../tests/fail/data_race/mixed_size_read.rs | 2 +- .../fail/data_race/mixed_size_read.stderr | 6 ++--- .../tests/fail/data_race/mixed_size_write.rs | 2 +- .../fail/data_race/mixed_size_write.stderr | 6 ++--- .../tests/fail/data_race/read_read_race1.rs | 2 +- .../fail/data_race/read_read_race1.stderr | 6 ++--- .../tests/fail/data_race/read_read_race2.rs | 2 +- .../fail/data_race/read_read_race2.stderr | 6 ++--- .../tests/fail/data_race/read_write_race.rs | 2 +- .../fail/data_race/read_write_race.stderr | 6 ++--- .../fail/data_race/read_write_race_stack.rs | 2 +- .../data_race/read_write_race_stack.stderr | 6 ++--- .../fail/data_race/relax_acquire_race.rs | 2 +- .../fail/data_race/relax_acquire_race.stderr | 6 ++--- .../tests/fail/data_race/release_seq_race.rs | 2 +- .../fail/data_race/release_seq_race.stderr | 6 ++--- .../data_race/release_seq_race_same_thread.rs | 2 +- .../release_seq_race_same_thread.stderr | 6 ++--- .../miri/tests/fail/data_race/rmw_race.rs | 2 +- .../miri/tests/fail/data_race/rmw_race.stderr | 6 ++--- .../tests/fail/data_race/stack_pop_race.rs | 2 +- .../fail/data_race/stack_pop_race.stderr | 4 +-- .../tests/fail/data_race/write_write_race.rs | 2 +- .../fail/data_race/write_write_race.stderr | 6 ++--- .../fail/data_race/write_write_race_stack.rs | 2 +- .../data_race/write_write_race_stack.stderr | 6 ++--- .../exported_symbol_bad_unwind2.both.stderr | 1 + ...orted_symbol_bad_unwind2.definition.stderr | 1 + .../intrinsics/uninit_uninhabited_type.stderr | 1 + .../tests/fail/intrinsics/zero_fn_ptr.stderr | 1 + src/tools/miri/tests/fail/layout_cycle.stderr | 1 + src/tools/miri/tests/fail/memleak.stderr | 1 + .../miri/tests/fail/memleak_rc.64bit.stderr | 1 + .../miri/tests/fail/panic/double_panic.stderr | 1 + src/tools/miri/tests/fail/panic/no_std.stderr | 1 + .../miri/tests/fail/panic/panic_abort1.stderr | 1 + .../miri/tests/fail/panic/panic_abort2.stderr | 1 + .../miri/tests/fail/panic/panic_abort3.stderr | 1 + .../miri/tests/fail/panic/panic_abort4.stderr | 1 + .../retag_data_race_protected_read.rs | 2 +- .../retag_data_race_protected_read.stderr | 6 ++--- .../stacked_borrows/retag_data_race_read.rs | 2 +- .../retag_data_race_read.stack.stderr | 4 +-- .../retag_data_race_read.stderr | 6 ++--- .../tests/fail/terminate-terminator.stderr | 1 + .../miri/tests/fail/tls_macro_leak.stderr | 1 + .../miri/tests/fail/tls_static_leak.stderr | 1 + .../fail/tree_borrows/spurious_read.stderr | 2 +- .../miri/tests/fail/type-too-large.stderr | 1 + .../tests/fail/unwind-action-terminate.stderr | 1 + .../fail/weak_memory/racing_mixed_size.rs | 2 +- .../fail/weak_memory/racing_mixed_size.stderr | 6 ++--- .../weak_memory/racing_mixed_size_read.rs | 2 +- .../weak_memory/racing_mixed_size_read.stderr | 6 ++--- src/tools/miri/tests/pass/box.stack.stderr | 1 + 117 files changed, 219 insertions(+), 170 deletions(-) diff --git a/src/tools/miri/src/concurrency/data_race.rs b/src/tools/miri/src/concurrency/data_race.rs index a280448ae05d2..1fc702fff56ac 100644 --- a/src/tools/miri/src/concurrency/data_race.rs +++ b/src/tools/miri/src/concurrency/data_race.rs @@ -1673,8 +1673,8 @@ impl GlobalState { vector: VectorIdx, ) -> String { let thread = self.vector_info.borrow()[vector]; - let thread_name = thread_mgr.get_thread_name(thread); - format!("thread `{}`", String::from_utf8_lossy(thread_name)) + let thread_name = thread_mgr.get_thread_display_name(thread); + format!("thread `{thread_name}`") } /// Acquire a lock, express that the previous call of diff --git a/src/tools/miri/src/concurrency/thread.rs b/src/tools/miri/src/concurrency/thread.rs index 822ba8bf922f8..43278387120cd 100644 --- a/src/tools/miri/src/concurrency/thread.rs +++ b/src/tools/miri/src/concurrency/thread.rs @@ -160,9 +160,18 @@ pub type StackEmptyCallback<'mir, 'tcx> = Box) -> InterpResult<'tcx, Poll<()>>>; impl<'mir, 'tcx> Thread<'mir, 'tcx> { - /// Get the name of the current thread, or `` if it was not set. - fn thread_name(&self) -> &[u8] { - if let Some(ref thread_name) = self.thread_name { thread_name } else { b"" } + /// Get the name of the current thread if it was set. + fn thread_name(&self) -> Option<&[u8]> { + self.thread_name.as_deref() + } + + /// Get the name of the current thread for display purposes; will include thread ID if not set. + fn thread_display_name(&self, id: ThreadId) -> String { + if let Some(ref thread_name) = self.thread_name { + String::from_utf8_lossy(thread_name).into_owned() + } else { + format!("unnamed-{}", id.index()) + } } /// Return the top user-relevant frame, if there is one. @@ -205,7 +214,7 @@ impl<'mir, 'tcx> std::fmt::Debug for Thread<'mir, 'tcx> { write!( f, "{}({:?}, {:?})", - String::from_utf8_lossy(self.thread_name()), + String::from_utf8_lossy(self.thread_name().unwrap_or(b"")), self.state, self.join_status ) @@ -572,10 +581,14 @@ impl<'mir, 'tcx: 'mir> ThreadManager<'mir, 'tcx> { } /// Get the name of the given thread. - pub fn get_thread_name(&self, thread: ThreadId) -> &[u8] { + pub fn get_thread_name(&self, thread: ThreadId) -> Option<&[u8]> { self.threads[thread].thread_name() } + pub fn get_thread_display_name(&self, thread: ThreadId) -> String { + self.threads[thread].thread_display_name(thread) + } + /// Put the thread into the blocked state. fn block_thread(&mut self, thread: ThreadId) { let state = &mut self.threads[thread].state; @@ -980,7 +993,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { } #[inline] - fn get_thread_name<'c>(&'c self, thread: ThreadId) -> &'c [u8] + fn get_thread_name<'c>(&'c self, thread: ThreadId) -> Option<&[u8]> where 'mir: 'c, { diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs index 0433254aedbe5..c7d0f9a823be0 100644 --- a/src/tools/miri/src/diagnostics.rs +++ b/src/tools/miri/src/diagnostics.rs @@ -477,7 +477,6 @@ pub fn report_msg<'tcx>( // Show note and help messages. let mut extra_span = false; - let notes_len = notes.len(); for (span_data, note) in notes { if let Some(span_data) = span_data { err.span_note(span_data.span(), note); @@ -486,7 +485,6 @@ pub fn report_msg<'tcx>( err.note(note); } } - let helps_len = helps.len(); for (span_data, help) in helps { if let Some(span_data) = span_data { err.span_help(span_data.span(), help); @@ -495,12 +493,20 @@ pub fn report_msg<'tcx>( err.help(help); } } - if notes_len + helps_len > 0 { - // Add visual separator before backtrace. - err.note(if extra_span { "BACKTRACE (of the first span):" } else { "BACKTRACE:" }); - } // Add backtrace + let mut backtrace_title = String::from("BACKTRACE"); + if extra_span { + write!(backtrace_title, " (of the first span)").unwrap(); + } + let thread_name = + machine.threads.get_thread_display_name(machine.threads.get_active_thread_id()); + if thread_name != "main" { + // Only print thread name if it is not `main`. + write!(backtrace_title, " on thread `{thread_name}`").unwrap(); + }; + write!(backtrace_title, ":").unwrap(); + err.note(backtrace_title); for (idx, frame_info) in stacktrace.iter().enumerate() { let is_local = machine.is_local(frame_info); // No span for non-local frames and the first frame (which is the error site). diff --git a/src/tools/miri/src/shims/unix/thread.rs b/src/tools/miri/src/shims/unix/thread.rs index 259689348ade3..2a56cd35dcbf3 100644 --- a/src/tools/miri/src/shims/unix/thread.rs +++ b/src/tools/miri/src/shims/unix/thread.rs @@ -104,7 +104,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let name_out = name_out.to_pointer(this)?; let len = len.to_target_usize(this)?; - let name = this.get_thread_name(thread).to_owned(); + // FIXME: we should use the program name if the thread name is not set + let name = this.get_thread_name(thread).unwrap_or(b"").to_owned(); let (success, _written) = this.write_c_str(&name, name_out, len)?; Ok(if success { Scalar::from_u32(0) } else { this.eval_libc("ERANGE") }) diff --git a/src/tools/miri/tests/compiletest.rs b/src/tools/miri/tests/compiletest.rs index d8f7cafe3b2ed..9f46772456518 100644 --- a/src/tools/miri/tests/compiletest.rs +++ b/src/tools/miri/tests/compiletest.rs @@ -172,6 +172,8 @@ regexes! { r"\.rs:[0-9]+:[0-9]+(: [0-9]+:[0-9]+)?" => ".rs:LL:CC", // erase alloc ids "alloc[0-9]+" => "ALLOC", + // erase thread ids + r"unnamed-[0-9]+" => "unnamed-ID", // erase borrow tags "<[0-9]+>" => "", "<[0-9]+=" => "` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `main` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/env-set_var-data-race.rs:LL:CC | LL | libc::getenv(b"TZ/0".as_ptr().cast()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `main` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `main` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/env-set_var-data-race.rs:LL:CC @@ -11,7 +11,7 @@ LL | env::set_var("MY_RUST_VAR", "Ferris"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/env-set_var-data-race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.stderr index 272bee38b5a10..76b1d26bd3326 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_deadlock.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | assert_eq!(libc::pthread_mutex_lock(lock_copy.0.get() as *mut _), 0); | ^ the evaluated program deadlocked | + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_mutex_deadlock.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.stderr index 16de503bebf68..334c14ebf04f2 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_normal_deadlock.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | libc::pthread_mutex_lock(&mut mutex as *mut _); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program deadlocked | + = note: BACKTRACE: = note: inside `main` at $DIR/libc_pthread_mutex_normal_deadlock.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.stderr index a1de36db96674..b8ec2d6d01822 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_mutex_wrong_owner.stderr @@ -6,7 +6,7 @@ LL | ...t_eq!(libc::pthread_mutex_unlock(lock_copy.0.get() as *mut _), 0); | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE: + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_mutex_wrong_owner.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr index 21383825f81e0..957458a7ba004 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_write_deadlock_single_thread.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | libc::pthread_rwlock_wrlock(rw.get()); | ^ the evaluated program deadlocked | + = note: BACKTRACE: = note: inside `main` at $DIR/libc_pthread_rwlock_read_write_deadlock_single_thread.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.stderr index d1b7d5ca1adac..a964a64284adb 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_read_wrong_owner.stderr @@ -6,7 +6,7 @@ LL | ... assert_eq!(libc::pthread_rwlock_unlock(lock_copy.0.get() as *mut _), | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE: + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_rwlock_read_wrong_owner.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.stderr index 6271d5cb2ff7a..5501dab81aca3 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | assert_eq!(libc::pthread_rwlock_wrlock(lock_copy.0.get() as *mut _), 0); | ^ the evaluated program deadlocked | + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_rwlock_write_read_deadlock.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr index 3d09c6dbce744..d6cceaff1660a 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_read_deadlock_single_thread.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | libc::pthread_rwlock_rdlock(rw.get()); | ^ the evaluated program deadlocked | + = note: BACKTRACE: = note: inside `main` at $DIR/libc_pthread_rwlock_write_read_deadlock_single_thread.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.stderr index faaf3f5e9a0d3..815d85af502c9 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | assert_eq!(libc::pthread_rwlock_wrlock(lock_copy.0.get() as *mut _), 0); | ^ the evaluated program deadlocked | + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_rwlock_write_write_deadlock.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr index 3dc99a1fd1951..3ba99e3db4afb 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_write_deadlock_single_thread.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | libc::pthread_rwlock_wrlock(rw.get()); | ^ the evaluated program deadlocked | + = note: BACKTRACE: = note: inside `main` at $DIR/libc_pthread_rwlock_write_write_deadlock_single_thread.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.stderr b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.stderr index dea2529b86580..c9c22dea6556c 100644 --- a/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.stderr +++ b/src/tools/miri/tests/fail-dep/shims/sync/libc_pthread_rwlock_write_wrong_owner.stderr @@ -6,7 +6,7 @@ LL | ... assert_eq!(libc::pthread_rwlock_unlock(lock_copy.0.get() as *mut _), | = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE: + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/libc_pthread_rwlock_write_wrong_owner.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.rs b/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.rs index 7c67ea45bdff9..eb1fe56df0721 100644 --- a/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.rs +++ b/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.rs @@ -17,7 +17,7 @@ fn thread_1(p: SendPtr) { fn thread_2(p: SendPtr) { let p = p.0; unsafe { - *p = 5; //~ ERROR: /Data race detected between \(1\) non-atomic (read|write) on thread `` and \(2\) non-atomic write on thread ``/ + *p = 5; //~ ERROR: /Data race detected between \(1\) non-atomic (read|write) on thread `unnamed-[0-9]+` and \(2\) non-atomic write on thread `unnamed-[0-9]+`/ } } diff --git a/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.stack.stderr b/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.stack.stderr index 63eb90b6bc801..c5b65e6f747fb 100644 --- a/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.stack.stderr +++ b/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.stack.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/retag_data_race_write.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here + | ^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/retag_data_race_write.rs:LL:CC @@ -11,7 +11,7 @@ LL | let _r = &mut *p; | ^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside `thread_2` at $DIR/retag_data_race_write.rs:LL:CC note: inside closure --> $DIR/retag_data_race_write.rs:LL:CC diff --git a/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.tree.stderr b/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.tree.stderr index f05533a6bb4ca..62f139f6f086a 100644 --- a/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/retag_data_race_write.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/retag_data_race_write.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between (1) non-atomic read on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here + | ^^^^^^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/retag_data_race_write.rs:LL:CC @@ -11,7 +11,7 @@ LL | let _r = &mut *p; | ^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside `thread_2` at $DIR/retag_data_race_write.rs:LL:CC note: inside closure --> $DIR/retag_data_race_write.rs:LL:CC diff --git a/src/tools/miri/tests/fail/breakpoint.stderr b/src/tools/miri/tests/fail/breakpoint.stderr index 1b43c594da43c..a5666d52a2f2b 100644 --- a/src/tools/miri/tests/fail/breakpoint.stderr +++ b/src/tools/miri/tests/fail/breakpoint.stderr @@ -4,6 +4,7 @@ error: abnormal termination: trace/breakpoint trap LL | core::intrinsics::breakpoint() | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ trace/breakpoint trap | + = note: BACKTRACE: = note: inside `main` at $DIR/breakpoint.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/alloc_read_race.rs b/src/tools/miri/tests/fail/data_race/alloc_read_race.rs index 786e57666e2ce..2cf366069073a 100644 --- a/src/tools/miri/tests/fail/data_race/alloc_read_race.rs +++ b/src/tools/miri/tests/fail/data_race/alloc_read_race.rs @@ -39,7 +39,7 @@ pub fn main() { let pointer = &*ptr.0; // Note: could also error due to reading uninitialized memory, but the data-race detector triggers first. - *pointer.load(Ordering::Relaxed) //~ ERROR: Data race detected between (1) creating a new allocation on thread `` and (2) non-atomic read on thread `` + *pointer.load(Ordering::Relaxed) //~ ERROR: Data race detected between (1) creating a new allocation on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/alloc_read_race.stderr b/src/tools/miri/tests/fail/data_race/alloc_read_race.stderr index fb0f77d2e6f41..59ed5fe9cf2c4 100644 --- a/src/tools/miri/tests/fail/data_race/alloc_read_race.stderr +++ b/src/tools/miri/tests/fail/data_race/alloc_read_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) creating a new allocation on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) creating a new allocation on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/alloc_read_race.rs:LL:CC | LL | *pointer.load(Ordering::Relaxed) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) creating a new allocation on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) creating a new allocation on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/alloc_read_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | pointer.store(Box::into_raw(Box::new_uninit()), Ordering::Relax | ^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/alloc_read_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/alloc_write_race.rs b/src/tools/miri/tests/fail/data_race/alloc_write_race.rs index 8c685dcb7603a..e95e0e1a841d6 100644 --- a/src/tools/miri/tests/fail/data_race/alloc_write_race.rs +++ b/src/tools/miri/tests/fail/data_race/alloc_write_race.rs @@ -37,7 +37,7 @@ pub fn main() { let j2 = spawn(move || { let ptr = ptr; // avoid field capturing let pointer = &*ptr.0; - *pointer.load(Ordering::Relaxed) = 2; //~ ERROR: Data race detected between (1) creating a new allocation on thread `` and (2) non-atomic write on thread `` + *pointer.load(Ordering::Relaxed) = 2; //~ ERROR: Data race detected between (1) creating a new allocation on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/alloc_write_race.stderr b/src/tools/miri/tests/fail/data_race/alloc_write_race.stderr index 7e6edc02bc2cf..9770684fc52d2 100644 --- a/src/tools/miri/tests/fail/data_race/alloc_write_race.stderr +++ b/src/tools/miri/tests/fail/data_race/alloc_write_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) creating a new allocation on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) creating a new allocation on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/alloc_write_race.rs:LL:CC | LL | *pointer.load(Ordering::Relaxed) = 2; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) creating a new allocation on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) creating a new allocation on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/alloc_write_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | .store(Box::into_raw(Box::::new_uninit()) as *mut us | ^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/alloc_write_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.rs b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.rs index d7e9561caf3a3..a256267bcda09 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.rs +++ b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.rs @@ -22,7 +22,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing - (&*c.0).load(Ordering::SeqCst) //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) atomic load on thread `` + (&*c.0).load(Ordering::SeqCst) //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) atomic load on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.stderr b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.stderr index 04186f7ff7be1..a1132ed20679c 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race1.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) atomic load on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/atomic_read_na_write_race1.rs:LL:CC | LL | (&*c.0).load(Ordering::SeqCst) - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `` and (2) atomic load on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/atomic_read_na_write_race1.rs:LL:CC @@ -11,7 +11,7 @@ LL | *(c.0 as *mut usize) = 32; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/atomic_read_na_write_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.rs b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.rs index 62bf8b6556182..cc6a0742c23eb 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.rs +++ b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.rs @@ -25,7 +25,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing let atomic_ref = &mut *c.0; - *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) atomic load on thread `` and (2) non-atomic write on thread `` + *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) atomic load on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.stderr b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.stderr index 7e76205da9cb2..865357cb0ef4b 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/atomic_read_na_write_race2.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) atomic load on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) atomic load on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/atomic_read_na_write_race2.rs:LL:CC | LL | *atomic_ref.get_mut() = 32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic load on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic load on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/atomic_read_na_write_race2.rs:LL:CC @@ -11,7 +11,7 @@ LL | atomic_ref.load(Ordering::SeqCst) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/atomic_read_na_write_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.rs b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.rs index 9186c562670e1..7392781e6c6b1 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.rs +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.rs @@ -25,7 +25,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing let atomic_ref = &mut *c.0; - *atomic_ref.get_mut() //~ ERROR: Data race detected between (1) atomic store on thread `` and (2) non-atomic read on thread `` + *atomic_ref.get_mut() //~ ERROR: Data race detected between (1) atomic store on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.stderr b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.stderr index 69d11a0a83c77..355ea48f11716 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race1.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) atomic store on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) atomic store on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/atomic_write_na_read_race1.rs:LL:CC | LL | *atomic_ref.get_mut() - | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic store on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic store on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/atomic_write_na_read_race1.rs:LL:CC @@ -11,7 +11,7 @@ LL | atomic_ref.store(32, Ordering::SeqCst) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/atomic_write_na_read_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.rs b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.rs index 0fcae906f0912..f681ce0c051ad 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.rs +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.rs @@ -22,7 +22,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing - (&*c.0).store(32, Ordering::SeqCst); //~ ERROR: Data race detected between (1) non-atomic read on thread `` and (2) atomic store on thread `` + (&*c.0).store(32, Ordering::SeqCst); //~ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) atomic store on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.stderr b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.stderr index 4f734ae5465a0..500cd09a33307 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_read_race2.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `` and (2) atomic store on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) atomic store on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/atomic_write_na_read_race2.rs:LL:CC | LL | (&*c.0).store(32, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic read on thread `` and (2) atomic store on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) atomic store on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/atomic_write_na_read_race2.rs:LL:CC @@ -11,7 +11,7 @@ LL | let _val = *(c.0 as *mut usize); | ^^^^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/atomic_write_na_read_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.rs b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.rs index 822d86c1c1d7d..47a3ef5d16897 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.rs +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.rs @@ -22,7 +22,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing - (&*c.0).store(64, Ordering::SeqCst); //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) atomic store on thread `` + (&*c.0).store(64, Ordering::SeqCst); //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) atomic store on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.stderr b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.stderr index 8745048df473d..0b870f13bb2b9 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race1.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) atomic store on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) atomic store on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/atomic_write_na_write_race1.rs:LL:CC | LL | (&*c.0).store(64, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `` and (2) atomic store on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) atomic store on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/atomic_write_na_write_race1.rs:LL:CC @@ -11,7 +11,7 @@ LL | *(c.0 as *mut usize) = 32; | ^^^^^^^^^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/atomic_write_na_write_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.rs b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.rs index d84531646e231..8bba4a88924e6 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.rs +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.rs @@ -25,7 +25,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing let atomic_ref = &mut *c.0; - *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) atomic store on thread `` and (2) non-atomic write on thread `` + *atomic_ref.get_mut() = 32; //~ ERROR: Data race detected between (1) atomic store on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.stderr b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.stderr index 7ee5014312483..dbbf6bf1ef573 100644 --- a/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/atomic_write_na_write_race2.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) atomic store on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) atomic store on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/atomic_write_na_write_race2.rs:LL:CC | LL | *atomic_ref.get_mut() = 32; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic store on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) atomic store on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/atomic_write_na_write_race2.rs:LL:CC @@ -11,7 +11,7 @@ LL | atomic_ref.store(64, Ordering::SeqCst); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/atomic_write_na_write_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.rs b/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.rs index 0fdb8e631a1f6..5b9005606e0e7 100644 --- a/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.rs +++ b/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.rs @@ -36,7 +36,7 @@ fn main() { let join2 = unsafe { spawn(move || { let c = c; // capture `c`, not just its field. - *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` + *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-3` }) }; diff --git a/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.stderr b/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.stderr index deb6029577ffb..1b02880b99861 100644 --- a/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.stderr +++ b/src/tools/miri/tests/fail/data_race/dangling_thread_async_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/dangling_thread_async_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/dangling_thread_async_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 32; | ^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dangling_thread_async_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dangling_thread_race.rs b/src/tools/miri/tests/fail/data_race/dangling_thread_race.rs index fa2176d844f26..91c1191e03636 100644 --- a/src/tools/miri/tests/fail/data_race/dangling_thread_race.rs +++ b/src/tools/miri/tests/fail/data_race/dangling_thread_race.rs @@ -34,6 +34,6 @@ fn main() { spawn(|| ()).join().unwrap(); unsafe { - *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `main` + *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic write on thread `main` } } diff --git a/src/tools/miri/tests/fail/data_race/dangling_thread_race.stderr b/src/tools/miri/tests/fail/data_race/dangling_thread_race.stderr index f8ede3ac4c840..7f6ba5ee04088 100644 --- a/src/tools/miri/tests/fail/data_race/dangling_thread_race.stderr +++ b/src/tools/miri/tests/fail/data_race/dangling_thread_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here --> $DIR/dangling_thread_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here + | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/dangling_thread_race.rs:LL:CC diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs b/src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs index 1d914f0a80839..5928e47176050 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race1.rs @@ -27,7 +27,7 @@ pub fn main() { let j2 = spawn(move || { let ptr = ptr; // avoid field capturing __rust_dealloc( - //~^ ERROR: Data race detected between (1) non-atomic read on thread `` and (2) deallocation on thread `` + //~^ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) deallocation on thread `unnamed-2` ptr.0 as *mut _, std::mem::size_of::(), std::mem::align_of::(), diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr b/src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr index 55b0b44721325..a4a22a8d71e94 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race1.stderr @@ -1,4 +1,4 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `` and (2) deallocation on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/dealloc_read_race1.rs:LL:CC | LL | / __rust_dealloc( @@ -7,7 +7,7 @@ LL | | ptr.0 as *mut _, LL | | std::mem::size_of::(), LL | | std::mem::align_of::(), LL | | ); - | |_____________^ Data race detected between (1) non-atomic read on thread `` and (2) deallocation on thread `` at ALLOC. (2) just happened here + | |_____________^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/dealloc_read_race1.rs:LL:CC @@ -16,7 +16,7 @@ LL | let _val = *ptr.0; | ^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dealloc_read_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs b/src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs index 53f1d19fa7157..c5f82cc9a74e5 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race2.rs @@ -30,7 +30,7 @@ pub fn main() { let j2 = spawn(move || { let ptr = ptr; // avoid field capturing - // Also an error of the form: Data race detected between (1) deallocation on thread `` and (2) non-atomic read on thread `` + // Also an error of the form: Data race detected between (1) deallocation on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` // but the invalid allocation is detected first. *ptr.0 //~ ERROR: has been freed }); diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race2.stderr b/src/tools/miri/tests/fail/data_race/dealloc_read_race2.stderr index 8925de139b4b2..dbf9acd23b6e0 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race2.stderr @@ -20,7 +20,7 @@ LL | | std::mem::size_of::(), LL | | std::mem::align_of::(), LL | | ) | |_____________^ - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dealloc_read_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.rs b/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.rs index 728dc64d828d0..1095f1e4e82fa 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.rs @@ -36,7 +36,7 @@ pub fn main() { sleep(Duration::from_millis(200)); // Now `stack_var` gets deallocated. - } //~ ERROR: Data race detected between (1) non-atomic read on thread `` and (2) deallocation on thread `` + } //~ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-2` and (2) deallocation on thread `unnamed-1` }); let j2 = spawn(move || { diff --git a/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.stderr b/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.stderr index b9aa4bb041b45..e36376d0c75b2 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_read_race_stack.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `` and (2) deallocation on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/dealloc_read_race_stack.rs:LL:CC | LL | } - | ^ Data race detected between (1) non-atomic read on thread `` and (2) deallocation on thread `` at ALLOC. (2) just happened here + | ^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/dealloc_read_race_stack.rs:LL:CC @@ -11,7 +11,7 @@ LL | *pointer.load(Ordering::Acquire) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dealloc_read_race_stack.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs b/src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs index e0d7f983a6372..b5911e5111b3d 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race1.rs @@ -26,7 +26,7 @@ pub fn main() { let j2 = spawn(move || { let ptr = ptr; // avoid field capturing __rust_dealloc( - //~^ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) deallocation on thread `` + //~^ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) deallocation on thread `unnamed-2` ptr.0 as *mut _, std::mem::size_of::(), std::mem::align_of::(), diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race1.stderr b/src/tools/miri/tests/fail/data_race/dealloc_write_race1.stderr index 0af2911223fc8..0c6cd9bbd932e 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race1.stderr @@ -1,4 +1,4 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) deallocation on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/dealloc_write_race1.rs:LL:CC | LL | / __rust_dealloc( @@ -7,7 +7,7 @@ LL | | ptr.0 as *mut _, LL | | std::mem::size_of::(), LL | | std::mem::align_of::(), LL | | ); - | |_____________^ Data race detected between (1) non-atomic write on thread `` and (2) deallocation on thread `` at ALLOC. (2) just happened here + | |_____________^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/dealloc_write_race1.rs:LL:CC @@ -16,7 +16,7 @@ LL | *ptr.0 = 2; | ^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dealloc_write_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs b/src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs index 11b9d97527c00..7a2c882f7ecc4 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race2.rs @@ -29,7 +29,7 @@ pub fn main() { let j2 = spawn(move || { let ptr = ptr; // avoid field capturing - // Also an error of the form: Data race detected between (1) deallocation on thread `` and (2) non-atomic write on thread `` + // Also an error of the form: Data race detected between (1) deallocation on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` // but the invalid allocation is detected first. *ptr.0 = 2; //~ ERROR: has been freed }); diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race2.stderr b/src/tools/miri/tests/fail/data_race/dealloc_write_race2.stderr index 6ab77de8afea7..3009373531356 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race2.stderr @@ -20,7 +20,7 @@ LL | | std::mem::size_of::(), LL | | std::mem::align_of::(), LL | | ); | |_____________^ - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dealloc_write_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.rs b/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.rs index da3cdc23ad602..5ee4cc04a8fb0 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.rs +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.rs @@ -36,7 +36,7 @@ pub fn main() { sleep(Duration::from_millis(200)); // Now `stack_var` gets deallocated. - } //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) deallocation on thread `` + } //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-2` and (2) deallocation on thread `unnamed-1` }); let j2 = spawn(move || { diff --git a/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.stderr b/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.stderr index c1471ae55838c..4c16162fa1f16 100644 --- a/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.stderr +++ b/src/tools/miri/tests/fail/data_race/dealloc_write_race_stack.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) deallocation on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/dealloc_write_race_stack.rs:LL:CC | LL | } - | ^ Data race detected between (1) non-atomic write on thread `` and (2) deallocation on thread `` at ALLOC. (2) just happened here + | ^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) deallocation on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/dealloc_write_race_stack.rs:LL:CC @@ -11,7 +11,7 @@ LL | *pointer.load(Ordering::Acquire) = 3; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/dealloc_write_race_stack.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.rs b/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.rs index c1407fc5391f1..f2da45d7275b0 100644 --- a/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.rs +++ b/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.rs @@ -32,7 +32,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing - *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` + *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-5` and (2) non-atomic write on thread `unnamed-6` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.stderr b/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.stderr index e51119ddb2f5e..686d9b48e5312 100644 --- a/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.stderr +++ b/src/tools/miri/tests/fail/data_race/enable_after_join_to_main.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/enable_after_join_to_main.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/enable_after_join_to_main.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 32; | ^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/enable_after_join_to_main.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/fence_after_load.rs b/src/tools/miri/tests/fail/data_race/fence_after_load.rs index 12c74740387db..683e3b9c7ac66 100644 --- a/src/tools/miri/tests/fail/data_race/fence_after_load.rs +++ b/src/tools/miri/tests/fail/data_race/fence_after_load.rs @@ -20,5 +20,5 @@ fn main() { // The fence is useless, since it did not happen-after the `store` in the other thread. // Hence this is a data race. // Also see https://github.com/rust-lang/miri/issues/2192. - unsafe { V = 2 } //~ERROR: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `main` + unsafe { V = 2 } //~ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic write on thread `main` } diff --git a/src/tools/miri/tests/fail/data_race/fence_after_load.stderr b/src/tools/miri/tests/fail/data_race/fence_after_load.stderr index 0b71a41098a7e..776cf7c17b95a 100644 --- a/src/tools/miri/tests/fail/data_race/fence_after_load.stderr +++ b/src/tools/miri/tests/fail/data_race/fence_after_load.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here --> $DIR/fence_after_load.rs:LL:CC | LL | unsafe { V = 2 } - | ^^^^^ Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here + | ^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `main` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/fence_after_load.rs:LL:CC diff --git a/src/tools/miri/tests/fail/data_race/mixed_size_read.rs b/src/tools/miri/tests/fail/data_race/mixed_size_read.rs index 871d5f9a9db9b..091a47070bafb 100644 --- a/src/tools/miri/tests/fail/data_race/mixed_size_read.rs +++ b/src/tools/miri/tests/fail/data_race/mixed_size_read.rs @@ -19,7 +19,7 @@ fn main() { }); s.spawn(|| { a8[0].load(Ordering::SeqCst); - //~^ ERROR: Race condition detected between (1) 2-byte atomic load on thread `` and (2) 1-byte atomic load on thread `` + //~^ ERROR: Race condition detected between (1) 2-byte atomic load on thread `unnamed-1` and (2) 1-byte atomic load on thread `unnamed-2` }); }); } diff --git a/src/tools/miri/tests/fail/data_race/mixed_size_read.stderr b/src/tools/miri/tests/fail/data_race/mixed_size_read.stderr index acbc2306726e7..5b25c666f4199 100644 --- a/src/tools/miri/tests/fail/data_race/mixed_size_read.stderr +++ b/src/tools/miri/tests/fail/data_race/mixed_size_read.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Race condition detected between (1) 2-byte atomic load on thread `` and (2) 1-byte atomic load on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Race condition detected between (1) 2-byte atomic load on thread `unnamed-ID` and (2) 1-byte atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/mixed_size_read.rs:LL:CC | LL | a8[0].load(Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 2-byte atomic load on thread `` and (2) 1-byte atomic load on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 2-byte atomic load on thread `unnamed-ID` and (2) 1-byte atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/mixed_size_read.rs:LL:CC @@ -13,7 +13,7 @@ LL | a16.load(Ordering::SeqCst); = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/mixed_size_read.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/mixed_size_write.rs b/src/tools/miri/tests/fail/data_race/mixed_size_write.rs index e52e76e4802f6..49fb6c1d5c3e3 100644 --- a/src/tools/miri/tests/fail/data_race/mixed_size_write.rs +++ b/src/tools/miri/tests/fail/data_race/mixed_size_write.rs @@ -19,7 +19,7 @@ fn main() { }); s.spawn(|| { a8[0].store(1, Ordering::SeqCst); - //~^ ERROR: Race condition detected between (1) 2-byte atomic store on thread `` and (2) 1-byte atomic store on thread `` + //~^ ERROR: Race condition detected between (1) 2-byte atomic store on thread `unnamed-1` and (2) 1-byte atomic store on thread `unnamed-2` }); }); } diff --git a/src/tools/miri/tests/fail/data_race/mixed_size_write.stderr b/src/tools/miri/tests/fail/data_race/mixed_size_write.stderr index 761942cbad319..c6157b87b387c 100644 --- a/src/tools/miri/tests/fail/data_race/mixed_size_write.stderr +++ b/src/tools/miri/tests/fail/data_race/mixed_size_write.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Race condition detected between (1) 2-byte atomic store on thread `` and (2) 1-byte atomic store on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Race condition detected between (1) 2-byte atomic store on thread `unnamed-ID` and (2) 1-byte atomic store on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/mixed_size_write.rs:LL:CC | LL | a8[0].store(1, Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 2-byte atomic store on thread `` and (2) 1-byte atomic store on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 2-byte atomic store on thread `unnamed-ID` and (2) 1-byte atomic store on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/mixed_size_write.rs:LL:CC @@ -13,7 +13,7 @@ LL | a16.store(1, Ordering::SeqCst); = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/mixed_size_write.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/read_read_race1.rs b/src/tools/miri/tests/fail/data_race/read_read_race1.rs index dd800af4af707..f66b5ca3d53af 100644 --- a/src/tools/miri/tests/fail/data_race/read_read_race1.rs +++ b/src/tools/miri/tests/fail/data_race/read_read_race1.rs @@ -21,7 +21,7 @@ fn main() { unsafe { ptr.read() }; // Then do the atomic access. a.load(Ordering::SeqCst); - //~^ ERROR: Data race detected between (1) non-atomic read on thread `` and (2) atomic load on thread `` + //~^ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) atomic load on thread `unnamed-2` }); }); } diff --git a/src/tools/miri/tests/fail/data_race/read_read_race1.stderr b/src/tools/miri/tests/fail/data_race/read_read_race1.stderr index d2ba738f0b9d9..37ef46335d414 100644 --- a/src/tools/miri/tests/fail/data_race/read_read_race1.stderr +++ b/src/tools/miri/tests/fail/data_race/read_read_race1.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `` and (2) atomic load on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/read_read_race1.rs:LL:CC | LL | a.load(Ordering::SeqCst); - | ^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic read on thread `` and (2) atomic load on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/read_read_race1.rs:LL:CC @@ -13,7 +13,7 @@ LL | unsafe { ptr.read() }; = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/read_read_race1.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/read_read_race2.rs b/src/tools/miri/tests/fail/data_race/read_read_race2.rs index 1f35cb639c3bf..d87b667d91287 100644 --- a/src/tools/miri/tests/fail/data_race/read_read_race2.rs +++ b/src/tools/miri/tests/fail/data_race/read_read_race2.rs @@ -21,7 +21,7 @@ fn main() { let ptr = &a as *const AtomicU16 as *mut u16; unsafe { ptr.read() }; - //~^ ERROR: Data race detected between (1) atomic load on thread `` and (2) non-atomic read on thread `` + //~^ ERROR: Data race detected between (1) atomic load on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-2` }); }); } diff --git a/src/tools/miri/tests/fail/data_race/read_read_race2.stderr b/src/tools/miri/tests/fail/data_race/read_read_race2.stderr index 8ac0446fccd4c..e0cabf62a2504 100644 --- a/src/tools/miri/tests/fail/data_race/read_read_race2.stderr +++ b/src/tools/miri/tests/fail/data_race/read_read_race2.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) atomic load on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) atomic load on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/read_read_race2.rs:LL:CC | LL | unsafe { ptr.read() }; - | ^^^^^^^^^^ Data race detected between (1) atomic load on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^ Data race detected between (1) atomic load on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/read_read_race2.rs:LL:CC @@ -13,7 +13,7 @@ LL | a.load(Ordering::SeqCst); = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/read_read_race2.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/read_write_race.rs b/src/tools/miri/tests/fail/data_race/read_write_race.rs index 372085496863e..70971b59ffe89 100644 --- a/src/tools/miri/tests/fail/data_race/read_write_race.rs +++ b/src/tools/miri/tests/fail/data_race/read_write_race.rs @@ -21,7 +21,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing - *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic read on thread `` and (2) non-atomic write on thread `` + *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/read_write_race.stderr b/src/tools/miri/tests/fail/data_race/read_write_race.stderr index 0066a11188bb7..8558db4bfdc8c 100644 --- a/src/tools/miri/tests/fail/data_race/read_write_race.stderr +++ b/src/tools/miri/tests/fail/data_race/read_write_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/read_write_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) non-atomic read on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/read_write_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | let _val = *c.0; | ^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/read_write_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/read_write_race_stack.rs b/src/tools/miri/tests/fail/data_race/read_write_race_stack.rs index df000b7942ef7..9fec3ceee07fb 100644 --- a/src/tools/miri/tests/fail/data_race/read_write_race_stack.rs +++ b/src/tools/miri/tests/fail/data_race/read_write_race_stack.rs @@ -40,7 +40,7 @@ pub fn main() { sleep(Duration::from_millis(200)); - stack_var //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` + stack_var //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-2` and (2) non-atomic read on thread `unnamed-1` }); let j2 = spawn(move || { diff --git a/src/tools/miri/tests/fail/data_race/read_write_race_stack.stderr b/src/tools/miri/tests/fail/data_race/read_write_race_stack.stderr index 35f63af2dc594..7ca249a917b27 100644 --- a/src/tools/miri/tests/fail/data_race/read_write_race_stack.stderr +++ b/src/tools/miri/tests/fail/data_race/read_write_race_stack.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/read_write_race_stack.rs:LL:CC | LL | stack_var - | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/read_write_race_stack.rs:LL:CC @@ -11,7 +11,7 @@ LL | *pointer.load(Ordering::Acquire) = 3; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/read_write_race_stack.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/relax_acquire_race.rs b/src/tools/miri/tests/fail/data_race/relax_acquire_race.rs index f20dcec4e2812..be4450794ca6c 100644 --- a/src/tools/miri/tests/fail/data_race/relax_acquire_race.rs +++ b/src/tools/miri/tests/fail/data_race/relax_acquire_race.rs @@ -39,7 +39,7 @@ pub fn main() { let j3 = spawn(move || { let c = c; // avoid field capturing if SYNC.load(Ordering::Acquire) == 2 { - *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` + *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-3` } else { 0 } diff --git a/src/tools/miri/tests/fail/data_race/relax_acquire_race.stderr b/src/tools/miri/tests/fail/data_race/relax_acquire_race.stderr index 6cd232ac3d4bd..b5e6895302f30 100644 --- a/src/tools/miri/tests/fail/data_race/relax_acquire_race.stderr +++ b/src/tools/miri/tests/fail/data_race/relax_acquire_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/relax_acquire_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here + | ^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/relax_acquire_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 1; | ^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/relax_acquire_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/release_seq_race.rs b/src/tools/miri/tests/fail/data_race/release_seq_race.rs index 4050895f296ef..9810832413ec5 100644 --- a/src/tools/miri/tests/fail/data_race/release_seq_race.rs +++ b/src/tools/miri/tests/fail/data_race/release_seq_race.rs @@ -43,7 +43,7 @@ pub fn main() { let c = c; // avoid field capturing sleep(Duration::from_millis(500)); if SYNC.load(Ordering::Acquire) == 3 { - *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` + *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-3` } else { 0 } diff --git a/src/tools/miri/tests/fail/data_race/release_seq_race.stderr b/src/tools/miri/tests/fail/data_race/release_seq_race.stderr index 61121bb83472a..e031c55ecb17f 100644 --- a/src/tools/miri/tests/fail/data_race/release_seq_race.stderr +++ b/src/tools/miri/tests/fail/data_race/release_seq_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/release_seq_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here + | ^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/release_seq_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 1; | ^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/release_seq_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.rs b/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.rs index 2cba38a8e1e07..93cbc2a57d6be 100644 --- a/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.rs +++ b/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.rs @@ -39,7 +39,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing if SYNC.load(Ordering::Acquire) == 2 { - *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` + *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-2` } else { 0 } diff --git a/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.stderr b/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.stderr index d674b30c77033..86183e1e43f7a 100644 --- a/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.stderr +++ b/src/tools/miri/tests/fail/data_race/release_seq_race_same_thread.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/release_seq_race_same_thread.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here + | ^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/release_seq_race_same_thread.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 1; | ^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/release_seq_race_same_thread.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/rmw_race.rs b/src/tools/miri/tests/fail/data_race/rmw_race.rs index 973ebdf48d3ca..982e9c1c4109d 100644 --- a/src/tools/miri/tests/fail/data_race/rmw_race.rs +++ b/src/tools/miri/tests/fail/data_race/rmw_race.rs @@ -40,7 +40,7 @@ pub fn main() { let j3 = spawn(move || { let c = c; // capture `c`, not just its field. if SYNC.load(Ordering::Acquire) == 3 { - *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` + *c.0 //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic read on thread `unnamed-3` } else { 0 } diff --git a/src/tools/miri/tests/fail/data_race/rmw_race.stderr b/src/tools/miri/tests/fail/data_race/rmw_race.stderr index eeaada1b0f310..2aa27cc8c7f2e 100644 --- a/src/tools/miri/tests/fail/data_race/rmw_race.stderr +++ b/src/tools/miri/tests/fail/data_race/rmw_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/rmw_race.rs:LL:CC | LL | *c.0 - | ^^^^ Data race detected between (1) non-atomic write on thread `` and (2) non-atomic read on thread `` at ALLOC. (2) just happened here + | ^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic read on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/rmw_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 1; | ^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/rmw_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/stack_pop_race.rs b/src/tools/miri/tests/fail/data_race/stack_pop_race.rs index 047d3757f14c6..68d82bc30a58d 100644 --- a/src/tools/miri/tests/fail/data_race/stack_pop_race.rs +++ b/src/tools/miri/tests/fail/data_race/stack_pop_race.rs @@ -21,4 +21,4 @@ fn race(local: i32) { // Deallocating the local (when `main` returns) // races with the read in the other thread. // Make sure the error points at this function's end, not just the call site. -} //~ERROR: Data race detected between (1) non-atomic read on thread `` and (2) deallocation on thread `main` +} //~ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) deallocation on thread `main` diff --git a/src/tools/miri/tests/fail/data_race/stack_pop_race.stderr b/src/tools/miri/tests/fail/data_race/stack_pop_race.stderr index 2cef51ec94ba6..683acc1abd252 100644 --- a/src/tools/miri/tests/fail/data_race/stack_pop_race.stderr +++ b/src/tools/miri/tests/fail/data_race/stack_pop_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `` and (2) deallocation on thread `main` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `main` at ALLOC. (2) just happened here --> $DIR/stack_pop_race.rs:LL:CC | LL | } - | ^ Data race detected between (1) non-atomic read on thread `` and (2) deallocation on thread `main` at ALLOC. (2) just happened here + | ^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) deallocation on thread `main` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/stack_pop_race.rs:LL:CC diff --git a/src/tools/miri/tests/fail/data_race/write_write_race.rs b/src/tools/miri/tests/fail/data_race/write_write_race.rs index 05ec8d63c7af0..e8924702af818 100644 --- a/src/tools/miri/tests/fail/data_race/write_write_race.rs +++ b/src/tools/miri/tests/fail/data_race/write_write_race.rs @@ -21,7 +21,7 @@ pub fn main() { let j2 = spawn(move || { let c = c; // avoid field capturing - *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` + *c.0 = 64; //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-2` }); j1.join().unwrap(); diff --git a/src/tools/miri/tests/fail/data_race/write_write_race.stderr b/src/tools/miri/tests/fail/data_race/write_write_race.stderr index ca32984be2f48..37b758ab2a5cd 100644 --- a/src/tools/miri/tests/fail/data_race/write_write_race.stderr +++ b/src/tools/miri/tests/fail/data_race/write_write_race.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/write_write_race.rs:LL:CC | LL | *c.0 = 64; - | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/write_write_race.rs:LL:CC @@ -11,7 +11,7 @@ LL | *c.0 = 32; | ^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/write_write_race.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/data_race/write_write_race_stack.rs b/src/tools/miri/tests/fail/data_race/write_write_race_stack.rs index d3ef552eab850..984ae2ee83dce 100644 --- a/src/tools/miri/tests/fail/data_race/write_write_race_stack.rs +++ b/src/tools/miri/tests/fail/data_race/write_write_race_stack.rs @@ -40,7 +40,7 @@ pub fn main() { sleep(Duration::from_millis(200)); - stack_var = 1usize; //~ ERROR: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` + stack_var = 1usize; //~ ERROR: Data race detected between (1) non-atomic write on thread `unnamed-2` and (2) non-atomic write on thread `unnamed-1` // read to silence errors stack_var diff --git a/src/tools/miri/tests/fail/data_race/write_write_race_stack.stderr b/src/tools/miri/tests/fail/data_race/write_write_race_stack.stderr index 038e9079c54e5..2503a4f4ba870 100644 --- a/src/tools/miri/tests/fail/data_race/write_write_race_stack.stderr +++ b/src/tools/miri/tests/fail/data_race/write_write_race_stack.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/write_write_race_stack.rs:LL:CC | LL | stack_var = 1usize; - | ^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^ Data race detected between (1) non-atomic write on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/write_write_race_stack.rs:LL:CC @@ -11,7 +11,7 @@ LL | *pointer.load(Ordering::Acquire) = 3; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/write_write_race_stack.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr index bccd532faca93..9774e1e1a793b 100644 --- a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr +++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.both.stderr @@ -11,6 +11,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr index bccd532faca93..9774e1e1a793b 100644 --- a/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr +++ b/src/tools/miri/tests/fail/function_calls/exported_symbol_bad_unwind2.definition.stderr @@ -11,6 +11,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr b/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr index 5d4ea011581c3..4723eddaa67be 100644 --- a/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr +++ b/src/tools/miri/tests/fail/intrinsics/uninit_uninhabited_type.stderr @@ -8,6 +8,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr b/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr index 935e79dfd8d35..9c6dd10079edb 100644 --- a/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr +++ b/src/tools/miri/tests/fail/intrinsics/zero_fn_ptr.stderr @@ -8,6 +8,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/layout_cycle.stderr b/src/tools/miri/tests/fail/layout_cycle.stderr index 38907a1c50cc5..cc343d6431fc6 100644 --- a/src/tools/miri/tests/fail/layout_cycle.stderr +++ b/src/tools/miri/tests/fail/layout_cycle.stderr @@ -10,6 +10,7 @@ error: post-monomorphization error: a cycle occurred during layout computation LL | intrinsics::size_of::() | ^^^^^^^^^^^^^^^^^^^^^^^^^^ a cycle occurred during layout computation | + = note: BACKTRACE: = note: inside `std::mem::size_of::>>` at RUSTLIB/core/src/mem/mod.rs:LL:CC note: inside `foo::>` --> $DIR/layout_cycle.rs:LL:CC diff --git a/src/tools/miri/tests/fail/memleak.stderr b/src/tools/miri/tests/fail/memleak.stderr index 9c885c37f3a84..8ba78ef66443e 100644 --- a/src/tools/miri/tests/fail/memleak.stderr +++ b/src/tools/miri/tests/fail/memleak.stderr @@ -4,6 +4,7 @@ error: memory leaked: ALLOC (Rust heap, size: 4, align: 4), allocated here: LL | __rust_alloc(layout.size(), layout.align()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: BACKTRACE: = note: inside `std::alloc::alloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside `std::alloc::Global::alloc_impl` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside `::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC diff --git a/src/tools/miri/tests/fail/memleak_rc.64bit.stderr b/src/tools/miri/tests/fail/memleak_rc.64bit.stderr index b68991602ea32..1c85a0f9d9f69 100644 --- a/src/tools/miri/tests/fail/memleak_rc.64bit.stderr +++ b/src/tools/miri/tests/fail/memleak_rc.64bit.stderr @@ -4,6 +4,7 @@ error: memory leaked: ALLOC (Rust heap, size: 32, align: 8), allocated here: LL | __rust_alloc(layout.size(), layout.align()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: BACKTRACE: = note: inside `std::alloc::alloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside `std::alloc::Global::alloc_impl` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside `::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/double_panic.stderr b/src/tools/miri/tests/fail/panic/double_panic.stderr index 2eb9354a4d04f..e3cacbd27bac6 100644 --- a/src/tools/miri/tests/fail/panic/double_panic.stderr +++ b/src/tools/miri/tests/fail/panic/double_panic.stderr @@ -13,6 +13,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/no_std.stderr b/src/tools/miri/tests/fail/panic/no_std.stderr index 8b48f75296761..40f6cf1fc0b24 100644 --- a/src/tools/miri/tests/fail/panic/no_std.stderr +++ b/src/tools/miri/tests/fail/panic/no_std.stderr @@ -6,6 +6,7 @@ error: abnormal termination: the program aborted execution LL | core::intrinsics::abort(); | ^^^^^^^^^^^^^^^^^^^^^^^^^ the program aborted execution | + = note: BACKTRACE: = note: inside `panic_handler` at $DIR/no_std.rs:LL:CC note: inside `start` --> $DIR/no_std.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/panic_abort1.stderr b/src/tools/miri/tests/fail/panic/panic_abort1.stderr index 690f5bbec13d5..60455693619f3 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort1.stderr +++ b/src/tools/miri/tests/fail/panic/panic_abort1.stderr @@ -7,6 +7,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `panic_abort::__rust_start_panic::abort` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `panic_abort::__rust_start_panic` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `std::panicking::rust_panic` at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/panic_abort2.stderr b/src/tools/miri/tests/fail/panic/panic_abort2.stderr index e937fa02b0ded..7bb27e4baa0a5 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort2.stderr +++ b/src/tools/miri/tests/fail/panic/panic_abort2.stderr @@ -7,6 +7,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `panic_abort::__rust_start_panic::abort` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `panic_abort::__rust_start_panic` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `std::panicking::rust_panic` at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/panic_abort3.stderr b/src/tools/miri/tests/fail/panic/panic_abort3.stderr index 0513ae7e765f9..b46e8c2079580 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort3.stderr +++ b/src/tools/miri/tests/fail/panic/panic_abort3.stderr @@ -7,6 +7,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `panic_abort::__rust_start_panic::abort` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `panic_abort::__rust_start_panic` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `std::panicking::rust_panic` at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/panic/panic_abort4.stderr b/src/tools/miri/tests/fail/panic/panic_abort4.stderr index 314e0c3079255..b15f720e43f13 100644 --- a/src/tools/miri/tests/fail/panic/panic_abort4.stderr +++ b/src/tools/miri/tests/fail/panic/panic_abort4.stderr @@ -7,6 +7,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `panic_abort::__rust_start_panic::abort` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `panic_abort::__rust_start_panic` at RUSTLIB/panic_abort/src/lib.rs:LL:CC = note: inside `std::panicking::rust_panic` at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.rs b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.rs index 71f1f132bc77f..5db89c89b77ec 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.rs +++ b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.rs @@ -13,7 +13,7 @@ fn main() { let ptr = ptr; // We do a protected mutable retag (but no write!) in this thread. fn retag(_x: &mut i32) {} - retag(unsafe { &mut *ptr.0 }); //~ERROR: Data race detected between (1) non-atomic read on thread `main` and (2) non-atomic write on thread `` + retag(unsafe { &mut *ptr.0 }); //~ERROR: Data race detected between (1) non-atomic read on thread `main` and (2) non-atomic write on thread `unnamed-1` }); // We do a read in the main thread. diff --git a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.stderr b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.stderr index 905776155eb8f..2ce757013d5f2 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.stderr +++ b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_protected_read.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `main` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `main` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/retag_data_race_protected_read.rs:LL:CC | LL | retag(unsafe { &mut *ptr.0 }); - | ^^^^^^^^^^^ Data race detected between (1) non-atomic read on thread `main` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^ Data race detected between (1) non-atomic read on thread `main` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/retag_data_race_protected_read.rs:LL:CC @@ -11,7 +11,7 @@ LL | unsafe { ptr.0.read() }; | ^^^^^^^^^^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/retag_data_race_protected_read.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.rs b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.rs index 46694cd49e358..01a2e9ac474ac 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.rs +++ b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.rs @@ -15,7 +15,7 @@ fn thread_1(p: SendPtr) { fn thread_2(p: SendPtr) { let p = p.0; unsafe { - *p = 5; //~ ERROR: Data race detected between (1) non-atomic read on thread `` and (2) non-atomic write on thread `` + *p = 5; //~ ERROR: Data race detected between (1) non-atomic read on thread `unnamed-1` and (2) non-atomic write on thread `unnamed-2` } } diff --git a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stack.stderr b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stack.stderr index c6828d62d5ab6..1d7ea18982d1d 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stack.stderr +++ b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stack.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) Read on thread `unnamed-ID` and (2) Write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/retag_data_race_read.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between (1) Read on thread `` and (2) Write on thread `` at ALLOC. (2) just happened here + | ^^^^^^ Data race detected between (1) Read on thread `unnamed-ID` and (2) Write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/retag_data_race_read.rs:LL:CC diff --git a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stderr b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stderr index 129b9ffb26ec2..d3c8d14e2a198 100644 --- a/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stderr +++ b/src/tools/miri/tests/fail/stacked_borrows/retag_data_race_read.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/retag_data_race_read.rs:LL:CC | LL | *p = 5; - | ^^^^^^ Data race detected between (1) non-atomic read on thread `` and (2) non-atomic write on thread `` at ALLOC. (2) just happened here + | ^^^^^^ Data race detected between (1) non-atomic read on thread `unnamed-ID` and (2) non-atomic write on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/retag_data_race_read.rs:LL:CC @@ -11,7 +11,7 @@ LL | let _r = &*p; | ^^^ = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside `thread_2` at $DIR/retag_data_race_read.rs:LL:CC note: inside closure --> $DIR/retag_data_race_read.rs:LL:CC diff --git a/src/tools/miri/tests/fail/terminate-terminator.stderr b/src/tools/miri/tests/fail/terminate-terminator.stderr index 44c04b3ae9301..8dbc802bf5955 100644 --- a/src/tools/miri/tests/fail/terminate-terminator.stderr +++ b/src/tools/miri/tests/fail/terminate-terminator.stderr @@ -13,6 +13,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/tls_macro_leak.stderr b/src/tools/miri/tests/fail/tls_macro_leak.stderr index be0e846b63369..40b21f8625a4a 100644 --- a/src/tools/miri/tests/fail/tls_macro_leak.stderr +++ b/src/tools/miri/tests/fail/tls_macro_leak.stderr @@ -4,6 +4,7 @@ error: memory leaked: ALLOC (Rust heap, size: 4, align: 4), allocated here: LL | __rust_alloc(layout.size(), layout.align()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: BACKTRACE: = note: inside `std::alloc::alloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside `std::alloc::Global::alloc_impl` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside `::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC diff --git a/src/tools/miri/tests/fail/tls_static_leak.stderr b/src/tools/miri/tests/fail/tls_static_leak.stderr index 533651f2efd7f..580b52c151269 100644 --- a/src/tools/miri/tests/fail/tls_static_leak.stderr +++ b/src/tools/miri/tests/fail/tls_static_leak.stderr @@ -4,6 +4,7 @@ error: memory leaked: ALLOC (Rust heap, size: 4, align: 4), allocated here: LL | __rust_alloc(layout.size(), layout.align()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: BACKTRACE: = note: inside `std::alloc::alloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside `std::alloc::Global::alloc_impl` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside `::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC diff --git a/src/tools/miri/tests/fail/tree_borrows/spurious_read.stderr b/src/tools/miri/tests/fail/tree_borrows/spurious_read.stderr index e48145567f579..ae61fc030f609 100644 --- a/src/tools/miri/tests/fail/tree_borrows/spurious_read.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/spurious_read.stderr @@ -30,7 +30,7 @@ help: the accessed tag later transitioned to Reserved (conflicted) due to LL | } | ^ = help: this transition corresponds to a temporary loss of write permissions until function exit - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside `retagx_retagy_retx_writey_rety::{closure#1}::as_mut` at $DIR/spurious_read.rs:LL:CC note: inside closure --> $DIR/spurious_read.rs:LL:CC diff --git a/src/tools/miri/tests/fail/type-too-large.stderr b/src/tools/miri/tests/fail/type-too-large.stderr index cdff049198d37..b07bb84e348f3 100644 --- a/src/tools/miri/tests/fail/type-too-large.stderr +++ b/src/tools/miri/tests/fail/type-too-large.stderr @@ -4,6 +4,7 @@ error: post-monomorphization error: values of the type `[u8; 2305843011361177600 LL | _fat = [0; (1u64 << 61) as usize + (1u64 << 31) as usize]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ values of the type `[u8; 2305843011361177600]` are too big for the current architecture | + = note: BACKTRACE: = note: inside `main` at $DIR/type-too-large.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/unwind-action-terminate.stderr b/src/tools/miri/tests/fail/unwind-action-terminate.stderr index adb2967feaf5b..1323a3971003c 100644 --- a/src/tools/miri/tests/fail/unwind-action-terminate.stderr +++ b/src/tools/miri/tests/fail/unwind-action-terminate.stderr @@ -11,6 +11,7 @@ error: abnormal termination: the program aborted execution LL | ABORT(); | ^ the program aborted execution | + = note: BACKTRACE: = note: inside `std::sys::pal::PLATFORM::abort_internal` at RUSTLIB/std/src/sys/pal/PLATFORM/mod.rs:LL:CC = note: inside `std::panicking::rust_panic_with_hook` at RUSTLIB/std/src/panicking.rs:LL:CC = note: inside closure at RUSTLIB/std/src/panicking.rs:LL:CC diff --git a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.rs b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.rs index e36d947565a1d..dfe9397a4c46a 100644 --- a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.rs +++ b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.rs @@ -31,7 +31,7 @@ pub fn main() { let x_split = split_u32_ptr(x_ptr); unsafe { let hi = ptr::addr_of!((*x_split)[0]); - std::intrinsics::atomic_load_relaxed(hi); //~ ERROR: (1) 4-byte atomic store on thread `` and (2) 2-byte atomic load + std::intrinsics::atomic_load_relaxed(hi); //~ ERROR: (1) 4-byte atomic store on thread `unnamed-1` and (2) 2-byte atomic load } }); diff --git a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.stderr b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.stderr index 9f92853d0ec6a..44430cd25db72 100644 --- a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.stderr +++ b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Race condition detected between (1) 4-byte atomic store on thread `` and (2) 2-byte atomic load on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Race condition detected between (1) 4-byte atomic store on thread `unnamed-ID` and (2) 2-byte atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/racing_mixed_size.rs:LL:CC | LL | std::intrinsics::atomic_load_relaxed(hi); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 4-byte atomic store on thread `` and (2) 2-byte atomic load on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 4-byte atomic store on thread `unnamed-ID` and (2) 2-byte atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/racing_mixed_size.rs:LL:CC @@ -13,7 +13,7 @@ LL | x.store(1, Relaxed); = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/racing_mixed_size.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.rs b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.rs index 34917245ea5b7..b946a75c3abb3 100644 --- a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.rs +++ b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.rs @@ -29,7 +29,7 @@ pub fn main() { let x_split = split_u32_ptr(x_ptr); unsafe { let hi = x_split as *const u16 as *const AtomicU16; - (*hi).load(Relaxed); //~ ERROR: (1) 4-byte atomic load on thread `` and (2) 2-byte atomic load + (*hi).load(Relaxed); //~ ERROR: (1) 4-byte atomic load on thread `unnamed-1` and (2) 2-byte atomic load } }); diff --git a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.stderr b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.stderr index a28dec2833fa7..94b4123d34567 100644 --- a/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.stderr +++ b/src/tools/miri/tests/fail/weak_memory/racing_mixed_size_read.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: Race condition detected between (1) 4-byte atomic load on thread `` and (2) 2-byte atomic load on thread `` at ALLOC. (2) just happened here +error: Undefined Behavior: Race condition detected between (1) 4-byte atomic load on thread `unnamed-ID` and (2) 2-byte atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here --> $DIR/racing_mixed_size_read.rs:LL:CC | LL | (*hi).load(Relaxed); - | ^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 4-byte atomic load on thread `` and (2) 2-byte atomic load on thread `` at ALLOC. (2) just happened here + | ^^^^^^^^^^^^^^^^^^^ Race condition detected between (1) 4-byte atomic load on thread `unnamed-ID` and (2) 2-byte atomic load on thread `unnamed-ID` at ALLOC. (2) just happened here | help: and (1) occurred earlier here --> $DIR/racing_mixed_size_read.rs:LL:CC @@ -13,7 +13,7 @@ LL | x.load(Relaxed); = help: see https://doc.rust-lang.org/nightly/std/sync/atomic/index.html#memory-model-for-atomic-accesses for more information about the Rust memory model = help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior = help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information - = note: BACKTRACE (of the first span): + = note: BACKTRACE (of the first span) on thread `unnamed-ID`: = note: inside closure at $DIR/racing_mixed_size_read.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/pass/box.stack.stderr b/src/tools/miri/tests/pass/box.stack.stderr index 4c2fb40e11021..f6e208cea9a82 100644 --- a/src/tools/miri/tests/pass/box.stack.stderr +++ b/src/tools/miri/tests/pass/box.stack.stderr @@ -24,6 +24,7 @@ warning: integer-to-pointer cast LL | let r = ((u.as_ptr() as usize) + 0) as *mut i32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ integer-to-pointer cast | + = note: BACKTRACE: = note: inside `into_unique` at $DIR/box.rs:LL:CC note: inside `main` --> $DIR/box.rs:LL:CC From fe545d62db72b632364ba9cc29bbe7259ddad385 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 2 Mar 2024 16:39:23 +0100 Subject: [PATCH 16/21] add option to track all read/write accesses to tracked allocations --- src/tools/miri/src/bin/miri.rs | 2 ++ src/tools/miri/src/borrow_tracker/mod.rs | 7 ------- .../borrow_tracker/stacked_borrows/diagnostics.rs | 2 +- .../miri/src/borrow_tracker/stacked_borrows/mod.rs | 2 +- .../src/borrow_tracker/tree_borrows/diagnostics.rs | 2 +- .../miri/src/borrow_tracker/tree_borrows/mod.rs | 2 +- .../miri/src/borrow_tracker/tree_borrows/perms.rs | 2 +- .../miri/src/borrow_tracker/tree_borrows/tree.rs | 2 +- src/tools/miri/src/diagnostics.rs | 4 ++++ src/tools/miri/src/eval.rs | 3 +++ src/tools/miri/src/helpers.rs | 7 +++++++ src/tools/miri/src/lib.rs | 2 +- src/tools/miri/src/machine.rs | 12 ++++++++++++ .../fail-dep/concurrency/windows_join_main.stderr | 1 + .../fail-dep/concurrency/windows_join_self.stderr | 1 + src/tools/miri/tests/fail/memleak_rc.32bit.stderr | 1 + 16 files changed, 38 insertions(+), 14 deletions(-) diff --git a/src/tools/miri/src/bin/miri.rs b/src/tools/miri/src/bin/miri.rs index 281a32b77c5b5..2f37a64576e4e 100644 --- a/src/tools/miri/src/bin/miri.rs +++ b/src/tools/miri/src/bin/miri.rs @@ -534,6 +534,8 @@ fn main() { ), }; miri_config.tracked_alloc_ids.extend(ids); + } else if arg == "-Zmiri-track-alloc-accesses" { + miri_config.track_alloc_accesses = true; } else if let Some(param) = arg.strip_prefix("-Zmiri-compare-exchange-weak-failure-rate=") { let rate = match param.parse::() { Ok(rate) if rate >= 0.0 && rate <= 1.0 => rate, diff --git a/src/tools/miri/src/borrow_tracker/mod.rs b/src/tools/miri/src/borrow_tracker/mod.rs index 711323b51c20d..2e784e74195ac 100644 --- a/src/tools/miri/src/borrow_tracker/mod.rs +++ b/src/tools/miri/src/borrow_tracker/mod.rs @@ -122,13 +122,6 @@ impl VisitProvenance for GlobalStateInner { /// We need interior mutable access to the global state. pub type GlobalState = RefCell; -/// Indicates which kind of access is being performed. -#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)] -pub enum AccessKind { - Read, - Write, -} - impl fmt::Display for AccessKind { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { diff --git a/src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs b/src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs index b964b1f9ec245..aa99a14b18e62 100644 --- a/src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs +++ b/src/tools/miri/src/borrow_tracker/stacked_borrows/diagnostics.rs @@ -5,7 +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::{GlobalStateInner, ProtectorKind}; use crate::*; /// Error reporting diff --git a/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs b/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs index 0fe422180f76f..86d22229714d5 100644 --- a/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs +++ b/src/tools/miri/src/borrow_tracker/stacked_borrows/mod.rs @@ -16,7 +16,7 @@ use rustc_target::abi::{Abi, Size}; use crate::borrow_tracker::{ stacked_borrows::diagnostics::{AllocHistory, DiagnosticCx, DiagnosticCxBuilder}, - AccessKind, GlobalStateInner, ProtectorKind, + GlobalStateInner, ProtectorKind, }; use crate::*; diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs index 43e6616e34a71..0663417ca41ca 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs @@ -9,7 +9,7 @@ use crate::borrow_tracker::tree_borrows::{ tree::LocationState, unimap::UniIndex, }; -use crate::borrow_tracker::{AccessKind, ProtectorKind}; +use crate::borrow_tracker::ProtectorKind; use crate::*; /// Cause of an access: either a real access or one diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs index cc98286534107..8618ab42e9126 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs @@ -1,6 +1,6 @@ use rustc_target::abi::{Abi, Size}; -use crate::borrow_tracker::{AccessKind, GlobalState, GlobalStateInner, ProtectorKind}; +use crate::borrow_tracker::{GlobalState, GlobalStateInner, ProtectorKind}; use rustc_middle::{ mir::{Mutability, RetagKind}, ty::{ diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs index bf72e902993b4..5c7f5ea46bacb 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/perms.rs @@ -3,7 +3,7 @@ use std::fmt; use crate::borrow_tracker::tree_borrows::diagnostics::TransitionError; use crate::borrow_tracker::tree_borrows::tree::AccessRelatedness; -use crate::borrow_tracker::AccessKind; +use crate::AccessKind; /// The activation states of a pointer. #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs index 4b47cc0cb824d..c7c15150fbd2a 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs @@ -24,7 +24,7 @@ use crate::borrow_tracker::tree_borrows::{ unimap::{UniEntry, UniIndex, UniKeyMap, UniValMap}, Permission, }; -use crate::borrow_tracker::{AccessKind, GlobalState, ProtectorKind}; +use crate::borrow_tracker::{GlobalState, ProtectorKind}; use crate::*; mod tests; diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs index c7d0f9a823be0..7afcf919b9183 100644 --- a/src/tools/miri/src/diagnostics.rs +++ b/src/tools/miri/src/diagnostics.rs @@ -116,6 +116,7 @@ pub enum NonHaltingDiagnostic { CreatedCallId(CallId), CreatedAlloc(AllocId, Size, Align, MemoryKind), FreedAlloc(AllocId), + AccessedAlloc(AllocId, AccessKind), RejectedIsolatedOp(String), ProgressReport { block_count: u64, // how many basic blocks have been run so far @@ -538,6 +539,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { | PoppedPointerTag(..) | CreatedCallId(..) | CreatedAlloc(..) + | AccessedAlloc(..) | FreedAlloc(..) | ProgressReport { .. } | WeakMemoryOutdatedLoad => ("tracking was triggered".to_string(), DiagLevel::Note), @@ -559,6 +561,8 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { size = size.bytes(), align = align.bytes(), ), + AccessedAlloc(AllocId(id), access_kind) => + format!("{access_kind} access to allocation with id {id}"), FreedAlloc(AllocId(id)) => format!("freed allocation with id {id}"), RejectedIsolatedOp(ref op) => format!("{op} was made to return an error due to isolation"), diff --git a/src/tools/miri/src/eval.rs b/src/tools/miri/src/eval.rs index 9bab9488e378e..ef50bd43de3b2 100644 --- a/src/tools/miri/src/eval.rs +++ b/src/tools/miri/src/eval.rs @@ -112,6 +112,8 @@ pub struct MiriConfig { pub tracked_call_ids: FxHashSet, /// The allocation ids to report about. pub tracked_alloc_ids: FxHashSet, + /// For the tracked alloc ids, also report read/write accesses. + pub track_alloc_accesses: bool, /// Determine if data race detection should be enabled pub data_race_detector: bool, /// Determine if weak memory emulation should be enabled. Requires data race detection to be enabled @@ -169,6 +171,7 @@ impl Default for MiriConfig { tracked_pointer_tags: FxHashSet::default(), tracked_call_ids: FxHashSet::default(), tracked_alloc_ids: FxHashSet::default(), + track_alloc_accesses: false, data_race_detector: true, weak_memory_emulation: true, track_outdated_loads: false, diff --git a/src/tools/miri/src/helpers.rs b/src/tools/miri/src/helpers.rs index d9b4363d604b4..65260254ae25f 100644 --- a/src/tools/miri/src/helpers.rs +++ b/src/tools/miri/src/helpers.rs @@ -22,6 +22,13 @@ use rand::RngCore; use crate::*; +/// Indicates which kind of access is being performed. +#[derive(Copy, Clone, Hash, PartialEq, Eq, Debug)] +pub enum AccessKind { + Read, + Write, +} + // This mapping should match `decode_error_kind` in // . const UNIX_IO_ERROR_TABLE: &[(&str, std::io::ErrorKind)] = { diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index c567949102f63..e1d0bc1c18386 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -120,7 +120,7 @@ pub use crate::diagnostics::{ pub use crate::eval::{ create_ecx, eval_entry, AlignmentCheck, BacktraceStyle, IsolatedOp, MiriConfig, RejectOpWith, }; -pub use crate::helpers::EvalContextExt as _; +pub use crate::helpers::{AccessKind, EvalContextExt as _}; pub use crate::intptrcast::{EvalContextExt as _, ProvenanceMode}; pub use crate::machine::{ AllocExtra, FrameExtra, MiriInterpCx, MiriInterpCxExt, MiriMachine, MiriMemoryKind, diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs index 40d041c8fdb16..c411962fcf2e2 100644 --- a/src/tools/miri/src/machine.rs +++ b/src/tools/miri/src/machine.rs @@ -512,6 +512,8 @@ pub struct MiriMachine<'mir, 'tcx> { /// The allocation IDs to report when they are being allocated /// (helps for debugging memory leaks and use after free bugs). tracked_alloc_ids: FxHashSet, + /// For the tracked alloc ids, also report read/write accesses. + track_alloc_accesses: bool, /// Controls whether alignment of memory accesses is being checked. pub(crate) check_alignment: AlignmentCheck, @@ -654,6 +656,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { extern_statics: FxHashMap::default(), rng: RefCell::new(rng), tracked_alloc_ids: config.tracked_alloc_ids.clone(), + track_alloc_accesses: config.track_alloc_accesses, check_alignment: config.check_alignment, cmpxchg_weak_failure_rate: config.cmpxchg_weak_failure_rate, mute_stdout_stderr: config.mute_stdout_stderr, @@ -793,6 +796,7 @@ impl VisitProvenance for MiriMachine<'_, '_> { local_crates: _, rng: _, tracked_alloc_ids: _, + track_alloc_accesses: _, check_alignment: _, cmpxchg_weak_failure_rate: _, mute_stdout_stderr: _, @@ -1235,6 +1239,10 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { (alloc_id, prov_extra): (AllocId, Self::ProvenanceExtra), range: AllocRange, ) -> InterpResult<'tcx> { + if machine.track_alloc_accesses && machine.tracked_alloc_ids.contains(&alloc_id) { + machine + .emit_diagnostic(NonHaltingDiagnostic::AccessedAlloc(alloc_id, AccessKind::Read)); + } if let Some(data_race) = &alloc_extra.data_race { data_race.read(alloc_id, range, machine)?; } @@ -1255,6 +1263,10 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for MiriMachine<'mir, 'tcx> { (alloc_id, prov_extra): (AllocId, Self::ProvenanceExtra), range: AllocRange, ) -> InterpResult<'tcx> { + if machine.track_alloc_accesses && machine.tracked_alloc_ids.contains(&alloc_id) { + machine + .emit_diagnostic(NonHaltingDiagnostic::AccessedAlloc(alloc_id, AccessKind::Write)); + } if let Some(data_race) = &mut alloc_extra.data_race { data_race.write(alloc_id, range, machine)?; } diff --git a/src/tools/miri/tests/fail-dep/concurrency/windows_join_main.stderr b/src/tools/miri/tests/fail-dep/concurrency/windows_join_main.stderr index cb51c7e0bd985..d9137ee74376c 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/windows_join_main.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/windows_join_main.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | assert_eq!(WaitForSingleObject(MAIN_THREAD, INFINITE), WAIT_OBJECT_0); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program deadlocked | + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at RUSTLIB/core/src/macros/mod.rs:LL:CC = note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/src/tools/miri/tests/fail-dep/concurrency/windows_join_self.stderr b/src/tools/miri/tests/fail-dep/concurrency/windows_join_self.stderr index 8b76e12421552..74699a0317fff 100644 --- a/src/tools/miri/tests/fail-dep/concurrency/windows_join_self.stderr +++ b/src/tools/miri/tests/fail-dep/concurrency/windows_join_self.stderr @@ -4,6 +4,7 @@ error: deadlock: the evaluated program deadlocked LL | assert_eq!(WaitForSingleObject(native, INFINITE), WAIT_OBJECT_0); | ^ the evaluated program deadlocked | + = note: BACKTRACE on thread `unnamed-ID`: = note: inside closure at $DIR/windows_join_self.rs:LL:CC note: some details are omitted, run with `MIRIFLAGS=-Zmiri-backtrace=full` for a verbose backtrace diff --git a/src/tools/miri/tests/fail/memleak_rc.32bit.stderr b/src/tools/miri/tests/fail/memleak_rc.32bit.stderr index 3f8b7a3e81956..781e1458db9e3 100644 --- a/src/tools/miri/tests/fail/memleak_rc.32bit.stderr +++ b/src/tools/miri/tests/fail/memleak_rc.32bit.stderr @@ -4,6 +4,7 @@ error: memory leaked: ALLOC (Rust heap, size: 16, align: 4), allocated here: LL | __rust_alloc(layout.size(), layout.align()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | + = note: BACKTRACE: = note: inside `std::alloc::alloc` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside `std::alloc::Global::alloc_impl` at RUSTLIB/alloc/src/alloc.rs:LL:CC = note: inside `::allocate` at RUSTLIB/alloc/src/alloc.rs:LL:CC From 21527d23d2ef1511abfb39fada406b47577077e1 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 2 Mar 2024 21:04:20 +0100 Subject: [PATCH 17/21] Tree Borrows: print where the forbidden access happens; make tag tracking less verbose --- src/tools/miri/src/borrow_tracker/mod.rs | 11 +++++++++-- .../borrow_tracker/tree_borrows/diagnostics.rs | 8 +++++++- .../miri/src/borrow_tracker/tree_borrows/mod.rs | 15 +++++++++------ .../miri/src/borrow_tracker/tree_borrows/tree.rs | 7 ++++++- .../alias_through_mutation.tree.stderr | 4 ++-- .../fail/both_borrows/aliasing_mut1.tree.stderr | 4 ++-- .../fail/both_borrows/aliasing_mut2.tree.stderr | 4 ++-- .../fail/both_borrows/aliasing_mut3.tree.stderr | 4 ++-- .../fail/both_borrows/aliasing_mut4.tree.stderr | 4 ++-- .../box_exclusive_violation1.tree.stderr | 4 ++-- .../box_noalias_violation.tree.stderr | 4 ++-- .../both_borrows/buggy_as_mut_slice.tree.stderr | 4 ++-- .../both_borrows/buggy_split_at_mut.tree.stderr | 4 ++-- .../fail/both_borrows/illegal_write1.tree.stderr | 4 ++-- .../fail/both_borrows/illegal_write5.tree.stderr | 4 ++-- .../fail/both_borrows/illegal_write6.tree.stderr | 4 ++-- .../invalidate_against_protector2.tree.stderr | 4 ++-- .../invalidate_against_protector3.tree.stderr | 4 ++-- .../both_borrows/load_invalid_shr.tree.stderr | 4 ++-- .../mut_exclusive_violation1.tree.stderr | 4 ++-- .../mut_exclusive_violation2.tree.stderr | 4 ++-- .../newtype_pair_retagging.tree.stderr | 4 ++-- .../both_borrows/newtype_retagging.tree.stderr | 4 ++-- .../fail/both_borrows/outdated_local.tree.stderr | 4 ++-- .../both_borrows/pass_invalid_shr.tree.stderr | 4 ++-- .../pass_invalid_shr_option.tree.stderr | 4 ++-- .../pass_invalid_shr_tuple.tree.stderr | 4 ++-- .../both_borrows/return_invalid_shr.tree.stderr | 4 ++-- .../return_invalid_shr_option.tree.stderr | 4 ++-- .../return_invalid_shr_tuple.tree.stderr | 4 ++-- .../shr_frozen_violation1.tree.stderr | 4 ++-- .../shr_frozen_violation2.tree.stderr | 4 ++-- .../function_calls/arg_inplace_mutate.tree.stderr | 4 ++-- .../arg_inplace_observe_during.tree.stderr | 4 ++-- .../return_pointer_aliasing.tree.stderr | 4 ++-- .../return_pointer_aliasing2.tree.stderr | 4 ++-- .../fail/tree_borrows/alternate-read-write.stderr | 4 ++-- .../tree_borrows/children-can-alias.uniq.stderr | 4 ++-- .../tests/fail/tree_borrows/error-range.stderr | 4 ++-- .../fail/tree_borrows/fnentry_invalidation.stderr | 4 ++-- .../tests/fail/tree_borrows/outside-range.stderr | 4 ++-- .../parent_read_freezes_raw_mut.stderr | 4 ++-- .../fail/tree_borrows/pass_invalid_mut.stderr | 4 ++-- .../reserved/cell-protected-write.stderr | 4 ++-- .../reserved/int-protected-write.stderr | 4 ++-- .../fail/tree_borrows/return_invalid_mut.stderr | 4 ++-- .../tests/fail/tree_borrows/spurious_read.stderr | 4 ++-- .../fail/tree_borrows/strongly-protected.stderr | 4 ++-- .../tests/fail/tree_borrows/unique.default.stderr | 4 ++-- .../tests/fail/tree_borrows/unique.uniq.stderr | 4 ++-- .../fail/tree_borrows/write-during-2phase.stderr | 4 ++-- 51 files changed, 125 insertions(+), 104 deletions(-) diff --git a/src/tools/miri/src/borrow_tracker/mod.rs b/src/tools/miri/src/borrow_tracker/mod.rs index 2e784e74195ac..262f7c449d275 100644 --- a/src/tools/miri/src/borrow_tracker/mod.rs +++ b/src/tools/miri/src/borrow_tracker/mod.rs @@ -377,7 +377,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { if matches!(kind, AllocKind::LiveData) { let alloc_extra = this.get_alloc_extra(*alloc_id)?; // can still fail for `extern static` let alloc_borrow_tracker = &alloc_extra.borrow_tracker.as_ref().unwrap(); - alloc_borrow_tracker.release_protector(&this.machine, borrow_tracker, *tag)?; + alloc_borrow_tracker.release_protector( + &this.machine, + borrow_tracker, + *tag, + *alloc_id, + )?; } } borrow_tracker.borrow_mut().end_call(&frame.extra); @@ -491,10 +496,12 @@ impl AllocState { machine: &MiriMachine<'_, 'tcx>, global: &GlobalState, tag: BorTag, + alloc_id: AllocId, // diagnostics ) -> InterpResult<'tcx> { match self { AllocState::StackedBorrows(_sb) => Ok(()), - AllocState::TreeBorrows(tb) => tb.borrow_mut().release_protector(machine, global, tag), + AllocState::TreeBorrows(tb) => + tb.borrow_mut().release_protector(machine, global, tag, alloc_id), } } } diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs index 0663417ca41ca..4394e3c2c86a4 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/diagnostics.rs @@ -278,6 +278,8 @@ impl History { pub(super) struct TbError<'node> { /// What failure occurred. pub error_kind: TransitionError, + /// The allocation in which the error is happening. + pub alloc_id: AllocId, /// The offset (into the allocation) at which the conflict occurred. pub error_offset: u64, /// The tag on which the error was triggered. @@ -300,7 +302,11 @@ impl TbError<'_> { let accessed = self.accessed_info; let conflicting = self.conflicting_info; let accessed_is_conflicting = accessed.tag == conflicting.tag; - let title = format!("{cause} through {accessed} is forbidden"); + let title = format!( + "{cause} through {accessed} at {alloc_id:?}[{offset:#x}] is forbidden", + alloc_id = self.alloc_id, + offset = self.error_offset + ); let (title, details, conflicting_tag_name) = match self.error_kind { ChildAccessForbidden(perm) => { let conflicting_tag_name = diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs index 8618ab42e9126..4b944ea88f503 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/mod.rs @@ -1,6 +1,3 @@ -use rustc_target::abi::{Abi, Size}; - -use crate::borrow_tracker::{GlobalState, GlobalStateInner, ProtectorKind}; use rustc_middle::{ mir::{Mutability, RetagKind}, ty::{ @@ -10,7 +7,9 @@ use rustc_middle::{ }, }; use rustc_span::def_id::DefId; +use rustc_target::abi::{Abi, Size}; +use crate::borrow_tracker::{GlobalState, GlobalStateInner, ProtectorKind}; use crate::*; pub mod diagnostics; @@ -70,6 +69,7 @@ impl<'tcx> Tree { tag, Some(range), global, + alloc_id, span, diagnostics::AccessCause::Explicit(access_kind), ) @@ -78,7 +78,7 @@ impl<'tcx> Tree { /// Check that this pointer has permission to deallocate this range. pub fn before_memory_deallocation( &mut self, - _alloc_id: AllocId, + alloc_id: AllocId, prov: ProvenanceExtra, range: AllocRange, machine: &MiriMachine<'_, 'tcx>, @@ -91,7 +91,7 @@ impl<'tcx> Tree { }; let global = machine.borrow_tracker.as_ref().unwrap(); let span = machine.current_span(); - self.dealloc(tag, range, global, span) + self.dealloc(tag, range, global, alloc_id, span) } pub fn expose_tag(&mut self, _tag: BorTag) { @@ -109,6 +109,7 @@ impl<'tcx> Tree { machine: &MiriMachine<'_, 'tcx>, global: &GlobalState, tag: BorTag, + alloc_id: AllocId, // diagnostics ) -> InterpResult<'tcx> { let span = machine.current_span(); self.perform_access( @@ -116,6 +117,7 @@ impl<'tcx> Tree { tag, None, // no specified range because it occurs on the entire allocation global, + alloc_id, span, diagnostics::AccessCause::FnExit, ) @@ -211,7 +213,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<' let global = this.machine.borrow_tracker.as_ref().unwrap().borrow(); let ty = place.layout.ty; if global.tracked_pointer_tags.contains(&new_tag) { - let kind_str = format!("{new_perm:?} (pointee type {ty})"); + let kind_str = format!("initial state {} (pointee type {ty})", new_perm.initial_state); this.emit_diagnostic(NonHaltingDiagnostic::CreatedPointerTag( new_tag.inner(), Some(kind_str), @@ -299,6 +301,7 @@ trait EvalContextPrivExt<'mir: 'ecx, 'tcx: 'mir, 'ecx>: crate::MiriInterpCxExt<' orig_tag, Some(range), this.machine.borrow_tracker.as_ref().unwrap(), + alloc_id, this.machine.current_span(), diagnostics::AccessCause::Reborrow, )?; diff --git a/src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs b/src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs index c7c15150fbd2a..dda1c7cca19a7 100644 --- a/src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs +++ b/src/tools/miri/src/borrow_tracker/tree_borrows/tree.rs @@ -516,13 +516,15 @@ impl<'tcx> Tree { tag: BorTag, access_range: AllocRange, global: &GlobalState, - span: Span, // diagnostics + alloc_id: AllocId, // diagnostics + span: Span, // diagnostics ) -> InterpResult<'tcx> { self.perform_access( AccessKind::Write, tag, Some(access_range), global, + alloc_id, span, diagnostics::AccessCause::Dealloc, )?; @@ -545,6 +547,7 @@ impl<'tcx> Tree { TbError { conflicting_info, access_cause: diagnostics::AccessCause::Dealloc, + alloc_id, error_offset: perms_range.start, error_kind, accessed_info, @@ -576,6 +579,7 @@ impl<'tcx> Tree { tag: BorTag, access_range: Option, global: &GlobalState, + alloc_id: AllocId, // diagnostics span: Span, // diagnostics access_cause: diagnostics::AccessCause, // diagnostics ) -> InterpResult<'tcx> { @@ -628,6 +632,7 @@ impl<'tcx> Tree { TbError { conflicting_info, access_cause, + alloc_id, error_offset: perms_range.start, error_kind, accessed_info, diff --git a/src/tools/miri/tests/fail/both_borrows/alias_through_mutation.tree.stderr b/src/tools/miri/tests/fail/both_borrows/alias_through_mutation.tree.stderr index db36d696e1d95..f26e8444a9aaf 100644 --- a/src/tools/miri/tests/fail/both_borrows/alias_through_mutation.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/alias_through_mutation.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through is forbidden +error: Undefined Behavior: read access through at ALLOC[0x0] is forbidden --> $DIR/alias_through_mutation.rs:LL:CC | LL | let _val = *target_alias; - | ^^^^^^^^^^^^^ read access through is forbidden + | ^^^^^^^^^^^^^ read access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/aliasing_mut1.tree.stderr b/src/tools/miri/tests/fail/both_borrows/aliasing_mut1.tree.stderr index 4ee154eeb991a..3aff0a41de231 100644 --- a/src/tools/miri/tests/fail/both_borrows/aliasing_mut1.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/aliasing_mut1.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/aliasing_mut1.rs:LL:CC | LL | *x = 1; - | ^^^^^^ write access through is forbidden + | ^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Reserved (conflicted) which forbids this child write access diff --git a/src/tools/miri/tests/fail/both_borrows/aliasing_mut2.tree.stderr b/src/tools/miri/tests/fail/both_borrows/aliasing_mut2.tree.stderr index 4b15e93165497..d8602a54c6408 100644 --- a/src/tools/miri/tests/fail/both_borrows/aliasing_mut2.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/aliasing_mut2.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/aliasing_mut2.rs:LL:CC | LL | *y = 2; - | ^^^^^^ write access through is forbidden + | ^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Reserved (conflicted) which forbids this child write access diff --git a/src/tools/miri/tests/fail/both_borrows/aliasing_mut3.tree.stderr b/src/tools/miri/tests/fail/both_borrows/aliasing_mut3.tree.stderr index 7b8082292a1de..83191962a3f87 100644 --- a/src/tools/miri/tests/fail/both_borrows/aliasing_mut3.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/aliasing_mut3.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/aliasing_mut3.rs:LL:CC | LL | *x = 1; - | ^^^^^^ write access through is forbidden + | ^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Reserved (conflicted) which forbids this child write access diff --git a/src/tools/miri/tests/fail/both_borrows/aliasing_mut4.tree.stderr b/src/tools/miri/tests/fail/both_borrows/aliasing_mut4.tree.stderr index 5dbcd39321855..b1f1e231e5ab8 100644 --- a/src/tools/miri/tests/fail/both_borrows/aliasing_mut4.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/aliasing_mut4.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> RUSTLIB/core/src/mem/mod.rs:LL:CC | LL | ptr::write(dest, src); - | ^^^^^^^^^^^^^^^^^^^^^ write access through is forbidden + | ^^^^^^^^^^^^^^^^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is foreign to the protected tag (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/box_exclusive_violation1.tree.stderr b/src/tools/miri/tests/fail/both_borrows/box_exclusive_violation1.tree.stderr index 68ed09409bf93..ee5ef0c5ea8b2 100644 --- a/src/tools/miri/tests/fail/both_borrows/box_exclusive_violation1.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/box_exclusive_violation1.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/box_exclusive_violation1.rs:LL:CC | LL | *LEAK = 7; - | ^^^^^^^^^ write access through is forbidden + | ^^^^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/box_noalias_violation.tree.stderr b/src/tools/miri/tests/fail/both_borrows/box_noalias_violation.tree.stderr index 824a2d36fc485..95cf37c812394 100644 --- a/src/tools/miri/tests/fail/both_borrows/box_noalias_violation.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/box_noalias_violation.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through is forbidden +error: Undefined Behavior: read access through at ALLOC[0x0] is forbidden --> $DIR/box_noalias_violation.rs:LL:CC | LL | *y - | ^^ read access through is forbidden + | ^^ read access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is foreign to the protected tag (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/buggy_as_mut_slice.tree.stderr b/src/tools/miri/tests/fail/both_borrows/buggy_as_mut_slice.tree.stderr index 4e5a8bbe0e0bb..5593db899710d 100644 --- a/src/tools/miri/tests/fail/both_borrows/buggy_as_mut_slice.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/buggy_as_mut_slice.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x4] is forbidden --> $DIR/buggy_as_mut_slice.rs:LL:CC | LL | v2[1] = 7; - | ^^^^^^^^^ write access through is forbidden + | ^^^^^^^^^ write access through at ALLOC[0x4] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/buggy_split_at_mut.tree.stderr b/src/tools/miri/tests/fail/both_borrows/buggy_split_at_mut.tree.stderr index 7fc795db097d8..7d3725d611a2c 100644 --- a/src/tools/miri/tests/fail/both_borrows/buggy_split_at_mut.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/buggy_split_at_mut.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x4] is forbidden --> $DIR/buggy_split_at_mut.rs:LL:CC | LL | b[1] = 6; - | ^^^^^^^^ write access through is forbidden + | ^^^^^^^^ write access through at ALLOC[0x4] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/illegal_write1.tree.stderr b/src/tools/miri/tests/fail/both_borrows/illegal_write1.tree.stderr index 5dd51b5f25770..6241c9db0d206 100644 --- a/src/tools/miri/tests/fail/both_borrows/illegal_write1.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/illegal_write1.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/illegal_write1.rs:LL:CC | LL | unsafe { *x = 42 }; - | ^^^^^^^ write access through is forbidden + | ^^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Frozen which forbids this child write access diff --git a/src/tools/miri/tests/fail/both_borrows/illegal_write5.tree.stderr b/src/tools/miri/tests/fail/both_borrows/illegal_write5.tree.stderr index 3698937d6fcc0..1f3d6e387d437 100644 --- a/src/tools/miri/tests/fail/both_borrows/illegal_write5.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/illegal_write5.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through is forbidden +error: Undefined Behavior: read access through at ALLOC[0x0] is forbidden --> $DIR/illegal_write5.rs:LL:CC | LL | let _val = *xref; - | ^^^^^ read access through is forbidden + | ^^^^^ read access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/illegal_write6.tree.stderr b/src/tools/miri/tests/fail/both_borrows/illegal_write6.tree.stderr index 37d5147b5d0e6..2e161ceea88db 100644 --- a/src/tools/miri/tests/fail/both_borrows/illegal_write6.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/illegal_write6.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/illegal_write6.rs:LL:CC | LL | unsafe { *y = 2 }; - | ^^^^^^ write access through is forbidden + | ^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is foreign to the protected tag (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector2.tree.stderr b/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector2.tree.stderr index 4ba80e13318a9..9fa52262f7ea8 100644 --- a/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector2.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector2.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/invalidate_against_protector2.rs:LL:CC | LL | unsafe { *x = 0 }; - | ^^^^^^ write access through is forbidden + | ^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is foreign to the protected tag (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector3.tree.stderr b/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector3.tree.stderr index 5a8fbe4ce5bcc..2cf476c837c57 100644 --- a/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector3.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/invalidate_against_protector3.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through (root of the allocation) is forbidden +error: Undefined Behavior: write access through (root of the allocation) at ALLOC[0x0] is forbidden --> $DIR/invalidate_against_protector3.rs:LL:CC | LL | unsafe { *x = 0 }; - | ^^^^^^ write access through (root of the allocation) is forbidden + | ^^^^^^ write access through (root of the allocation) at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag (root of the allocation) is foreign to the protected tag (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/load_invalid_shr.tree.stderr b/src/tools/miri/tests/fail/both_borrows/load_invalid_shr.tree.stderr index 5de9c9c14786c..292dc8150f17f 100644 --- a/src/tools/miri/tests/fail/both_borrows/load_invalid_shr.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/load_invalid_shr.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through is forbidden +error: Undefined Behavior: reborrow through at ALLOC[0x0] is forbidden --> $DIR/load_invalid_shr.rs:LL:CC | LL | let _val = *xref_in_mem; - | ^^^^^^^^^^^^ reborrow through is forbidden + | ^^^^^^^^^^^^ reborrow through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation1.tree.stderr b/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation1.tree.stderr index 892b1299bbce6..a5e62e9ea3381 100644 --- a/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation1.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation1.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/mut_exclusive_violation1.rs:LL:CC | LL | *LEAK = 7; - | ^^^^^^^^^ write access through is forbidden + | ^^^^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation2.tree.stderr b/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation2.tree.stderr index ca5ac5ac88b61..6b6eecbe41362 100644 --- a/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation2.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/mut_exclusive_violation2.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/mut_exclusive_violation2.rs:LL:CC | LL | *raw1 = 3; - | ^^^^^^^^^ write access through is forbidden + | ^^^^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr b/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr index 3900f5b233ebc..0a54f14bb5e19 100644 --- a/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/newtype_pair_retagging.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: deallocation through is forbidden +error: Undefined Behavior: deallocation through at ALLOC[0x0] is forbidden --> RUSTLIB/alloc/src/alloc.rs:LL:CC | LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through is forbidden + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is foreign to the protected tag (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/newtype_retagging.tree.stderr b/src/tools/miri/tests/fail/both_borrows/newtype_retagging.tree.stderr index dd1344a3ce343..05f1d8822c81f 100644 --- a/src/tools/miri/tests/fail/both_borrows/newtype_retagging.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/newtype_retagging.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: deallocation through is forbidden +error: Undefined Behavior: deallocation through at ALLOC[0x0] is forbidden --> RUSTLIB/alloc/src/alloc.rs:LL:CC | LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through is forbidden + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is foreign to the protected tag (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/both_borrows/outdated_local.tree.stderr b/src/tools/miri/tests/fail/both_borrows/outdated_local.tree.stderr index 4f79c427b915d..60de8417c1026 100644 --- a/src/tools/miri/tests/fail/both_borrows/outdated_local.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/outdated_local.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through is forbidden +error: Undefined Behavior: read access through at ALLOC[0x0] is forbidden --> $DIR/outdated_local.rs:LL:CC | LL | assert_eq!(unsafe { *y }, 1); - | ^^ read access through is forbidden + | ^^ read access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Disabled which forbids this child read access diff --git a/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr.tree.stderr b/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr.tree.stderr index 8060ea9c4a64c..97a6efa9f6a6c 100644 --- a/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through is forbidden +error: Undefined Behavior: reborrow through at ALLOC[0x0] is forbidden --> $DIR/pass_invalid_shr.rs:LL:CC | LL | foo(xref); - | ^^^^ reborrow through is forbidden + | ^^^^ reborrow through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Disabled which forbids this reborrow (acting as a child read access) diff --git a/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_option.tree.stderr b/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_option.tree.stderr index 6a92fec38ff15..f2eaf767a47af 100644 --- a/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_option.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_option.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through is forbidden +error: Undefined Behavior: reborrow through at ALLOC[0x0] is forbidden --> $DIR/pass_invalid_shr_option.rs:LL:CC | LL | foo(some_xref); - | ^^^^^^^^^ reborrow through is forbidden + | ^^^^^^^^^ reborrow through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_tuple.tree.stderr b/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_tuple.tree.stderr index d391c334faf51..9cfd4239c85f8 100644 --- a/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_tuple.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/pass_invalid_shr_tuple.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through is forbidden +error: Undefined Behavior: reborrow through at ALLOC[0x0] is forbidden --> $DIR/pass_invalid_shr_tuple.rs:LL:CC | LL | foo(pair_xref); - | ^^^^^^^^^ reborrow through is forbidden + | ^^^^^^^^^ reborrow through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/return_invalid_shr.tree.stderr b/src/tools/miri/tests/fail/both_borrows/return_invalid_shr.tree.stderr index 9358520d8ed38..0d19681f637da 100644 --- a/src/tools/miri/tests/fail/both_borrows/return_invalid_shr.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/return_invalid_shr.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through is forbidden +error: Undefined Behavior: reborrow through at ALLOC[0x4] is forbidden --> $DIR/return_invalid_shr.rs:LL:CC | LL | ret - | ^^^ reborrow through is forbidden + | ^^^ reborrow through at ALLOC[0x4] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Disabled which forbids this reborrow (acting as a child read access) diff --git a/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_option.tree.stderr b/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_option.tree.stderr index d60df19f94513..1169200b57c1f 100644 --- a/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_option.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_option.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through is forbidden +error: Undefined Behavior: reborrow through at ALLOC[0x4] is forbidden --> $DIR/return_invalid_shr_option.rs:LL:CC | LL | ret - | ^^^ reborrow through is forbidden + | ^^^ reborrow through at ALLOC[0x4] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_tuple.tree.stderr b/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_tuple.tree.stderr index b252c691c8d61..af410534140fe 100644 --- a/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_tuple.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/return_invalid_shr_tuple.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through is forbidden +error: Undefined Behavior: reborrow through at ALLOC[0x4] is forbidden --> $DIR/return_invalid_shr_tuple.rs:LL:CC | LL | ret - | ^^^ reborrow through is forbidden + | ^^^ reborrow through at ALLOC[0x4] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation1.tree.stderr b/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation1.tree.stderr index c2025332b9f14..97cd64c03be8c 100644 --- a/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation1.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation1.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/shr_frozen_violation1.rs:LL:CC | LL | *(x as *const i32 as *mut i32) = 7; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ write access through is forbidden + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation2.tree.stderr b/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation2.tree.stderr index 40f2d89850ea3..96c2e39edd20a 100644 --- a/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation2.tree.stderr +++ b/src/tools/miri/tests/fail/both_borrows/shr_frozen_violation2.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through is forbidden +error: Undefined Behavior: read access through at ALLOC[0x0] is forbidden --> $DIR/shr_frozen_violation2.rs:LL:CC | LL | let _val = *frozen; - | ^^^^^^^ read access through is forbidden + | ^^^^^^^ read access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Disabled which forbids this child read access diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr index 4fe9b7b4728da..354631bdcb5db 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_mutate.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through (root of the allocation) is forbidden +error: Undefined Behavior: write access through (root of the allocation) at ALLOC[0x0] is forbidden --> $DIR/arg_inplace_mutate.rs:LL:CC | LL | unsafe { ptr.write(S(0)) }; - | ^^^^^^^^^^^^^^^ write access through (root of the allocation) is forbidden + | ^^^^^^^^^^^^^^^ write access through (root of the allocation) at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag (root of the allocation) is foreign to the protected tag (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr index 67906f24bbd03..64888cce6135c 100644 --- a/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr +++ b/src/tools/miri/tests/fail/function_calls/arg_inplace_observe_during.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through (root of the allocation) is forbidden +error: Undefined Behavior: read access through (root of the allocation) at ALLOC[0x0] is forbidden --> $DIR/arg_inplace_observe_during.rs:LL:CC | LL | unsafe { ptr.read() }; - | ^^^^^^^^^^ read access through (root of the allocation) is forbidden + | ^^^^^^^^^^ read access through (root of the allocation) at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag (root of the allocation) is foreign to the protected tag (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr index 6b3f5fbedee9c..bbedba5a7ddb0 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through (root of the allocation) is forbidden +error: Undefined Behavior: read access through (root of the allocation) at ALLOC[0x0] is forbidden --> $DIR/return_pointer_aliasing.rs:LL:CC | LL | unsafe { ptr.read() }; - | ^^^^^^^^^^ read access through (root of the allocation) is forbidden + | ^^^^^^^^^^ read access through (root of the allocation) at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag (root of the allocation) is foreign to the protected tag (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.tree.stderr b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.tree.stderr index 37c98eabbec83..146bcfc7c47d0 100644 --- a/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.tree.stderr +++ b/src/tools/miri/tests/fail/function_calls/return_pointer_aliasing2.tree.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through (root of the allocation) is forbidden +error: Undefined Behavior: write access through (root of the allocation) at ALLOC[0x0] is forbidden --> $DIR/return_pointer_aliasing2.rs:LL:CC | LL | unsafe { ptr.write(0) }; - | ^^^^^^^^^^^^ write access through (root of the allocation) is forbidden + | ^^^^^^^^^^^^ write access through (root of the allocation) at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag (root of the allocation) is foreign to the protected tag (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/tree_borrows/alternate-read-write.stderr b/src/tools/miri/tests/fail/tree_borrows/alternate-read-write.stderr index 58d22c5641fbc..98371cbe7a262 100644 --- a/src/tools/miri/tests/fail/tree_borrows/alternate-read-write.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/alternate-read-write.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/alternate-read-write.rs:LL:CC | LL | *y += 1; // Failure - | ^^^^^^^ write access through is forbidden + | ^^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/tree_borrows/children-can-alias.uniq.stderr b/src/tools/miri/tests/fail/tree_borrows/children-can-alias.uniq.stderr index be85e1a1cee41..cc1fea30f53e4 100644 --- a/src/tools/miri/tests/fail/tree_borrows/children-can-alias.uniq.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/children-can-alias.uniq.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/children-can-alias.rs:LL:CC | LL | child2.write(2); - | ^^^^^^^^^^^^^^^ write access through is forbidden + | ^^^^^^^^^^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/tree_borrows/error-range.stderr b/src/tools/miri/tests/fail/tree_borrows/error-range.stderr index a03869f33bb9f..37f0b9b62b037 100644 --- a/src/tools/miri/tests/fail/tree_borrows/error-range.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/error-range.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: read access through is forbidden +error: Undefined Behavior: read access through at ALLOC[0x5] is forbidden --> $DIR/error-range.rs:LL:CC | LL | rmut[5] += 1; - | ^^^^^^^^^^^^ read access through is forbidden + | ^^^^^^^^^^^^ read access through at ALLOC[0x5] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/tree_borrows/fnentry_invalidation.stderr b/src/tools/miri/tests/fail/tree_borrows/fnentry_invalidation.stderr index 7df6cd9d9238d..dd5d27107fe8e 100644 --- a/src/tools/miri/tests/fail/tree_borrows/fnentry_invalidation.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/fnentry_invalidation.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/fnentry_invalidation.rs:LL:CC | LL | *z = 2; - | ^^^^^^ write access through is forbidden + | ^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Frozen which forbids this child write access diff --git a/src/tools/miri/tests/fail/tree_borrows/outside-range.stderr b/src/tools/miri/tests/fail/tree_borrows/outside-range.stderr index 5644862d23e70..715228028bc4b 100644 --- a/src/tools/miri/tests/fail/tree_borrows/outside-range.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/outside-range.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x3] is forbidden --> $DIR/outside-range.rs:LL:CC | LL | *y.add(3) = 42; - | ^^^^^^^^^^^^^^ write access through is forbidden + | ^^^^^^^^^^^^^^ write access through at ALLOC[0x3] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is foreign to the protected tag (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/tree_borrows/parent_read_freezes_raw_mut.stderr b/src/tools/miri/tests/fail/tree_borrows/parent_read_freezes_raw_mut.stderr index a9d5b0a68c154..87844ff401123 100644 --- a/src/tools/miri/tests/fail/tree_borrows/parent_read_freezes_raw_mut.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/parent_read_freezes_raw_mut.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/parent_read_freezes_raw_mut.rs:LL:CC | LL | *ptr = 0; - | ^^^^^^^^ write access through is forbidden + | ^^^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Frozen which forbids this child write access diff --git a/src/tools/miri/tests/fail/tree_borrows/pass_invalid_mut.stderr b/src/tools/miri/tests/fail/tree_borrows/pass_invalid_mut.stderr index 32cf1c18cde7c..84fbc91e686cf 100644 --- a/src/tools/miri/tests/fail/tree_borrows/pass_invalid_mut.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/pass_invalid_mut.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/pass_invalid_mut.rs:LL:CC | LL | *nope = 31; - | ^^^^^^^^^^ write access through is forbidden + | ^^^^^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/tree_borrows/reserved/cell-protected-write.stderr b/src/tools/miri/tests/fail/tree_borrows/reserved/cell-protected-write.stderr index ba6c30cf9354e..7d000ba55e60b 100644 --- a/src/tools/miri/tests/fail/tree_borrows/reserved/cell-protected-write.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/reserved/cell-protected-write.stderr @@ -8,11 +8,11 @@ Warning: this tree is indicative only. Some tags may have been hidden. | RsM | │ └──── Strongly protected | RsM | └──── ────────────────────────────────────────────────── -error: Undefined Behavior: write access through (y, callee:y, caller:y) is forbidden +error: Undefined Behavior: write access through (y, callee:y, caller:y) at ALLOC[0x0] is forbidden --> $DIR/cell-protected-write.rs:LL:CC | LL | *y = 1; - | ^^^^^^ write access through (y, callee:y, caller:y) is forbidden + | ^^^^^^ write access through (y, callee:y, caller:y) at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag (y, callee:y, caller:y) is foreign to the protected tag (callee:x) (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/tree_borrows/reserved/int-protected-write.stderr b/src/tools/miri/tests/fail/tree_borrows/reserved/int-protected-write.stderr index 16081871d9432..41559587bda33 100644 --- a/src/tools/miri/tests/fail/tree_borrows/reserved/int-protected-write.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/reserved/int-protected-write.stderr @@ -8,11 +8,11 @@ Warning: this tree is indicative only. Some tags may have been hidden. | Rs | │ └──── Strongly protected | Rs | └──── ────────────────────────────────────────────────── -error: Undefined Behavior: write access through (y, callee:y, caller:y) is forbidden +error: Undefined Behavior: write access through (y, callee:y, caller:y) at ALLOC[0x0] is forbidden --> $DIR/int-protected-write.rs:LL:CC | LL | *y = 0; - | ^^^^^^ write access through (y, callee:y, caller:y) is forbidden + | ^^^^^^ write access through (y, callee:y, caller:y) at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag (y, callee:y, caller:y) is foreign to the protected tag (callee:x) (i.e., it is not a child) diff --git a/src/tools/miri/tests/fail/tree_borrows/return_invalid_mut.stderr b/src/tools/miri/tests/fail/tree_borrows/return_invalid_mut.stderr index dff2374ba9f45..ca8c45d36f9db 100644 --- a/src/tools/miri/tests/fail/tree_borrows/return_invalid_mut.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/return_invalid_mut.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x4] is forbidden --> $DIR/return_invalid_mut.rs:LL:CC | LL | *ret = 3; - | ^^^^^^^^ write access through is forbidden + | ^^^^^^^^ write access through at ALLOC[0x4] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/tree_borrows/spurious_read.stderr b/src/tools/miri/tests/fail/tree_borrows/spurious_read.stderr index ae61fc030f609..f3934d4cbe579 100644 --- a/src/tools/miri/tests/fail/tree_borrows/spurious_read.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/spurious_read.stderr @@ -11,11 +11,11 @@ Thread 2 executing: ret x Thread 2 executing: write y Thread 1 executing: write y Thread 1 executing: ret y -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/spurious_read.rs:LL:CC | LL | *y = 2; - | ^^^^^^ write access through is forbidden + | ^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Reserved (conflicted) which forbids this child write access diff --git a/src/tools/miri/tests/fail/tree_borrows/strongly-protected.stderr b/src/tools/miri/tests/fail/tree_borrows/strongly-protected.stderr index 4793c2870454b..f0afcc7b3ff1e 100644 --- a/src/tools/miri/tests/fail/tree_borrows/strongly-protected.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/strongly-protected.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: deallocation through is forbidden +error: Undefined Behavior: deallocation through at ALLOC[0x0] is forbidden --> RUSTLIB/alloc/src/alloc.rs:LL:CC | LL | unsafe { __rust_dealloc(ptr, layout.size(), layout.align()) } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through is forbidden + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ deallocation through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the allocation of the accessed tag also contains the strongly protected tag diff --git a/src/tools/miri/tests/fail/tree_borrows/unique.default.stderr b/src/tools/miri/tests/fail/tree_borrows/unique.default.stderr index f058c61ec3b46..bce8cb011f64b 100644 --- a/src/tools/miri/tests/fail/tree_borrows/unique.default.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/unique.default.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/unique.rs:LL:CC | LL | *uniq.as_ptr() = 3; - | ^^^^^^^^^^^^^^^^^^ write access through is forbidden + | ^^^^^^^^^^^^^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Frozen which forbids this child write access diff --git a/src/tools/miri/tests/fail/tree_borrows/unique.uniq.stderr b/src/tools/miri/tests/fail/tree_borrows/unique.uniq.stderr index ba53a87f84ad9..7323cd1c5ad82 100644 --- a/src/tools/miri/tests/fail/tree_borrows/unique.uniq.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/unique.uniq.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: write access through is forbidden +error: Undefined Behavior: write access through at ALLOC[0x0] is forbidden --> $DIR/unique.rs:LL:CC | LL | *uniq.as_ptr() = 2; - | ^^^^^^^^^^^^^^^^^^ write access through is forbidden + | ^^^^^^^^^^^^^^^^^^ write access through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag is a child of the conflicting tag diff --git a/src/tools/miri/tests/fail/tree_borrows/write-during-2phase.stderr b/src/tools/miri/tests/fail/tree_borrows/write-during-2phase.stderr index 35087b1146846..87589299cb168 100644 --- a/src/tools/miri/tests/fail/tree_borrows/write-during-2phase.stderr +++ b/src/tools/miri/tests/fail/tree_borrows/write-during-2phase.stderr @@ -1,8 +1,8 @@ -error: Undefined Behavior: reborrow through is forbidden +error: Undefined Behavior: reborrow through at ALLOC[0x0] is forbidden --> $DIR/write-during-2phase.rs:LL:CC | LL | fn add(&mut self, n: u64) -> u64 { - | ^^^^^^^^^ reborrow through is forbidden + | ^^^^^^^^^ reborrow through at ALLOC[0x0] is forbidden | = help: this indicates a potential bug in the program: it performed an invalid operation, but the Tree Borrows rules it violated are still experimental = help: the accessed tag has state Disabled which forbids this reborrow (acting as a child read access) From 8deb65160307c0cf71b07f5d930cba7ae6344bc1 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 3 Mar 2024 09:00:38 +0100 Subject: [PATCH 18/21] move thread-panic tests to their own file; test getting the thread name --- .../miri/tests/pass/concurrency/simple.rs | 19 -------------- .../miri/tests/pass/concurrency/simple.stderr | 5 ---- .../tests/pass/concurrency/thread_name.rs | 21 ++++++++++++++++ .../miri/tests/pass/panic/thread_panic.rs | 25 +++++++++++++++++++ .../miri/tests/pass/panic/thread_panic.stderr | 5 ++++ 5 files changed, 51 insertions(+), 24 deletions(-) delete mode 100644 src/tools/miri/tests/pass/concurrency/simple.stderr create mode 100644 src/tools/miri/tests/pass/concurrency/thread_name.rs create mode 100644 src/tools/miri/tests/pass/panic/thread_panic.rs create mode 100644 src/tools/miri/tests/pass/panic/thread_panic.stderr diff --git a/src/tools/miri/tests/pass/concurrency/simple.rs b/src/tools/miri/tests/pass/concurrency/simple.rs index ec549a998bae7..46033eea35d1d 100644 --- a/src/tools/miri/tests/pass/concurrency/simple.rs +++ b/src/tools/miri/tests/pass/concurrency/simple.rs @@ -45,23 +45,6 @@ fn create_move_out() { assert_eq!(result.len(), 6); } -fn panic() { - let result = thread::spawn(|| panic!("Hello!")).join().unwrap_err(); - let msg = result.downcast_ref::<&'static str>().unwrap(); - assert_eq!(*msg, "Hello!"); -} - -fn panic_named() { - thread::Builder::new() - .name("childthread".to_string()) - .spawn(move || { - panic!("Hello, world!"); - }) - .unwrap() - .join() - .unwrap_err(); -} - // This is not a data race! fn shared_readonly() { use std::sync::Arc; @@ -89,6 +72,4 @@ fn main() { create_move_in(); create_move_out(); shared_readonly(); - panic(); - panic_named(); } diff --git a/src/tools/miri/tests/pass/concurrency/simple.stderr b/src/tools/miri/tests/pass/concurrency/simple.stderr deleted file mode 100644 index 33d6b6841ade6..0000000000000 --- a/src/tools/miri/tests/pass/concurrency/simple.stderr +++ /dev/null @@ -1,5 +0,0 @@ -thread '' panicked at $DIR/simple.rs:LL:CC: -Hello! -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace -thread 'childthread' panicked at $DIR/simple.rs:LL:CC: -Hello, world! diff --git a/src/tools/miri/tests/pass/concurrency/thread_name.rs b/src/tools/miri/tests/pass/concurrency/thread_name.rs new file mode 100644 index 0000000000000..6dd5f1f5c9149 --- /dev/null +++ b/src/tools/miri/tests/pass/concurrency/thread_name.rs @@ -0,0 +1,21 @@ +use std::thread; + +fn main() { + // When we have not set the name... + thread::spawn(|| { + assert!(thread::current().name().is_none()); + }); + + // ... and when we have set it. + thread::Builder::new() + .name("childthread".to_string()) + .spawn(move || { + assert_eq!(thread::current().name().unwrap(), "childthread"); + }) + .unwrap() + .join() + .unwrap(); + + // Also check main thread name. + assert_eq!(thread::current().name().unwrap(), "main"); +} diff --git a/src/tools/miri/tests/pass/panic/thread_panic.rs b/src/tools/miri/tests/pass/panic/thread_panic.rs new file mode 100644 index 0000000000000..9a3040b2c565a --- /dev/null +++ b/src/tools/miri/tests/pass/panic/thread_panic.rs @@ -0,0 +1,25 @@ +//! Panicking in other threads. + +use std::thread; + +fn panic() { + let result = thread::spawn(|| panic!("Hello!")).join().unwrap_err(); + let msg = result.downcast_ref::<&'static str>().unwrap(); + assert_eq!(*msg, "Hello!"); +} + +fn panic_named() { + thread::Builder::new() + .name("childthread".to_string()) + .spawn(move || { + panic!("Hello, world!"); + }) + .unwrap() + .join() + .unwrap_err(); +} + +fn main() { + panic(); + panic_named(); +} diff --git a/src/tools/miri/tests/pass/panic/thread_panic.stderr b/src/tools/miri/tests/pass/panic/thread_panic.stderr new file mode 100644 index 0000000000000..badd409d13fab --- /dev/null +++ b/src/tools/miri/tests/pass/panic/thread_panic.stderr @@ -0,0 +1,5 @@ +thread '' panicked at $DIR/thread_panic.rs:LL:CC: +Hello! +note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace +thread 'childthread' panicked at $DIR/thread_panic.rs:LL:CC: +Hello, world! From 7f485fc923c10990cd5b12c2e217d54bf00e0b91 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 3 Mar 2024 10:12:19 +0100 Subject: [PATCH 19/21] readme --- src/tools/miri/README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools/miri/README.md b/src/tools/miri/README.md index 2b5ffb1a33d22..5eb8c0fa7c99e 100644 --- a/src/tools/miri/README.md +++ b/src/tools/miri/README.md @@ -412,6 +412,8 @@ to Miri failing to detect cases of undefined behavior in a program. The default is to search for and remove unreachable provenance once every `10000` basic blocks. Setting this to `0` disables the garbage collector, which causes some programs to have explosive memory usage and/or super-linear runtime. +* `-Zmiri-track-alloc-accesses` show not only allocation and free events for tracked allocations, + but also reads and writes. * `-Zmiri-track-alloc-id=,,...` shows a backtrace when the given allocations are 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 From 931e45389a67f2f275d5b3829c227900aeb65514 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 3 Mar 2024 10:27:24 +0100 Subject: [PATCH 20/21] fix wording of alloc access tracking message --- src/tools/miri/src/diagnostics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/miri/src/diagnostics.rs b/src/tools/miri/src/diagnostics.rs index 7afcf919b9183..de0ed879b3666 100644 --- a/src/tools/miri/src/diagnostics.rs +++ b/src/tools/miri/src/diagnostics.rs @@ -562,7 +562,7 @@ impl<'mir, 'tcx> MiriMachine<'mir, 'tcx> { align = align.bytes(), ), AccessedAlloc(AllocId(id), access_kind) => - format!("{access_kind} access to allocation with id {id}"), + format!("{access_kind} to allocation with id {id}"), FreedAlloc(AllocId(id)) => format!("freed allocation with id {id}"), RejectedIsolatedOp(ref op) => format!("{op} was made to return an error due to isolation"), From c72b48778df951b16b2161316d41195b788f7518 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 3 Mar 2024 09:58:27 +0100 Subject: [PATCH 21/21] Windows: support getting the thread name --- src/tools/miri/src/concurrency/data_race.rs | 4 +- src/tools/miri/src/concurrency/thread.rs | 11 ----- src/tools/miri/src/machine.rs | 7 ++- .../miri/src/shims/windows/foreign_items.rs | 40 ++++++++++++++-- .../miri/tests/pass/shims/windows-rand.rs | 6 +-- .../tests/pass/shims/windows-threadname.rs | 46 +++++++++++++++++++ 6 files changed, 94 insertions(+), 20 deletions(-) create mode 100644 src/tools/miri/tests/pass/shims/windows-threadname.rs diff --git a/src/tools/miri/src/concurrency/data_race.rs b/src/tools/miri/src/concurrency/data_race.rs index 1fc702fff56ac..e304488408381 100644 --- a/src/tools/miri/src/concurrency/data_race.rs +++ b/src/tools/miri/src/concurrency/data_race.rs @@ -812,6 +812,7 @@ impl VClockAlloc { | MiriMemoryKind::Miri | MiriMemoryKind::C | MiriMemoryKind::WinHeap + | MiriMemoryKind::WinLocal | MiriMemoryKind::Mmap, ) | MemoryKind::Stack => { @@ -820,7 +821,8 @@ impl VClockAlloc { alloc_timestamp.span = current_span; (alloc_timestamp, alloc_index) } - // Other global memory should trace races but be allocated at the 0 timestamp. + // Other global memory should trace races but be allocated at the 0 timestamp + // (conceptually they are allocated before everything). MemoryKind::Machine( MiriMemoryKind::Global | MiriMemoryKind::Machine diff --git a/src/tools/miri/src/concurrency/thread.rs b/src/tools/miri/src/concurrency/thread.rs index 43278387120cd..83ca27a467c8d 100644 --- a/src/tools/miri/src/concurrency/thread.rs +++ b/src/tools/miri/src/concurrency/thread.rs @@ -981,17 +981,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { this.machine.threads.set_thread_name(thread, new_thread_name); } - #[inline] - fn set_thread_name_wide(&mut self, thread: ThreadId, new_thread_name: &[u16]) { - let this = self.eval_context_mut(); - - // The Windows `GetThreadDescription` shim to get the thread name isn't implemented, so being lossy is okay. - // This is only read by diagnostics, which already use `from_utf8_lossy`. - this.machine - .threads - .set_thread_name(thread, String::from_utf16_lossy(new_thread_name).into_bytes()); - } - #[inline] fn get_thread_name<'c>(&'c self, thread: ThreadId) -> Option<&[u8]> where diff --git a/src/tools/miri/src/machine.rs b/src/tools/miri/src/machine.rs index c411962fcf2e2..d40f1c4525fc2 100644 --- a/src/tools/miri/src/machine.rs +++ b/src/tools/miri/src/machine.rs @@ -113,6 +113,8 @@ pub enum MiriMemoryKind { C, /// Windows `HeapAlloc` memory. WinHeap, + /// Windows "local" memory (to be freed with `LocalFree`) + WinLocal, /// Memory for args, errno, and other parts of the machine-managed environment. /// This memory may leak. Machine, @@ -144,7 +146,7 @@ impl MayLeak for MiriMemoryKind { fn may_leak(self) -> bool { use self::MiriMemoryKind::*; match self { - Rust | Miri | C | WinHeap | Runtime => false, + Rust | Miri | C | WinHeap | WinLocal | Runtime => false, Machine | Global | ExternStatic | Tls | Mmap => true, } } @@ -156,7 +158,7 @@ impl MiriMemoryKind { use self::MiriMemoryKind::*; match self { // Heap allocations are fine since the `Allocation` is created immediately. - Rust | Miri | C | WinHeap | Mmap => true, + Rust | Miri | C | WinHeap | WinLocal | Mmap => true, // Everything else is unclear, let's not show potentially confusing spans. Machine | Global | ExternStatic | Tls | Runtime => false, } @@ -171,6 +173,7 @@ impl fmt::Display for MiriMemoryKind { Miri => write!(f, "Miri bare-metal heap"), C => write!(f, "C heap"), WinHeap => write!(f, "Windows heap"), + WinLocal => write!(f, "Windows local memory"), Machine => write!(f, "machine-managed memory"), Runtime => write!(f, "language runtime memory"), Global => write!(f, "global (static or const)"), diff --git a/src/tools/miri/src/shims/windows/foreign_items.rs b/src/tools/miri/src/shims/windows/foreign_items.rs index 9674b9da686e0..734737a86dd58 100644 --- a/src/tools/miri/src/shims/windows/foreign_items.rs +++ b/src/tools/miri/src/shims/windows/foreign_items.rs @@ -5,6 +5,7 @@ use rustc_span::Symbol; use rustc_target::abi::Size; use rustc_target::spec::abi::Abi; +use crate::shims::os_str::bytes_to_os_str; use crate::*; use shims::foreign_items::EmulateForeignItemResult; use shims::windows::handle::{EvalContextExt as _, Handle, PseudoHandle}; @@ -12,7 +13,11 @@ use shims::windows::sync::EvalContextExt as _; use shims::windows::thread::EvalContextExt as _; fn is_dyn_sym(name: &str) -> bool { - matches!(name, "SetThreadDescription" | "WaitOnAddress" | "WakeByAddressSingle") + // std does dynamic detection for these symbols + matches!( + name, + "SetThreadDescription" | "GetThreadDescription" | "WaitOnAddress" | "WakeByAddressSingle" + ) } impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriInterpCx<'mir, 'tcx> {} @@ -172,6 +177,12 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let res = this.realloc(ptr, size, MiriMemoryKind::WinHeap)?; this.write_pointer(res, dest)?; } + "LocalFree" => { + let [ptr] = this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?; + let ptr = this.read_pointer(ptr)?; + this.free(ptr, MiriMemoryKind::WinLocal)?; + this.write_null(dest)?; + } // errno "SetLastError" => { @@ -403,7 +414,6 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?; let handle = this.read_scalar(handle)?; - let name = this.read_wide_str(this.read_pointer(name)?)?; let thread = match Handle::from_scalar(handle, this)? { @@ -412,7 +422,31 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { _ => this.invalid_handle("SetThreadDescription")?, }; - this.set_thread_name_wide(thread, &name); + // FIXME: use non-lossy conversion + this.set_thread_name(thread, String::from_utf16_lossy(&name).into_bytes()); + + this.write_null(dest)?; + } + "GetThreadDescription" => { + let [handle, name_ptr] = + this.check_shim(abi, Abi::System { unwind: false }, link_name, args)?; + + let handle = this.read_scalar(handle)?; + let name_ptr = this.deref_pointer(name_ptr)?; // the pointer where we should store the ptr to the name + + let thread = match Handle::from_scalar(handle, this)? { + Some(Handle::Thread(thread)) => thread, + Some(Handle::Pseudo(PseudoHandle::CurrentThread)) => this.get_active_thread(), + _ => this.invalid_handle("SetThreadDescription")?, + }; + // Looks like the default thread name is empty. + let name = this.get_thread_name(thread).unwrap_or(b"").to_owned(); + let name = this.alloc_os_str_as_wide_str( + bytes_to_os_str(&name)?, + MiriMemoryKind::WinLocal.into(), + )?; + + this.write_scalar(Scalar::from_maybe_pointer(name, this), &name_ptr)?; this.write_null(dest)?; } diff --git a/src/tools/miri/tests/pass/shims/windows-rand.rs b/src/tools/miri/tests/pass/shims/windows-rand.rs index 5754a82d89050..cfbc1d278a932 100644 --- a/src/tools/miri/tests/pass/shims/windows-rand.rs +++ b/src/tools/miri/tests/pass/shims/windows-rand.rs @@ -1,4 +1,4 @@ -//@only-target-windows: this directly tests windows only random functions +//@only-target-windows: this directly tests windows-only functions use core::ffi::c_void; use core::mem::size_of_val; use core::ptr::null_mut; @@ -26,12 +26,12 @@ extern "system" { #[cfg(target_arch = "x86")] #[link(name = "bcryptprimitives", kind = "raw-dylib", import_name_type = "undecorated")] extern "system" { - pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL; + fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL; } #[cfg(not(target_arch = "x86"))] #[link(name = "bcryptprimitives", kind = "raw-dylib")] extern "system" { - pub fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL; + fn ProcessPrng(pbdata: *mut u8, cbdata: usize) -> BOOL; } fn main() { diff --git a/src/tools/miri/tests/pass/shims/windows-threadname.rs b/src/tools/miri/tests/pass/shims/windows-threadname.rs new file mode 100644 index 0000000000000..c863ac670b6d5 --- /dev/null +++ b/src/tools/miri/tests/pass/shims/windows-threadname.rs @@ -0,0 +1,46 @@ +//@only-target-windows: this directly tests windows-only functions + +use std::ffi::OsStr; +use std::os::windows::ffi::OsStrExt; + +use core::ffi::c_void; +type HANDLE = *mut c_void; +type PWSTR = *mut u16; +type PCWSTR = *const u16; +type HRESULT = i32; +type HLOCAL = *mut ::core::ffi::c_void; +extern "system" { + fn GetCurrentThread() -> HANDLE; + fn GetThreadDescription(hthread: HANDLE, lpthreaddescription: *mut PWSTR) -> HRESULT; + fn SetThreadDescription(hthread: HANDLE, lpthreaddescription: PCWSTR) -> HRESULT; + fn LocalFree(hmem: HLOCAL) -> HLOCAL; +} + +fn to_u16s>(s: S) -> Vec { + let mut result: Vec<_> = s.as_ref().encode_wide().collect(); + result.push(0); + result +} + +fn main() { + unsafe { + let name = c"mythreadname"; + + let utf16 = to_u16s(name.to_str().unwrap()); + SetThreadDescription(GetCurrentThread(), utf16.as_ptr()); + + let mut ptr = core::ptr::null_mut::(); + let result = GetThreadDescription(GetCurrentThread(), &mut ptr); + assert!(result >= 0); + let name_gotten = String::from_utf16_lossy({ + let mut len = 0; + while *ptr.add(len) != 0 { + len += 1; + } + core::slice::from_raw_parts(ptr, len) + }); + assert_eq!(name_gotten, name.to_str().unwrap()); + let r = LocalFree(ptr.cast()); + assert!(r.is_null()); + } +}