Skip to content

Commit 9c07581

Browse files
committed
Pass dest place to all FileDescription::write
1 parent 5acadca commit 9c07581

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

src/shims/unix/fd.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ pub trait FileDescription: std::fmt::Debug + Any {
4444
_self_ref: &FileDescriptionRef,
4545
_communicate_allowed: bool,
4646
_bytes: &[u8],
47+
_dest: &MPlaceTy<'tcx>,
4748
_ecx: &mut MiriInterpCx<'tcx>,
4849
) -> InterpResult<'tcx, io::Result<usize>> {
4950
throw_unsup_format!("cannot write to {}", self.name());
@@ -159,6 +160,7 @@ impl FileDescription for io::Stdout {
159160
_self_ref: &FileDescriptionRef,
160161
_communicate_allowed: bool,
161162
bytes: &[u8],
163+
_dest: &MPlaceTy<'tcx>,
162164
_ecx: &mut MiriInterpCx<'tcx>,
163165
) -> InterpResult<'tcx, io::Result<usize>> {
164166
// We allow writing to stderr even with isolation enabled.
@@ -188,6 +190,7 @@ impl FileDescription for io::Stderr {
188190
_self_ref: &FileDescriptionRef,
189191
_communicate_allowed: bool,
190192
bytes: &[u8],
193+
_dest: &MPlaceTy<'tcx>,
191194
_ecx: &mut MiriInterpCx<'tcx>,
192195
) -> InterpResult<'tcx, io::Result<usize>> {
193196
// We allow writing to stderr even with isolation enabled.
@@ -214,6 +217,7 @@ impl FileDescription for NullOutput {
214217
_self_ref: &FileDescriptionRef,
215218
_communicate_allowed: bool,
216219
bytes: &[u8],
220+
_dest: &MPlaceTy<'tcx>,
217221
_ecx: &mut MiriInterpCx<'tcx>,
218222
) -> InterpResult<'tcx, io::Result<usize>> {
219223
// We just don't write anything, but report to the user that we did.
@@ -623,7 +627,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
623627
};
624628

625629
let result = match offset {
626-
None => fd.write(&fd, communicate, &bytes, this),
630+
None => fd.write(&fd, communicate, &bytes, dest, this),
627631
Some(offset) => {
628632
let Ok(offset) = u64::try_from(offset) else {
629633
let einval = this.eval_libc("EINVAL");

src/shims/unix/fs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ impl FileDescription for FileHandle {
5151
_self_ref: &FileDescriptionRef,
5252
communicate_allowed: bool,
5353
bytes: &[u8],
54+
_dest: &MPlaceTy<'tcx>,
5455
_ecx: &mut MiriInterpCx<'tcx>,
5556
) -> InterpResult<'tcx, io::Result<usize>> {
5657
assert!(communicate_allowed, "isolation should have prevented even opening a file");

src/shims/unix/linux/eventfd.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ impl FileDescription for Event {
123123
self_ref: &FileDescriptionRef,
124124
_communicate_allowed: bool,
125125
bytes: &[u8],
126+
_dest: &MPlaceTy<'tcx>,
126127
ecx: &mut MiriInterpCx<'tcx>,
127128
) -> InterpResult<'tcx, io::Result<usize>> {
128129
// Check the size of slice, and return error only if the size of the slice < 8.

src/shims/unix/unnamed_socket.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ impl FileDescription for AnonSocket {
208208
_self_ref: &FileDescriptionRef,
209209
_communicate_allowed: bool,
210210
bytes: &[u8],
211+
_dest: &MPlaceTy<'tcx>,
211212
ecx: &mut MiriInterpCx<'tcx>,
212213
) -> InterpResult<'tcx, io::Result<usize>> {
213214
let write_size = bytes.len();

0 commit comments

Comments
 (0)