From owner-freebsd-current@FreeBSD.ORG Fri Mar 26 14:51:03 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 C1BF516A4DD; Fri, 26 Mar 2004 14:51:03 -0800 (PST) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7EEE643D1D; Fri, 26 Mar 2004 14:51:03 -0800 (PST) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.10/8.12.1) with ESMTP id i2QMp2tf011573; Fri, 26 Mar 2004 17:51:02 -0500 (EST) Date: Fri, 26 Mar 2004 17:51:02 -0500 (EST) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Sean McNeil In-Reply-To: <1080334840.11426.12.camel@server.mcneil.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: "Jacques A. Vidrine" 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 22:51:03 -0000 On Fri, 26 Mar 2004, 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? I think I made a comment about how you should always prefix _pthread_foo() calls with 'if (__isthreaded)'. When the thread libraries are initialized, then overrwrite the function pointers in libc's thread jumptable. If you unload the library, libc still retains those pointers. -- Dan Eischen