[PATCH v2 2/3] elf: Do not run constructors for proxy objects

Florian Weimer fweimer@redhat.com
Thu Feb 3 15:18:11 GMT 2022


Otherwise, the ld.so constructor runs for each audit namespace
and each dlmopen namespace.
---
v2: New patch.

 elf/dl-init.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/elf/dl-init.c b/elf/dl-init.c
index deefeb099a..cfeb28a2a7 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.34.1




More information about the Libc-alpha mailing list