summaryrefslogtreecommitdiff
path: root/nptl-Fix-pthread_cancel-cancelhandling-atomic-operat.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nptl-Fix-pthread_cancel-cancelhandling-atomic-operat.patch')
-rw-r--r--nptl-Fix-pthread_cancel-cancelhandling-atomic-operat.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/nptl-Fix-pthread_cancel-cancelhandling-atomic-operat.patch b/nptl-Fix-pthread_cancel-cancelhandling-atomic-operat.patch
new file mode 100644
index 0000000..e8c94b9
--- /dev/null
+++ b/nptl-Fix-pthread_cancel-cancelhandling-atomic-operat.patch
@@ -0,0 +1,38 @@
+From 62be9681677e7ce820db721c126909979382d379 Mon Sep 17 00:00:00 2001
+From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
+Date: Wed, 20 Apr 2022 12:01:43 -0300
+Subject: [PATCH] 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.
+---
+ 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 c76882e..e67b2df 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
+--
+1.8.3.1
+