-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Segfault in safe code on Rust nightly when running rustc --emit=asm,link #26235
Comments
Seems to run fine on both 1.0 stable and a nightly on x86_64 Linux. |
Confirmed to segfault on OSX with stable rust. Also confirmed to have different IR with |
Finding it hard to reduce further than this testcase (the usual tricks for getting rid of stuff like fn main() {
use std::thread;
let ref foo = [(0, 0, 0, 0)];
vec![thread::Builder::new().spawn(|| ()).ok()];
{
let mut res = (0, 0, 0, 0);
for s in foo {
res = (s.0, s.1, s.2, s.3);
}
println!("{}{}", res.0, res.1);
}
} |
Interestingly, in a dummy implementation which includes thread::Builder, removing the mutex used for park / unpark seems to make the issue go away (no idea if that's the real problem though). |
I also ran into a segfault with cargo on rust 1.2, but only when installing rust from homebrew. (OSX Yosemite 10.10.4) |
Tagging as unsound due to segfault in stable rust. |
Nominating as this is a soundness bug that has yet to have a priority assigned. |
triage: P-medium Believed to be specific to |
@alexcrichton you're seeing the same asm from --emit=asm because that happens first, because the codegen for the link output breaks things. You do get different asm if you look at the output from |
... that's using |
LLVM doesn't really support reusing the same module to emit more than one file. One bug this causes is that the IR is invalidated by the stack coloring pass when emitting the first file, and then the IR verifier complains by the time we try to emit the second file. Also, we get different binaries with --emit=asm,link than with just --emit=link. In some cases leading to segfaults. Unfortunately, it seems that at this point in time, the most sensible option to circumvent this problem is to just clone the whole llvm module for the asm output if we need both, asm and obj file output. Fixes rust-lang#24876 Fixes rust-lang#26235
LLVM doesn't really support reusing the same module to emit more than one file. One bug this causes is that the IR is invalidated by the stack coloring pass when emitting the first file, and then the IR verifier complains by the time we try to emit the second file. Also, we get different binaries with --emit=asm,link than with just --emit=link. In some cases leading to segfaults. Unfortunately, it seems that at this point in time, the most sensible option to circumvent this problem is to just clone the whole llvm module for the asm output if we need both, asm and obj file output. Fixes rust-lang#24876 Fixes rust-lang#26235
This reliably segfaults for me on a 13 inch 2015 Macbook Air running OS X Yosemite. I'm not sure what the culprit is yet; it might be trans. I haven't tested it with stable yet.
Maybe related to #24876 ?
The text was updated successfully, but these errors were encountered: