miri native_calls: ensure we actually expose *mutable* provenance to the memory FFI can access
This commit is contained in:
parent
705421b522
commit
3846f94230
4 changed files with 12 additions and 3 deletions
|
@ -679,6 +679,11 @@ impl<Prov: Provenance, Extra, Bytes: AllocBytes> Allocation<Prov, Extra, Bytes>
|
|||
// Set provenance of all bytes to wildcard.
|
||||
self.provenance.write_wildcards(self.len());
|
||||
|
||||
// Also expose the provenance of the interpreter-level allocation, so it can
|
||||
// be written by FFI. The `black_box` is defensive programming as LLVM likes
|
||||
// to (incorrectly) optimize away ptr2int casts whose result is unused.
|
||||
std::hint::black_box(self.get_bytes_unchecked_raw_mut().expose_provenance());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue