This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] elf: Always set l in _dl_init_paths (Bug 23462).
- From: Florian Weimer <fweimer at redhat dot com>
- To: Carlos O'Donell <carlos at redhat dot com>
- Cc: libc-alpha <libc-alpha at sourceware dot org>
- Date: Wed, 16 Oct 2019 11:54:01 +0200
- Subject: Re: [PATCH] elf: Always set l in _dl_init_paths (Bug 23462).
- References: <ca723e73-c8eb-ca4c-1ca0-5fbf2b88edcd@redhat.com>
* 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