-
Notifications
You must be signed in to change notification settings - Fork 13.3k
In cross-compiled i686->x86_64 code, thread::spawn crashes on my system #31139
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
Comments
Is there a way that this could be reproduced locally? Either through a VM or perhaps a docker container? |
What shall be in the VM? Just a minimal system to reproduce the crash itself or also full Rust toolchain? |
You can try yourself by downloading the qcow2 image. Select amd64 kernel in grub, use root:root to login. I'll add the link soonish. |
Link to the VM image (not sure if the link will actually download): magnet:?xt=urn:btih:e0493de828e6a0b569c26d66190844f76c899f0c&tr=http%3A%2F%2Ftracker.nl-2000.com%3A6969%2Fannounce%00 |
Alternative easier link: http://vi-server.org/pub/debian_wheezy_i386+amd64_rust.qcow2 |
@vi your linked donwloaded ok but I unfortunately can't seem to reproduce just yet, I'm getting:
Is there a special way that qemu needs to be invoked or is there something else going on? |
Have you did this? It's not default. There is GRUB menu at start of the VM. |
Hm no, I only have a |
You can make amd64 kernel to boot by default.
|
You can also update the image (I performed and uploaded those changes): rsync://vi-server.org/pub/debian_wheezy_i386+amd64_rust.qcow2 |
cc @pnkfelix, this looks like a bug in dropck maybe? This is reproducible (on linux) via: os=unknown-linux-gnu
target=x86_64-$os
host=i686-$os
curl https://static.rust-lang.org/dist/rustc-nightly-$host.tar.gz | tar xzf -
./rustc-nightly-$host/install.sh --prefix=install
curl https://static.rust-lang.org/dist/rust-std-nightly-$target.tar.gz | \
tar xzf - --strip-components=4 -C install/lib/rustlib \
rust-std-nightly-$target/rust-std-$target/lib/rustlib
echo 'fn main() { std::thread::spawn(|| {}).join().unwrap(); }' |
PATH=`pwd`/install/bin:$PATH \
LD_LIBRARY_PATH=`pwd`/install/lib \
rustc - -o foo --target $target
./foo It looks like this is a bug with any 32->64 compilation, and at least on Linux for me the faulting instruction is:
Seems suspicious! |
triage: I-nominated |
also just cc @rust-lang/compiler |
By dropck, I guess you mean a potential buy in the translation of drops? |
|
@nikomatsakis oh right sorry, I should have clarified there @dotdash that sounds like it'd do the trick! |
ah yeah I hadn't imagined someone cross-compiling to x64 from i686. Total oversight in my part on making that API. |
triage: P-high |
When cross compiling for a target that has a larger usize type than the host system, we use a truncated value to mark data as dropped, eventually leading to drop calls on already dropped data. To properly handle this, the drop pattern needs to be of type u64. Since C_integral truncates its given value to the requested size anyway, we can also drop the function that chose between the u32 and u64 values, and always use the u64 constant. Fixes rust-lang#31139
When cross compiling for a target that has a larger usize type than the host system, we use a truncated value to mark data as dropped, eventually leading to drop calls on already dropped data. To properly handle this, the drop pattern needs to be of type u64. Since C_integral truncates its given value to the requested size anyway, we can also drop the function that chose between the u32 and u64 values, and always use the u64 constant. Fixes #31139 r? @pnkfelix
Session:
The text was updated successfully, but these errors were encountered: