srcshelton · GitHub

(From https://github.com/llvm/llvm-project/issues/78732…)

Stack dump:
0.      Program arguments: ld.lld -m elf_x86_64 -mllvm -import-instr-limit=5 -z noexecstack -r -o arch/x86/crypto/ghash-clmulni-intel.o @arch/x86/crypto/ghash-clmulni-intel.mod
1.      Running pass 'Function Pass Manager' on module 'ld-temp.o'.
2.      Running pass 'Prologue/Epilogue Insertion & Frame Finalization' on function '@ghash_async_init'
 #0 0x00007f7ecffa4e9e llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x9a4e9e)
 #1 0x00007f7ecffa2c44 llvm::sys::RunSignalHandlers() (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x9a2c44)
 #2 0x00007f7ecffa2da6 (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x9a2da6)
 #3 0x00007f7ecf05fb70 (/lib64/libc.so.6+0x38b70)
 #4 0x00007f7ed04c2301 (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xec2301)
 #5 0x00007f7ed04c91a9 (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xec91a9)
 #6 0x00007f7ed039cb5d llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xd9cb5d)
 #7 0x00007f7ed00ecc49 llvm::FPPassManager::runOnFunction(llvm::Function&) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xaecc49)
 #8 0x00007f7ed00eced3 llvm::FPPassManager::runOnModule(llvm::Module&) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xaeced3)
 #9 0x00007f7ed00ed557 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xaed557)
#10 0x00007f7ed180d474 (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x220d474)
#11 0x00007f7ed180dbaa llvm::lto::backend(llvm::lto::Config const&, std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, unsigned int, llvm::Module&, llvm::ModuleSummaryIndex&) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x220dbaa)
#12 0x00007f7ed1803fc7 llvm::lto::LTO::runRegularLTO(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x2203fc7)
#13 0x00007f7ed180443b llvm::lto::LTO::run(std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>, std::function<llvm::Expected<std::function<llvm::Expected<std::unique_ptr<llvm::CachedFileStream, std::default_delete<llvm::CachedFileStream>>> (unsigned int, llvm::Twine const&)>> (unsigned int, llvm::StringRef, llvm::Twine const&)>) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x220443b)
#14 0x00007f7ed395d6d6 lld::elf::BitcodeCompiler::compile() (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+0x15d6d6)
#15 0x00007f7ed38e01f7 void lld::elf::LinkerDriver::compileBitcodeFiles<llvm::object::ELFType<(llvm::support::endianness)1, true>>(bool) (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+0xe01f7)
#16 0x00007f7ed38e8ae8 lld::elf::LinkerDriver::link(llvm::opt::InputArgList&) (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+0xe8ae8)
#17 0x00007f7ed38eb3e0 lld::elf::LinkerDriver::linkerMain(llvm::ArrayRef<char const*>) (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+0xeb3e0)
#18 0x00007f7ed38ecddc lld::elf::link(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, bool, bool) (/usr/lib/llvm/17/bin/../lib64/liblldELF.so.17+0xecddc)
#19 0x00007f7ed3ae10ad lld::unsafeLldMain(llvm::ArrayRef<char const*>, llvm::raw_ostream&, llvm::raw_ostream&, llvm::ArrayRef<lld::DriverDef>, bool) (/usr/lib/llvm/17/bin/../lib64/liblldCommon.so.17+0x100ad)
#20 0x000055ee43ce6d4c lld_main(int, char**, llvm::ToolContext const&) (/usr/lib/llvm/17/bin/ld.lld+0x3d4c)
#21 0x000055ee43ce6501 main (/usr/lib/llvm/17/bin/ld.lld+0x3501)
#22 0x00007f7ecf04ad77 (/lib64/libc.so.6+0x23d77)
#23 0x00007f7ecf04ae35 __libc_start_main (/lib64/libc.so.6+0x23e35)
#24 0x000055ee43ce6531 _start (/usr/lib/llvm/17/bin/ld.lld+0x3531)
Segmentation fault
make[6]: *** [/usr/src/linux-6.7.0/scripts/Makefile.build:438: arch/x86/crypto/ghash-clmulni-intel.o] Error 139
make[5]: *** [/usr/src/linux-6.7.0/scripts/Makefile.build:480: arch/x86/crypto] Error 2
make[4]: *** [/usr/src/linux-6.7.0/scripts/Makefile.build:480: arch/x86] Error 2
make[3]: *** [/usr/src/linux-6.7.0/Makefile:1911: .] Error 2
make[2]: *** [/usr/src/linux-6.7.0/Makefile:350: __build_one_by_one] Error 2
make[1]: *** [/usr/src/linux-6.7.0/Makefile:234: __sub-make] Error 2
make[1]: Leaving directory '/usr/src/build'

If the kernel is reconfigured with this module disabled then there is a different crash in KVM, and if that is disabled then another module breaks. I stopped trying to dig any deeper at this point.

FWIW, on the same host building linux-6.6.9 with clang-16.0.6 and the same configuration worked as expected.

# /usr/lib/llvm/17/bin/clang --version
clang version 17.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/17/bin
Configuration file: /etc/clang/x86_64-pc-linux-gnu-clang.cfg

Configuration:

--rtlib=compiler-rt
--unwindlib=libunwind
--stdlib=libc++
-fuse-ld=lld
-Wl,-z,relro
--gcc-install-dir="/usr/lib/gcc/x86_64-pc-linux-gnu/13"
-fstack-clash-protection
-fstack-protector-strong
-fPIE

Read the original on github.com ↗