[Bug 150959] [libc] Stub pthread_once in libc should call _libc_once

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Aug 31 11:52:36 UTC 2019


andrew at tao11.riddles.org.uk changed:

           What    |Removed                     |Added
                 CC|                            |andrew at tao11.riddles.org.uk

--- Comment #5 from andrew at tao11.riddles.org.uk ---
The current stub implementation of pthread_once now fails with an error return,
which does not seem much of an improvement.

In particular, it causes code that is static-linked with openssl to segfault
unless libthr is linked into the process (the fact that openssl has inadequate
error checks is a separate issue).

I've been told in another bug thread that the only reason to have pthread stubs
at all is to allow for libraries that might be dynamically loaded into either a
threaded or unthreaded process. It seems to me that such libraries would be
very likely to want to use pthread_once, and very unlikely to be able to cope
with it failing (it has no normal reason to fail).

Accordingly, libc should provide either a pthread_once stub that actually works
(interoperably with the real implementation in case libthr gets pulled in
later), or it should not provide the symbol at all, forcing libraries that want
to use it to pull in libthr themselves.

see also https://twitter.com/RhodiumToad/status/1165523338481061888

You are receiving this mail because:
You are the assignee for the bug.

More information about the freebsd-threads mailing list