diff mbox series

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

Message ID c3a8ae220797e71c74df32fc6fed7fcf3ccdcac1.1643901334.git.fweimer@redhat.com
State New
Headers show
Series Predictable ELF destructor ordering | expand

Checks

Context Check Description
dj/TryBot-apply_patch success Patch applied to master at the time it was sent

Commit Message

Florian Weimer Feb. 3, 2022, 3:18 p.m. UTC
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 mbox series

Patch

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.)  */