e77659
commit f6c8204fd7fabf0cf4162eaf10ccf23258e4d10e
e77659
Author: Florian Weimer <fweimer@redhat.com>
e77659
Date:   Tue Aug 22 13:56:25 2023 +0200
e77659
e77659
    elf: Do not run constructors for proxy objects
e77659
    
e77659
    Otherwise, the ld.so constructor runs for each audit namespace
e77659
    and each dlmopen namespace.
e77659
e77659
diff --git a/elf/dl-init.c b/elf/dl-init.c
e77659
index 99ce531d7b326f5f..73c0259fbe6d19af 100644
e77659
--- a/elf/dl-init.c
e77659
+++ b/elf/dl-init.c
e77659
@@ -28,10 +28,14 @@ typedef void (*init_t) (int, char **, char **);
e77659
 static void
e77659
 call_init (struct link_map *l, int argc, char **argv, char **env)
e77659
 {
e77659
+  /* Do not run constructors for proxy objects.  */
e77659
+  if (l != l->l_real)
e77659
+    return;
e77659
+
e77659
   /* If the object has not been relocated, this is a bug.  The
e77659
      function pointers are invalid in this case.  (Executables do not
e77659
-     need relocation, and neither do proxy objects.)  */
e77659
-  assert (l->l_real->l_relocated || l->l_real->l_type == lt_executable);
e77659
+     need relocation.)  */
e77659
+  assert (l->l_relocated || l->l_type == lt_executable);
e77659
 
e77659
   if (l->l_init_called)
e77659
     /* This object is all done.  */