Issue #3462 has been reported by tuxillo. ---------------------------------------- Bug #3462: pthread_join() returns before the joined thread is off its stack http://bugs.dragonflybsd.org/issues/3462
* Author: tuxillo * Status: New * Priority: Normal * Target version: 6.6 * Start date: 2026-11-05 ---------------------------------------- exit_thread() sets state = PS_DEAD, then still runs on its stack (unlock, _thr_umtx_wake, extexit) before the kernel sets td->terminated. join_common() only waits for PS_DEAD, so a caller that frees a pthread_attr_setstack() stack right after pthread_join() pulls it out from under the exiting thread. Seen with lang/sbcl, whose threaded tests die with SIGILL every few runs. joinrace.c reproduces it: ./joinrace 100000 segfaults in most runs. The patch makes join_common() also wait for terminated, like _thr_gc() already does (compile-tested only). ---Files-------------------------------- joinrace.c (1.94 KB) pthread_join-terminated.diff (561 Bytes) -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
