HomeFreeBSD

Ensure thread library is initialized in pthread_testcancel().

Description

Ensure thread library is initialized in pthread_testcancel().

Call _thr_check_init() before reading curthread in pthread_testcancel().

If a constructor in a library creates a semaphore via sem_init() and
then waits for it via sem_wait(), the program can core dump in
_pthread_testcancel() called from sem_wait(). This is because the
semaphore implementation lives in libc, so the library's constructors
can be run before libthr's constructors.

Reported by: arichardson
Reviewed by: kib
Obtained from: CheriBSD
MFC after: 1 week
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D14786

Details

Provenance
jhbAuthored on
Reviewer
kib
Differential Revision
D14786: Ensure thread library is initialized in pthread_testcancel().
Parents
rS331323: MFC 328158,330708: Update kgdb for PTI.
Branches
Unknown
Tags
Unknown