[llvm-bugs] [Bug 45377] New: [tsan] Unexpectedly warns about double lock of a mutex

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 31 09:47:13 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45377

            Bug ID: 45377
           Summary: [tsan] Unexpectedly warns about double lock of a mutex
           Product: compiler-rt
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: tsan
          Assignee: unassignedbugs at nondot.org
          Reporter: lewissbaker at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 23298
  --> https://bugs.llvm.org/attachment.cgi?id=23298&action=edit
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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200331/9d8019ab/attachment.html>


More information about the llvm-bugs mailing list