Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 24 May 2024 13:01:40 -0400
From: Rich Felker <>
To: AK47 <>
Cc: musl <>
Subject: Re: Re:Re: Pthread robust_list for non-pshared mutexes

On Fri, May 24, 2024 at 10:43:05PM +0800, AK47 wrote:
> Hi,
> Sorry, maybe what I asked was a bit confusing. My question is,
> except robust and process-shared mutex, &nbsp;what is the purpose of
> putting the other kinds of mutexes into Robust_list such as the
> normal recursive mutex.&nbsp;
> Take a normal recursive mutex as an example, if I lock and unlock it
> correctly in a thread, it will be put into robust list in
> pthread_mutex_lock and get removed from the list in
> pthread_mutex_unlock(). If I lock it but miss to unlock, it will be
> still in&nbsp;robust list and processed
> in&nbsp;pthread_exit().&nbsp;But in both cases, I did not find that
> the presence of the robust list had any impact on this mutex. Does
> it not need to be put into the robust list.

It is put in the list specifically so that, if the thread (or, in the
case of pshared, the entire process) holding the mutex exits, any
future attempt to take the mutex will deadlock. Otherwise, you have an
identifier-reuse bug whereby, if a new thread comes into existence and
gets the same thread-id that the exited thread had, it will wrongly
see itself as the owner of the mutex and succeed in taking a recursive
lock on it, instead of deadlocking like it should (and like POSIX
requires it to).


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.