fork() after pthread_mutex_init()

Edgar Fuß ef at math.uni-bonn.de
Mon May 13 21:03:04 CEST 2013


> Hmm... it's not *holding* the mutex, it's *creating* it.
Yes, sorry for mis-phrasing that.

> That should be allowed, IIRC.
Yes, it probably is.

Just for the sake of the archives: This turned out NOT to be a FreeRADIUS bug.

After a lot of debugging, it turned out that radiusd, via initgroups() and nsswitch.conf, loaded nss_ldap, which pulled in libldap (the non-reentrant version). Also, radiusd, via rlm_ldap, pulled in libldap_r (the reentrant version). However, nss_ldap had registered a pthread_atfork handler, which intended to call ldap_drop_conenction() from libldap, but, because of PLT load-time-linking, in fact ended up calling ldap_drop_connection() from libldap_r. Boom (inside fork()).


More information about the Freeradius-Devel mailing list