076f82
commit 2139b1848e3e0a960ccc615fe1fd78b5d10b1411
076f82
Author: Florian Weimer <fweimer@redhat.com>
076f82
Date:   Thu Feb 3 10:58:59 2022 +0100
076f82
076f82
    Linux: Remove HAVE_AUX_SECURE, HAVE_AUX_XID, HAVE_AUX_PAGESIZE
076f82
    
076f82
    They are always defined.
076f82
    
076f82
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
076f82
    (cherry picked from commit b9c3d3382f6f50e9723002deb2dc8127de720fa6)
076f82
076f82
diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c
076f82
index 3e41469bcc395179..aae983777ba15fae 100644
076f82
--- a/sysdeps/unix/sysv/linux/dl-sysdep.c
076f82
+++ b/sysdeps/unix/sysv/linux/dl-sysdep.c
076f82
@@ -85,21 +85,6 @@ _dl_sysdep_start (void **start_argptr,
076f82
   ElfW(Word) phnum = 0;
076f82
   ElfW(Addr) user_entry;
076f82
   ElfW(auxv_t) *av;
076f82
-#ifdef HAVE_AUX_SECURE
076f82
-# define set_seen(tag) (tag)	/* Evaluate for the side effects.  */
076f82
-# define set_seen_secure() ((void) 0)
076f82
-#else
076f82
-  uid_t uid = 0;
076f82
-  gid_t gid = 0;
076f82
-  unsigned int seen = 0;
076f82
-# define set_seen_secure() (seen = -1)
076f82
-# ifdef HAVE_AUX_XID
076f82
-#  define set_seen(tag) (tag)	/* Evaluate for the side effects.  */
076f82
-# else
076f82
-#  define M(type) (1 << (type))
076f82
-#  define set_seen(tag) seen |= M ((tag)->a_type)
076f82
-# endif
076f82
-#endif
076f82
 #ifdef NEED_DL_SYSINFO
076f82
   uintptr_t new_sysinfo = 0;
076f82
 #endif
076f82
@@ -116,7 +101,7 @@ _dl_sysdep_start (void **start_argptr,
076f82
 		  "CONSTANT_MINSIGSTKSZ is constant");
076f82
   GLRO(dl_minsigstacksize) = CONSTANT_MINSIGSTKSZ;
076f82
 
076f82
-  for (av = GLRO(dl_auxv); av->a_type != AT_NULL; set_seen (av++))
076f82
+  for (av = GLRO(dl_auxv); av->a_type != AT_NULL; av++)
076f82
     switch (av->a_type)
076f82
       {
076f82
       case AT_PHDR:
076f82
@@ -131,20 +116,7 @@ _dl_sysdep_start (void **start_argptr,
076f82
       case AT_ENTRY:
076f82
 	user_entry = av->a_un.a_val;
076f82
 	break;
076f82
-#ifndef HAVE_AUX_SECURE
076f82
-      case AT_UID:
076f82
-      case AT_EUID:
076f82
-	uid ^= av->a_un.a_val;
076f82
-	break;
076f82
-      case AT_GID:
076f82
-      case AT_EGID:
076f82
-	gid ^= av->a_un.a_val;
076f82
-	break;
076f82
-#endif
076f82
       case AT_SECURE:
076f82
-#ifndef HAVE_AUX_SECURE
076f82
-	seen = -1;
076f82
-#endif
076f82
 	__libc_enable_secure = av->a_un.a_val;
076f82
 	break;
076f82
       case AT_PLATFORM:
076f82
@@ -183,31 +155,6 @@ _dl_sysdep_start (void **start_argptr,
076f82
 
076f82
   dl_hwcap_check ();
076f82
 
076f82
-#ifndef HAVE_AUX_SECURE
076f82
-  if (seen != -1)
076f82
-    {
076f82
-      /* Fill in the values we have not gotten from the kernel through the
076f82
-	 auxiliary vector.  */
076f82
-# ifndef HAVE_AUX_XID
076f82
-#  define SEE(UID, var, uid) \
076f82
-   if ((seen & M (AT_##UID)) == 0) var ^= __get##uid ()
076f82
-      SEE (UID, uid, uid);
076f82
-      SEE (EUID, uid, euid);
076f82
-      SEE (GID, gid, gid);
076f82
-      SEE (EGID, gid, egid);
076f82
-# endif
076f82
-
076f82
-      /* If one of the two pairs of IDs does not match this is a setuid
076f82
-	 or setgid run.  */
076f82
-      __libc_enable_secure = uid | gid;
076f82
-    }
076f82
-#endif
076f82
-
076f82
-#ifndef HAVE_AUX_PAGESIZE
076f82
-  if (GLRO(dl_pagesize) == 0)
076f82
-    GLRO(dl_pagesize) = __getpagesize ();
076f82
-#endif
076f82
-
076f82
 #ifdef NEED_DL_SYSINFO
076f82
   if (new_sysinfo != 0)
076f82
     {
076f82
diff --git a/sysdeps/unix/sysv/linux/ldsodefs.h b/sysdeps/unix/sysv/linux/ldsodefs.h
076f82
index 7e01f685b03b984d..0f152c592c2a9b04 100644
076f82
--- a/sysdeps/unix/sysv/linux/ldsodefs.h
076f82
+++ b/sysdeps/unix/sysv/linux/ldsodefs.h
076f82
@@ -24,16 +24,4 @@
076f82
 /* Get the real definitions.  */
076f82
 #include_next <ldsodefs.h>
076f82
 
076f82
-/* We can assume that the kernel always provides the AT_UID, AT_EUID,
076f82
-   AT_GID, and AT_EGID values in the auxiliary vector from 2.4.0 or so on.  */
076f82
-#define HAVE_AUX_XID
076f82
-
076f82
-/* We can assume that the kernel always provides the AT_SECURE value
076f82
-   in the auxiliary vector from 2.5.74 or so on.  */
076f82
-#define HAVE_AUX_SECURE
076f82
-
076f82
-/* Starting with one of the 2.4.0 pre-releases the Linux kernel passes
076f82
-   up the page size information.  */
076f82
-#define HAVE_AUX_PAGESIZE
076f82
-
076f82
 #endif /* ldsodefs.h */