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

Crash in llvm::StringTableBuilder::write #125018

Open
AtomicOperation opened this issue Jan 30, 2025 · 2 comments
Open

Crash in llvm::StringTableBuilder::write #125018

AtomicOperation opened this issue Jan 30, 2025 · 2 comments
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] lld:ELF needs-reduction Large reproducer that should be reduced into a simpler form

Comments

@AtomicOperation
Copy link

AtomicOperation commented Jan 30, 2025

LMK if this isn't the right place for this.

 #0 0x00007f61aab3bbf5 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/coder/git/roblox/master/Client/dependencies/clang/bin/../lib/libLLVM.so.19.1+0x2690bf5)
 #1 0x00007f61aab3986e llvm::sys::RunSignalHandlers() (/home/coder/git/roblox/master/Client/dependencies/clang/bin/../lib/libLLVM.so.19.1+0x268e86e)
 #2 0x00007f61aab3c27f SignalHandler(int) Signals.cpp:0:0
 #3 0x00007f61ad741420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #4 0x00007f61a82f5ae6 /build/glibc-LcI20x/glibc-2.31/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:416:0
 #5 0x00007f61ac44391d llvm::StringTableBuilder::write(unsigned char*) const (/home/coder/git/roblox/master/Client/dependencies/clang/bin/../lib/libLLVM.so.19.1+0x3f9891d)
 #6 0x00007f61aaabfddd std::__1::__function::__func<llvm::parallelFor(unsigned long, unsigned long, llvm::function_ref<void (unsigned long)>)::$_0, std::__1::allocator<llvm::parallelFor(unsigned long, unsigned long, llvm::function_ref<void (unsigned long)>)::$_0>, void ()>::operator()() Parallel.cpp:0:0
 #7 0x00007f61aaabd590 llvm::parallelFor(unsigned long, unsigned long, llvm::function_ref<void (unsigned long)>) (/home/coder/git/roblox/master/Client/dependencies/clang/bin/../lib/libLLVM.so.19.1+0x2612590)
 #8 0x000055bb372f8c4d lld::elf::MergeNoTailSection::writeTo(unsigned char*) (/home/coder/git/roblox/master/Client/dependencies/clang/bin/ld.lld+0x3a9c4d)
 #9 0x000055bb3729d63a void lld::elf::OutputSection::writeTo<llvm::object::ELFType<(llvm::endianness)1, true>>(unsigned char*, llvm::parallel::TaskGroup&)::'lambda'(unsigned long, unsigned long)::operator()(unsigned long, unsigned long) const OutputSections.cpp:0:0
#10 0x00007f61aaabfcca std::__1::__function::__func<llvm::parallel::TaskGroup::spawn(std::__1::function<void ()>, bool)::$_0, std::__1::allocator<llvm::parallel::TaskGroup::spawn(std::__1::function<void ()>, bool)::$_0>, void ()>::operator()() Parallel.cpp:0:0
#11 0x00007f61aaabe59e llvm::parallel::detail::(anonymous namespace)::ThreadPoolExecutor::work(llvm::ThreadPoolStrategy, unsigned int) Parallel.cpp:0:0

Excluding the actual libraries (of which there are a lot) the command line is basically:

clang++
--sysroot=/home/coder/git/roblox/master/Client/dependencies/clang
-stdlib=libc++
-msse4
-D_FORTIFY_SOURCE=0
-fcolor-diagnostics
-DNDEBUG
-Wl,--no-rosegment,--build-id=uuid
-fuse-ld=lld
-lc++abi
-Wl,-z,stack-size=8388608
-fPIC
-fsanitize=address,fuzzer-no-link

This is on Ubuntu 20.04. The runtimes in the sysroot were built with musl, but the binaries weren't.

clang version 19.1.3 (https://github.rbx.com/GameEngine/llvm-project.git b4171ab8ef2bffc38b03887be39c82039d426dff)

@EugeneZelenko EugeneZelenko added lld:ELF crash Prefer [crash-on-valid] or [crash-on-invalid] needs-reduction Large reproducer that should be reduced into a simpler form and removed new issue labels Jan 30, 2025
@llvmbot
Copy link
Member

llvmbot commented Jan 30, 2025

@llvm/issue-subscribers-lld-elf

Author: None (AtomicOperation)

LMK if this isn't the right place for this.
 #<!-- -->0 0x00007f61aab3bbf5 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/home/coder/git/roblox/master/Client/dependencies/clang/bin/../lib/libLLVM.so.19.1+0x2690bf5)
 #<!-- -->1 0x00007f61aab3986e llvm::sys::RunSignalHandlers() (/home/coder/git/roblox/master/Client/dependencies/clang/bin/../lib/libLLVM.so.19.1+0x268e86e)
 #<!-- -->2 0x00007f61aab3c27f SignalHandler(int) Signals.cpp:0:0
 #<!-- -->3 0x00007f61ad741420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #<!-- -->4 0x00007f61a82f5ae6 /build/glibc-LcI20x/glibc-2.31/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:416:0
 #<!-- -->5 0x00007f61ac44391d llvm::StringTableBuilder::write(unsigned char*) const (/home/coder/git/roblox/master/Client/dependencies/clang/bin/../lib/libLLVM.so.19.1+0x3f9891d)
 #<!-- -->6 0x00007f61aaabfddd std::__1::__function::__func&lt;llvm::parallelFor(unsigned long, unsigned long, llvm::function_ref&lt;void (unsigned long)&gt;)::$_0, std::__1::allocator&lt;llvm::parallelFor(unsigned long, unsigned long, llvm::function_ref&lt;void (unsigned long)&gt;)::$_0&gt;, void ()&gt;::operator()() Parallel.cpp:0:0
 #<!-- -->7 0x00007f61aaabd590 llvm::parallelFor(unsigned long, unsigned long, llvm::function_ref&lt;void (unsigned long)&gt;) (/home/coder/git/roblox/master/Client/dependencies/clang/bin/../lib/libLLVM.so.19.1+0x2612590)
 #<!-- -->8 0x000055bb372f8c4d lld::elf::MergeNoTailSection::writeTo(unsigned char*) (/home/coder/git/roblox/master/Client/dependencies/clang/bin/ld.lld+0x3a9c4d)
 #<!-- -->9 0x000055bb3729d63a void lld::elf::OutputSection::writeTo&lt;llvm::object::ELFType&lt;(llvm::endianness)1, true&gt;&gt;(unsigned char*, llvm::parallel::TaskGroup&amp;)::'lambda'(unsigned long, unsigned long)::operator()(unsigned long, unsigned long) const OutputSections.cpp:0:0
#<!-- -->10 0x00007f61aaabfcca std::__1::__function::__func&lt;llvm::parallel::TaskGroup::spawn(std::__1::function&lt;void ()&gt;, bool)::$_0, std::__1::allocator&lt;llvm::parallel::TaskGroup::spawn(std::__1::function&lt;void ()&gt;, bool)::$_0&gt;, void ()&gt;::operator()() Parallel.cpp:0:0
#<!-- -->11 0x00007f61aaabe59e llvm::parallel::detail::(anonymous namespace)::ThreadPoolExecutor::work(llvm::ThreadPoolStrategy, unsigned int) Parallel.cpp:0:0

Excluding the actual libraries (of which there are a lot) the command line is basically:

clang++
--sysroot=/home/coder/git/roblox/master/Client/dependencies/clang
-stdlib=libc++
-msse4
-D_FORTIFY_SOURCE=0
-fcolor-diagnostics
-DNDEBUG
-Wl,--no-rosegment,--build-id=uuid
-fuse-ld=lld
-lc++abi
-Wl,-z,stack-size=8388608
-fPIC
-fsanitize=address,fuzzer-no-link

This is on Ubuntu 20.04. The runtimes in the sysroot were built with musl, but the binaries weren't.

clang version 19.1.3 (https://github.rbx.com/GameEngine/llvm-project.git b4171ab8ef2bffc38b03887be39c82039d426dff)

@rnk
Copy link
Collaborator

rnk commented Jan 30, 2025

Can you help differentiate this from an OOM situation? Users have recently reported they get SIGBUS during output writing, which is what's happening here based on the stack trace. What signal are you getting?

Does the problem go away if you link with -Wl,--no-mmap-output-file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Prefer [crash-on-valid] or [crash-on-invalid] lld:ELF needs-reduction Large reproducer that should be reduced into a simpler form
Projects
None yet
Development

No branches or pull requests

4 participants