public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH v2 2/3] elf: Do not run constructors for proxy objects
Date: Thu, 03 Feb 2022 16:18:11 +0100	[thread overview]
Message-ID: <c3a8ae220797e71c74df32fc6fed7fcf3ccdcac1.1643901334.git.fweimer@redhat.com> (raw)
In-Reply-To: <cover.1643901334.git.fweimer@redhat.com>

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



  parent reply	other threads:[~2022-02-03 15:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03 15:17 [PATCH v2 0/3] Predictable ELF destructor ordering Florian Weimer
2022-02-03 15:17 ` [PATCH v2 1/3] elf: Do not rely on relocation dependencies for destructor sorting Florian Weimer
2022-02-14 20:11   ` Adhemerval Zanella
2022-02-03 15:18 ` Florian Weimer [this message]
2022-02-03 15:18 ` [PATCH v2 3/3] elf: Always call destructors in reverse constructor order Florian Weimer
2022-02-15 11:59   ` Adhemerval Zanella
2023-08-22 10:46     ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c3a8ae220797e71c74df32fc6fed7fcf3ccdcac1.1643901334.git.fweimer@redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).