diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-04-20 12:01:43 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-04-20 12:01:43 -0300 |
commit | 62be9681677e7ce820db721c126909979382d379 (patch) | |
tree | 896a9792f83751ddfcbe544c1124a44f374ea9bd /nptl | |
parent | c72a1a062a1ded52719802c07ab459e1fd54d2a6 (diff) | |
download | glibc-62be9681677e7ce820db721c126909979382d379.tar.gz glibc-62be9681677e7ce820db721c126909979382d379.tar.xz glibc-62be9681677e7ce820db721c126909979382d379.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.
Diffstat (limited to 'nptl')
-rw-r--r-- | nptl/pthread_cancel.c | 3 |
1 files changed, 2 insertions, 1 deletions
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 |