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

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

Closed
skade opened this issue Jul 18, 2017 · 5 comments
Closed

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

skade opened this issue Jul 18, 2017 · 5 comments

Comments

@skade
Copy link

skade commented Jul 18, 2017

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.
@RalfJung
Copy link
Member

RalfJung commented Jul 18, 2017

I assume anything but Linux

Certainly not Windows as that's covered by Travis (well only via cross compilation, but that should not make a difference...).
@oli-obk maybe macOS should be corss-tested on Travis as well? Is there any reason this should not work? (Of course it would not have found this bug, but once #202 is solved, it will.)

But it seems that non-Linux unixes still use mmap. Seems we have to revert #239. :(

@skade
Copy link
Author

skade commented Jul 18, 2017

Certainly not Windows as that's covered by Travis.

Ah, sorry 😆 . I had quick glance through the relevant code and from "not linux" followed "everything else". The filename unix.rs should have been a tell that there was some context :).

@oli-obk
Copy link
Contributor

oli-obk commented Jul 18, 2017

We could add a mac Travis in order to prevent such things from happening.

@RalfJung
Copy link
Member

I think we now do have that mac job, and it is passing. Closing the issue.

@skade Please reopen if it still does not work.

@skade
Copy link
Author

skade commented Aug 13, 2018

@RalfJung I recently switched off macOS, so I can't test ;). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants