HomeFreeBSD

MFC 331324: Ensure thread library is initialized in pthread_testcancel().

Description

MFC 331324: 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.

Sponsored by: DARPA / AFRL

Details

Provenance
jhbAuthored on
Parents
rS332632: quota(1): Fix calculation overflow and underflow
Branches
Unknown
Tags
Unknown