[PING][PATCH] Fix race in pthread_mutex_lock while promoting to PTHREAD_MUTEX_ELISION_NP [BZ #23275]
Stefan Liebler
stli@linux.ibm.com
Tue Jun 26 06:45:00 GMT 2018
PING
On 06/19/2018 09:45 AM, Stefan Liebler wrote:
> PING
>
> On 06/12/2018 04:24 PM, Stefan Liebler wrote:
>> Hi,
>>
>> 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 framework.
>>
>> 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 on power?
>>
>> Bye
>> Stefan
>>
>> ChangeLog:
>>
>> Â Â Â Â Â [BZ #23275]
>> Â Â Â Â Â * 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/powerpc/force-elision.h
>> Â Â Â Â Â (FORCE_ELISION): Likewise.
>> Â Â Â Â Â * sysdeps/unix/sysv/linux/x86/force-elision.h: (FORCE_ELISION):
>> Â Â Â Â Â Likewise.
>> Â Â Â Â Â * nptl/pthreadP.h (PTHREAD_MUTEX_TYPE,
>> Â Â Â Â Â PTHREAD_MUTEX_TYPE_ELISION, PTHREAD_MUTEX_PSHARED):
>> Â Â Â Â Â Use atomic_load_relaxed.
>> Â Â Â Â Â * nptl/pthread_mutex_consistent.c (pthread_mutex_consistent):
>> Â Â Â Â Â Likewise.
>> Â Â Â Â Â * nptl/pthread_mutex_getprioceiling.c
>> Â Â Â Â Â (pthread_mutex_getprioceiling): Likewise.
>> Â Â Â Â Â * nptl/pthread_mutex_lock.c (__pthread_mutex_lock_full,
>> Â Â Â Â Â __pthread_mutex_cond_lock_adjust): Likewise.
>> Â Â Â Â Â * nptl/pthread_mutex_setprioceiling.c
>> Â Â Â Â Â (pthread_mutex_setprioceiling): Likewise.
>> Â Â Â Â Â * nptl/pthread_mutex_timedlock.c (__pthread_mutex_timedlock):
>> Â Â Â Â Â Likewise.
>> Â Â Â Â Â * nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock):
>> Â Â Â Â Â Likewise.
>> Â Â Â Â Â * nptl/pthread_mutex_unlock.c (__pthread_mutex_unlock_full):
>> Â Â Â Â Â Likewise.
>> Â Â Â Â Â * sysdeps/nptl/bits/thread-shared-types.h
>> Â Â Â Â Â (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):
>> Â Â Â Â Â Use atomic_store_relaxed.
>
More information about the Libc-alpha
mailing list