[llvm-bugs] [Bug 42918] New: libc++ passes invalid values to pthread_equal

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Aug 7 07:49:33 PDT 2019


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

            Bug ID: 42918
           Summary: libc++ passes invalid values to pthread_equal
           Product: libc++
           Version: unspecified
          Hardware: All
                OS: FreeBSD
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mclow.lists at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

[ received from Ed Maste at FreeBSD ]

We just had a FreeBSD bug submitted for a failure arising from
libc++'s use of pthread_equal.

FreeBSD's pthread_equal stub implementation (used in non-threaded
programs) returns true unconditionally, since a non-threaded program
cannot have two different threads. However, std::thread::id defines a
special value that should not equal any real thread, and this is may
be passed to pthread_equal. See FreeBSD PR 239550 for more details,
and PR 239038 for the user-facing issue that prompted this.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239550
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239038

Now the most expedient fix is probably for us to make pthread_equal
somewhat less of a stub, but for correctness it seems
__libcpp_thread_id_equal would need to check for libc++'s special
value before calling pthread_equal.

-- 
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/20190807/d137c6fa/attachment.html>


More information about the llvm-bugs mailing list