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

thinlto: Crash during final link #1322

Closed
arndb opened this issue Mar 6, 2021 · 1 comment
Closed

thinlto: Crash during final link #1322

arndb opened this issue Mar 6, 2021 · 1 comment
Labels
Compiler crash This bug makes Clang crash, emitting a backtrace [FEATURE] LTO Related to building the kernel with LLVM Link Time Optimization unreproducible Not or no longer reproducible

Comments

@arndb
Copy link

arndb commented Mar 6, 2021

A randconfig kernel build triggered this bug in llvm during the final link:

ld.lld -m elf_x86_64 --thinlto-cache-dir=.thinlto-cache -mllvm -import-instr-limit=5 -r -o vmlinux.o -T .tmp_initcalls.lds -T .tmp_symversions.lds --whole-archive arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/ebda.o arch/x86/kernel/platform-quirks.o init/built-in.a usr/built-in.a arch/x86/built-in.a kernel/built-in.a certs/built-in.a mm/built-in.a fs/built-in.a ipc/built-in.a security/built-in.a crypto/built-in.a block/built-in.a lib/built-in.a arch/x86/lib/built-in.a lib/lib.a arch/x86/lib/lib.a drivers/built-in.a sound/built-in.a virt/built-in.a arch/x86/pci/built-in.a arch/x86/power/built-in.a --no-whole-archive --start-group --end-group
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0. Running pass 'Function Pass Manager' on module 'mm/built-in.a(gup.o at 2432)'.

  1. Running pass 'CodeGen Prepare' on function '@internal_get_user_pages_fast'
    #0 0x00007f3f3aee90e3 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xc020e3)
    auto update fork #1 0x00007f3f3aee74d0 llvm::sys::RunSignalHandlers() (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xc004d0)
    automated testing #2 0x00007f3f3aee974a (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xc0274a)
    clang validates extended assembly constraints even when -fno-integrated-as is set #3 0x00007f3f3fa7e160 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14160)
    support for "r" prefixed variables in ARM inline assembly #4 0x00007f3f3bf5455b llvm::LoopBase<llvm::BasicBlock, llvm::Loop>::getLoopLatch() const (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0x1c6d55b)
    VLAIS in ExoFS #5 0x00007f3f3b0ee3bf (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xe073bf)
    support for asm goto #6 0x00007f3f3b0decda (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xdf7cda)
    __builtin_constant_p() does not work in deep inline functions #7 0x00007f3f3b0d5613 (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xdee613)
    -Wvla in __compiletime_assert #8 0x00007f3f3b00ef7d llvm::FPPassManager::runOnFunction(llvm::Function&) (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xd27f7d)
    invalid -fmerge-all-constants #9 0x00007f3f3b014a63 llvm::FPPassManager::runOnModule(llvm::Module&) (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xd2da63)
    removed null pointer checks #10 0x00007f3f3b00f5cf llvm::legacy::PassManagerImpl::run(llvm::Module&) (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xd285cf)
    arm64 kvm built with clang doesn't boot #11 0x00007f3f3c076737 (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0x1d8f737)
    assembly: unrecognized token in .rept directive #12 0x00007f3f3c0774f6 (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0x1d904f6)
    [arm64] missing "S" constraint #13 0x00007f3f3c07734b llvm::lto::thinBackend(llvm::lto::Config const&, unsigned int, std::function<std::unique_ptr<llvm::lto::NativeObjectStream, std::default_deletellvm::lto::NativeObjectStream > (unsigned int)>, llvm::Module&, llvm::ModuleSummaryIndex const&, llvm::StringMap<std::unordered_set<unsigned long, std::hash, std::equal_to, std::allocator >, llvm::MallocAllocator> const&, llvm::DenseMap<unsigned long, llvm::GlobalValueSummary*, llvm::DenseMapInfo, llvm::detail::DenseMapPair<unsigned long, llvm::GlobalValueSummary*> > const&, llvm::MapVector<llvm::StringRef, llvm::BitcodeModule, llvm::DenseMap<llvm::StringRef, unsigned int, llvm::DenseMapInfollvm::StringRef, llvm::detail::DenseMapPair<llvm::StringRef, unsigned int> >, std::vector<std::pair<llvm::StringRef, llvm::BitcodeModule>, std::allocator<std::pair<llvm::StringRef, llvm::BitcodeModule> > > >&, std::vector<unsigned char, std::allocator > const&) (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0x1d9034b)
    CONFIG_STACK_VALIDATION=y HOSTCC=clang #14 0x00007f3f3c071778 (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0x1d8a778)
    i915 driver compiler crash #15 0x00007f3f3c07143d (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0x1d8a43d)
    CONFIG_CC_STACKPROTECTOR_STRONG=y and CONFIG_PARAVIRT=y issue #16 0x00007f3f3ae95c8f (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xbaec8f)
    missing gcov support #17 0x00007f3f3ae79367 (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xb92367)
    function attribute no_stack_protector #18 0x00007f3f3fa7b45f __pthread_once_slow ./nptl/pthread_once.c:118:7
    integrated assembler does not support variable assignment #19 0x00007f3f3ae79300 (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xb92300)
    -fzero-call-used-regs=used-gpr #20 0x00007f3f3ae95a3d (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xbaea3d)
    Memory exhausted with integrated assembler #21 0x00007f3f3ae95539 (/lib/x86_64-linux-gnu/libLLVM-13.so.1+0xbae539)
    clang crash compiling binder.o for 32b x86 #22 0x00007f3f3a1a8774 (/lib/x86_64-linux-gnu/libstdc++.so.6+0xda774)
    [llvm-as] unknown token in expression  #23 0x00007f3f3fa73430 start_thread ./nptl/pthread_create.c:474:7
    -Wreturn-stack-address in _THIS_IP_ and current_text_addr #24 0x00007f3f39e8ed03 __clone ./misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:97:0
    Segmentation fault (core dumped)

Full object files attached here:
link-time-crash.tar.xz.gz

I see this happen with lld version 1:13~++20210306104456+7ae191f59f0f-1exp120210306095217.256

@arndb arndb added [FEATURE] LTO Related to building the kernel with LLVM Link Time Optimization Compiler crash This bug makes Clang crash, emitting a backtrace labels Mar 6, 2021
@nickdesaulniers
Copy link
Member

I see this happen with lld version 1:13~++20210306104456+7ae191f59f0f-1exp120210306095217.256

2021-03-06

I just tested with llvm @ 8ace12130526f450c822ca232d1f865b247d7434 (2021-06-26) and wasn't able to repro:

$ wget https://github.com/ClangBuiltLinux/linux/files/6096101/link-time-crash.tar.xz.gz
$ gunzip link-time-crash.tar.xz.gz
$ tar xvf link-time-crash.tar.xz
$ cd git/arm-soc/build/x86/0xF108A65C_defconfig/
$ ld.lld -m elf_x86_64 --thinlto-cache-dir=.thinlto-cache -mllvm -import-instr-limit=5 -r -o vmlinux.o -T .tmp_initcalls.lds -T .tmp_symversions.lds --whole-archive arch/x86/kernel/head_64.o arch/x86/kernel/head64.o arch/x86/kernel/ebda.o arch/x86/kernel/platform-quirks.o init/built-in.a usr/built-in.a arch/x86/built-in.a kernel/built-in.a certs/built-in.a mm/built-in.a fs/built-in.a ipc/built-in.a security/built-in.a crypto/built-in.a block/built-in.a lib/built-in.a arch/x86/lib/built-in.a lib/lib.a arch/x86/lib/lib.a drivers/built-in.a sound/built-in.a virt/built-in.a arch/x86/pci/built-in.a arch/x86/power/built-in.a --no-whole-archive --start-group --end-group
$ echo $?
0

Perhaps this was fixed between March and now. Thanks anyways for the report.

@nickdesaulniers nickdesaulniers added the unreproducible Not or no longer reproducible label Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compiler crash This bug makes Clang crash, emitting a backtrace [FEATURE] LTO Related to building the kernel with LLVM Link Time Optimization unreproducible Not or no longer reproducible
Projects
None yet
Development

No branches or pull requests

2 participants