-
Notifications
You must be signed in to change notification settings - Fork 394
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
PartialEq
impl for IpAddr
causes SIGBUS
on mips-unknown-linux-gnu
#1060
Comments
We're using the official Ubuntu toolchain for the target, so it's pretty unlikely to be a toolchain issue. I've also been unable to reproduce it locally, but obviously, that doesn't mean the issue doesn't exist. We also use the same toolchain as Rust's Dockerfile in their ci. If you can provide more info on your setup, I might see if I can get a working test case in a VM. I'm also unable to reproduce this on the latest cross with newer images. My information is:
And inside the images:
I have the following use std::net::{IpAddr, Ipv4Addr};
fn main() {
let value = IpAddr::V4(Ipv4Addr::new(31, 41, 59, 26));
assert_eq!(&value, &value);
println!("tests succeeded");
} And then run: $ cross run --target mips-unknown-linux-gnu
Finished dev [unoptimized + debuginfo] target(s) in 0.14s
Running `/qemu-runner mips /target/mips-unknown-linux-gnu/debug/issue_1060`
tests succeeded The only other difference is we use a newer version of Ubuntu (20.04) than the Rust CI Dockerfile (16.04), which was done as part of the update in #591. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Does it produce the same SIGBUS signal? Also, I'd have to imagine it's the |
This will be updated, but this is the systems I've tested. A checked box means it passes:
All are using the latest main images. I'll see if I can reproduce it on my Macbook (x86_64, 2013). The security options are also not causing issues on my Fedora 36 system. |
try with a newer rustc |
(I can get the error with the same versions as you but still, never know) |
It's also not reproducing with 1.61.0, 1.63.0 and 1.64.0 on my machines. |
Oh! I'm getting this error
maybe the fact I can get this to error is not applicable since it's not the same |
Ah that's a different issue. Also, @djkoloski, feel free to send me the output binaries from the test-case that are compiled on your machine to me (ahuszagh@gmail.com). I'd like to test them locally. I'm pretty sure it's an issue of the kernel versions the Docker container is using are different, since that's the only that seems to have changed :/. |
you can also attach them to a message here 👍🏼 |
I think this is either a QEMU issue or a miscompilation, and not a I can get this error without # .cargo/config.coml
[target.mips-unknown-linux-gnu]
linker = "mips-linux-gnu-gcc"
runner = ["qemu-mips", "-L", "/usr/mips-linux-gnu"] (same main.rs as OP, default Cargo.toml; run $ cargo run --target mips-unknown-linux-gnu
Compiling rust-102722 v0.1.0 (/root/rust-102722-mwe)
Finished dev [unoptimized + debuginfo] target(s) in 0.16s
Running `qemu-mips -L /usr/mips-linux-gnu target/mips-unknown-linux-gnu/debug/rust-102722`
qemu: uncaught target signal 10 (Bus error) - core dumped
Bus error (core dumped) On Ubuntu 20.04 with qemu 6.2.0: (no error) $ cargo run --target mips-unknown-linux-gnu
Compiling rust-102722 v0.1.0 (/home/zachary/Programming/mwe/rust-102722)
Finished dev [unoptimized + debuginfo] target(s) in 0.16s
Running `qemu-mips -L /usr/mips-linux-gnu target/mips-unknown-linux-gnu/debug/rust-102722` |
I'll try to get some minimal VMs (not using Docker because I need to ensure the kernel is actually for the host distro it is) for this, copy over the Qemu binaries we have for different versions (great thing is due to the different tags published and that they're statically linked, this is easy), and compile binaries for different versions and detect if this is a cross issue or a Qemu issue. Going to Try with:
On VMs for:
(I might be able to get away with this on WSL2). Compiled Against:
This will be using a 1.64.0 Rust toolchain. |
I'm almost certain this is an odd interaction between Linux (and likely mostly the kernel, since this seems to matter in Docker images of unaffected Ubuntu versions, where the only difference for the same image on different machines is the host kernel), since the Qemu version only matters on Ubuntu 22.04, but not Ubuntu 20.04. Test InformationUsing cross for versions 0.2.4 and the latest main, I did the following: main.rs use std::net::{IpAddr, Ipv4Addr};
fn main() {
let value = IpAddr::V4(Ipv4Addr::new(31, 41, 59, 26));
assert_eq!(&value, &value);
} build cargo install cross
cross build --target mips-unknown-linux-gnu
cp target/mips-unknown-linux-gnu/issue_1060 mips-0.2.4
cargo clean
cargo install cross --git https://github.com/cross-rs/cross
cross build --target mips-unknown-linux-gnu
cp target/mips-unknown-linux-gnu/issue_1060 mips-main Just to confirm the toolchains used and resulting binaries were certainly different, I calculated the hashsums just in case (using the same toolchains with clean builds produced the same sum): $ sha256sum mips_main
e46f7038794e11c6299d19036cd768e664a5f43ddc3802405da942436442094c *mips_main
$ sha256sum mips_0.2.4
0975d99db29702dcf5c95f1f019359975aaf47791941b818974a259592f5fc45 *mips_0.2.4 From here, then on WSL2 I tried the following: apt-get install g++-mips-linux-gnu libc6-dev-mips-cross qemu-user qemu-user-static -y
# ubuntu 22.04 has qemu 7.1.0, 20.04 has 4.2.1
cp /usr/bin/qemu-mips-static qemu-mips-$version
./qemu-mips-4.2.1 -L /usr/mips-linux-gnu mips_main
./qemu-mips-4.2.1 -L /usr/mips-linux-gnu mips_0.2.4
./qemu-mips-7.1.0 -L /usr/mips-linux-gnu mips_main
./qemu-mips-7.1.0 -L /usr/mips-linux-gnu mips_0.2.4 ResultsThe docker results are for runs inside Docker containers with a host of Fedora 36 0.2.4
main
The signal from Ubuntu 20.04 (Docker) is a qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault (core dumped) FilesThese are the attached static qemu builds for 4.2.1 and 7.1.0, as well as the debug builds for the 0.2.4 and main images. |
Checklist
Describe your issue
(originally filed at rust-lang/rust#102722, original text below)
What target(s) are you cross-compiling for?
mips-unknown-linux-gnu
Which operating system is the host (e.g computer cross is on) running?
What architecture is the host?
What container engine is cross using?
cross version
cross 0.2.4 (6ecf9e3 2022-10-4-05)
Example
Additional information / notes
It looks like this is a cross issue, as cross installed with
cargo install
does not exhibit this issue but cross installed withcargo install --git
does. It looks like the QEMU version has been bumped a few times since I can last confirm last passed roughly 25 days ago. However, it could be anything really.The text was updated successfully, but these errors were encountered: