Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2f6b0b9
Prepare for merging from rust-lang/rust
Aug 26, 2026
7af0b9d
Merge ref '0f33d0912709' from rust-lang/rust
Aug 26, 2026
320e73d
Merge pull request #5288 from rust-lang/rustup-2026-08-26
RalfJung Aug 26, 2026
8899b3a
Prepare for merging from rust-lang/rust
Aug 27, 2026
ae4d3f6
Merge ref 'd9dd0703ba33' from rust-lang/rust
Aug 27, 2026
6b76f62
Merge pull request #5290 from rust-lang/rustup-2026-08-27
RalfJung Aug 27, 2026
447c07c
Prepare for merging from rust-lang/rust
Aug 28, 2026
f59840a
Merge ref 'd0f2ef5e5303' from rust-lang/rust
Aug 28, 2026
0537ad1
fmt
Aug 28, 2026
84eda66
Merge pull request #5292 from rust-lang/rustup-2026-08-28
RalfJung Aug 28, 2026
a19dad7
add chacha20 target feature bug to trophy case
RalfJung Aug 28, 2026
8173a82
Merge pull request #5293 from RalfJung/trophy
RalfJung Aug 28, 2026
6bebbc6
Install cargo tools with locked dependencies
konstin Aug 28, 2026
a7e8b16
Prepare for merging from rust-lang/rust
RalfJung Aug 29, 2026
386ff4d
Merge ref '17fd5b8a37b6' from rust-lang/rust
RalfJung Aug 29, 2026
d40b91f
add FIXME in GetProcAddress
RalfJung Aug 29, 2026
5c00572
genmc: fix incorrect use of ptr size
RalfJung Aug 29, 2026
43ba074
Merge pull request #5295 from konstin/konsti/cargo-install-locked
RalfJung Aug 29, 2026
5eb9288
Merge pull request #5296 from RalfJung/rustup
RalfJung Aug 29, 2026
5110844
remove outdated reference to -Zsaturating-float-casts
hanna-kruppe Aug 29, 2026
b71de26
Merge pull request #5297 from hanna-kruppe/rm-flag-satfpcast
RalfJung Aug 29, 2026
de7ea66
use `portable_simd` `f16` vectors in tests
folkertdev Aug 23, 2026
c56b0dd
further tweaks
RalfJung Sep 1, 2026
b5b163f
Merge pull request #5279 from folkertdev/portable-simd-f16
RalfJung Sep 1, 2026
94834d1
Prepare for merging from rust-lang/rust
Sep 2, 2026
106327c
Merge ref 'edc52f87c28f' from rust-lang/rust
Sep 2, 2026
000f1be
Merge pull request #5300 from rust-lang/rustup-2026-09-02
RalfJung Sep 2, 2026
03d623e
Prepare for merging from rust-lang/rust
RalfJung Sep 3, 2026
e25eb54
Merge ref '2e2b193f8ada' from rust-lang/rust
RalfJung Sep 3, 2026
d80f170
suppress unused_crate_dependencies
RalfJung Sep 3, 2026
0bddb6e
update chacha20 (previous version got yanked)
RalfJung Sep 3, 2026
55daf60
Merge pull request #5302 from RalfJung/rustup
RalfJung Sep 3, 2026
da7e8aa
Prepare for merging from rust-lang/rust
Sep 4, 2026
5c24233
Merge ref 'a69a63265cfd' from rust-lang/rust
Sep 4, 2026
4fcf6aa
Merge pull request #5304 from rust-lang/rustup-2026-09-04
RalfJung Sep 4, 2026
0fae8c9
Prepare for merging from rust-lang/rust
Sep 5, 2026
ed65325
Merge ref '0ed41eb4142d' from rust-lang/rust
Sep 5, 2026
71d9c84
Merge pull request #5307 from rust-lang/rustup-2026-09-05
RalfJung Sep 5, 2026
a6a7ec1
Add `llvm.x86.aesni.aeskeygenassist` support
newpavlov Sep 2, 2026
ec653e0
Merge pull request #5298 from newpavlov/aeskeygenassist
RalfJung Sep 5, 2026
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: 1 addition & 1 deletion src/tools/miri/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ jobs:
- name: Install nightly toolchain
run: rustup toolchain install nightly --profile minimal
- name: Install rustup-toolchain-install-master
run: cargo install -f rustup-toolchain-install-master
run: cargo install --locked -f rustup-toolchain-install-master
# Create a token for the next step so it can create a PR that actually runs CI.
- uses: actions/create-github-app-token@v3
id: app-token
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 @@ -38,7 +38,7 @@ runs:

- name: Install the tools we need
if: steps.cache.outputs.cache-hit != 'true'
run: cargo install -f rustup-toolchain-install-master hyperfine
run: cargo install --locked -f rustup-toolchain-install-master hyperfine
shell: bash

- name: Install "master" toolchain
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/.github/workflows/sysroots.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Build the sysroots
run: |
rustup toolchain install nightly
cargo install -f rustup-toolchain-install-master
cargo install --locked -f rustup-toolchain-install-master
./miri toolchain -c rust-docs # Docs are the only place targets are separated by tier
./miri install
python3 -m pip install beautifulsoup4
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/.gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ image: ubuntu:latest
tasks:
- before: echo "..."
init: |
cargo install rustup-toolchain-install-master
cargo install --locked rustup-toolchain-install-master
./miri toolchain
./miri build
command: echo "Run tests with ./miri test"
2 changes: 1 addition & 1 deletion src/tools/miri/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ and on macOS, `rm -rf ~/Library/Caches/org.rust-lang.miri`).

Miri comes with a few benchmarks; you can run `./miri bench` to run them with the locally built
Miri. Note: this will run `./miri install` as a side-effect. Also requires `hyperfine` to be
installed (`cargo install hyperfine`).
installed (`cargo install --locked hyperfine`).

To compare the benchmark results with a baseline, do the following:
- Before applying your changes, run `./miri bench --save-baseline=baseline.json`.
Expand Down
4 changes: 2 additions & 2 deletions src/tools/miri/Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527"

[[package]]
name = "chacha20"
version = "0.10.1"
version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81"
checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06"
dependencies = [
"cfg-if",
"cpufeatures",
Expand Down
1 change: 1 addition & 0 deletions src/tools/miri/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,7 @@ Definite bugs found:
* [`VecDeque::splice` confusing physical and logical indices](https://github.com/rust-lang/rust/issues/151758)
* [Data race in `oneshot` channel](https://github.com/faern/oneshot/issues/69)
* [Memory leak in serde-yaml-bw](https://github.com/bourumir-wyngs/serde-yaml-bw/issues/197)
* [Incorrect use of SSE4.1 intrinsic in SSE2 backend in chacha20](https://github.com/RustCrypto/stream-ciphers/issues/579)

Violations of [Stacked Borrows] found that are likely bugs (but Stacked Borrows is currently just an experiment):

Expand Down
6 changes: 5 additions & 1 deletion src/tools/miri/cargo-miri/src/phases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -606,13 +606,17 @@ pub fn phase_runner(mut binary_args: impl Iterator<Item = String>, phase: Runner
// We need to remove `--error-format` as cargo specifies that to be JSON,
// but when we run here, cargo does not interpret the JSON any more. `--json`
// then also needs to be dropped.
for arg in &info.args {
// We also need to remove `--force-warn=unused_crate_dependencies` as cargo is not there to
// process the output.
for arg in info.args {
if let Some(suffix) = arg.strip_prefix("--error-format") {
assert!(suffix.starts_with('='));
// Drop this argument.
} else if let Some(suffix) = arg.strip_prefix("--json") {
assert!(suffix.starts_with('='));
// Drop this argument.
} else if arg == "--force-warn=unused_crate_dependencies" {
// Drop this argument.
} else {
cmd.arg(arg);
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/miri-script/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ impl Command {

cmd!(sh, "rustup-toolchain-install-master -n miri -c cargo -c rust-src -c rustc-dev -c llvm-tools -c rustfmt -c clippy {flags...} -- {new_commit}")
.run()
.context("Failed to run rustup-toolchain-install-master. If it is not installed, run 'cargo install rustup-toolchain-install-master'.")?;
.context("Failed to run rustup-toolchain-install-master. If it is not installed, run 'cargo install --locked rustup-toolchain-install-master'.")?;
cmd!(sh, "rustup override set miri").run()?;
// Cleanup.
cmd!(sh, "cargo clean").run()?;
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 @@
9bb55c8c865411b7d9dea6ff743e583d510d89f5
0ed41eb4142dda2df61eb1145a312c1a9d62eb56
5 changes: 2 additions & 3 deletions src/tools/miri/src/concurrency/genmc/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ pub fn scalar_to_genmc_scalar<'tcx>(
let value: u64 = scalar_int.to_uint(scalar_int.size()).try_into().unwrap();
GenmcScalar { value, provenance: 0, is_init: true }
}
rustc_const_eval::interpret::Scalar::Ptr(pointer, size) => {
rustc_const_eval::interpret::Scalar::Ptr(pointer, _ptr_size) => {
// FIXME(genmc,borrow tracking): Borrow tracking information is lost.
let addr = crate::Pointer::from(pointer).addr();
if let crate::Provenance::Wildcard = pointer.provenance {
throw_unsup_format!("Pointers with wildcard provenance not allowed in GenMC mode");
}
let (alloc_id, _size, _prov_extra) =
rustc_const_eval::interpret::Machine::ptr_get_alloc(ecx, pointer, size.into())
.unwrap();
rustc_const_eval::interpret::Machine::ptr_get_alloc(ecx, pointer, 0).unwrap();
let base_addr = ecx.addr_from_alloc_id(alloc_id, None)?;
// Add the base_addr alloc_id pair to the map.
genmc_ctx.exec_state.genmc_shared_allocs_map.borrow_mut().insert(base_addr, alloc_id);
Expand Down
35 changes: 35 additions & 0 deletions src/tools/miri/src/intrinsics/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,41 @@ pub(crate) fn compute_crc32(crc: u32, data: u64, bit_size: u32, polynomial: u128
u32::try_from(dividend).unwrap().reverse_bits()
}

/// AES primitives
pub(crate) mod aes {
/// AES S-box
///
/// Source: [NIST Advanced Encryption Standar][1], Figure 7 (page 16)
///
/// [1]: https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=901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5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08, 0xba, 0x78, 0x25,
0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e,
0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1,
0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb,
0x16,
];

/// Applies S-box substitution to each byte of a 32-bit word
pub(crate) fn sub_word(word: u32) -> u32 {
let bytes = word.to_ne_bytes().map(|b| SBOX[usize::from(b)]);
u32::from_ne_bytes(bytes)
}
}

// sha256 primitives shared by the x86 and aarch64 intrinsics. Math helpers adapted from RustCrypto soft impl:
// https://github.com/RustCrypto/hashes/blob/3d2bc57db40fd6aeb25d6c6da98d67e2784c2985/sha2/src/sha256/soft/compact.rs
pub(crate) mod sha256 {
Expand Down
50 changes: 48 additions & 2 deletions src/tools/miri/src/intrinsics/x86/aesni.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,21 @@ pub(super) trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {

this.write_scalar(Scalar::from_u128(u128::from_le_bytes(state.into())), &dest)?;
}
// TODO: Implement the `llvm.x86.aesni.aeskeygenassist` when possible
// with an external crate.
// Used to implement the _mm_aeskeygenassist_si128 function.
// Assists in expanding the AES cipher key.
"aeskeygenassist" => {
let [ckey, rcon] = this.check_shim_sig_llvm_intrinsic(link_name, args)?;
// Transmute `__m128i` to `u128`.
let ckey = ckey.transmute(this.machine.layouts.u128, this)?;
let dest = dest.transmute(this.machine.layouts.u128, this)?;

let rcon = this.read_scalar(rcon)?.to_u8()?;
let ckey = this.read_scalar(&ckey)?.to_u128()?;

let res = aeskeygenassist(ckey, rcon);

this.write_scalar(Scalar::from_u128(res), &dest)?;
}
_ => return interp_ok(EmulateItemResult::NotSupported),
}
interp_ok(EmulateItemResult::NeedsReturn)
Expand Down Expand Up @@ -152,3 +165,36 @@ fn aes_round<'tcx>(

interp_ok(())
}

/// AES Key Generation Assist
///
/// From [Intel Intrinsics Guide][1]:
/// ```text
/// X3[31:0] := a[127:96]
/// X2[31:0] := a[95:64]
/// X1[31:0] := a[63:32]
/// X0[31:0] := a[31:0]
/// RCON[31:0] := ZeroExtend32(imm8[7:0])
/// dst[31:0] := SubWord(X1)
/// dst[63:32] := RotWord(SubWord(X1)) XOR RCON
/// dst[95:64] := SubWord(X3)
/// dst[127:96] := RotWord(SubWord(X3)) XOR RCON
/// ```
///
/// [1]: https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#text=_mm_aeskeygenassist_si128
#[expect(clippy::as_conversions, reason = "deliberately truncating")]
fn aeskeygenassist(a: u128, rcon: u8) -> u128 {
use crate::intrinsics::math::aes::sub_word;

let rcon = u32::from(rcon);
// TODO: use `truncate` method on stabilization
let x1 = (a >> 32) as u32;
let x3 = (a >> 96) as u32;

let x0 = sub_word(x1);
let x1 = x0.rotate_right(8) ^ rcon;
let x2 = sub_word(x3);
let x3 = x2.rotate_right(8) ^ rcon;

(u128::from(x3) << 96) | (u128::from(x2) << 64) | (u128::from(x1) << 32) | u128::from(x0)
}
6 changes: 2 additions & 4 deletions src/tools/miri/src/shims/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,8 @@ trait EvalContextExtPriv<'tcx>: crate::MiriInterpCxExt<'tcx> {
name if name == this.mangle_internal_symbol(NO_ALLOC_SHIM_IS_UNSTABLE) => {
// This is a no-op shim that only exists to prevent making the allocator shims
// instantly stable.
let [] = this.check_shim_sig(
shim_sig!(extern "Rust" fn() -> ()),
(link_name, abi, args),
)?;
let [] = this
.check_shim_sig(shim_sig!(extern "Rust" fn() -> ()), (link_name, abi, args))?;
}

// Miri-specific extern functions
Expand Down
2 changes: 1 addition & 1 deletion src/tools/miri/src/shims/windows/foreign_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -828,7 +828,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
shim_sig!(extern "system" fn(winapi::HMODULE, *_) -> winapi::FARPROC),
(link_name, abi, args),
)?;
this.read_target_isize(module)?;
this.read_target_isize(module)?; // FIXME validate the module!
let name = this.read_c_str(this.read_pointer(proc_name)?)?;
if let Ok(name) = str::from_utf8(name)
&& is_dyn_sym(name)
Expand Down
3 changes: 3 additions & 0 deletions src/tools/miri/test-cargo-miri/proc-macro-crate/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ proc-macro = true
[dependencies]
# A common dependency of proc macros, let's make sure that works.
proc-macro2 = "1.0"

[lints.cargo]
unused_dependencies = "allow"
2 changes: 1 addition & 1 deletion src/tools/miri/tests/pass/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ where

/// Helper function to avoid promotion so that this tests "run-time" casts, not CTFE.
/// Doesn't make a big difference when running this in Miri, but it means we can compare this
/// with the LLVM backend by running `rustc -Zmir-opt-level=0 -Zsaturating-float-casts`.
/// with the LLVM backend by running `rustc -Zmir-opt-level=0`.
#[track_caller]
#[inline(never)]
fn assert_eq<T: PartialEq + Debug>(x: T, y: T) {
Expand Down
Loading
Loading