This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
Re: elf_end(): rwlock_fini() with a locked object
- From: Mark Wielaard <mjw at redhat dot com>
- To: elfutils-devel at lists dot fedorahosted dot org
- Date: Sun, 26 Feb 2012 13:44:38 +0100
- Subject: Re: elf_end(): rwlock_fini() with a locked object
On Sun, Feb 26, 2012 at 12:11:43AM +0100, Kurt Roeckx wrote:
> In libelf/elf_end.c:244 you have:
> rwlock_fini (elf->lock);
>
> But this lock is always still held when you get there.
>
> I see this:
> > Results are undefined if pthread_rwlock_destroy()
> > is called when any thread holds rwlock.
> [...]
> And I get this on Debian's kfreebsd port, resulting in an
> assertion failure. I wonder why I'm not getting it on other
> ports.
The result is undefined and reporting EBUSY isn't required,
so an implementation is certainly allowed to just ignore any
locks still being held.
> Adding a "rwlock_unlock (elf->lock);" just in front of that
> line fixes the problem.
Yes, that looks correct.
Thanks,
Mark