From owner-freebsd-threads@FreeBSD.ORG Mon Mar 20 11:03:16 2006 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 671A616A424 for ; Mon, 20 Mar 2006 11:03:16 +0000 (UTC) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 203C443D46 for ; Mon, 20 Mar 2006 11:03:16 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k2KB3F9w082711 for ; Mon, 20 Mar 2006 11:03:16 GMT (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k2KB3DYt082704 for freebsd-threads@freebsd.org; Mon, 20 Mar 2006 11:03:13 GMT (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 20 Mar 2006 11:03:13 GMT Message-Id: <200603201103.k2KB3DYt082704@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: peter set sender to owner-bugmaster@freebsd.org using -f From: FreeBSD bugmaster To: freebsd-threads@FreeBSD.org Cc: Subject: Current problem reports assigned to you X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Mar 2006 11:03:16 -0000 Current FreeBSD problem reports Critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2005/01/26] threads/76690threads fork hang in child for (-lc_r & -lthr) 1 problem total. Serious problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/07/18] kern/20016 threads pthreads: Cannot set scheduling timer/Can o [2000/08/26] kern/20861 threads libc_r does not honor socket timeouts o [2001/01/20] threads/24472threads libc_r does not honor SO_SNDTIMEO/SO_RCVT o [2001/01/25] threads/24632threads libc_r delicate deviation from libc in ha o [2001/01/25] kern/24641 threads pthread_rwlock_rdlock can deadlock o [2001/11/26] bin/32295 threads pthread dont dequeue signals o [2002/02/01] threads/34536threads accept() blocks other threads o [2002/05/25] kern/38549 threads the procces compiled whith pthread stoppe o [2002/06/27] threads/39922threads [threads] [patch] Threaded applications e o [2002/08/04] kern/41331 threads Pthread library open sets O_NONBLOCK flag o [2003/03/02] threads/48856threads Setting SIGCHLD to SIG_IGN still leaves z o [2003/03/10] threads/49087threads Signals lost in programs linked with libc s [2004/03/15] kern/64313 threads FreeBSD (OpenBSD) pthread implicit set/un o [2004/08/26] threads/70975threads unexpected and unreliable behaviour when o [2004/10/05] threads/72353threads Assertion fails in /usr/src/lib/libpthrea o [2004/10/07] threads/72429threads threads blocked in stdio (fgets, etc) are o [2004/10/21] threads/72953threads fork() unblocks blocked signals w/o PTHRE o [2004/12/19] threads/75273threads FBSD 5.3 libpthread (KSE) bug o [2004/12/21] threads/75374threads pthread_kill() ignores SA_SIGINFO flag o [2005/01/26] threads/76694threads fork cause hang in dup()/close() function p [2005/03/10] threads/78660threads Java hangs unkillably in STOP state after o [2005/04/08] threads/79683threads svctcp_create() fails if multiple threads o [2005/04/28] threads/80435threads panic on high loads o [2005/05/19] threads/81258threads Thread specific data is sometimes assigne o [2005/07/22] threads/83914threads [libc] popen() doesn't work in static thr o [2005/08/02] threads/84483threads problems with devel/nspr and -lc_r on 4.x o [2005/08/20] threads/85160threads [libthr] [patch] libobjc + libpthread/lib p [2005/11/19] threads/89262threads [kernel] [patch] multi-threaded process h o [2005/12/12] threads/90278threads libthr, ULE and -current produces >100% W o [2006/01/03] kern/91266 threads [threads] Trying sleep, but thread marked o [2006/03/07] threads/94176threads KSE: sigwait doesn't recieve SIGWINCH sen o [2006/03/15] threads/94467threads send(), sendto() and sendmsg() are not co 32 problems total. Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/06/13] kern/19247 threads uthread_sigaction.c does not do anything o [2000/10/21] kern/22190 threads A threaded read(2) from a socketpair(2) f o [2001/09/09] threads/30464threads pthread mutex attributes -- pshared o [2002/05/02] threads/37676threads libc_r: msgsnd(), msgrcv(), pread(), pwri s [2002/07/16] threads/40671threads pthread_cancel doesn't remove thread from o [2004/07/13] threads/69020threads pthreads library leaks _gc_mutex o [2004/09/21] threads/71966threads Mlnet Core Dumped : Fatal error '_pq_inse o [2004/11/21] threads/74180threads KSE problem. Applications those riched ma o [2005/04/13] threads/79887threads [patch] freopen() isn't thread-safe o [2005/05/13] threads/80992threads abort() sometimes not caught by gdb depen o [2005/05/26] threads/81534threads [libc_r] [patch] libc_r close() will fail 11 problems total. From owner-freebsd-threads@FreeBSD.ORG Fri Mar 24 08:48:43 2006 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 703AE16A41F; Fri, 24 Mar 2006 08:48:43 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from fw.zoral.com.ua (ll-227.216.82.212.sovam.net.ua [212.82.216.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 822EE43D46; Fri, 24 Mar 2006 08:48:41 +0000 (GMT) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by fw.zoral.com.ua (8.13.4/8.13.3) with ESMTP id k2O8mZLg002769 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Mar 2006 10:48:35 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.13.4/8.13.4) with ESMTP id k2O8mYHw028195; Fri, 24 Mar 2006 10:48:34 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.13.4/8.13.4/Submit) id k2O8mYYd028194; Fri, 24 Mar 2006 10:48:34 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Mar 2006 10:48:34 +0200 From: Kostik Belousov To: freebsd-threads@freebsd.org Message-ID: <20060324084834.GE27116@deviant.kiev.zoral.com.ua> References: <44215FE9.2070602@highway.ne.jp> <20060322174312.GB27116@deviant.kiev.zoral.com.ua> <20060322190725.GC27116@deviant.kiev.zoral.com.ua> <4421BA34.8040908@highway.ne.jp> <20060323105440.GD27116@deviant.kiev.zoral.com.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="zCKi3GIZzVBPywwA" Content-Disposition: inline In-Reply-To: <20060323105440.GD27116@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: ClamAV version 0.88, clamav-milter version 0.87 on fw.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on fw.zoral.com.ua Cc: freebsd-hackers@freebsd.org Subject: Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Mar 2006 08:48:43 -0000 --zCKi3GIZzVBPywwA Content-Type: text/plain; charset=us-ascii Content-Disposition: inline I did understand the purpose of the thread mask code in libexec/rtld/rtld_lock.c, or, more precisely, the condition where this code works (for the context, see the mails with same subject on freebsd-hackers). Look, that code assumes that blocking async signals would stop thread scheduler from doing preemption of the current thread. This works for libc_r, but fails in libpthread and libthr cases. libpthread provides implementation of the locks for rtld. But libthr does not ! As result, rtld exhibit races when used with libthr. In other words, libthr needs code to do proper locking. Do you agree ? Does somebody already planned to do this work ? Best regards, Kostik Belousov --zCKi3GIZzVBPywwA Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (FreeBSD) iD8DBQFEI7JhC3+MBN1Mb4gRAiHtAJ9XJSGx3Y9lpjAUaRFM+D/Qy0YpxgCgtm3r nxXCU+TonMJc6DrF4a4gqik= =0lBj -----END PGP SIGNATURE----- --zCKi3GIZzVBPywwA-- From owner-freebsd-threads@FreeBSD.ORG Fri Mar 24 10:46:14 2006 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2FB4F16A41F; Fri, 24 Mar 2006 10:46:14 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3C52243D55; Fri, 24 Mar 2006 10:46:13 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from localhost.my.domain (root@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k2OAk9E2079676; Fri, 24 Mar 2006 10:46:10 GMT (envelope-from davidxu@freebsd.org) From: David Xu To: freebsd-threads@freebsd.org Date: Fri, 24 Mar 2006 18:46:00 +0800 User-Agent: KMail/1.8.2 References: <44215FE9.2070602@highway.ne.jp> <20060323105440.GD27116@deviant.kiev.zoral.com.ua> <20060324084834.GE27116@deviant.kiev.zoral.com.ua> In-Reply-To: <20060324084834.GE27116@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603241846.00579.davidxu@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Mar 2006 10:46:14 -0000 =D4=DA Friday 24 March 2006 16:48=A3=ACKostik Belousov =D0=B4=B5=C0=A3=BA > I did understand the purpose of the thread mask code in > libexec/rtld/rtld_lock.c, or, more precisely, the condition where this co= de > works (for the context, see the mails with same subject on freebsd-hacker= s). >=20 > Look, that code assumes that blocking async signals would stop thread > scheduler from doing preemption of the current thread. This works > for libc_r, but fails in libpthread and libthr cases. libpthread provides > implementation of the locks for rtld. But libthr does not ! >=20 > As result, rtld exhibit races when used with libthr. In other words, > libthr needs code to do proper locking. >=20 > Do you agree ? Does somebody already planned to do this work ? >=20 > Best regards, > Kostik Belousov >=20 I will check libthr source code to see if I can fix it at the weekend. David Xu From owner-freebsd-threads@FreeBSD.ORG Fri Mar 24 12:00:09 2006 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9383D16A401; Fri, 24 Mar 2006 12:00:09 +0000 (UTC) (envelope-from kaakun@highway.ne.jp) Received: from mx.highway.ne.jp (pip7.gate01.com [61.122.117.245]) by mx1.FreeBSD.org (Postfix) with ESMTP id 21EDC43D46; Fri, 24 Mar 2006 12:00:08 +0000 (GMT) (envelope-from kaakun@highway.ne.jp) Received: from [219.0.96.106] (helo=[192.168.11.17]) by pop12.isp.us-com.jp with esmtp (Mail 4.20) id 1FMkxa-0000l9-P1; Fri, 24 Mar 2006 21:00:06 +0900 Message-ID: <4423DDFA.3090504@highway.ne.jp> Date: Fri, 24 Mar 2006 20:54:34 +0900 From: Kazuaki Oda User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051211) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Kostik Belousov References: <44215FE9.2070602@highway.ne.jp> <20060322174312.GB27116@deviant.kiev.zoral.com.ua> <20060322190725.GC27116@deviant.kiev.zoral.com.ua> <4421BA34.8040908@highway.ne.jp> <20060323105440.GD27116@deviant.kiev.zoral.com.ua> <20060324084834.GE27116@deviant.kiev.zoral.com.ua> In-Reply-To: <20060324084834.GE27116@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-2022-JP Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, freebsd-threads@freebsd.org Subject: Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Mar 2006 12:00:09 -0000 Kostik Belousov wrote: > I did understand the purpose of the thread mask code in > libexec/rtld/rtld_lock.c, or, more precisely, the condition where this code > works (for the context, see the mails with same subject on freebsd-hackers). > > Look, that code assumes that blocking async signals would stop thread > scheduler from doing preemption of the current thread. This works > for libc_r, but fails in libpthread and libthr cases. libpthread provides > implementation of the locks for rtld. But libthr does not ! > > As result, rtld exhibit races when used with libthr. In other words, > libthr needs code to do proper locking. > > Do you agree ? Does somebody already planned to do this work ? > > Best regards, > Kostik Belousov I'm a bit confused. Do you mean the following? * The current implementation of rtld has a problem both with libpthread and libthr. It works only with libc_r. * In libpthread case, the problem goes away if we modify rtld code. * In libthr case, in addition to above, we must modify libthr code to provide implementation of the locks for rtld. right? -- Kazuaki Oda From owner-freebsd-threads@FreeBSD.ORG Fri Mar 24 12:32:33 2006 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A23D516A401; Fri, 24 Mar 2006 12:32:33 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from fw.zoral.com.ua (ll-227.216.82.212.sovam.net.ua [212.82.216.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 855D743D45; Fri, 24 Mar 2006 12:32:32 +0000 (GMT) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by fw.zoral.com.ua (8.13.4/8.13.3) with ESMTP id k2OCWQCC008693 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 24 Mar 2006 14:32:26 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.13.4/8.13.4) with ESMTP id k2OCWQwe085012; Fri, 24 Mar 2006 14:32:26 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.13.4/8.13.4/Submit) id k2OCWPwZ085011; Fri, 24 Mar 2006 14:32:25 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 24 Mar 2006 14:32:25 +0200 From: Kostik Belousov To: Kazuaki Oda Message-ID: <20060324123225.GG27116@deviant.kiev.zoral.com.ua> References: <44215FE9.2070602@highway.ne.jp> <20060322174312.GB27116@deviant.kiev.zoral.com.ua> <20060322190725.GC27116@deviant.kiev.zoral.com.ua> <4421BA34.8040908@highway.ne.jp> <20060323105440.GD27116@deviant.kiev.zoral.com.ua> <20060324084834.GE27116@deviant.kiev.zoral.com.ua> <4423DDFA.3090504@highway.ne.jp> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BQPnanjtCNWHyqYD" Content-Disposition: inline In-Reply-To: <4423DDFA.3090504@highway.ne.jp> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: ClamAV version 0.88, clamav-milter version 0.87 on fw.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on fw.zoral.com.ua Cc: freebsd-hackers@freebsd.org, freebsd-threads@freebsd.org Subject: Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Mar 2006 12:32:33 -0000 --BQPnanjtCNWHyqYD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 24, 2006 at 08:54:34PM +0900, Kazuaki Oda wrote: > Kostik Belousov wrote: > > I did understand the purpose of the thread mask code in > > libexec/rtld/rtld_lock.c, or, more precisely, the condition where this = code > > works (for the context, see the mails with same subject on freebsd-hack= ers). > >=20 > > Look, that code assumes that blocking async signals would stop thread > > scheduler from doing preemption of the current thread. This works > > for libc_r, but fails in libpthread and libthr cases. libpthread provid= es > > implementation of the locks for rtld. But libthr does not ! > >=20 > > As result, rtld exhibit races when used with libthr. In other words, > > libthr needs code to do proper locking. > >=20 > > Do you agree ? Does somebody already planned to do this work ? > >=20 > > Best regards, > > Kostik Belousov >=20 > I'm a bit confused. Do you mean the following? >=20 > * The current implementation of rtld has a problem both with > libpthread and libthr. It works only with libc_r. It does not work correctly with libc_r too. > * In libpthread case, the problem goes away if we modify rtld code. Yes. > * In libthr case, in addition to above, we must modify libthr code to > provide implementation of the locks for rtld. Yes. --BQPnanjtCNWHyqYD Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (FreeBSD) iD8DBQFEI+bYC3+MBN1Mb4gRAj07AJ9juDKTVIIEs+Zt4WiNSO/zPajEYACgrOAG s6fhh4iFaka6huvxUVTOvPY= =e15F -----END PGP SIGNATURE----- --BQPnanjtCNWHyqYD-- From owner-freebsd-threads@FreeBSD.ORG Sat Mar 25 15:07:35 2006 Return-Path: X-Original-To: freebsd-threads@freebsd.org Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 97EC616A401 for ; Sat, 25 Mar 2006 15:07:35 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.227]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9E1B243D45 for ; Sat, 25 Mar 2006 15:07:34 +0000 (GMT) (envelope-from kabaev@gmail.com) Received: by wproxy.gmail.com with SMTP id 55so1214785wri for ; Sat, 25 Mar 2006 07:07:34 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer:mime-version:content-type:content-transfer-encoding; b=M0PwhLVjcXSgQ5nFkqre+L7SKjZ1uHloGHZQcrbAr7WbnQephrIRAqNnAtX6kvTXZenNiCI7OFkH8NLiQuKagR9KunwWK3NuOZTVtQY3aePeseYFQhnOUGK1iq/oMOF8rpWTR1vujByGlFiC69uE+mdYhGcXov6Xjw1dcH46cro= Received: by 10.54.154.16 with SMTP id b16mr1402553wre; Sat, 25 Mar 2006 07:07:33 -0800 (PST) Received: from kan.dnsalias.net ( [24.63.93.195]) by mx.gmail.com with ESMTP id 10sm1183377wrl.2006.03.25.07.07.32; Sat, 25 Mar 2006 07:07:32 -0800 (PST) Date: Sat, 25 Mar 2006 10:07:29 -0500 From: Alexander Kabaev To: Kostik Belousov Message-ID: <20060325100729.00713045@kan.dnsalias.net> In-Reply-To: <20060324084834.GE27116@deviant.kiev.zoral.com.ua> References: <44215FE9.2070602@highway.ne.jp> <20060322174312.GB27116@deviant.kiev.zoral.com.ua> <20060322190725.GC27116@deviant.kiev.zoral.com.ua> <4421BA34.8040908@highway.ne.jp> <20060323105440.GD27116@deviant.kiev.zoral.com.ua> <20060324084834.GE27116@deviant.kiev.zoral.com.ua> X-Mailer: Sylpheed-Claws 2.0.0 (GTK+ 2.8.15; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: freebsd-hackers@freebsd.org, freebsd-threads@freebsd.org Subject: Re: [patch] Re: dlopen() and dlclose() are not MT-safe? YES, esp. for libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Mar 2006 15:07:35 -0000 On Fri, 24 Mar 2006 10:48:34 +0200 Kostik Belousov wrote: > I did understand the purpose of the thread mask code in > libexec/rtld/rtld_lock.c, or, more precisely, the condition where > this code works (for the context, see the mails with same subject on > freebsd-hackers). > > Look, that code assumes that blocking async signals would stop thread > scheduler from doing preemption of the current thread. This works > for libc_r, but fails in libpthread and libthr cases. libpthread > provides implementation of the locks for rtld. But libthr does not ! > > As result, rtld exhibit races when used with libthr. In other words, > libthr needs code to do proper locking. > > Do you agree ? Does somebody already planned to do this work ? > > Best regards, > Kostik Belousov The thread mask only makes sense when flags are per-thread. I meant to use it to detect PLT recursions from locking primitives exported to rtld by the threads library as those are not allowed and threads implementations are required to take special care to provide only self-contained locks. The 'default' lock implementation will not work with any library other than libc_r, and even that holds true only for some definition of "work". The dynamic loader never had a reliable locking and furthermore, there was no way to make it work better without threading library cooperation. This is why we came up with a set of callbacks rtld expects every threading library to provide. libpthread was the first where these callbacks were implemented. It comes as a surprise that libthr did not have them, because David Xu was the one who did most of the work on rtld locking callbacks in libpthread. The def_thread_set_flag function use is racy and should be fixed. -- Alexander Kabaev