]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: Do not run constructors for proxy objects
authorFlorian Weimer <fweimer@redhat.com>
Tue, 22 Aug 2023 11:56:25 +0000 (13:56 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 22 Aug 2023 11:56:25 +0000 (13:56 +0200)
Otherwise, the ld.so constructor runs for each audit namespace
and each dlmopen namespace.

elf/dl-init.c

index 5b0732590fa12a04619d0fb0cc5537d7a1af2ec5..ba4d2fdc859c563ecbfa607d7ea6c1159ed4518f 100644 (file)
 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.  */