The futex implementation seems to have problems

I saw when trying to run rustc:

I tested on the Gentoo image and the Bianbu image to exclude unexpected problems in the userspace, the only common part is the kernel:

For the Bianbu image:

apt update && apt install curl
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
. "$HOME/.cargo/env"
cargo install starship (or any other crate)
/root/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-dafdbc3029b7490d.so(+0xc66f74)[0x3fa1c0df74]
linux-vdso.so.1(__vdso_rt_sigreturn+0x0)[0x3fa9399800]
/lib/riscv64-linux-gnu/libc.so.6(syscall+0x16)[0x3fa0df27c2]
/root/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/libstd-e6f743a77fe832a8.so(_ZN3std3sys4sync5mutex5futex5Mutex14lock_contended17h42b7c0a92dd4b740E+0x8e)[0x3fa0ee4bbe]
/root/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/libstd-e6f743a77fe832a8.so(_ZN3std3sys4sync7condvar5futex7Condvar4wait17hfb6ea1838bbbabc0E+0x9e)[0x3fa0f1f2a0]
/root/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-dafdbc3029b7490d.so(+0x56d9528)[0x3fa6680528]
/root/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-dafdbc3029b7490d.so(+0x56d9b6c)[0x3fa6680b6c]
/root/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-dafdbc3029b7490d.so(+0x56d9bbc)[0x3fa6680bbc]
/root/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-dafdbc3029b7490d.so(+0x56da068)[0x3fa6681068]
/root/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-dafdbc3029b7490d.so(+0x56daf6c)[0x3fa6681f6c]
/root/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/libstd-e6f743a77fe832a8.so(rust_metadata_std_fcef57a55afbbf4d+0x7beb4)[0x3fa0f1beb4]
/lib/riscv64-linux-gnu/libc.so.6(+0x6a956)[0x3fa0da2956]
/lib/riscv64-linux-gnu/libc.so.6(+0xbc010)[0x3fa0df4010]

what‘s the problem have you encountered?the cargo command does not work well?

I can produce a better backtrace, but it boils down to a call to syscall(SYS_futex) ending up with a segfault.

You may try locally and you should reproduce it, I hadn’t had time to run further tests.

I tested on a musl system instead of glibc and everything works seems working as intended.

Digging further it seems a kernel bug that got fixed in 6.6 217923 – [bisected][regression] rustc userspace crashes on riscv in kernel 6.5 (thanks to bjorn3 for pointing it out)