[PATCH v3 1/2] elf: Do not run constructors for proxy objects

Florian Weimer fweimer@redhat.com
Tue Aug 22 10:58:29 GMT 2023


Otherwise, the ld.so constructor runs for each audit namespace
and each dlmopen namespace.
---
 elf/dl-init.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/elf/dl-init.c b/elf/dl-init.c
index 5b0732590f..fefd471851 100644
--- a/elf/dl-init.c
+++ b/elf/dl-init.c
@@ -25,6 +25,10 @@
 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.)  */
-- 
2.41.0




More information about the Libc-alpha mailing list