From owner-freebsd-stable@freebsd.org Thu Dec 3 11:04:17 2020 Return-Path: Delivered-To: freebsd-stable@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1673A4A362B for ; Thu, 3 Dec 2020 11:04:17 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmtJJ72k8z3PwK; Thu, 3 Dec 2020 11:04:16 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from onlyone.not-for.work (onlyone.not-for.work [IPv6:2a01:4f8:201:6350::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: lev/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id CA0392D768; Thu, 3 Dec 2020 11:04:16 +0000 (UTC) (envelope-from lev@FreeBSD.org) Received: from [192.168.23.230] (unknown [89.113.128.32]) (Authenticated sender: lev@serebryakov.spb.ru) by onlyone.not-for.work (Postfix) with ESMTPSA id D33134284; Thu, 3 Dec 2020 14:04:13 +0300 (MSK) Reply-To: lev@FreeBSD.org Subject: Re: 12-STABLE try to init thead-using libraries before threads and program crashes To: Konstantin Belousov Cc: FreeBSD Stable References: From: Lev Serebryakov Organization: FreeBSD Message-ID: Date: Thu, 3 Dec 2020 14:04:13 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 11:04:17 -0000 On 27.11.2020 20:03, Konstantin Belousov wrote: > libthr is cleanly linked too early, it should come after all consumers. > Anyway, try this. > > diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c > index 57984ef6d0e..303386db7fe 100644 > --- a/lib/libthr/thread/thr_mutex.c > +++ b/lib/libthr/thread/thr_mutex.c > @@ -384,6 +384,8 @@ __Tthr_mutex_init(pthread_mutex_t * __restrict mutex, > struct pthread_mutex *pmtx; > int ret; > > + _thr_check_init(); > + > if (mutex_attr != NULL) { > ret = mutex_check_attr(*mutex_attr); > if (ret != 0) > It helps! -- // Lev Serebryakov