[PATCH] pthread_detach: add a comment about a known segfault bug.
Aaron Jacobs
aaronjjacobs@gmail.com
Sun Nov 23 21:25:56 GMT 2025
From: Aaron Jacobs <aaronjjacobs@gmail.com>
This bug has existed for nearly a decade, so doesn't seem like it's
likely to be fixed tomorrow. If this comment had been here yesterday it
would have saved me many hours of debugging.
---
nptl/pthread_detach.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/nptl/pthread_detach.c b/nptl/pthread_detach.c
index 3bbc037bdc..1e26eaf09e 100644
--- a/nptl/pthread_detach.c
+++ b/nptl/pthread_detach.c
@@ -44,7 +44,9 @@ ___pthread_detach (pthread_t th)
}
else
/* Check whether the thread terminated meanwhile. In this case we
- will just free the TCB. */
+ will just free the TCB. Note using pd after giving up ownership above is
+ incorrect, and this code may segfault. See
+ https://sourceware.org/bugzilla/show_bug.cgi?id=19951. */
if ((pd->cancelhandling & EXITING_BITMASK) != 0)
/* Note that the code in __free_tcb makes sure each thread
control block is freed only once. */
--
2.52.0.rc2.455.g230fcf2819-goog
More information about the Libc-alpha
mailing list