<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - lld/mac sometimes use-after-frees in parallel linkedit writing"
href="https://bugs.llvm.org/show_bug.cgi?id=50101">50101</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>lld/mac sometimes use-after-frees in parallel linkedit writing
</td>
</tr>
<tr>
<th>Product</th>
<td>lld
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>MachO
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>nicolasweber@gmx.de
</td>
</tr>
<tr>
<th>CC</th>
<td>gkm@fb.com, jezreel@gmail.com, llvm-bugs@lists.llvm.org, smeenai@fb.com
</td>
</tr></table>
<p>
<div>
<pre>I got this during a full chromium build (with today's trunk lld):
[23601/35445] LINK ./run_testserver
FAILED: run_testserver
TOOL_VERSION=1615494527 ../../build/toolchain/apple/linker_driver.py
-Wcrl,strippath,../../build/mac_files/xcode_binaries/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip
../../third_party/llvm-build/Release+Asserts/bin/clang++ -fuse-ld=lld
-Wl,--color-diagnostics -stdlib=libc++ --target=x86_64-apple-macos -Werror
-Wl,-dead_strip -nostdlib++ -isysroot
../../build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk
-mmacosx-version-min=10.11.0 -Wl,-ObjC -o "./run_testserver"
-Wl,-filelist,"./run_testserver.rsp" -framework Security -framework
ApplicationServices -framework AppKit -framework CoreFoundation -framework
IOKit -framework OpenDirectory -framework Foundation -framework CFNetwork
-framework CoreServices -framework SystemConfiguration -lbsm -lpmenergy
-lpmsample -lresolv
ld64.lld: warning: Option `-dead_strip' is not yet implemented. Stay tuned...
free(): invalid next size (fast)
PLEASE submit a bug report to <a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash
backtrace.
Stack dump:
0. Program arguments:
/usr/local/google/home/thakis/src/chrome/src/out/gnmac/../../third_party/llvm-build/Release+Asserts/bin/ld64.lld
-demangle -dynamic -arch x86_64 -platform_version macos 10.11.0 11.1
-syslibroot
../../build/mac_files/xcode_binaries/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk
-o ./run_testserver --color-diagnostics -dead_strip -ObjC -filelist
./run_testserver.rsp -framework Security -framework ApplicationServices
-framework AppKit -framework CoreFoundation -framework IOKit -framework
OpenDirectory -framework Foundation -framework CFNetwork -framework
CoreServices -framework SystemConfiguration -lbsm -lpmenergy -lpmsample
-lresolv -lSystem
/usr/local/google/home/thakis/src/chrome/src/third_party/llvm-build/Release+Asserts/lib/clang/13.0.0/lib/darwin/libclang_rt.osx.a
#0 0x0000000001eca7ec llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
(/usr/local/google/home/thakis/src/chrome/src/out/gnmac/../../third_party/llvm-build/Release+Asserts/bin/ld64.lld+0x1eca7ec)
#1 0x0000000001ec86be llvm::sys::RunSignalHandlers()
(/usr/local/google/home/thakis/src/chrome/src/out/gnmac/../../third_party/llvm-build/Release+Asserts/bin/ld64.lld+0x1ec86be)
#2 0x0000000001ecab3f SignalHandler(int) Signals.cpp:0:0
#3 0x00007f6e627ec140 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x14140)
#4 0x00007f6e62156ce1 raise ./signal/../sysdeps/unix/sysv/linux/raise.c:51:1
#5 0x00007f6e62140537 abort ./stdlib/abort.c:81:7
#6 0x00007f6e62199768 __libc_message
./libio/../sysdeps/posix/libc_fatal.c:156:1
#7 0x00007f6e621a0a5a ./malloc/malloc.c:5348:3
#8 0x00007f6e621a1c94 _int_free ./malloc/malloc.c:4249:4
#9 0x0000000001db7fbb std::_Function_handler<void (), void
llvm::parallel::detail::parallel_for_each_n<unsigned long, (anonymous
namespace)::Writer::writeUuid()::$_2>(unsigned long, unsigned long, (anonymous
namespace)::Writer::writeUuid()::$_2)::'lambda'()>::_M_manager(std::_Any_data&,
std::_Any_data const&, std::_Manager_operation) Writer.cpp:0:0
#10 0x0000000001db2d1d (anonymous namespace)::Writer::writeOutputFile()
Writer.cpp:0:0
#11 0x0000000001db98f2 void lld::macho::writeResult<lld::macho::LP64>()
(/usr/local/google/home/thakis/src/chrome/src/out/gnmac/../../third_party/llvm-build/Release+Asserts/bin/ld64.lld+0x1db98f2)
#12 0x0000000001d81d29 lld::macho::link(llvm::ArrayRef<char const*>, bool,
llvm::raw_ostream&, llvm::raw_ostream&)
(/usr/local/google/home/thakis/src/chrome/src/out/gnmac/../../third_party/llvm-build/Release+Asserts/bin/ld64.lld+0x1d81d29)
#13 0x0000000001ab2e13 lldMain(int, char const**, llvm::raw_ostream&,
llvm::raw_ostream&, bool) lld.cpp:0:0
#14 0x0000000001ab28ff main
(/usr/local/google/home/thakis/src/chrome/src/out/gnmac/../../third_party/llvm-build/Release+Asserts/bin/ld64.lld+0x1ab28ff)
#15 0x00007f6e62141d0a __libc_start_main ./csu/../csu/libc-start.c:308:16
#16 0x0000000001ab26aa _start
(/usr/local/google/home/thakis/src/chrome/src/out/gnmac/../../third_party/llvm-build/Release+Asserts/bin/ld64.lld+0x1ab26aa)
clang: error: unable to execute command: Aborted
However, I can't get it to repro running that command in isolation.
Here's a repro file
<a href="https://drive.google.com/file/d/1si1bnjCaYBRpykPLn5QlDXK0GoExAhGg/view?usp=sharing&resourcekey=0-zcAJLnHVA8mFMOTaCpf7kA">https://drive.google.com/file/d/1si1bnjCaYBRpykPLn5QlDXK0GoExAhGg/view?usp=sharing&resourcekey=0-zcAJLnHVA8mFMOTaCpf7kA</a>
but I'm not sure how useful it is. Maybe with asan or valgrind?
Jez, that's in your code :)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>