HomeFreeBSD

libpthread_init(): ensure curthread == NULL until set explicitly

Description

libpthread_init(): ensure curthread == NULL until set explicitly

Otherwise libthr::_get_curthread() returns a garbage kept there from
allocate_initial_tls(), until libthr initialization proceeds enough to
set initial pcb->pcb_thread. The garbage pcb_thread was dereferenced
as struct pthread and some memory read as TID. Since the read might not
be consistent between reads, thr_malloc_umtx unlock sometimes returned
EPERM instead of clearing the lock word.

Reported by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

Details

Provenance
kibAuthored on Tue, Jan 14, 10:11 PM
Parents
rG1cd455f39d88: fs: Add new VFCF_xxx flags for va_filerev
Branches
Unknown
Tags
Unknown