Stream: cranelift

Topic: rustc 1.70, riscv64, qemu segfault


view this post on Zulip Alex Crichton (Jun 01 2023 at 22:48):

@Afonso Bordado you might be interested in the fact that riscv64 is failing CI with a rustc 1.70 build (which notably contains a LLVM 15->16 upgrade relative to 1.69). I can reproduce this failure locally with ./ci/run-tests.sh using the same version of QEMU as CI. Additionally I get a segfault in QEMU using QEMU 7.2.3 and 8.0.2 (current latest according to their website)

Do you perhaps have actual hardware to test on? I dunno how to get a gdb stack trace from qemu user mode

view this post on Zulip Afonso Bordado (Jun 01 2023 at 22:51):

That's weird. Yeah I can try this on actual hardware tommorow. Might need some help with tracking it down afterwards though.

view this post on Zulip Alex Crichton (Jun 01 2023 at 22:54):

hm ok so I don't know how accurate this is but I used gdb-multiarch locally to attach to qemu and it reports the faulting instruction is ld a0,0(s0) within _ZN5tokio7runtime9scheduler12multi_thread4park6Parker8shutdown17h7a55a0112c28a19dE

view this post on Zulip Alex Crichton (Jun 01 2023 at 22:54):

where s0 is null

view this post on Zulip Alex Crichton (Jun 01 2023 at 22:55):

so this may be "just" an llvm issue

view this post on Zulip Alex Crichton (Jun 01 2023 at 22:55):

(also first time I got gdb and qemu user mode working, wow!)

view this post on Zulip Chris Clark (Jun 02 2023 at 02:04):

turns out, not even cranelift can get away from llvm problems. :laughter_tears:

view this post on Zulip Afonso Bordado (Jun 02 2023 at 14:07):

I've been having some issues running these WASM tests natively, it looks like rustup does not ship rust-lld for riscv64. Is there a guide somewhere on how I can compile that?

view this post on Zulip bjorn3 (Jun 02 2023 at 14:34):

Is it shipped with the llvm-tools component?

view this post on Zulip Afonso Bordado (Jun 02 2023 at 14:36):

Doesen't seem to be. I tried rustup component add llvm-tools-preview and it still doesen't show up in toolchain bin directory

view this post on Zulip Afonso Bordado (Jun 02 2023 at 14:36):

afonso@starfive:~/git/wasmtime$ ls ~/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/
cargo  cargo-clippy  cargo-fmt  clippy-driver  rust-gdb  rust-gdbgui  rust-lldb  rustc  rustdoc  rustfmt

view this post on Zulip Afonso Bordado (Jun 02 2023 at 14:37):

I found a similar issue in the rust-lang repo: https://github.com/rust-lang/rust/issues/111907

rust-lld missing from ~/.cargo/bin (after installing with "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh") Verified this bevavior in a Ubuntu/23.04 guest (QEMU) and Debian/sid on h...

view this post on Zulip Alex Crichton (Jun 02 2023 at 17:36):

Yeah rust-lld is only compiled for a subset of architectures since it adds build time. It's probably "just" a flag somewhere to get it into rustc's distribution, but if it's not there that flag probably isn't flipped. Otherwise though it should still be possible to do ./ci/run-tests.sh --no-run --target ... and scp the cross-compiled binaries perhaps?

view this post on Zulip Alex Crichton (Jun 02 2023 at 18:47):

Along the lines of the s390x issue, looks like 1.71 beta may not have this issue, so may not be much to investigate

view this post on Zulip Afonso Bordado (Jun 03 2023 at 12:40):

So, I've found some slightly weird results. Using rustc 1.70.0 (90c541806 2023-05-31) which seems to be the same as on CI, I can't reproduce this natively, or in QEMU in my machine. Locally the tests run fine.

Additionally I ran the test in CI again. While originally it failed in wasi-preview1-host-in-preview2, it looks like in the latest run it now failed in wasi-http. (neither one crashes natively or on QEMU in my machine).

I also ran a CI run with 1.71 beta, and it looks like its fixed as you mentioned.

Standalone JIT-style runtime for WebAssembly, using Cranelift - test 1.70 · afonso360/wasmtime@da4dd7e
Standalone JIT-style runtime for WebAssembly, using Cranelift - test beta · afonso360/wasmtime@27fc5e6

view this post on Zulip Alex Crichton (Jun 03 2023 at 17:30):

Oh did you disable incremental and debuginfo and enable optimizations locally?

view this post on Zulip Alex Crichton (Jun 03 2023 at 17:31):

CI is a bit funky in that regard

view this post on Zulip Afonso Bordado (Jun 03 2023 at 17:32):

Huh, I didn't know we did that. I'll try that again at least as a sanity check that my setup is working

view this post on Zulip lqd (Jun 03 2023 at 20:22):

Afonso Bordado said:

afonso@starfive:~/git/wasmtime$ ls ~/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/
cargo  cargo-clippy  cargo-fmt  clippy-driver  rust-gdb  rust-gdbgui  rust-lldb  rustc  rustdoc  rustfmt

(note that this is not where rust-lld would be located, but somewhere like ~/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/lib/rustlib/riscv64gc-unknown-linux-gnu/bin/ but I don't believe it's distributed for that target yet)


Last updated: Nov 22 2024 at 16:03 UTC