aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-04-20 12:01:43 -0300
committerAndreas K. Hüttel <dilfridge@gentoo.org>2022-04-22 12:50:11 +0200
commit1562ee37a220d58792ba26658352290c84040c83 (patch)
treed707f3a8a9450de8b2068d20a8056357be06cfa8
parentmips: Fix mips64n32 64 bit time_t stat support (BZ#29069) (diff)
downloadglibc-1562ee37a220d58792ba26658352290c84040c83.tar.gz
glibc-1562ee37a220d58792ba26658352290c84040c83.tar.bz2
glibc-1562ee37a220d58792ba26658352290c84040c83.zip
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) (cherry picked from commit 71326f1f2fd09dafb9c34404765fb88129e94237)
-rw-r--r--nptl/pthread_cancel.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/nptl/pthread_cancel.c b/nptl/pthread_cancel.c
index 2680b55586..64fd183fde 100644
--- a/nptl/pthread_cancel.c
+++ b/nptl/pthread_cancel.c
@@ -122,6 +122,7 @@ __pthread_cancel (pthread_t th)
int newval;
do
{
+ again:
newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK;
if (oldval == newval)
break;
@@ -135,7 +136,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