This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Add LD_PRELOAD_INIT_EARLY [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: Fri, 15 Feb 2019 12:43:54 +0100
- Subject: Re: [PATCH] Add LD_PRELOAD_INIT_EARLY [BZ #14379]
- References: <20190214170852.30862-1-vincent.whitchurch@axis.com>
* Vincent Whitchurch:
> Currently, DSOs preloaded with LD_PRELOAD are initialized after
> linked-in DSOs, unless dependencies require otherwise.
>
> However, in some 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.
>
> Changing the default behaviour could lead to breakage, so add a new
> environment variable, LD_PRELOAD_INIT_EARLY, the presence of which will
> ask preloaded libraries to be initialized as early as possible and
> finalized as late as possible. If multiple DSOs are preloaded, DSOs
> earlier on the LD_PRELOAD list will be initalized earlier and finalized
> later than DSOs present later on the list.
>
> Note that dependencies are still taken into account: DSOs which the
> preloaded DSO depends on are correctly initalized before it and
> finalized after it.
Maybe we should LD_PRELOAD to use this behavior instead? Isn't that
what users expect?
Thanks,
Florian