Skip to content

Do not use cpuid on Miri #1214

@AaronKutch

Description

@AaronKutch

When trying to run certain things on Miri, it will fail because cpuid assembly is being called somewhere. This should be configured out for the case where Miri is used. Actually, there is probably a bad default to begin with if it is using inline assembly at all, it should be falling back to entirely generic code unless a known architecture is being compiled for.

home/aaron/.rustup/toolchains/nightly-2025-08-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/x86/cpuid.rs:75:9
    |
 75 | /         asm!(
 76 | |             "mov {0:r}, rbx",
 77 | |             "cpuid",
 78 | |             "xchg {0:r}, rbx",
...   |
 83 | |             options(nostack, preserves_flags),
 84 | |         );
    | |_________^ unsupported operation occurred here
    |
    = help: this is likely not a bug in the program; it indicates that the program performed an operation that Miri does not support
    = note: BACKTRACE on thread 
    = note: inside `std::arch::x86_64::__cpuid_count` at /home/aaron/.rustup/toolchains/nightly-2025-08-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/x86/cpuid.rs:75:9: 84:10
    = note: inside `std::arch::x86_64::__cpuid` at /home/aaron/.rustup/toolchains/nightly-2025-08-20-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/x86/cpuid.rs:94:5: 94:27
    = note: inside `libcrux_platform::x86::init::cpuid` at /home/aaron/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libcrux-platform-0.0.2/src/x86.rs:123:9: 123:22
    = note: inside `libcrux_platform::x86::init` at /home/aaron/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libcrux-platform-0.0.2/src/x86.rs:136:19: 136:27
    = note: inside `libcrux_platform::x86::supported` at /home/aaron/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libcrux-platform-0.0.2/src/x86.rs:49:5: 49:11
    = note: inside `libcrux_platform::platform::simd256_support` at /home/aaron/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/libcrux-platform-0.0.2/src/lib.rs:92:16: 92:48
    = note: inside `libcrux_ml_kem::ind_cca::multiplexing::generate_keypair:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions