<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 - [tsan] Unexpectedly warns about double lock of a mutex"
href="https://bugs.llvm.org/show_bug.cgi?id=45377">45377</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>[tsan] Unexpectedly warns about double lock of a mutex
</td>
</tr>
<tr>
<th>Product</th>
<td>compiler-rt
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>tsan
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>lewissbaker@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=23298" name="attach_23298" title="Example program that demonstrates issue.">attachment 23298</a> <a href="attachment.cgi?id=23298&action=edit" title="Example program that demonstrates issue.">[details]</a></span>
Example program that demonstrates issue.
Compile the attached program tsan.cpp with clang trunk (github commit
6a9ad5f3f4ac66f0cae592e911f4baeb6ee5eca6).
Command-line args: -std=c++2a -stdlib=libc++ -fsanitize=thread
Running the program occasionally (about 1 in 4 for me) fails with a
ThreadSanitizer warning about a mutex being double locked despite the code only
ever using scoped lock-guards.
See the attached file (tsan_log.txt) for output of the program when run with
tsan trace output enabled.
The log seems to indicate that tsan has observed two threads simultaneously
acquiring a lock on the same mutex - two threads both execute MutexPostLock for
the same mutex without an intervening MutexUnlock event.
Tests were run on Ubuntu 18.04 with kernel 5.5.2-050502-generic.
Also tested with kernel 5.6.0-050600-generic and observed the same problem.
It is unclear whether this is due to tsan, libc++ or pthread.</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>