[PATCH 0/1] __libc_start_main() now uses auxv to obtain phdr's address [BZ #29864]
Florian Weimer
fweimer@redhat.com
Fri Dec 9 13:13:03 GMT 2022
* Yago Gutiérrez:
> diff --git a/sysdeps/unix/sysv/linux/dl-parse_auxv.h b/sysdeps/unix/sysv/linux/dl-parse_auxv.h
> index bf9374371e..f1a964ec1d 100644
> --- a/sysdeps/unix/sysv/linux/dl-parse_auxv.h
> +++ b/sysdeps/unix/sysv/linux/dl-parse_auxv.h
> @@ -52,6 +52,9 @@ void _dl_parse_auxv (ElfW(auxv_t) *av, dl_parse_auxv_t auxv_values)
> _dl_random = (void *) auxv_values[AT_RANDOM];
> GLRO(dl_minsigstacksize) = auxv_values[AT_MINSIGSTKSZ];
> GLRO(dl_sysinfo_dso) = (void *) auxv_values[AT_SYSINFO_EHDR];
> +#ifndef SHARED
> + GL(dl_phdr) = (void*) auxv_values[AT_PHDR];
> +#endif
> #ifdef NEED_DL_SYSINFO
> if (GLRO(dl_sysinfo_dso) != NULL)
> GLRO(dl_sysinfo) = auxv_values[AT_SYSINFO];
The dynamic linker calls _dl_parse_auxv via _dl_sysdep_parse_arguments.
This gives direct access to all auxv entries. I wonder if we should
abolish _dl_aux_init and call _dl_parse_auxv here. It shouldn't be
necessary to duplicate this data in _dl_main_map and separate variables
(see _dl_non_dynamic_init).
Can we assume that AT_PHDR and AT_PHNUM are always present on Linux?
Thanks,
Florian
More information about the Libc-alpha
mailing list