From owner-freebsd-current@FreeBSD.ORG Fri Mar 26 13:16:22 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CF98416A4CE; Fri, 26 Mar 2004 13:16:22 -0800 (PST) Received: from ms-smtp-01-eri0.socal.rr.com (ms-smtp-01-qfe0.socal.rr.com [66.75.162.133]) by mx1.FreeBSD.org (Postfix) with ESMTP id ACFA743D31; Fri, 26 Mar 2004 13:16:22 -0800 (PST) (envelope-from sean@mcneil.com) Received: from mail.mcneil.com (cpe-24-24-233-222.socal.rr.com [24.24.233.222])i2QLGKu2011338; Fri, 26 Mar 2004 13:16:20 -0800 (PST) Received: from localhost (localhost.mcneil.com [127.0.0.1]) by mail.mcneil.com (Postfix) with ESMTP id 11325FD152; Fri, 26 Mar 2004 13:16:20 -0800 (PST) Received: from mail.mcneil.com ([127.0.0.1]) by localhost (server.mcneil.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 74089-02; Fri, 26 Mar 2004 13:16:19 -0800 (PST) Received: from [24.24.233.222] (mcneil.com [24.24.233.222]) by mail.mcneil.com (Postfix) with ESMTP id 90EA2FD12E; Fri, 26 Mar 2004 13:16:19 -0800 (PST) From: Sean McNeil To: "Jacques A. Vidrine" In-Reply-To: <1080334840.11426.12.camel@server.mcneil.com> References: <1080273717.18231.10.camel@server.mcneil.com> <20040326125934.GA68357@madman.celabo.org> <1080334840.11426.12.camel@server.mcneil.com> Content-Type: text/plain Message-Id: <1080335779.11426.15.camel@server.mcneil.com> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 Date: Fri, 26 Mar 2004 13:16:19 -0800 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Virus-Scanned: by amavisd-new at mcneil.com cc: freebsd-current@freebsd.org Subject: Re: nss_ldap broken X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Mar 2004 21:16:23 -0000 On Fri, 2004-03-26 at 13:00, Sean McNeil wrote: > OK, I think I understand this problem... > > When I have my nsswitch.conf setup as follows, I get seg11s: > > passwd: files ldap > group: files ldap > > This appears to be an issue with any external nss_*.so.1 module that > uses pthread. It looks to me it is about the following: > > /* > * Cleanup > */ > static void > nss_atexit(void) > { > (void)_pthread_rwlock_wrlock(&nss_lock); > VECTOR_FREE(_nsmap, &_nsmapsize, sizeof(*_nsmap), > (vector_free_elem)ns_dbt_free); > VECTOR_FREE(_nsmod, &_nsmodsize, sizeof(*_nsmod), > (vector_free_elem)ns_mod_free); > (void)_pthread_rwlock_unlock(&nss_lock); > } > > In my case, the nss_ldap.so.1 module was loaded which pulls in > libpthread. I'm not sure how this works without a libpthred, but it > would appear that unless libpthread.so is loaded everything is OK. But > now, it has been loaded and the rwlock_wrlock() works, but then it has > been unloaded before rwlock_unlock() gets called. > > Would using > > #include > rwlock_wrlock() > rwlock_unlock() > > macros fix this? > > Cheers, > Sean > Final thought: exit() sets __isthreaded to 0, so I am hazarding a guess that the lock isn't necessary. Removing the lock/unlock from nss_atexit() did the trick. Sean