[PATCH] nptl: avoid invalid memory access in pthread_join after fork
Andreas Schwab
schwab@linux-m68k.org
Fri Jun 5 10:33:05 GMT 2026
On Jun 05 2026, Wupeng wrote:
> Calling pthread_join() on threads that no longer exist after fork() is technically undefined behavior. However, in real-world engineering scenarios this is difficult to avoid completely, especially when:
> - pthread_join() is located in shared cleanup/destructor paths
> - parent and child processes share common cleanup logic
> - third-party libraries internally manage threads
Add an atfork handler that cleans up the mess after fork.
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
More information about the Libc-alpha
mailing list