From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id 621D93858C5F; Fri, 8 Dec 2023 13:33:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 621D93858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1702042405; bh=KdZSCtnugMdIdXeVgX43mY99W+d74VThgR8ZJfRm2Yo=; h=From:To:Subject:Date:From; b=fUcMq5zcjkTT+fxQkf3FH7C9OCCUAkAdzjjKb+KvDC0gQCbVYXIYAsnRQzfndnj36 e1o517uQ/ZcXZEepy5vS6SYsheaNjLMghrtAkpkgsWAttlK7OL3dCdYUzkh4hAPF9v hyNQgMgXhRRRzBO2w+TPcapViK/ohnBb9bHzNnHA= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc] elf: Initialize GLRO(dl_lazy) before relocating libc in dynamic startup X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/master X-Git-Oldrev: 60c57b8467f11e334e7c7fd07d588c248e93d952 X-Git-Newrev: b3bee76c5f59498b9c189608f0a3132e2013fa1a Message-Id: <20231208133325.621D93858C5F@sourceware.org> Date: Fri, 8 Dec 2023 13:33:25 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b3bee76c5f59498b9c189608f0a3132e2013fa1a commit b3bee76c5f59498b9c189608f0a3132e2013fa1a Author: Florian Weimer 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 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); {