Date: Mon, 01 Sep 2008 11:34:45 +0300 From: Andriy Gapon <avg@icyb.net.ua> To: David Xu <davidxu@freebsd.org> Cc: Daniel Eischen <deischen@freebsd.org>, freebsd-threads@freebsd.org Subject: Re: mysterious hang in pthread_create Message-ID: <48BBA925.1000303@icyb.net.ua> In-Reply-To: <48BBA369.9010108@freebsd.org> References: <48B7101E.7060203@icyb.net.ua> <48B71BA6.5040504@icyb.net.ua> <20080829141043.GX2038@deviant.kiev.zoral.com.ua> <48B8052A.6070908@icyb.net.ua> <20080829143645.GY2038@deviant.kiev.zoral.com.ua> <Pine.GSO.4.64.0808291223240.5086@sea.ntplx.net> <20080829190506.GA2038@deviant.kiev.zoral.com.ua> <Pine.GSO.4.64.0808301128410.9898@sea.ntplx.net> <20080830155622.GF2038@deviant.kiev.zoral.com.ua> <Pine.GSO.4.64.0808301200460.9898@sea.ntplx.net> <20080830184512.GH2038@deviant.kiev.zoral.com.ua> <48BBA369.9010108@freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
on 01/09/2008 11:10 David Xu said the following: > The ancient bug is in rtld, rlock_acquire() and wlock_acquire() test > thread_flag as a boolean value, because pt_iterate_phdr() tries to > lock two locks at same time, this test will always fail once it > acquired first lock. > > The following silly patch fixes the problem Andriy encountered: I can confirm - this fixed the issue for me. David, thanks! > Index: rtld_lock.c > =================================================================== > --- rtld_lock.c (版本 182594) > +++ rtld_lock.c (工作副本) > @@ -184,7 +184,7 @@ > int > rlock_acquire(rtld_lock_t lock) > { > - if (thread_mask_set(lock->mask)) { > + if (thread_mask_set(lock->mask) & lock->mask) { > dbg("rlock_acquire: recursed"); > return (0); > } > @@ -195,7 +195,7 @@ > int > wlock_acquire(rtld_lock_t lock) > { > - if (thread_mask_set(lock->mask)) { > + if (thread_mask_set(lock->mask) & lock->mask) { > dbg("wlock_acquire: recursed"); > return (0); > } > > > Regards, > David Xu > -- Andriy Gapon
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?48BBA925.1000303>