[llvm-bugs] [Bug 50365] New: Data race in std::unique_lock

via llvm-bugs llvm-bugs at lists.llvm.org
Sun May 16 10:50:31 PDT 2021


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

            Bug ID: 50365
           Summary: Data race in std::unique_lock
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sololev27 at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

There are two lines in ```unique_lock::unlock``` that should appear in reverse
order:
https://github.com/llvm/llvm-project/blob/d480f968ad8b56d3ee4a6b6df5532d485b0ad01e/libcxx/include/__mutex_base#L255
https://github.com/llvm/llvm-project/blob/d480f968ad8b56d3ee4a6b6df5532d485b0ad01e/libcxx/include/__mutex_base#L256

MRE would require a thread pool with fibers running over it (that's how TSan
detected the race condition in the first place) so that one thread has unlocked
```__m_``` but not written false yet, and another thread is destroying the lock
already.

-- 
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/20210516/5b5dfa9e/attachment-0001.html>


More information about the llvm-bugs mailing list