From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77276 invoked by alias); 16 Oct 2019 09:54:08 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 77268 invoked by uid 89); 16 Oct 2019 09:54:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.5 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.redhat.com From: Florian Weimer To: Carlos O'Donell Cc: libc-alpha Subject: Re: [PATCH] elf: Always set l in _dl_init_paths (Bug 23462). References: Date: Wed, 16 Oct 2019 09:54:00 -0000 In-Reply-To: (Carlos O'Donell's message of "Tue, 8 Oct 2019 20:01:49 -0400") Message-ID: <87d0ex6mo6.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2019-10/txt/msg00478.txt.bz2 * Carlos O'Donell: > diff --git a/elf/dl-load.c b/elf/dl-load.c > index 438793e53d..903f8af13a 100644 > --- a/elf/dl-load.c > +++ b/elf/dl-load.c > @@ -748,50 +748,47 @@ _dl_init_paths (const char *llp) > max_dirnamelen = SYSTEM_DIRS_MAX_LEN; > *aelem = NULL; > > -#ifdef SHARED > - /* This points to the map of the main object. */ > + /* This points to the map of the main object. It is always non-NULL > + since we have purposely made the dynamic and static cases look the > + same. */ > l = GL(dl_ns)[LM_ID_BASE]._ns_loaded; > - if (l != NULL) > + assert (l->l_type != lt_loaded); > + > + if (l->l_info[DT_RUNPATH]) > + { > + /* Allocate room for the search path and fill in information > + from RUNPATH. */ > + decompose_rpath (&l->l_runpath_dirs, > + (const void *) (D_PTR (l, l_info[DT_STRTAB]) > + + l->l_info[DT_RUNPATH]->d_un.d_val), > + l, "RUNPATH"); > + /* During rtld init the memory is allocated by the stub malloc, > + prevent any attempt to free it by the normal malloc. */ > + l->l_runpath_dirs.malloced = 0; > + > + /* The RPATH is ignored. */ > + l->l_rpath_dirs.dirs = (void *) -1; > + } Does this change enable DT_RUNPATH/DT_RPATH for statically linked binaries? Should that receive a NEWS entry and a test? Thanks, Florian