public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/release/2.35/master] nptl: Fix pthread_cancel cancelhandling atomic operations
@ 2022-04-20 16:42 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2022-04-20 16:42 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=68d3a9a69696b46f2e552330dd0de5512c36302d

commit 68d3a9a69696b46f2e552330dd0de5512c36302d
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date:   Wed Apr 20 12:01:43 2022 -0300

    nptl: Fix pthread_cancel cancelhandling atomic operations
    
    The 404656009b reversion did not setup the atomic loop to set the
    cancel bits correctly.  The fix is essentially what pthread_cancel
    did prior 26cfbb7162ad.
    
    Checked on x86_64-linux-gnu and aarch64-linux-gnu.
    
    (cherry picked from commit 62be9681677e7ce820db721c126909979382d379)

Diff:
---
 nptl/pthread_cancel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
index c76882e279..e67b2df5cc 100644
--- a/nptl/pthread_cancel.c
+++ b/nptl/pthread_cancel.c
@@ -121,6 +121,7 @@ __pthread_cancel (pthread_t th)
   int newval;
   do
     {
+    again:
       newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK;
       if (oldval == newval)
 	break;
@@ -134,7 +135,7 @@ __pthread_cancel (pthread_t th)
 	  int newval2 = oldval | CANCELING_BITMASK;
 	  if (!atomic_compare_exchange_weak_acquire (&pd->cancelhandling,
 						     &oldval, newval2))
-	    continue;
+	    goto again;
 
 	  if (pd == THREAD_SELF)
 	    /* This is not merely an optimization: An application may


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-20 16:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-20 16:42 [glibc/release/2.35/master] nptl: Fix pthread_cancel cancelhandling atomic operations Adhemerval Zanella

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).