]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Update.
authorUlrich Drepper <drepper@redhat.com>
Tue, 6 May 2003 06:34:21 +0000 (06:34 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 6 May 2003 06:34:21 +0000 (06:34 +0000)
* sysdeps/generic/enbl-secure.c (__libc_enable_secure_decided): New
variable.
(__libc_init_secure): Don't do anything if __libc_enable_secure_decided
is nonzero.
* include/unistd.h: Declare __libc_enable_secure_decided.
* elf/dl-support.c (_dl_aux_init): Recognize AT_UID, AT_EUID, AT_GID,
and AT_EGID.  If all found, set __libc_enable_secure and
__libc_enable_secure_decided.

ChangeLog
elf/dl-support.c
include/unistd.h
linuxthreads/ChangeLog
nptl/ChangeLog
sysdeps/generic/enbl-secure.c

index db7699697bc1fa842347dd2271402ae5937708ff..5cc3a1976dbf9a0724192f0ee53d6510f62ad6fd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2003-05-05  Ulrich Drepper  <drepper@redhat.com>
 
+       * sysdeps/generic/enbl-secure.c (__libc_enable_secure_decided): New
+       variable.
+       (__libc_init_secure): Don't do anything if __libc_enable_secure_decided
+       is nonzero.
+       * include/unistd.h: Declare __libc_enable_secure_decided.
+       * elf/dl-support.c (_dl_aux_init): Recognize AT_UID, AT_EUID, AT_GID,
+       and AT_EGID.  If all found, set __libc_enable_secure and
+       __libc_enable_secure_decided.
+
        * sysdeps/generic/libc-start.c [!SHARED]: Call
        __libc_check_standard_fds after __libc_init_first.
 
index 2ff3d2f905108382e94f25a655b18f21c9e7d993..0d6ce6a12bdc8b3c07bb3a42ac24ece02564c1b6 100644 (file)
@@ -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
 
index eba14514c188205247e34fdb34bc06ece11de039..a66e97822dfbc612b9ae2be31893dedd75189e17 100644 (file)
@@ -140,6 +140,7 @@ libc_hidden_proto (__sbrk)
    and some functions contained in the C library ignore various
    environment variables that normally affect them.  */
 extern int __libc_enable_secure;
+extern int __libc_enable_secure_decided;
 #ifdef IS_IN_rtld
 /* XXX The #ifdef should go.  */
 extern int __libc_enable_secure_internal attribute_hidden;
index 8f695c631fba2b475c34983a8b51cbffd7034717..c435b54e2f6f3061c88798cbd475e6378c57c75a 100644 (file)
@@ -1,3 +1,8 @@
+2003-05-05  Ulrich Drepper  <drepper@redhat.com>
+
+       * sysdeps/i386/tls.h (TLS_DO_SET_THREAD_AREA): Add \n to error
+       messages.
+
 2003-05-04  Roland McGrath  <roland@redhat.com>
 
        * Makefile ($(objpfx)../libc.so): New target.
index a1efb2bf26c4616b5a2fbb8a4c0c3b77f6e65528..791d2ece5a5ce0a9b085cc65089c1c1221da2e4c 100644 (file)
@@ -1,3 +1,7 @@
+2003-05-05  Ulrich Drepper  <drepper@redhat.com>
+
+       * sysdeps/i386/tls.h (TLS_INIT_TP): Include \n in error message.
+
 2003-05-04  Roland McGrath  <roland@redhat.com>
 
        * Makefile ($(objpfx)../libc.so): New target.
index c8117120877380e0951e7720a4f8f82798117526..fac3b9c527c8e198794cf3cdb9fbbe28aa45c859 100644 (file)
@@ -1,5 +1,5 @@
 /* Define and initialize the `__libc_enable_secure' flag.  Generic version.
-   Copyright (C) 1996, 1997, 1998, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 2000, 2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
 #include <unistd.h>
 #include <libc-internal.h>
 
+/* If nonzero __libc_enable_secure is already set.  */
+int __libc_enable_secure_decided;
 /* Safest assumption, if somehow the initializer isn't run.  */
 int __libc_enable_secure = 1;
 
 void
 __libc_init_secure (void)
 {
-  __libc_enable_secure = (__geteuid () != __getuid ()
-                         || __getegid () != __getgid ());
+  if (__libc_enable_secure_decided == 0)
+    __libc_enable_secure = (__geteuid () != __getuid ()
+                           || __getegid () != __getgid ());
 }