about summary refs log tree commit diff
path: root/elf/dl-support.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-support.c')
-rw-r--r--elf/dl-support.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/elf/dl-support.c b/elf/dl-support.c
index 2ff3d2f905..0d6ce6a12b 100644
--- a/elf/dl-support.c
+++ b/elf/dl-support.c
@@ -148,6 +148,10 @@ void
 internal_function
 _dl_aux_init (ElfW(auxv_t) *av)
 {
+  int seen = 0;
+  uid_t uid = 0;
+  gid_t gid = 0;
+
   for (; av->a_type != AT_NULL; ++av)
     switch (av->a_type)
       {
@@ -168,7 +172,28 @@ _dl_aux_init (ElfW(auxv_t) *av)
 	GL(dl_sysinfo) = av->a_un.a_val;
 	break;
 #endif
+      case AT_UID:
+	uid ^= av->a_un.a_val;
+	seen |= 1;
+	break;
+      case AT_EUID:
+	uid ^= av->a_un.a_val;
+	seen |= 2;
+	break;
+      case AT_GID:
+	gid ^= av->a_un.a_val;
+	seen |= 4;
+	break;
+      case AT_EGID:
+	gid ^= av->a_un.a_val;
+	seen |= 8;
+	break;
       }
+  if (seen == 0xf)
+    {
+      __libc_enable_secure = uid != 0 || gid != 0;
+      __libc_enable_secure_decided = 1;
+    }
 }
 #endif