Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3422,9 +3422,9 @@ dependencies = [

[[package]]
name = "rustc-build-sysroot"
version = "0.5.12"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eec3905e8201688412f6f4b1f6c86d38b3ee6578f59ba85f41330a3af61e8365"
checksum = "569d545953ee9a1ab9d3e9112e961739ff0cfd50bce06b126937395940be69c9"
dependencies = [
"anyhow",
"rustc_version",
Expand Down
4 changes: 2 additions & 2 deletions src/tools/miri/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
# Deliberately skipping `./.github/workflows/setup` as we do our own setup
- name: Add cache for cargo
id: cache
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: |
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:
exit ${exitcode}
fi

# Store merge commit message
# Store merge commit message
git log -1 --pretty=%B > message.txt

# Format changes
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/.github/workflows/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ runs:
# over time).
- name: Add cache for cargo
id: cache
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: |
# Taken from <https://doc.rust-lang.org/nightly/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci>.
Expand Down
4 changes: 2 additions & 2 deletions src/tools/miri/cargo-miri/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,9 @@ dependencies = [

[[package]]
name = "rustc-build-sysroot"
version = "0.5.12"
version = "0.5.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eec3905e8201688412f6f4b1f6c86d38b3ee6578f59ba85f41330a3af61e8365"
checksum = "569d545953ee9a1ab9d3e9112e961739ff0cfd50bce06b126937395940be69c9"
dependencies = [
"anyhow",
"rustc_version",
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/cargo-miri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ directories = "6"
rustc_version = "0.4"
serde_json = "1.0.40"
cargo_metadata = "0.23"
rustc-build-sysroot = "0.5.12"
rustc-build-sysroot = "0.5.13"

# Enable some feature flags that dev-dependencies need but dependencies
# do not. This makes `./miri install` after `./miri build` faster.
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
116458d0a5ae01cd517cabd2d1aee7f5457018ab
55e86c996809902e8bbad512cfb4d2c18be446d9
14 changes: 8 additions & 6 deletions src/tools/miri/src/shims/files.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::any::Any;
use std::collections::BTreeMap;
use std::fs::{File, Metadata};
use std::io::{ErrorKind, IsTerminal, Seek, SeekFrom, Write};
use std::io::{ErrorKind, IsTerminal, Read, Seek, SeekFrom, Write};
use std::marker::CoercePointee;
use std::ops::Deref;
use std::rc::{Rc, Weak};
Expand Down Expand Up @@ -245,7 +245,8 @@ impl FileDescription for io::Stdin {
helpers::isolation_abort_error("`read` from stdin")?;
}

let result = ecx.read_from_host(&*self, len, ptr)?;
let mut stdin = &*self;
let result = ecx.read_from_host(|buf| stdin.read(buf), len, ptr)?;
finish.call(ecx, result)
}

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

let result = ecx.read_from_host(&self.file, len, ptr)?;
let mut file = &self.file;
let result = ecx.read_from_host(|buf| file.read(buf), len, ptr)?;
finish.call(ecx, result)
}

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

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

/// Write data to a host `Write` type, withthe bytes taken from machine memory.
/// Write data to a host `Write` type, with the bytes taken from machine memory.
fn write_to_host(
&mut self,
mut file: impl io::Write,
Expand Down
18 changes: 18 additions & 0 deletions src/tools/miri/src/shims/unix/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,24 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
)?;
this.connect(socket, address, address_len, dest)?;
}
"send" => {
let [socket, buffer, length, flags] = this.check_shim_sig(
shim_sig!(extern "C" fn(i32, *const _, libc::size_t, i32) -> libc::ssize_t),
link_name,
abi,
args,
)?;
this.send(socket, buffer, length, flags, dest)?;
}
"recv" => {
let [socket, buffer, length, flags] = this.check_shim_sig(
shim_sig!(extern "C" fn(i32, *mut _, libc::size_t, i32) -> libc::ssize_t),
link_name,
abi,
args,
)?;
this.recv(socket, buffer, length, flags, dest)?;
}
"setsockopt" => {
let [socket, level, option_name, option_value, option_len] = this.check_shim_sig(
shim_sig!(extern "C" fn(i32, i32, i32, *const _, libc::socklen_t) -> i32),
Expand Down
Loading
Loading