Skip to content
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

SIGSEV on stable (1.74.0) #118619

Closed
TTDRosen opened this issue Dec 4, 2023 · 6 comments
Closed

SIGSEV on stable (1.74.0) #118619

TTDRosen opened this issue Dec 4, 2023 · 6 comments
Labels
C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-riscv Target: RISC-V architecture T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@TTDRosen
Copy link

TTDRosen commented Dec 4, 2023

When running the rust compiler under the qemu-system-riscv64 emulator I get a SIGSEV crash. This same crash can also be seen on real riscv hardware when running ubuntu-23.10.

Code

The crash seems to happen before code has compiled so any program will cause a similar crash.

fn main() {}

Meta

This happened on every version of rust that I tried

rustc 1.74.0 (79e9716c9 2023-11-13)
binary: rustc
commit-hash: 79e9716c980570bfd1f666e3b16ac583f0168962
commit-date: 2023-11-13
host: riscv64gc-unknown-linux-gnu
release: 1.74.0
LLVM version: 17.0.4

Error output

error: rustc interrupted by SIGSEGV, printing backtrace

/home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-32688bc33ce513ef.so(+0xbcb99a)[0x7fff9f9cb99a]
linux-vdso.so.1(__vdso_rt_sigreturn+0x0)[0x7fffa7313800]
/lib/riscv64-linux-gnu/libc.so.6(read+0x44)[0x7fff9ebeaece]
/home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/libstd-3fecb5e5a54e748b.so(_ZN3std3sys4unix2fs4File4read17h96a5ba4bb0c3f6c1E+0x26)[0x7fff9ed41058]
/home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-32688bc33ce513ef.so(+0x532e27a)[0x7fffa412e27a]
/home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-32688bc33ce513ef.so(+0x532d268)[0x7fffa412d268]
/home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-32688bc33ce513ef.so(+0x532f06e)[0x7fffa412f06e]
/home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-32688bc33ce513ef.so(+0x532f0c2)[0x7fffa412f0c2]
/home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-32688bc33ce513ef.so(+0x532f8fa)[0x7fffa412f8fa]
/home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-32688bc33ce513ef.so(+0x533089e)[0x7fffa413089e]
/home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/libstd-3fecb5e5a54e748b.so(rust_metadata_std_8ca29eab19a61e15+0xaebf0)[0x7fff9ed46bf0]
/lib/riscv64-linux-gnu/libc.so.6(+0x6a956)[0x7fff9eba0956]
/lib/riscv64-linux-gnu/libc.so.6(+0xbbbf0)[0x7fff9ebf1bf0]

@TTDRosen TTDRosen added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 4, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Dec 4, 2023
@bjorn3
Copy link
Member

bjorn3 commented Dec 4, 2023

Can you get a backtrace using gdb? The backtrace printed by the SIGSEGV handler uses frame pointers, which is not all that accurate given that rustc is compiled without frame pointers. And it misses symbols for most frames.

@TTDRosen
Copy link
Author

TTDRosen commented Dec 4, 2023

This is the backtrace I got from gdb

Thread 3 "rustc" received signal SIGSEGV, Segmentation fault.
syscall (syscall_number=98, arg1=<optimized out>, arg2=137, arg3=2, arg4=0, arg5=0, arg6=-1, arg7=98) at ../sysdeps/unix/sysv/linux/riscv/syscall.c:27
27	in ../sysdeps/unix/sysv/linux/riscv/syscall.c
(gdb) bt
#0  syscall (syscall_number=98, arg1=<optimized out>, arg2=137, arg3=2, arg4=0, arg5=0, arg6=-1, arg7=98) at ../sysdeps/unix/sysv/linux/riscv/syscall.c:27
#1  0x00007ffff7f1e09e in std::sys::unix::futex::futex_wait () at library/std/src/sys/unix/futex.rs:62
#2  std::sys::unix::locks::futex_condvar::Condvar::wait_optional_timeout () at library/std/src/sys/unix/locks/futex_condvar.rs:49
#3  std::sys::unix::locks::futex_condvar::Condvar::wait () at library/std/src/sys/unix/locks/futex_condvar.rs:33
#4  0x00007ffff4d2d230 in <jobserver::HelperState>::for_each_request::<jobserver::imp::spawn_helper::{closure#1}::{closure#0}> ()
   from /home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-32688bc33ce513ef.so
#5  0x00007ffff4d2f06e in std::sys_common::backtrace::__rust_begin_short_backtrace::<jobserver::imp::spawn_helper::{closure#1}, ()> ()
   from /home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-32688bc33ce513ef.so
#6  0x00007ffff4d2f0c2 in std::panicking::try::do_call::<core::panic::unwind_safe::AssertUnwindSafe<<std::thread::Builder>::spawn_unchecked_<jobserver::imp::spawn_helper::{closure#1}, ()>::{closure#1}::{closure#0}>, ()> () from /home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-32688bc33ce513ef.so
#7  0x00007ffff4d2f8fa in __rust_try.llvm.14045574179110023769 () from /home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-32688bc33ce513ef.so
#8  0x00007ffff4d3089e in <<std::thread::Builder>::spawn_unchecked_<jobserver::imp::spawn_helper::{closure#1}, ()>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} () from /home/ubuntu/.rustup/toolchains/stable-riscv64gc-unknown-linux-gnu/bin/../lib/librustc_driver-32688bc33ce513ef.so
#9  0x00007ffff7f1cbf0 in alloc::boxed::{impl#47}::call_once<(), dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global> () at library/alloc/src/boxed.rs:2007
#10 alloc::boxed::{impl#47}::call_once<(), alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output=()>, alloc::alloc::Global>, alloc::alloc::Global> ()
    at library/alloc/src/boxed.rs:2007
#11 std::sys::unix::thread::{impl#2}::new::thread_start () at library/std/src/sys/unix/thread.rs:108
#12 0x00007fffef908956 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:444
#13 0x00007fffef959bf0 in __thread_start_clone3 () at ../sysdeps/unix/sysv/linux/riscv/clone3.S:71

@bjorn3 bjorn3 added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-riscv Target: RISC-V architecture I-prioritize Issue: Indicates that prioritization has been requested for this issue. and removed I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Dec 4, 2023
@TTDRosen
Copy link
Author

TTDRosen commented Dec 4, 2023

For a bit more context, I ran under strace and the last output was futex(0x7fff77e23d10, FUTEX_WAIT_BITSET|FUTEX_CLOCK_REALTIME, 16924, NULL, FUTEX_BITSET_MATCH_ANYerror: rustc interrupted by SIGSEGV, printing backtrace

@saethlin
Copy link
Member

saethlin commented Dec 5, 2023

This looks like a duplicate of #117022

@apiraino
Copy link
Contributor

apiraino commented Dec 5, 2023

yes, very likely. I'm also confident enough this is a duplicate so closing. Feel free to reopen if it's not the case.

@TTDRosen do you have a chance to test against another Ubuntu RISCV distribution (see comment)?

@apiraino apiraino closed this as not planned Won't fix, can't repro, duplicate, stale Dec 5, 2023
@apiraino apiraino removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Dec 5, 2023
@TTDRosen
Copy link
Author

TTDRosen commented Dec 5, 2023

Yes, reverting to an older Ubuntu install seems to have solved the problem.

Thanks for the help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-riscv Target: RISC-V architecture T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants