public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Florian Weimer <fw@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] elf: Initialize GLRO(dl_lazy) before relocating libc in dynamic startup
Date: Fri,  8 Dec 2023 13:33:25 +0000 (GMT)	[thread overview]
Message-ID: <20231208133325.621D93858C5F@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b3bee76c5f59498b9c189608f0a3132e2013fa1a

commit b3bee76c5f59498b9c189608f0a3132e2013fa1a
Author: Florian Weimer <fweimer@redhat.com>
Date:   Fri Dec 8 09:51:34 2023 +0100

    elf: Initialize GLRO(dl_lazy) before relocating libc in dynamic startup
    
    GLRO(dl_lazy) is used to set the parameters for the early
    _dl_relocate_object call, so the consider_profiling setting has to
    be applied before the call.
    
    Fixes commit 78ca44da0160a0b442f0ca1f253e3360f044b2ec ("elf: Relocate
    libc.so early during startup and dlmopen (bug 31083)").
    
    Reviewed-by: Carlos O'Donell <carlos@redhat.com>

Diff:
---
 elf/rtld.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/elf/rtld.c b/elf/rtld.c
index f0b0f3328d..326286f3b2 100644
--- a/elf/rtld.c
+++ b/elf/rtld.c
@@ -2278,14 +2278,14 @@ dl_main (const ElfW(Phdr) *phdr,
 
   int consider_profiling = GLRO(dl_profile) != NULL;
 
+  /* If we are profiling we also must do lazy reloaction.  */
+  GLRO(dl_lazy) |= consider_profiling;
+
   if (GL(dl_ns)[LM_ID_BASE].libc_map != NULL)
     _dl_relocate_object (GL(dl_ns)[LM_ID_BASE].libc_map,
 			 GL(dl_ns)[LM_ID_BASE].libc_map->l_scope,
 			 GLRO(dl_lazy) ? RTLD_LAZY : 0, consider_profiling);
 
-  /* If we are profiling we also must do lazy reloaction.  */
-  GLRO(dl_lazy) |= consider_profiling;
-
   RTLD_TIMING_VAR (start);
   rtld_timer_start (&start);
   {

                 reply	other threads:[~2023-12-08 13:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20231208133325.621D93858C5F@sourceware.org \
    --to=fw@sourceware.org \
    --cc=glibc-cvs@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).