Repository navigation
rustc segfault #70117
Copy link
Copy link
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Description
Code
Steps to reproduce are in this comment
and in this comment
Meta
rustc --version --verbose:
rustc 1.42.0 (b8cedc004 2020-03-09)
binary: rustc
commit-hash: b8cedc00407a4c56a3bda1ed605c6fc166655447
commit-date: 2020-03-09
host: x86_64-unknown-linux-gnu
release: 1.42.0
LLVM version: 9.0
and
rustc 1.43.0-nightly (c20d7eecb 2020-03-11)
binary: rustc
commit-hash: c20d7eecbc0928b57da8fe30b2ef8528e2bdd5be
commit-date: 2020-03-11
host: x86_64-unknown-linux-gnu
release: 1.43.0-nightly
LLVM version: 9.0
Error output
gdb backtrace with 1.42.0
Thread 2 "rustc" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffef7ff700 (LWP 258154)]
0x00007ffff482cf95 in __memmove_sse2_unaligned_erms () from /lib64/libc.so.6
(gdb)
(gdb) bt
#0 0x00007ffff482cf95 in __memmove_sse2_unaligned_erms () from /lib64/libc.so.6
#1 0x00007ffff1b70226 in llvm::AttributeList::addAttributes(llvm::LLVMContext&, unsigned int, llvm::AttrBuilder const&) const ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-9-rust-1.42.0-stable.so
#2 0x00007ffff1c4d226 in llvm::Function::addAttributes(unsigned int, llvm::AttrBuilder const&) ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-9-rust-1.42.0-stable.so
#3 0x00007ffff53b7dd0 in LLVMRustAddFunctionAttribute ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#4 0x00007ffff53abd2e in rustc_codegen_llvm::declare::declare_raw_fn ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#5 0x00007ffff528b3f2 in <rustc_codegen_llvm::context::CodegenCx as rustc_codegen_ssa::traits::misc::MiscMethods>::eh_personality ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#6 0x00007ffff5369714 in rustc_codegen_ssa::mir::codegen_mir ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#7 0x00007ffff5287335 in <rustc::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#8 0x00007ffff52509ca in rustc_codegen_llvm::base::compile_codegen_unit::module_codegen ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#9 0x00007ffff52ca460 in rustc::dep_graph::graph::DepGraph::with_task ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#10 0x00007ffff5250624 in rustc_codegen_llvm::base::compile_codegen_unit ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#11 0x00007ffff5321fb6 in rustc_codegen_ssa::base::codegen_crate ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#12 0x00007ffff52b49fe in <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#13 0x00007ffff5126d6f in rustc_session::utils::<impl rustc_session::session::Session>::time ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#14 0x00007ffff51c1de8 in rustc_interface::passes::QueryContext::enter ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#15 0x00007ffff5123a91 in rustc_interface::queries::Queries::ongoing_codegen ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#16 0x00007ffff4f62224 in rustc_interface::interface::run_compiler_in_existing_thread_pool ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#17 0x00007ffff4f5137d in scoped_tls::ScopedKey<T>::set ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#18 0x00007ffff4f4e584 in syntax::with_globals ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#19 0x00007ffff4f523b0 in std::sys_common::backtrace::__rust_begin_short_backtrace ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#20 0x00007ffff4a18b97 in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:86
#21 0x00007ffff4f64449 in core::ops::function::FnOnce::call_once{{vtable-shim}} ()
from /home/harald/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-f0fe6d0442c8c573.so
#22 0x00007ffff49e7e8f in <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once ()
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/liballoc/boxed.rs:1015
#23 0x00007ffff4a177b0 in <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once ()
at /rustc/b8cedc00407a4c56a3bda1ed605c6fc166655447/src/liballoc/boxed.rs:1015
#24 std::sys_common::thread::start_thread () at src/libstd/sys_common/thread.rs:13
#25 std::sys::unix::thread::Thread::new::thread_start () at src/libstd/sys/unix/thread.rs:80
#26 0x00007ffff4968432 in start_thread () from /lib64/libpthread.so.0
#27 0x00007ffff4884833 in clone () from /lib64/libc.so.6
gdb backtrace with 1.43.0-nightly (c20d7ee 2020-03-11)
Thread 2 "rustc" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffef1ff700 (LWP 258633)]
0x00007ffff154a1bd in llvm::AttributeList::addAttributes(llvm::LLVMContext&, unsigned int, llvm::AttrBuilder const&) const ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-9-rust-1.43.0-nightly.so
(gdb) bt
#0 0x00007ffff154a1bd in llvm::AttributeList::addAttributes(llvm::LLVMContext&, unsigned int, llvm::AttrBuilder const&) const ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-9-rust-1.43.0-nightly.so
#1 0x00007ffff1627226 in llvm::Function::addAttributes(unsigned int, llvm::AttrBuilder const&) ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/../lib/libLLVM-9-rust-1.43.0-nightly.so
#2 0x00007ffff4efc5c0 in LLVMRustAddFunctionAttribute ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#3 0x00007ffff4d436c6 in rustc_codegen_llvm::declare::declare_raw_fn ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#4 0x00007ffff4dd4a52 in <rustc_codegen_llvm::context::CodegenCx as rustc_codegen_ssa::traits::misc::MiscMethods>::eh_personality ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#5 0x00007ffff4e39944 in rustc_codegen_ssa::mir::codegen_mir ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#6 0x00007ffff4dc1e7c in <rustc::mir::mono::MonoItem as rustc_codegen_ssa::mono_item::MonoItemExt>::define ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#7 0x00007ffff4d3f71a in rustc_codegen_llvm::base::compile_codegen_unit::module_codegen ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#8 0x00007ffff4e237a1 in rustc::dep_graph::graph::DepGraph::with_task ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#9 0x00007ffff4d3f314 in rustc_codegen_llvm::base::compile_codegen_unit ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#10 0x00007ffff4ea0f5f in rustc_codegen_ssa::base::codegen_crate ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#11 0x00007ffff4e35415 in <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#12 0x00007ffff4cbce16 in rustc_interface::passes::start_codegen ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#13 0x00007ffff4cd0923 in rustc::ty::context::tls::enter_global ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#14 0x00007ffff4be4126 in rustc_interface::queries::Queries::ongoing_codegen ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#15 0x00007ffff4a93ff6 in rustc_interface::interface::run_compiler_in_existing_thread_pool ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#16 0x00007ffff4a47bcd in scoped_tls::ScopedKey<T>::set ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#17 0x00007ffff4a44c14 in rustc_ast::attr::with_globals ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#18 0x00007ffff4a49060 in std::sys_common::backtrace::__rust_begin_short_backtrace ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#19 0x00007ffff43fa697 in __rust_maybe_catch_panic () at src/libpanic_unwind/lib.rs:86
#20 0x00007ffff4a96486 in core::ops::function::FnOnce::call_once{{vtable-shim}} ()
from /home/harald/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/../lib/librustc_driver-5bafe156ff266a09.so
#21 0x00007ffff43c563f in <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once ()
at /rustc/c20d7eecbc0928b57da8fe30b2ef8528e2bdd5be/src/liballoc/boxed.rs:1017
#22 0x00007ffff43f8f9d in <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once ()
at /rustc/c20d7eecbc0928b57da8fe30b2ef8528e2bdd5be/src/liballoc/boxed.rs:1017
#23 std::sys_common::thread::start_thread () at src/libstd/sys_common/thread.rs:13
#24 std::sys::unix::thread::Thread::new::thread_start () at src/libstd/sys/unix/thread.rs:80
#25 0x00007ffff4344432 in start_thread () from /lib64/libpthread.so.0
#26 0x00007ffff4260833 in clone () from /lib64/libc.so.6
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.E-needs-mcveCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleCall for participation: This issue has a repro, but needs a Minimal Complete and Verifiable ExampleI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-highHigh priorityHigh priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.
Activity
haraldh commentedon Mar 18, 2020
haraldh commentedon Mar 18, 2020
oops, corrected backtrace of nightly.. pasted the stable output again.
spastorino commentedon Mar 19, 2020
@haraldh can you share the code that causes this issue?.
spastorino commentedon Mar 19, 2020
triage: we couldn't decide the priority of the issue due to the lack of code. Left nomination so we can check again once we have the code that triggers the issue.
haraldh commentedon Mar 19, 2020
@spastorino:
pnkfelix commentedon Mar 19, 2020
@rustbot ping cleanup-crew
rustbot commentedon Mar 19, 2020
Error: This team (
cleanup-crew) cannot be pinged via this command;it may need to be added totriagebot.tomlon the master branch.Please let
@rust-lang/releaseknow if you're having trouble with this bot.15 remaining items
haraldh commentedon May 5, 2020
Still an issue.. this time with released "stable"
haraldh commentedon May 5, 2020
$ sudo apt-get install musl-tools
$ git clone --single-branch -b rust_segfault https://github.com/haraldh/enarx.git
$ cd enarx/enarx-keep-sev-shim
$ while cargo build -vvv --release ; do cargo clean; done;
haraldh commentedon May 5, 2020
And it's segfaulting way more often, than succeeding.
haraldh commentedon May 5, 2020
haraldh commentedon May 5, 2020
for a successful build I have to do:
❯ while ! cargo build --release ; do :; done;tmiasko commentedon May 9, 2020
There is a mismatch between
rust_eh_personalitydeclared by rustc (which hasi32return type and variadic arguments) and one from the crate. The issue can be reproduced with code below, but observing it might require enabled LLVM assertions:Using the same type signature seems to work fine, although it requires ZST to workaround requirement for at least one named argument.
haraldh commentedon May 12, 2020
Oh, you are right.. I can totally remove it and it does not segfault anymore!
Thanks!
haraldh commentedon May 12, 2020
so, I added
#[cfg(debug_assertions)]torust_eh_personalitybecause it's only needed in the debug profile, and seems to cause the segfault in release.hussein-aitlahcen commentedon Feb 11, 2021
Hi folks, I think I encountered the same issue, I've commented here with a similar stacktrace.