svn commit: r338816 - in projects/openssl111: secure/lib/libcrypto share/mk

Konstantin Belousov kostikbel at gmail.com
Thu Sep 20 18:21:38 UTC 2018


On Thu, Sep 20, 2018 at 01:41:26PM -0400, Jung-uk Kim wrote:
> On 18. 9. 20., Konstantin Belousov wrote:
> > On Thu, Sep 20, 2018 at 08:16:02AM -0500, Benjamin Kaduk wrote:
> >> On Thu, Sep 20, 2018 at 5:10 AM Konstantin Belousov <kostikbel at gmail.com>
> >> wrote:
> >>
> >>> On Thu, Sep 20, 2018 at 12:20:04AM +0000, Jung-uk Kim wrote:
> >>>> Author: jkim
> >>>> Date: Thu Sep 20 00:20:04 2018
> >>>> New Revision: 338816
> >>>> URL: https://svnweb.freebsd.org/changeset/base/338816
> >>>>
> >>>> Log:
> >>>>   Link libcrypto with pthread.
> >>> Why ?
> >>>
> >>>
> >> It uses pthread_once and pthread locks.
> > So what ?  libc provides the stubs.
> 
> Historically, OpenSSL was okay without pthread because native
> implementation wasn't provided and users had to provide native callback
> functions instead.
> 
> https://www.openssl.org/docs/man1.0.2/crypto/threads.html
> 
> In fact, "objdump -T /lib/libcrypto.so.8 | grep pthread_" returns
> nothing.  dwmalone discovered it and committed r127643 about 14 years ago.
> 
> https://svnweb.freebsd.org/changeset/base/127643
> 
> Now OpenSSL 1.1 actually uses POSIX pthread.  Please see the blog post
> for the rationale:
> 
> https://www.openssl.org/blog/blog/2017/02/21/threads/
> 
> Unfortunately, our stubs are not enough or broken somehow, i.e., some
> functions malfunction without pthread.
> 
> FYI, OpenSSL 1.1.1 requires the following functions now:
> 
> pthread_atfork(3)
> pthread_equal(3)
> pthread_getspecific(3)
> pthread_key_create(3)
> pthread_key_delete(3)
> pthread_once(3)
> pthread_rwlock_destroy(3)
> pthread_rwlock_init(3)
> pthread_rwlock_rdlock(3)
> pthread_rwlock_unlock(3)
> pthread_rwlock_wrlock(3)
> pthread_self(3)
> pthread_setspecific(3)
> 
> If you have a functional patch for libc stubs, I'll be more than happy
> to revert it.

>From the list, I think the possible candidates are
	pthread_once(),
	pthread_atfork(),
	pthread_key*/setspecific().
Other should work with stubs as is, key/setspecific currently just fail.
pthread_once() and pthread_atfork() silently do nothing, is it your
problem ?

The story about pthread_once() is known, there are some high-profile
programs depending on pthread_once() failing in single-threaded environment
(AKA gcc).


More information about the svn-src-projects mailing list