[Bug nptl/33717] New: nptl: pthread_join/pthread_timedjoin_np/pthread_clockjoin_np might not act as cancellation entrypoint
adhemerval.zanella at linaro dot org
sourceware-bugzilla@sourceware.org
Thu Dec 11 19:29:56 GMT 2025
https://sourceware.org/bugzilla/show_bug.cgi?id=33717
Bug ID: 33717
Summary: nptl:
pthread_join/pthread_timedjoin_np/pthread_clockjoin_np
might not act as cancellation entrypoint
Product: glibc
Version: 2.13
Status: NEW
Severity: normal
Priority: P2
Component: nptl
Assignee: unassigned at sourceware dot org
Reporter: adhemerval.zanella at linaro dot org
CC: drepper.fsp at gmail dot com
Target Milestone: ---
The pthread_join/pthread_timedjoin_np/pthread_clockjoin_np will not act
on cancellation if 1. some other thread is already waiting on the 'joinid' or
2. if the thread has already exited.
On nptl/pthread_join_common.c, the 1. is due the CAS doing an early return:
80 else if (__glibc_unlikely (atomic_compare_exchange_weak_acquire
(&pd->joinid,
81 &self,
82 NULL)))
83 /* There is already somebody waiting for the thread. */
84 return EINVAL;
And 2. is due the pd->tid equal to 0:
99 pid_t tid;
100 while ((tid = atomic_load_acquire (&pd->tid)) != 0)
101 {
The easiest solution would to add an __pthread_testcancel () on
__pthread_clockjoin_ex () if 'cancel' is true.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list