This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] [BZ#15903] INITFIRST flag does not change fini order (ld.so)
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: Guillaume Berard <berardgui at gmail dot com>
- Cc: "Ryan S. Arnold" <ryan dot arnold at gmail dot com>, libc-alpha <libc-alpha at sourceware dot org>
- Date: Thu, 19 Sep 2013 13:05:51 +0200
- Subject: Re: [PATCH] [BZ#15903] INITFIRST flag does not change fini order (ld.so)
- Authentication-results: sourceware.org; auth=none
- References: <CAJ3=_khdUcYQ0aj0rRsSDiWTHcjaUQq+JrVzDR0xE6oS=C99-A at mail dot gmail dot com> <CAAKybw9A2u+HdY8WY4Z9HDQm4M=5hdvhVJkn5w9O7GdMujk0nQ at mail dot gmail dot com> <CAJ3=_kggQAAWksNh03_uDSUNBvzMigUKr1i69GQxSz467A8_0A at mail dot gmail dot com> <CAAKybw_vO9zrkbP5C9cgS9+cXt36_a5J870Mn+_S+3LmMkSXEA at mail dot gmail dot com> <CAJ3=_kjy-vO4XZ_J1JPwy-u6nzDEeGSRUX2pfh8stPCcfwDkZw at mail dot gmail dot com> <CAAKybw8O++1hDrKGBfWiSBoxvHJ_9WgJcrZapSvP9sqaWTW+Lg at mail dot gmail dot com> <1378593028 dot 3097 dot 21 dot camel at localhost dot localdomain> <CAJ3=_kg_6hSJ=YCN+E=VQpvccA-eCzEqUyirqqLiOnvCiiL_bg at mail dot gmail dot com>
On Thu, Sep 19, 2013 at 10:48:18AM +0200, Guillaume Berard wrote:
> I dig a bit in the code to find a clean solution, and I found this comment:
>
> /* Lots of fun ahead. We have to call the destructors for all still
> loaded objects, in all namespaces. The problem is that the ELF
> specification now demands that dependencies between the modules
> are taken into account. I.e., the destructor for a module is
> called before the ones for any of its dependencies.
>
> To make things more complicated, we cannot simply use the reverse
> order of the constructors. Since the user might have loaded objects
> using `dlopen' there are possibly several other modules with its
> dependencies to be taken into account. Therefore we have to start
> determining the order of the modules once again from the beginning. */
>
> So it seems that ELF specifications are not really working with the
> initfirst specifications...
> Just by curiosity, does anyone knows where I can find up-to-date ELF
> specifications?
> It could be a help to decide the behavior to adapt here.
>
I am not sure that I understand what is a problem. Is that some objects
cannot be unloaded?
If so then we could just do one pass to determine list of objects that
need to be unloaded and then sort them in reverse init order and call
destructors.
Or with dynamic dependencies should we also load order in which they are
loaded?