This is the mail archive of the
mailing list for the glibc project.
Re: [PING][PATCH] Fix race in pthread_mutex_lock while promoting to PTHREAD_MUTEX_ELISION_NP [BZ #23275]
Please have a look at the patch posted here:
On 07/16/2018 01:56 PM, Stefan Liebler wrote:
On 07/10/2018 08:33 AM, Stefan Liebler wrote:
On 07/03/2018 08:28 AM, Stefan Liebler wrote:
On 06/26/2018 08:45 AM, Stefan Liebler wrote:
On 06/19/2018 09:45 AM, Stefan Liebler wrote:
On 06/12/2018 04:24 PM, Stefan Liebler wrote:
The race leads either to pthread_mutex_destroy returning EBUSY or
triggering an assertion (See description in bugzilla).
This patch is fixing the race by ensuring that the elision path is
used in all cases if elision is enabled by the GLIBC_TUNABLES
The __kind variable in struct __pthread_mutex_s is accessed
concurrently. Therefore we are now using the atomic macros.
The new testcase tst-mutex10 is triggering the race on s390x and
intel. Presumably also on power, but I don't have access to a
power machine with lock-elision. At least the code for power is
the same as on the other two architectures. Can somebody test it
* nptl/tst-mutex10.c: New File.
* nptl/Makefile (tests): Add tst-mutex10.
(tst-mutex-ENV): New variable.
* sysdeps/unix/sysv/linux/s390/force-elision.h: (FORCE_ELISION):
Ensure that elision path is used if elision is available.
* sysdeps/unix/sysv/linux/x86/force-elision.h: (FORCE_ELISION):
* nptl/pthreadP.h (PTHREAD_MUTEX_TYPE,
* nptl/pthread_mutex_consistent.c (pthread_mutex_consistent):
* nptl/pthread_mutex_lock.c (__pthread_mutex_lock_full,
* nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock):
* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
* nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_full):
(struct __pthread_mutex_s): Add comments.
* nptl/pthread_mutex_destroy.c (__pthread_mutex_destroy):
Use atomic_load_relaxed and atomic_store_relaxed.
* nptl/pthread_mutex_init.c (__pthread_mutex_init):