Skip to content

Commit b555b65

Browse files
author
The Miri Cronjob Bot
committed
Merge from rustc
2 parents 74c13a2 + 334de33 commit b555b65

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/shims/native_lib/mod.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
255255
.collect::<Vec<libffi::high::Arg<'_>>>();
256256

257257
// Prepare all exposed memory (both previously exposed, and just newly exposed since a
258-
// pointer was passed as argument).
258+
// pointer was passed as argument). Uninitialised memory is left as-is, but any data
259+
// exposed this way is garbage anyway.
259260
this.visit_reachable_allocs(this.exposed_allocs(), |this, alloc_id, info| {
260261
// If there is no data behind this pointer, skip this.
261262
if !matches!(info.kind, AllocKind::LiveData) {
@@ -275,8 +276,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
275276

276277
// Prepare for possible write from native code if mutable.
277278
if info.mutbl.is_mut() {
278-
let alloc = &mut this.get_alloc_raw_mut(alloc_id)?.0;
279-
alloc.prepare_for_native_access();
279+
let (alloc, cx) = this.get_alloc_raw_mut(alloc_id)?;
280+
alloc.process_native_write(&cx.tcx, None);
280281
// Also expose *mutable* provenance for the interpreter-level allocation.
281282
std::hint::black_box(alloc.get_bytes_unchecked_raw_mut().expose_provenance());
282283
}

tests/ui.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ fn miri_config(
9797
let mut config = Config {
9898
target: Some(target.to_owned()),
9999
program,
100+
// When changing this, remember to also adjust the logic in bootstrap, in Miri's test step,
101+
// that deletes the `miri_ui` dir when it needs a rebuild.
100102
out_dir: PathBuf::from(env!("CARGO_TARGET_TMPDIR")).join("miri_ui"),
101103
threads: std::env::var("MIRI_TEST_THREADS")
102104
.ok()

0 commit comments

Comments
 (0)