This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Initialize preloaded DSOs earlier [BZ #14379]
- From: Florian Weimer <fweimer at redhat dot com>
- To: Vincent Whitchurch <vincent dot whitchurch at axis dot com>
- Cc: libc-alpha at sourceware dot org, Vincent Whitchurch <rabinv at axis dot com>
- Date: Wed, 06 Mar 2019 13:35:21 +0100
- Subject: Re: [PATCH v2] Initialize preloaded DSOs earlier [BZ #14379]
- References: <20190221125702.1084-1-vincent.whitchurch@axis.com>
* Vincent Whitchurch:
> Currently, preloaded DSOs are initialized after linked-in DSOs.
>
> However, in many cases it is desirable that preloaded DSO are
> initialized before linked-in DSOs (unless dependencies require
> otherwise). For example, when malloc is overloaded using a preloaded
> DSO for the purpose of heap profiling, we ideally want the preloaded DSO
> to be initialized before other DSOs so that it has a chance to set up
> its accounting code before their initializers are called.
>
> So ensure that preloaded libraries are initialized as early as possible
> and finalized as late as possible. Dependencies are still taken into
> account: DSOs which the preloaded DSO depends on are correctly
> initialized before it and finalized after it.
>
> If multiple DSOs are preloaded, DSOs earlier on the preload list will be
> initialized earlier and finalized later than DSOs present later on the
> list, analogous to how DSOs earlier on the preload list are searched for
> symbols before DSOs later on the preload list.
>
> Add a test case for this.
>
> Test suite run on x86-64.
Rich Felker shared this insightful comment:
<https://sourceware.org/bugzilla/show_bug.cgi?id=14379#c9>
I'm no longer sure if the feature is a good idea after all (whether
applied to all LD_PRELOAD objects, or a subset of them using a new
environment variable). Sorry.
Thanks,
Florian