This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[ping][PATCH][BZ #11941] Fix spurious assert in dlclose.
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: libc-alpha at sourceware dot org
- Date: Thu, 31 Oct 2013 19:00:20 +0100
- Subject: [ping][PATCH][BZ #11941] Fix spurious assert in dlclose.
- Authentication-results: sourceware.org; auth=none
- References: <20131026073726 dot GA15095 at domone dot podge>
ping
On Sat, Oct 26, 2013 at 09:37:26AM +0200, OndÅej BÃlka wrote:
> Hi, in following bug we did represent that destructor was called by reseting
> l_init_called to zero. This triggered a assert in dlclose.
>
> A solution would be add additional l_fini_called flag to represent this
> condition.
>
> [BZ #11941]
> include/link.h (struct link_map): Add l_fini_called.
> elf/dl-fini.c (_dl_fini): Guard double call by l_fini_called
> instead of reseting l_init_called.
>
> diff --git a/elf/dl-fini.c b/elf/dl-fini.c
> index 458aaf1..6f72454 100644
> --- a/elf/dl-fini.c
> +++ b/elf/dl-fini.c
> @@ -224,10 +224,10 @@ _dl_fini (void)
> {
> l = maps[i];
>
> - if (l->l_init_called)
> + if (l->l_init_called && !l->l_fini_called)
> {
> /* Make sure nothing happens if we are called twice. */
> - l->l_init_called = 0;
> + l->l_fini_called = 1;
>
> /* Is there a destructor function? */
> if (l->l_info[DT_FINI_ARRAY] != NULL
> diff --git a/include/link.h b/include/link.h
> index 1682467..17a9bed 100644
> --- a/include/link.h
> +++ b/include/link.h
> @@ -169,6 +169,7 @@ struct link_map
> } l_type:2;
> unsigned int l_relocated:1; /* Nonzero if object's relocations done. */
> unsigned int l_init_called:1; /* Nonzero if DT_INIT function called. */
> + unsigned int l_fini_called:1; /* Nonzero if DT_FINI function called. */
> unsigned int l_global:1; /* Nonzero if object in _dl_global_scope. */
> unsigned int l_reserved:2; /* Reserved for internal use. */
> unsigned int l_phdr_allocated:1; /* Nonzero if the data structure pointed
--
not properly grounded, please bury computer