[asterisk-bugs] [JIRA] (ASTERISK-24154) PTHREAD_MUTEX_INITIALIZER should not be assumed to be recursive mutex

Timo Teräs (JIRA) noreply at issues.asterisk.org
Mon Aug 4 08:26:56 CDT 2014


Timo Teräs created ASTERISK-24154:
-------------------------------------

             Summary: PTHREAD_MUTEX_INITIALIZER should not be assumed to be recursive mutex
                 Key: ASTERISK-24154
                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-24154
             Project: Asterisk
          Issue Type: Bug
      Security Level: None
          Components: Core/Portability
    Affects Versions: 12.4.0
            Reporter: Timo Teräs
         Attachments: musl-mutex-init.patch

Currently the build system recognizes if PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP is available, and uses it only if detected. If it is not available, PTHREAD_MUTEX_INITIALIZER is used instead. Only on Solaris and BSD, the code revers using constructors to call pthread_mutex_init with proper attributes to create recursive mutex.

This logic is wrong. PTHREAD_MUTEX_INITIALIZER is not guaranteed to create recursive mutex. Please do that assumption only on GLIBC or other C-libraries where this is a known fact.

Current code is broken assumably on non-GLIBC systems not explicitly listed. One notable example is musl c-library based Linux systems. 



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list