This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: Detecting dlclose() on an already closed handle?
- From: Carlos O'Donell <carlos at redhat dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Sun, 25 Dec 2016 22:10:13 -0500
- Subject: Re: Detecting dlclose() on an already closed handle?
- Authentication-results: sourceware.org; auth=none
- References: <1df8e262-9163-55b4-7c3a-a5150a70fabc@redhat.com>
On 12/22/2016 11:56 AM, Carlos O'Donell wrote:
> POSIX says:
> ~~~
> If the referenced symbol table handle was successfully closed, dlclose()
> shall return 0. If handle does not refer to an open symbol table handle
> or if the symbol table handle could not be closed, dlclose() shall
> return a non-zero value. More detailed diagnostic information shall
> be available through dlerror().
> ~~~
I read too much into this.
The only thing the text guarantees is that the handle currently points to
an open symbol table (loaded library) and we don't care if it originally
referenced a different library due to handle reuse.
Therefore the only solution being forced is that the implementation must
maintain a list of open objects. We already do that for dlopen/dlclose.
Where it's costly is dlsym where you have to do handle validation.
Therefore I think we can fix this without much trouble.
--
Cheers,
Carlos.