public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Stefan Liebler <stli@linux.ibm.com>
To: libc-alpha@sourceware.org
Subject: Re: [PATCH] Fix race in pthread_mutex_lock while promoting to PTHREAD_MUTEX_ELISION_NP [BZ #23275]
Date: Tue, 19 Jun 2018 07:45:00 -0000	[thread overview]
Message-ID: <4614fea8-43b9-0125-1346-603ad8ad66e4@linux.ibm.com> (raw)
In-Reply-To: <f3fc33e5-aa98-f772-a1bf-c02ddf9352c7@linux.ibm.com>

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.

  parent reply	other threads:[~2018-06-19  7:45 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-12 14:25 Stefan Liebler
2018-06-13  8:43 ` Florian Weimer
2018-06-13  9:18   ` Stefan Liebler
2018-06-13  9:36     ` Florian Weimer
2018-06-13 15:25       ` Stefan Liebler
2018-06-14  8:04         ` Stefan Liebler
2018-06-13 21:45     ` Tulio Magno Quites Machado Filho
2018-06-19  7:45 ` Stefan Liebler [this message]
2018-06-26  6:45   ` [PING][PATCH] " Stefan Liebler
2018-07-03  6:28     ` Stefan Liebler
2018-07-10  6:34       ` Stefan Liebler
2018-07-16 11:57         ` Stefan Liebler
2018-07-23  6:42           ` Stefan Liebler
2018-07-30  7:22             ` Stefan Liebler
2018-08-27  9:12               ` Stefan Liebler
2018-09-03  7:10                 ` Stefan Liebler
2018-09-10 12:01                   ` Stefan Liebler
2018-09-17 13:38 ` [PATCH] " Florian Weimer
2018-10-04 16:08   ` Stefan Liebler
2018-10-16 14:23     ` Florian Weimer
2018-10-17 10:36       ` Stefan Liebler
2018-10-18 13:24         ` [COMMITTED 2.27 / 2.28] " Stefan Liebler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4614fea8-43b9-0125-1346-603ad8ad66e4@linux.ibm.com \
    --to=stli@linux.ibm.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).