From owner-svn-src-projects@freebsd.org Thu Sep 20 18:21:38 2018 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BC91A10A47B5 for ; Thu, 20 Sep 2018 18:21:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4772777DD4; Thu, 20 Sep 2018 18:21:37 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w8KILQSx056120 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 20 Sep 2018 21:21:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w8KILQSx056120 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w8KILPQM056119; Thu, 20 Sep 2018 21:21:25 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Thu, 20 Sep 2018 21:21:25 +0300 From: Konstantin Belousov To: Jung-uk Kim Cc: Benjamin Kaduk , svn-src-projects@freebsd.org, src-committers , John Baldwin Subject: Re: svn commit: r338816 - in projects/openssl111: secure/lib/libcrypto share/mk Message-ID: <20180920182125.GF3161@kib.kiev.ua> References: <201809200020.w8K0K45h000526@repo.freebsd.org> <20180920100939.GU3161@kib.kiev.ua> <20180920131952.GZ3161@kib.kiev.ua> <08a628fe-e640-7804-7c54-de9fdc407c7d@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <08a628fe-e640-7804-7c54-de9fdc407c7d@FreeBSD.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Sep 2018 18:21:38 -0000 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 > >> 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).