Skip to content

Compiler segfaults when compiling the vte crate for aarch64 #52884

Closed
@cramertj

Description

@cramertj

Only reproduces when doing a debug build of rustc for the aarch64-fuchsia target, the aarch64-unknown-linux-gnu target, and presumably others. rustc produces no output, but returns a failure status code. Building with cargo just says "compiling vte v0.3.2... error: could not compile vte". The log and backtrace can be found here.

To reproduce, run this command, which calls this script, which attempts to compile this crate inside of a fuchsia checkout.

Compiling with cargo build -v shows that there's a SIGSEGV being triggered:

Caused by:
  process didn't exit successfully: `/usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/bin/rustc --crate-name vte vendor/vte/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=7dbc2e4c2a7c8274 -C extra-filename=-7dbc2e4c2a7c8274 --out-dir /usr/local/google/home/cramertj/src/fuchsia/out/arm64/rust_third_party/aarch64-fuchsia/debug/deps --target aarch64-fuchsia -C linker=/usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/clang/bin/clang -L dependency=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/rust_third_party/aarch64-fuchsia/debug/deps -L dependency=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/rust_third_party/debug/deps --extern utf8parse=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/rust_third_party/aarch64-fuchsia/debug/deps/libutf8parse-f80c351b97daf887.rlib --cap-lints allow -Clink-arg=--target=aarch64-fuchsia -Copt-level=0 -Clink-arg=--sysroot=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/sdks/zircon_sysroot/arch/arm64/sysroot -Lnative=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/arm64-shared` (signal: 11, SIGSEGV: invalid memory reference)

Running this rustc command directly shows rustc failing with a segmentation fault:

/usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/bin/rustc --crate-name vte vendor/vte/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=7dbc2e4c2a7c8274 -C extra-filename=-7dbc2e4c2a7c8274 --out-dir /usr/local/google/home/cramertj/src/fuchsia/out/arm64/rust_third_party/aarch64-fuchsia/debug/deps --target aarch64-fuchsia -C linker=/usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/clang/bin/clang -L dependency=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/rust_third_party/aarch64-fuchsia/debug/deps -L dependency=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/rust_third_party/debug/deps --extern utf8parse=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/rust_third_party/aarch64-fuchsia/debug/deps/libutf8parse-f80c351b97daf887.rlib --cap-lints allow -Clink-arg=--target=aarch64-fuchsia -Copt-level=0 -Clink-arg=--sysroot=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/sdks/zircon_sysroot/arch/arm64/sysroot -Lnative=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/arm64-shared
[1]    141780 segmentation fault   --crate-name vte vendor/vte/src/lib.rs --color always --crate-type lib  -C 

Running inside gdb gives

Starting program: /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/bin/rustc --crate-name vte vendor/vte/src/lib.rs --color always --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=7dbc2e4c2a7c8274 -C extra-filename=-7dbc2e4c2a7c8274 --out-dir /usr/local/google/home/cramertj/src/fuchsia/out/arm64/rust_third_party/aarch64-fuchsia/debug/deps --target aarch64-fuchsia -C linker=/usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/clang/bin/clang -L dependency=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/rust_third_party/aarch64-fuchsia/debug/deps -L dependency=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/rust_third_party/debug/deps --extern utf8parse=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/rust_third_party/aarch64-fuchsia/debug/deps/libutf8parse-f80c351b97daf887.rlib --cap-lints allow -Clink-arg=--target=aarch64-fuchsia -Copt-level=0 -Clink-arg=--sysroot=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/sdks/zircon_sysroot/arch/arm64/sysroot -Lnative=/usr/local/google/home/cramertj/src/fuchsia/out/arm64/arm64-shared
Dwarf Error: wrong version in compilation unit header (is 0, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/ef/9474f02d7f7a3959b6dae0afe8e6acee1ac5ba.debug]
Dwarf Error: wrong version in compilation unit header (is 0, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/7b/5f153d3f24f886129354bf9e6a32d01607e87a.debug]
Dwarf Error: wrong version in compilation unit header (is 0, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/18/ad48fb80336dd6554ce9d61ecb3ccb7f6befa3.debug]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Dwarf Error: wrong version in compilation unit header (is 0, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/cb/88f1fe155855433a969d01f052923b299701b8.debug]
Dwarf Error: wrong version in compilation unit header (is 0, should be 2, 3, or 4) [in module /usr/lib/debug/.build-id/45/2d8247a2b64710d413dfc84b6d7c8924aca427.debug]
[New Thread 0x7fffe9bff700 (LWP 148074)]
[New Thread 0x7fffea1ff700 (LWP 148073)]
[New Thread 0x7fffea9fe700 (LWP 148071)]
[New Thread 0x7fffeabff700 (LWP 148070)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe9bff700 (LWP 148074)]
0x00007fffee25db31 in llvm::AArch64RegisterBankInfo::getInstrMapping(llvm::MachineInstr const&) const ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so

That's a failure in llvm::AArch64RegisterBankInfo::getInstrMapping.

Backtrace:

#0  0x00007fffee25db31 in llvm::AArch64RegisterBankInfo::getInstrMapping(llvm::MachineInstr const&) const ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#1  0x00007fffee2a95ab in llvm::RegBankSelect::assignInstr(llvm::MachineInstr&) ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#2  0x00007fffee2a985b in llvm::RegBankSelect::runOnMachineFunction(llvm::MachineFunction&) ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#3  0x00007fffee64c5e1 in llvm::MachineFunctionPass::runOnFunction(llvm::Function&) ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#4  0x00007fffef025b8a in llvm::FPPassManager::runOnFunction(llvm::Function&) ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#5  0x00007fffef025c33 in llvm::FPPassManager::runOnModule(llvm::Module&) ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#6  0x00007fffef02649c in llvm::legacy::PassManagerImpl::run(llvm::Module&) ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#7  0x00007fffedbe035e in LLVMRustWriteOutputFile ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#8  0x00007fffeda9602a in rustc_codegen_llvm::back::write::write_output_file::hc1598394e3dc1211 ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#9  0x00007fffeda887fd in rustc_codegen_llvm::back::write::codegen::_$u7b$$u7b$closure$u7d$$u7d$::hd52935e011270cea ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#10 0x00007fffeda84088 in rustc::util::common::time_ext::h95d6f9755793118d ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#11 0x00007fffeda98317 in rustc_codegen_llvm::back::write::codegen::hb3c2e05dc727551f ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#12 0x00007fffeda9f5c0 in rustc_codegen_llvm::back::write::execute_work_item::hbe07d0cf915f5ac7 ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#13 0x00007fffeda6ce7e in std::sys_common::backtrace::__rust_begin_short_backtrace::h1bfae061eb41ee5c ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#14 0x00007fffeda8fdb8 in std::panicking::try::do_call::hdd25355d6215f15f ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#15 0x00007ffff76ae00a in __rust_maybe_catch_panic ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/bin/../lib/libstd-5fd27a9c989d76ae.so
#16 0x00007fffeda7b581 in _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::h2db209aaa27400ee ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so
#17 0x00007ffff76760ab in std::sys_common::thread::start_thread::hb5e82cfc8bd3d75e ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/bin/../lib/libstd-5fd27a9c989d76ae.so
#18 0x00007ffff7672336 in std::sys::unix::thread::Thread::new::thread_start::h4be83cd1b9373083 ()
   from /usr/local/google/home/cramertj/src/fuchsia/buildtools/linux-x64/rust/bin/../lib/libstd-5fd27a9c989d76ae.so
#19 0x00007ffff1946494 in start_thread (arg=0x7fffe9bff700) at pthread_create.c:333
#20 0x00007ffff7365a8f in clone () from /lib/x86_64-linux-gnu/libc.so.6

This error does not occur on revision 8acec1, so the LLVM 7 upgrade (#51966) might be at fault here (cc @alexcrichton).

Edit: Confirmed-- I bisected this locally to the LLVM 7 upgrade (Fuchsia compiles fine before, compiler segfaults after).

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions