about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNia Espera <a5b6@riseup.net>2025-07-08 10:47:01 +0200
committerNia Espera <a5b6@riseup.net>2025-07-10 16:33:31 +0200
commit8d0e0c6d6fae36283c11535dcb88b52baf286fc5 (patch)
treea075568015c356f5b5f9c171cceb8183f61364b9 /src
parent2783fc43fd13a669f314742890acd64200ad0bbf (diff)
downloadrust-8d0e0c6d6fae36283c11535dcb88b52baf286fc5.tar.gz
rust-8d0e0c6d6fae36283c11535dcb88b52baf286fc5.zip
interpret/allocation: expose init + write_wildcards on a range
Diffstat (limited to 'src')
-rw-r--r--src/tools/miri/src/shims/native_lib/mod.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tools/miri/src/shims/native_lib/mod.rs b/src/tools/miri/src/shims/native_lib/mod.rs
index 9b30d8ce78b..02c3bde036d 100644
--- a/src/tools/miri/src/shims/native_lib/mod.rs
+++ b/src/tools/miri/src/shims/native_lib/mod.rs
@@ -231,7 +231,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
             .collect::<Vec<libffi::high::Arg<'_>>>();
 
         // Prepare all exposed memory (both previously exposed, and just newly exposed since a
-        // pointer was passed as argument).
+        // pointer was passed as argument). Uninitialised memory is left as-is, but any data
+        // exposed this way is garbage anyway.
         this.visit_reachable_allocs(this.exposed_allocs(), |this, alloc_id, info| {
             // If there is no data behind this pointer, skip this.
             if !matches!(info.kind, AllocKind::LiveData) {
@@ -251,8 +252,8 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
 
             // Prepare for possible write from native code if mutable.
             if info.mutbl.is_mut() {
-                let alloc = &mut this.get_alloc_raw_mut(alloc_id)?.0;
-                alloc.prepare_for_native_access();
+                let (alloc, cx) = this.get_alloc_raw_mut(alloc_id)?;
+                alloc.process_native_write(&cx.tcx, None);
                 // Also expose *mutable* provenance for the interpreter-level allocation.
                 std::hint::black_box(alloc.get_bytes_unchecked_raw_mut().expose_provenance());
             }