Skip to content

Cannot run with libstd MIR on macOS due to stack guards #252

@skade

Description

@skade

Executing any Rust program on macOS (and I assume anything but Linux) leads to the following crash:

[ skade miri ] cargo run --bin miri -- --sysroot ~/.xargo/HOST tests/run-pass/hello.rs
    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs
     Running `target/debug/miri --sysroot /Users/skade/.xargo/HOST tests/run-pass/hello.rs`
WARN:miri::terminator: ignoring C ABI call: pthread_self
WARN:miri::terminator: ignoring C ABI call: pthread_get_stackaddr_np
WARN:miri::terminator: ignoring C ABI call: pthread_self
WARN:miri::terminator: ignoring C ABI call: pthread_get_stacksize_np
error: can't call C ABI function: mmap
   --> /Users/skade/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/sys/unix/thread.rs:283:26
    |
283 |               let result = mmap(stackaddr, psize, PROT_NONE,
    |  __________________________^
284 | |                               MAP_PRIVATE | MAP_ANON | MAP_FIXED, -1, 0);
    | |________________________________________________________________________^
    |
note: inside call to std::sys::imp::thread::guard::init
   --> /Users/skade/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/rt.rs:44:26
    |
44  |         let main_guard = sys::thread::guard::init();
    |                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
note: inside call to std::rt::lang_start
   --> /Users/skade/.rustup/toolchains/nightly-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/rt.rs:32:1
    |
32  | / fn lang_start(main: fn(), argc: isize, argv: *const *const u8) -> isize {
33  | |     use panic;
34  | |     use sys;
35  | |     use sys_common;
...   |
72  | |     }
73  | | }
    | |_^

error: aborting due to previous error

thread 'main' panicked at 'Box<Any>', src/librustc_errors/lib.rs:526:8
note: Run with `RUST_BACKTRACE=1` for a backtrace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions