Skip to content

Commit f359441

Browse files
Rollup merge of #154830 - RalfJung:miri, r=RalfJung
miri subtree update Subtree update of `miri` to rust-lang/miri@ce20bd3. Created using https://github.com/rust-lang/josh-sync. r? @ghost
2 parents b7c319c + 21256d8 commit f359441

15 files changed

Lines changed: 1288 additions & 529 deletions

File tree

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3422,9 +3422,9 @@ dependencies = [
34223422

34233423
[[package]]
34243424
name = "rustc-build-sysroot"
3425-
version = "0.5.12"
3425+
version = "0.5.13"
34263426
source = "registry+https://github.com/rust-lang/crates.io-index"
3427-
checksum = "eec3905e8201688412f6f4b1f6c86d38b3ee6578f59ba85f41330a3af61e8365"
3427+
checksum = "569d545953ee9a1ab9d3e9112e961739ff0cfd50bce06b126937395940be69c9"
34283428
dependencies = [
34293429
"anyhow",
34303430
"rustc_version",

src/tools/miri/.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ jobs:
125125
# Deliberately skipping `./.github/workflows/setup` as we do our own setup
126126
- name: Add cache for cargo
127127
id: cache
128-
uses: actions/cache@v4
128+
uses: actions/cache@v5
129129
with:
130130
path: |
131131
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
@@ -231,7 +231,7 @@ jobs:
231231
exit ${exitcode}
232232
fi
233233
234-
# Store merge commit message
234+
# Store merge commit message
235235
git log -1 --pretty=%B > message.txt
236236
237237
# Format changes

src/tools/miri/.github/workflows/setup/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ runs:
2020
# over time).
2121
- name: Add cache for cargo
2222
id: cache
23-
uses: actions/cache@v4
23+
uses: actions/cache@v5
2424
with:
2525
path: |
2626
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.

src/tools/miri/cargo-miri/Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ dependencies = [
230230

231231
[[package]]
232232
name = "rustc-build-sysroot"
233-
version = "0.5.12"
233+
version = "0.5.13"
234234
source = "registry+https://github.com/rust-lang/crates.io-index"
235-
checksum = "eec3905e8201688412f6f4b1f6c86d38b3ee6578f59ba85f41330a3af61e8365"
235+
checksum = "569d545953ee9a1ab9d3e9112e961739ff0cfd50bce06b126937395940be69c9"
236236
dependencies = [
237237
"anyhow",
238238
"rustc_version",

src/tools/miri/cargo-miri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ directories = "6"
1818
rustc_version = "0.4"
1919
serde_json = "1.0.40"
2020
cargo_metadata = "0.23"
21-
rustc-build-sysroot = "0.5.12"
21+
rustc-build-sysroot = "0.5.13"
2222

2323
# Enable some feature flags that dev-dependencies need but dependencies
2424
# do not. This makes `./miri install` after `./miri build` faster.

src/tools/miri/rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
116458d0a5ae01cd517cabd2d1aee7f5457018ab
1+
55e86c996809902e8bbad512cfb4d2c18be446d9

src/tools/miri/src/shims/files.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::any::Any;
22
use std::collections::BTreeMap;
33
use std::fs::{File, Metadata};
4-
use std::io::{ErrorKind, IsTerminal, Seek, SeekFrom, Write};
4+
use std::io::{ErrorKind, IsTerminal, Read, Seek, SeekFrom, Write};
55
use std::marker::CoercePointee;
66
use std::ops::Deref;
77
use std::rc::{Rc, Weak};
@@ -245,7 +245,8 @@ impl FileDescription for io::Stdin {
245245
helpers::isolation_abort_error("`read` from stdin")?;
246246
}
247247

248-
let result = ecx.read_from_host(&*self, len, ptr)?;
248+
let mut stdin = &*self;
249+
let result = ecx.read_from_host(|buf| stdin.read(buf), len, ptr)?;
249250
finish.call(ecx, result)
250251
}
251252

@@ -356,7 +357,8 @@ impl FileDescription for FileHandle {
356357
) -> InterpResult<'tcx> {
357358
assert!(communicate_allowed, "isolation should have prevented even opening a file");
358359

359-
let result = ecx.read_from_host(&self.file, len, ptr)?;
360+
let mut file = &self.file;
361+
let result = ecx.read_from_host(|buf| file.read(buf), len, ptr)?;
360362
finish.call(ecx, result)
361363
}
362364

@@ -576,14 +578,14 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
576578
/// and return whether that worked.
577579
fn read_from_host(
578580
&mut self,
579-
mut file: impl io::Read,
581+
mut read_cb: impl FnMut(&mut [u8]) -> io::Result<usize>,
580582
len: usize,
581583
ptr: Pointer,
582584
) -> InterpResult<'tcx, Result<usize, IoError>> {
583585
let this = self.eval_context_mut();
584586

585587
let mut bytes = vec![0; len];
586-
let result = file.read(&mut bytes);
588+
let result = read_cb(&mut bytes);
587589
match result {
588590
Ok(read_size) => {
589591
// If reading to `bytes` did not fail, we write those bytes to the buffer.
@@ -596,7 +598,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
596598
}
597599
}
598600

599-
/// Write data to a host `Write` type, withthe bytes taken from machine memory.
601+
/// Write data to a host `Write` type, with the bytes taken from machine memory.
600602
fn write_to_host(
601603
&mut self,
602604
mut file: impl io::Write,

src/tools/miri/src/shims/unix/foreign_items.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,24 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
612612
)?;
613613
this.connect(socket, address, address_len, dest)?;
614614
}
615+
"send" => {
616+
let [socket, buffer, length, flags] = this.check_shim_sig(
617+
shim_sig!(extern "C" fn(i32, *const _, libc::size_t, i32) -> libc::ssize_t),
618+
link_name,
619+
abi,
620+
args,
621+
)?;
622+
this.send(socket, buffer, length, flags, dest)?;
623+
}
624+
"recv" => {
625+
let [socket, buffer, length, flags] = this.check_shim_sig(
626+
shim_sig!(extern "C" fn(i32, *mut _, libc::size_t, i32) -> libc::ssize_t),
627+
link_name,
628+
abi,
629+
args,
630+
)?;
631+
this.recv(socket, buffer, length, flags, dest)?;
632+
}
615633
"setsockopt" => {
616634
let [socket, level, option_name, option_value, option_len] = this.check_shim_sig(
617635
shim_sig!(extern "C" fn(i32, i32, i32, *const _, libc::socklen_t) -> i32),

0 commit comments

Comments
 (0)