[oi-dev] Issue with pthreads

Rouven WEILER Rouven_Weiler at gmx.net
Thu Apr 18 16:36:55 UTC 2019


Thanks a lot. Was just to make sure.

> Am 18.04.2019 um 18:32 schrieb Andreas Wacknitz <A.Wacknitz at gmx.de>:
> 
>> Am 18.04.19 um 17:55 schrieb Rouven WEILER:
>> is the following patch included in the actual oi codebase and since when?
>> 
>> https://www.illumos.org/issues/9959
>> 
>> 
>> _______________________________________________
>> oi-dev mailing list
>> oi-dev at openindiana.org
>> https://openindiana.org/mailman/listinfo/oi-dev
> Obviously, you can see the commit id. With this you can run
> git show 6da2547363ddbd247ee9513db83b05a31bca31af
> 
> commit 6da2547363ddbd247ee9513db83b05a31bca31af
> Author: Richard Lowe <richlowe at richlowe.net>
> Date:   Tue Nov 6 00:57:32 2018 +0000
> 
>     9959 pthread_mutex_init should initialize mutex appropriately for robust mutex_init
>     Reviewed by: Jason King <jason.king at joyent.com>
>     Reviewed by: Robert Mustacchi <rm at joyent.com>
>     Approved by: Dan McDonald <danmcd at joyent.com>
> 
> diff --git a/usr/src/lib/libc/port/threads/pthr_mutex.c b/usr/src/lib/libc/port/threads/pthr_mutex.c
> index 1f70725677..c8943671aa 100644
> --- a/usr/src/lib/libc/port/threads/pthr_mutex.c
> +++ b/usr/src/lib/libc/port/threads/pthr_mutex.c
> @@ -226,6 +226,23 @@ pthread_mutex_init(pthread_mutex_t *_RESTRICT_KYWD mutex,
>                     PTHREAD_PRIO_NONE | PTHREAD_MUTEX_STALLED;
>         }
> 
> +       /*
> +        * POSIX mutexes (this interface) make no guarantee about the state of
> +        * the mutex before pthread_mutex_init(3C) is called.  Sun mutexes, upon
> +        * which these are built and which mutex_init(3C) below represents
> +        * require that a robust mutex be initialized to all 0s _prior_ to
> +        * mutex_init() being called, and that mutex_init() of an initialized
> +        * mutex return EBUSY.
> +        *
> +        * We respect both these behaviors by zeroing the mutex here in the
> +        * POSIX implementation if and only if the mutex magic is incorrect,
> +        * and the mutex is robust.
> +        */
> +       if (((type & PTHREAD_MUTEX_ROBUST) != 0) &&
> +           (((mutex_t *)mutex)->mutex_magic != MUTEX_MAGIC)) {
> +               (void) memset(mutex, 0, sizeof (*mutex));
> +       }
> +
>         return (mutex_init((mutex_t *)mutex, type, &prioceiling));
>  }
> 
> 
> So if you run pkg update on OI after Nov 6th, 2018, you should have it :)
> 
> Regards
> _______________________________________________
> oi-dev mailing list
> oi-dev at openindiana.org
> https://openindiana.org/mailman/listinfo/oi-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openindiana.org/pipermail/oi-dev/attachments/20190418/75686b68/attachment-0005.html>


More information about the oi-dev mailing list