diff --git a/rust-version b/rust-version index 5d44fe9e4b8..0260e9beab1 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -bf469eb6c20ccea05400a1942c70343f36705e1c +172acf8f61018df3719e42e633ffd62ebecaa1e7 diff --git a/src/shims/posix/fs.rs b/src/shims/posix/fs.rs index 50589ca322d..10f0c910979 100644 --- a/src/shims/posix/fs.rs +++ b/src/shims/posix/fs.rs @@ -831,17 +831,10 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx }; let path = this.read_path_from_c_str(pathname_scalar)?.into_owned(); - // `flags` should be a `c_int` but the `syscall` function provides an `isize`. - let flags: i32 = - this.read_scalar(flags_op)?.to_machine_isize(&*this.tcx)?.try_into().map_err(|e| { - err_unsup_format!("failed to convert pointer sized operand to integer: {}", e) - })?; + // See for a discussion of argument sizes. + let flags = this.read_scalar(flags_op)?.to_i32()?; let empty_path_flag = flags & this.eval_libc("AT_EMPTY_PATH")?.to_i32()? != 0; - // `dirfd` should be a `c_int` but the `syscall` function provides an `isize`. - let dirfd: i32 = - this.read_scalar(dirfd_op)?.to_machine_isize(&*this.tcx)?.try_into().map_err(|e| { - err_unsup_format!("failed to convert pointer sized operand to integer: {}", e) - })?; + let dirfd = this.read_scalar(dirfd_op)?.to_i32()?; // We only support: // * interpreting `path` as an absolute directory, // * interpreting `path` as a path relative to `dirfd` when the latter is `AT_FDCWD`, or diff --git a/src/shims/posix/linux/foreign_items.rs b/src/shims/posix/linux/foreign_items.rs index 23dc02a6aff..45afbd05efc 100644 --- a/src/shims/posix/linux/foreign_items.rs +++ b/src/shims/posix/linux/foreign_items.rs @@ -208,9 +208,8 @@ fn getrandom<'tcx>( // The only supported flags are GRND_RANDOM and GRND_NONBLOCK, // neither of which have any effect on our current PRNG. - let _flags = this.read_scalar(flags)?; - // FIXME: Check that this is an integer type of the right size. - // Currently, some callers pass i32 and some usize, is that even allowed? + // See for a discussion of argument sizes. + let _flags = this.read_scalar(flags)?.to_i32(); this.gen_random(ptr, len)?; this.write_scalar(Scalar::from_machine_usize(len, this), dest)?;