Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Miri subtree update #137542

Closed
wants to merge 70 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
3f57fc1
Preparing for merge from rustc
Feb 3, 2025
45c3b3d
Merge from rustc
Feb 3, 2025
6e94718
Merge pull request #4175 from rust-lang/rustup-2025-02-03
oli-obk Feb 3, 2025
9a858fa
Preparing for merge from rustc
Feb 4, 2025
cf4be3f
Merge from rustc
Feb 4, 2025
8f1c4a3
update JSON target spec to declare softfloat ABI
RalfJung Feb 4, 2025
4d78916
Merge pull request #4176 from rust-lang/rustup-2025-02-04
RalfJung Feb 4, 2025
a2d4f7f
Merge pull request #4177 from psumbera/solaris-no-flock
RalfJung Feb 5, 2025
6b969d7
Preparing for merge from rustc
RalfJung Feb 5, 2025
7f95fa4
Merge from rustc
RalfJung Feb 5, 2025
e58e3d5
bump default max parallelism up to 20
RalfJung Feb 5, 2025
9673d8d
Fix build on Solaris where is no flock().
psumbera Feb 4, 2025
a058e1a
use cfg_match
RalfJung Feb 5, 2025
abe6846
Merge pull request #4178 from RalfJung/rustup
RalfJung Feb 5, 2025
2d7f2ff
allow code to call geteuid()
rayslava Feb 6, 2025
eb41458
Preparing for merge from rustc
Feb 6, 2025
7afb845
Merge from rustc
Feb 6, 2025
8f11cc0
Merge pull request #4180 from rust-lang/rustup-2025-02-06
oli-obk Feb 6, 2025
fd11306
Merge pull request #4179 from rayslava/master
RalfJung Feb 6, 2025
046451d
Throw ub error when invoking non-vararg shim with vararg import
tiif Feb 6, 2025
550d217
inline a once-used function
RalfJung Feb 6, 2025
af04c0d
some more argument checking cleanup
RalfJung Feb 6, 2025
0193a5a
Merge pull request #4181 from tiif/check_shim_variadic
RalfJung Feb 6, 2025
89fd6d0
Preparing for merge from rustc
Feb 7, 2025
1194ad9
Merge from rustc
Feb 7, 2025
1a6fece
fmt
Feb 7, 2025
66c54d9
Merge pull request #4182 from rust-lang/rustup-2025-02-07
RalfJung Feb 7, 2025
2a60a25
Preparing for merge from rustc
Feb 8, 2025
510e844
Merge from rustc
Feb 8, 2025
f22fd36
Merge pull request #4184 from rust-lang/rustup-2025-02-08
saethlin Feb 8, 2025
005508e
Preparing for merge from rustc
Feb 11, 2025
e8cf1d2
Merge from rustc
Feb 11, 2025
2066d6e
Merge pull request #4186 from rust-lang/rustup-2025-02-11
RalfJung Feb 11, 2025
3cee072
Preparing for merge from rustc
Feb 13, 2025
dc8dbd2
Merge from rustc
Feb 13, 2025
09e0696
Merge pull request #4190 from rust-lang/rustup-2025-02-13
RalfJung Feb 13, 2025
f1b4a1d
Remove the build script for miri
bjorn3 Feb 14, 2025
17f218d
Merge pull request #4192 from bjorn3/no_build_script
RalfJung Feb 14, 2025
8b3506c
Preparing for merge from rustc
Feb 15, 2025
626007b
Merge from rustc
Feb 15, 2025
24ccff6
Merge pull request #4194 from rust-lang/rustup-2025-02-15
RalfJung Feb 15, 2025
12a14bb
Preparing for merge from rustc
RalfJung Feb 16, 2025
9ad59e4
Merge from rustc
RalfJung Feb 16, 2025
c75f12b
Merge pull request #4195 from RalfJung/rustup
RalfJung Feb 16, 2025
151477f
apply random float error to most floating-point operations
LorrensP-2158466 Jan 12, 2025
d24ff27
add erf and erfc to nondet tests, and reduce how much we're changing …
RalfJung Feb 16, 2025
9e9c6d3
Merge pull request #4156 from LorrensP-2158466/apply-random-float-error
RalfJung Feb 16, 2025
b705aea
Preparing for merge from rustc
Feb 17, 2025
279607d
Merge from rustc
Feb 17, 2025
3952b58
Merge pull request #4196 from rust-lang/rustup-2025-02-17
saethlin Feb 17, 2025
997f0b4
Preparing for merge from rustc
Feb 19, 2025
d0af071
Merge from rustc
Feb 19, 2025
409351d
Merge pull request #4197 from rust-lang/rustup-2025-02-19
saethlin Feb 19, 2025
f67eb9f
Remove GitHub job summaries
Kobzol Feb 20, 2025
6d7533c
Add explanation comment
Kobzol Feb 20, 2025
6bfaa5a
Merge pull request #4198 from Kobzol/remove-gha-summary
RalfJung Feb 20, 2025
1679035
Resolve some FIXME from socketpair test
tiif Feb 20, 2025
d15e00e
Merge pull request #4199 from tiif/small_fix
RalfJung Feb 21, 2025
ad0810b
Implement vpmaxq_u8 on aarch64
bjorn3 Feb 14, 2025
eb4720d
Fix review comments
bjorn3 Feb 21, 2025
d0dc36e
Add tests
bjorn3 Feb 21, 2025
9374bf7
Preparing for merge from rustc
RalfJung Feb 24, 2025
2a8a9f8
Merge from rustc
RalfJung Feb 24, 2025
f461981
Merge pull request #4203 from RalfJung/rustup
RalfJung Feb 24, 2025
ec480ab
sanity-check for HOST_TARGET
RalfJung Feb 24, 2025
e1aa75e
make sure we install the toolchain for the intended host target
RalfJung Feb 24, 2025
e83fd5f
add missing float non-determinism tests and skip some on i686-pc-wind…
RalfJung Feb 24, 2025
4303a14
slightly extend comment
RalfJung Feb 24, 2025
9c31612
Merge pull request #4205 from RalfJung/host-target
RalfJung Feb 24, 2025
a81d0b5
Merge pull request #4193 from bjorn3/arm64_vpmaxq_u8
RalfJung Feb 24, 2025
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
2 changes: 2 additions & 0 deletions src/tools/miri/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/setup
with:
toolchain_flags: "--host ${{ matrix.host_target }}"

# The `style` job only runs on Linux; this makes sure the Windows-host-specific
# code is also covered by clippy.
Expand Down
6 changes: 5 additions & 1 deletion src/tools/miri/.github/workflows/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: "Miri CI setup"
description: "Sets up Miri CI"
inputs:
toolchain_flags:
required: false
default: ''
runs:
using: "composite"
steps:
Expand Down Expand Up @@ -45,7 +49,7 @@ runs:
echo "Building against latest rustc git version"
git ls-remote https://github.com/rust-lang/rust/ HEAD | cut -f 1 > rust-version
fi
./miri toolchain
./miri toolchain ${{ inputs.toolchain_flags }}
shell: bash

- name: Show Rust version (miri toolchain)
Expand Down
4 changes: 4 additions & 0 deletions src/tools/miri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ default = ["stack-cache"]
stack-cache = []
stack-cache-consistency-check = ["stack-cache"]

[lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = ['cfg(bootstrap)']

# Be aware that this file is inside a workspace when used via the
# submodule in the rustc repo. That means there are many cargo features
# we cannot use, such as profiles.
10 changes: 0 additions & 10 deletions src/tools/miri/build.rs

This file was deleted.

13 changes: 12 additions & 1 deletion src/tools/miri/ci/ci.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
set -euo pipefail
set -eu

function begingroup {
echo "::group::$@"
Expand All @@ -11,6 +11,17 @@ function endgroup {
echo "::endgroup"
}

begingroup "Sanity-check environment"

# Ensure the HOST_TARGET is what it should be.
if ! rustc -vV | grep -q "^host: $HOST_TARGET\$"; then
echo "This runner should be using host target $HOST_TARGET but rustc disagrees:"
rustc -vV
exit 1
fi

endgroup

begingroup "Building Miri"

# Global configuration
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 @@
6dd75f0d6802f56564f5f9c947a85ded286d3986
e0be1a02626abef2878cb7f4aaef7ae409477112
6 changes: 3 additions & 3 deletions src/tools/miri/src/bin/miri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ use std::num::NonZero;
use std::ops::Range;
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::{Arc, Once};
use std::sync::atomic::{AtomicI32, AtomicU32, Ordering};
use std::sync::{Arc, Once};

use miri::{
BacktraceStyle, BorrowTrackerMethod, MiriConfig, MiriEntryFnType, ProvenanceMode, RetagFields,
Expand Down Expand Up @@ -720,8 +720,8 @@ fn main() {

// Ensure we have parallelism for many-seeds mode.
if many_seeds.is_some() && !rustc_args.iter().any(|arg| arg.starts_with("-Zthreads=")) {
// Clamp to 10 threads; things get a lot less efficient beyond that due to lock contention.
let threads = std::thread::available_parallelism().map_or(1, |n| n.get()).min(10);
// Clamp to 20 threads; things get a less efficient beyond that due to lock contention.
let threads = std::thread::available_parallelism().map_or(1, |n| n.get()).min(20);
rustc_args.push(format!("-Zthreads={threads}"));
}
let many_seeds =
Expand Down
69 changes: 37 additions & 32 deletions src/tools/miri/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,20 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
&'a [OpTy<'tcx>; N]: TryFrom<&'a [OpTy<'tcx>]>,
{
self.check_abi_and_shim_symbol_clash(abi, exp_abi, link_name)?;
check_arg_count(args)

if abi.c_variadic {
throw_ub_format!(
"calling a non-variadic function with a variadic caller-side signature"
);
}
if let Ok(ops) = args.try_into() {
return interp_ok(ops);
}
throw_ub_format!(
"incorrect number of arguments for `{link_name}`: got {}, expected {}",
args.len(),
N
)
}

/// Check shim for variadic function.
Expand All @@ -1015,7 +1028,23 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
&'a [OpTy<'tcx>; N]: TryFrom<&'a [OpTy<'tcx>]>,
{
self.check_abi_and_shim_symbol_clash(abi, exp_abi, link_name)?;
check_vargarg_fixed_arg_count(link_name, abi, args)

if !abi.c_variadic {
throw_ub_format!(
"calling a variadic function with a non-variadic caller-side signature"
);
}
if abi.fixed_count != u32::try_from(N).unwrap() {
throw_ub_format!(
"incorrect number of fixed arguments for variadic function `{}`: got {}, expected {N}",
link_name.as_str(),
abi.fixed_count
)
}
if let Some(args) = args.split_first_chunk() {
return interp_ok(args);
}
panic!("mismatch between signature and `args` slice");
}

/// Mark a machine allocation that was just created as immutable.
Expand Down Expand Up @@ -1199,7 +1228,7 @@ impl<'tcx> MiriMachine<'tcx> {
}

/// Check that the number of args is what we expect.
pub fn check_arg_count<'a, 'tcx, const N: usize>(
pub fn check_intrinsic_arg_count<'a, 'tcx, const N: usize>(
args: &'a [OpTy<'tcx>],
) -> InterpResult<'tcx, &'a [OpTy<'tcx>; N]>
where
Expand All @@ -1208,7 +1237,11 @@ where
if let Ok(ops) = args.try_into() {
return interp_ok(ops);
}
throw_ub_format!("incorrect number of arguments: got {}, expected {}", args.len(), N)
throw_ub_format!(
"incorrect number of arguments for intrinsic: got {}, expected {}",
args.len(),
N
)
}

/// Check that the number of varargs is at least the minimum what we expect.
Expand All @@ -1228,34 +1261,6 @@ pub fn check_min_vararg_count<'a, 'tcx, const N: usize>(
)
}

/// Check the number of fixed args of a vararg function.
/// Returns a tuple that consisting of an array of fixed args, and a slice of varargs.
fn check_vargarg_fixed_arg_count<'a, 'tcx, const N: usize>(
link_name: Symbol,
abi: &FnAbi<'tcx, Ty<'tcx>>,
args: &'a [OpTy<'tcx>],
) -> InterpResult<'tcx, (&'a [OpTy<'tcx>; N], &'a [OpTy<'tcx>])> {
if !abi.c_variadic {
throw_ub_format!("calling a variadic function with a non-variadic caller-side signature");
}
if abi.fixed_count != u32::try_from(N).unwrap() {
throw_ub_format!(
"incorrect number of fixed arguments for variadic function `{}`: got {}, expected {N}",
link_name.as_str(),
abi.fixed_count
)
}
if let Some(args) = args.split_first_chunk() {
return interp_ok(args);
}
throw_ub_format!(
"incorrect number of arguments for `{}`: got {}, expected at least {}",
link_name.as_str(),
args.len(),
N
)
}

pub fn isolation_abort_error<'tcx>(name: &str) -> InterpResult<'tcx> {
throw_machine_stop!(TerminationInfo::UnsupportedInIsolation(format!(
"{name} not available when isolation is enabled",
Expand Down
16 changes: 8 additions & 8 deletions src/tools/miri/src/intrinsics/atomic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use rustc_middle::mir::BinOp;
use rustc_middle::{mir, ty};

use self::helpers::check_arg_count;
use self::helpers::check_intrinsic_arg_count;
use crate::*;

pub enum AtomicOp {
Expand Down Expand Up @@ -131,7 +131,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
) -> InterpResult<'tcx> {
let this = self.eval_context_mut();

let [place] = check_arg_count(args)?;
let [place] = check_intrinsic_arg_count(args)?;
let place = this.deref_pointer(place)?;

// Perform atomic load.
Expand All @@ -144,7 +144,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
fn atomic_store(&mut self, args: &[OpTy<'tcx>], atomic: AtomicWriteOrd) -> InterpResult<'tcx> {
let this = self.eval_context_mut();

let [place, val] = check_arg_count(args)?;
let [place, val] = check_intrinsic_arg_count(args)?;
let place = this.deref_pointer(place)?;

// Perform regular load.
Expand All @@ -159,7 +159,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
args: &[OpTy<'tcx>],
atomic: AtomicFenceOrd,
) -> InterpResult<'tcx> {
let [] = check_arg_count(args)?;
let [] = check_intrinsic_arg_count(args)?;
let _ = atomic;
//FIXME: compiler fences are currently ignored
interp_ok(())
Expand All @@ -171,7 +171,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
atomic: AtomicFenceOrd,
) -> InterpResult<'tcx> {
let this = self.eval_context_mut();
let [] = check_arg_count(args)?;
let [] = check_intrinsic_arg_count(args)?;
this.atomic_fence(atomic)?;
interp_ok(())
}
Expand All @@ -185,7 +185,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
) -> InterpResult<'tcx> {
let this = self.eval_context_mut();

let [place, rhs] = check_arg_count(args)?;
let [place, rhs] = check_intrinsic_arg_count(args)?;
let place = this.deref_pointer(place)?;
let rhs = this.read_immediate(rhs)?;

Expand Down Expand Up @@ -226,7 +226,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
) -> InterpResult<'tcx> {
let this = self.eval_context_mut();

let [place, new] = check_arg_count(args)?;
let [place, new] = check_intrinsic_arg_count(args)?;
let place = this.deref_pointer(place)?;
let new = this.read_scalar(new)?;

Expand All @@ -245,7 +245,7 @@ trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
) -> InterpResult<'tcx> {
let this = self.eval_context_mut();

let [place, expect_old, new] = check_arg_count(args)?;
let [place, expect_old, new] = check_intrinsic_arg_count(args)?;
let place = this.deref_pointer(place)?;
let expect_old = this.read_immediate(expect_old)?; // read as immediate for the sake of `binary_op()`
let new = this.read_scalar(new)?;
Expand Down
Loading
Loading