public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] elf: Avoid RELATIVE relocation for _dl_sysinfo
@ 2021-01-19 14:38 H.J. Lu
  0 siblings, 0 replies; only message in thread
From: H.J. Lu @ 2021-01-19 14:38 UTC (permalink / raw)
  To: glibc-cvs

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

commit cabc8a291629011894ff5d1dc4ec7e25ecee6269
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Jan 18 11:45:46 2021 +0000

    elf: Avoid RELATIVE relocation for _dl_sysinfo
    
    Set the default _dl_sysinfo in _dl_aux_init to avoid RELATIVE relocation
    in static PIE.
    
    This is needed for fixing bug 27072 on x86.
    
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

Diff:
---
 elf/dl-support.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/elf/dl-support.c b/elf/dl-support.c
index 9d468d5a4b..2434c470c7 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -193,8 +193,9 @@ int _dl_thread_gscope_count;
 struct dl_scope_free_list *_dl_scope_free_list;
 
 #ifdef NEED_DL_SYSINFO
-/* Needed for improved syscall handling on at least x86/Linux.  */
-uintptr_t _dl_sysinfo = DL_SYSINFO_DEFAULT;
+/* Needed for improved syscall handling on at least x86/Linux.  NB: Don't
+   initialize it here to avoid RELATIVE relocation in static PIE.  */
+uintptr_t _dl_sysinfo;
 #endif
 #ifdef NEED_DL_SYSINFO_DSO
 /* Address of the ELF headers in the vsyscall page.  */
@@ -232,6 +233,11 @@ _dl_aux_init (ElfW(auxv_t) *av)
   uid_t uid = 0;
   gid_t gid = 0;
 
+#ifdef NEED_DL_SYSINFO
+  /* NB: Avoid RELATIVE relocation in static PIE.  */
+  GL(dl_sysinfo) = DL_SYSINFO_DEFAULT;
+#endif
+
   _dl_auxv = av;
   for (; av->a_type != AT_NULL; ++av)
     switch (av->a_type)


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-19 14:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-19 14:38 [glibc] elf: Avoid RELATIVE relocation for _dl_sysinfo H.J. Lu

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).