public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Andreas Schwab <schwab@suse.de>
Cc: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH v3 1/2] elf: Do not run constructors for proxy objects
Date: Tue, 22 Aug 2023 13:25:57 +0200	[thread overview]
Message-ID: <87cyzf2u9m.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <mvmjztn9vmk.fsf@suse.de> (Andreas Schwab's message of "Tue, 22 Aug 2023 13:14:43 +0200")

* Andreas Schwab:

> On Aug 22 2023, Florian Weimer via Libc-alpha wrote:
>
>> 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.)  */
>
> Now that we know that l == l->l_real, the following assertion does not
> need to indirect through l_real any more.

Thanks, makes sense.  Okay to push with that change?

@@ -25,10 +25,14 @@
 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.)  */
-  assert (l->l_real->l_relocated || l->l_real->l_type == lt_executable);
+  assert (l->l_relocated || l->l_type == lt_executable);
 
   if (l->l_init_called)
     /* This object is all done.  */

Florian


  reply	other threads:[~2023-08-22 11:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-22 10:58 [PATCH v3 0/2] Predictable ELF destructor ordering (bug 30785) Florian Weimer
2023-08-22 10:58 ` [PATCH v3 1/2] elf: Do not run constructors for proxy objects Florian Weimer
2023-08-22 11:14   ` Andreas Schwab
2023-08-22 11:25     ` Florian Weimer [this message]
2023-08-22 11:50       ` Andreas Schwab
2023-08-22 10:58 ` [PATCH v3 2/2] elf: Always call destructors in reverse constructor order (bug 30785) Florian Weimer
2023-09-01 17:59   ` DJ Delorie
2023-09-01 21:29     ` Florian Weimer
2023-08-23 10:04 ` [PATCH v3 0/2] Predictable ELF destructor ordering " 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=87cyzf2u9m.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=schwab@suse.de \
    /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).