Fix crash on getauxval call without HAVE_AUX_VECTOR
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 10 Apr 2016 21:58:43 +0000 (23:58 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 10 Apr 2016 21:58:43 +0000 (23:58 +0200)
* sysdeps/generic/ldsodefs.h (struct rtld_global_ro)
[!HAVE_AUX_VECTOR]: Do not define _dl_auxv field.
* misc/getauxval.c (__getauxval) [!HAVE_AUX_VECTOR]: Do not go through
GLRO(dl_auxv) list.

ChangeLog
misc/getauxval.c
sysdeps/generic/ldsodefs.h

index 7a20eb3..fc5ffd8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-04-10  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+       * sysdeps/generic/ldsodefs.h (struct rtld_global_ro)
+       [!HAVE_AUX_VECTOR]: Do not define _dl_auxv field.
+       * misc/getauxval.c (__getauxval) [!HAVE_AUX_VECTOR]: Do not go through
+       GLRO(dl_auxv) list.
+
 2016-04-09  Nick Alcock  <nick.alcock@oracle.com>
 
        * elf/rtld-Rules (rtld-compile-command.c): Add $(rtld-CFLAGS).
index e48f40f..6111376 100644 (file)
@@ -30,9 +30,11 @@ __getauxval (unsigned long int type)
   else if (type == AT_HWCAP2)
     return GLRO(dl_hwcap2);
 
+#ifdef HAVE_AUX_VECTOR
   for (p = GLRO(dl_auxv); p->a_type != AT_NULL; p++)
     if (p->a_type == type)
       return p->a_un.a_val;
+#endif
 
   __set_errno (ENOENT);
   return 0;
index 2733ac8..ddec0be 100644 (file)
@@ -509,8 +509,10 @@ struct rtld_global_ro
   /* Mask for important hardware capabilities we honour. */
   EXTERN uint64_t _dl_hwcap_mask;
 
+#ifdef HAVE_AUX_VECTOR
   /* Pointer to the auxv list supplied to the program at startup.  */
   EXTERN ElfW(auxv_t) *_dl_auxv;
+#endif
 
   /* Get architecture specific definitions.  */
 #define PROCINFO_DECL