<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 - deadlock when forking in multithreaded application when using asan"
href="https://bugs.llvm.org/show_bug.cgi?id=45332">45332</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>deadlock when forking in multithreaded application when using asan
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</td>
</tr>
<tr>
<th>Version</th>
<td>10.0
</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>asan
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>adi@thingdust.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>I updated our codebase to use clang 10 today. With the asan build, our
testsuite starts to have spurious deadlocks which happen when a forking while
another thread is in a malloc call.
The problem look very much the same as described (and fixed, but reverted
again?) here some time ago: <a href="https://reviews.llvm.org/rL304285">https://reviews.llvm.org/rL304285</a>
The callstacks looks like this:
Parent process:
* thread #7, name = 'backend', stop reason = signal SIGSTOP
* frame #0: 0x00007f32c1645d94 libpthread.so.0`__libc_read at read.c:26:10
frame #1: 0x00007f32c1645d80 libpthread.so.0`__libc_read(fd=28,
buf=0x00007f32af67b620, nbytes=8) at read.c:24
frame #2: 0x00000000002d21a0 backend`::__interceptor_read() at
sanitizer_common_interceptors.inc:1011:17
... [boost::process]
frame #33: 0x00007f32c0f4fb1f libc.so.6`__clone + 63
Child process:
* thread #1, name = 'backend', stop reason = signal SIGSTOP
* frame #0: 0x0000000000348917 backend`::internal_sched_yield() at
sanitizer_linux.cpp:422:3
frame #1: 0x00000000002bd815 backend`::LockSlow() at sanitizer_mutex.h:54:9
frame #2: 0x0000000000352e61 backend`::Put() [inlined] Lock at
sanitizer_mutex.h:31:5
frame #3: 0x0000000000352e4d backend`::Put() [inlined] GenericScopedLock at
sanitizer_mutex.h:183
frame #4: 0x0000000000352e4d backend`::Put() [inlined] alloc at
sanitizer_persistent_allocator.h:51
frame #5: 0x0000000000352e1d backend`::Put() [inlined] PersistentAlloc at
sanitizer_persistent_allocator.h:66
frame #6: 0x0000000000352e1d backend`::Put() at
sanitizer_stackdepotbase.h:125
frame #7: 0x0000000000352b47 backend`::StackDepotPut() at
sanitizer_stackdepot.cpp:98:33
frame #8: 0x00000000002bbbaa backend`::Allocate() at
asan_allocator.cpp:526:27
frame #9: 0x00000000002bc43a backend`::asan_memalign() at
asan_allocator.cpp:952:16
frame #10: 0x00000000003620f3 backend`::operator new() at
asan_new_delete.cpp:99:3
frame #11: 0x00007f32c12b311d
libc++.so.1`std::__1::__libcpp_allocate(unsigned long, unsigned long) at
new:253:10
frame #12: 0x00007f32c12b8bb0
libc++.so.1`std::__1::allocator<char>::allocate(unsigned long, void const*) at
memory:1864:37
frame #13: 0x00007f32c12b85c6
libc++.so.1`std::__1::allocator_traits<std::__1::allocator<char>
<span class="quote">>::allocate(std::__1::allocator<char>&, unsigned long) at memory:1581:21</span >
frame #14: 0x00007f32c12dffc8 libc++.so.1`std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char> >::__init(char const*,
unsigned long) at string:1788:15
frame #15: 0x00007f32c12dfbda libc++.so.1`std::__1::basic_string<char,
std::__1::char_traits<char>, std::__1::allocator<char>
<span class="quote">>::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>,</span >
std::__1::allocator<char> > const&) at string:1840:9
...
frame #58: 0x00007f32c0f4fb1f libc.so.6`__clone + 63</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>