aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2023-08-22 13:56:25 +0200
committerFlorian Weimer <fweimer@redhat.com>2023-09-11 09:37:40 +0200
commitaeea91fd1555a1ea8b1fd8711766f869355a7e81 (patch)
tree9a4eb3d557d5c7d79886ef4bf752825a80cc7034
parent1d828d58556ec8515e2e6e539ca8b1d948ff1f56 (diff)
downloadglibc-aeea91fd1555a1ea8b1fd8711766f869355a7e81.tar
glibc-aeea91fd1555a1ea8b1fd8711766f869355a7e81.tar.gz
glibc-aeea91fd1555a1ea8b1fd8711766f869355a7e81.tar.bz2
glibc-aeea91fd1555a1ea8b1fd8711766f869355a7e81.zip
elf: Do not run constructors for proxy objects
Otherwise, the ld.so constructor runs for each audit namespace and each dlmopen namespace. (cherry picked from commit f6c8204fd7fabf0cf4162eaf10ccf23258e4d10e)
-rw-r--r--elf/dl-init.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/elf/dl-init.c b/elf/dl-init.c
index deefeb099a..fca8e3a05e 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -25,10 +25,14 @@
static void
call_init (struct link_map *l, int argc, char **argv, char **env)
{
+ /* Do not run constructors for proxy objects. */
+ if (l != l->l_real)
+ return;
+
/* If the object has not been relocated, this is a bug. The
function pointers are invalid in this case. (Executables do not
- need relocation, and neither do proxy objects.) */
- assert (l->l_real->l_relocated || l->l_real->l_type == lt_executable);
+ need relocation.) */
+ assert (l->l_relocated || l->l_type == lt_executable);
if (l->l_init_called)
/* This object is all done. */