about summary refs log tree commit diff
path: root/sysdeps/generic/dl-sysdep.c
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-04-21 00:27:19 +0000
committerRoland McGrath <roland@gnu.org>1996-04-21 00:27:19 +0000
commitb0d20a87b5f0ba27496abcb6a4f9ad99fd412303 (patch)
tree9a6f89f0486f5cc4d4d8b4d25b1d9c9a745a2dc9 /sysdeps/generic/dl-sysdep.c
parenta641835acd28fabf507c5a99d7805c694c2ec7e3 (diff)
downloadglibc-b0d20a87b5f0ba27496abcb6a4f9ad99fd412303.tar.gz
glibc-b0d20a87b5f0ba27496abcb6a4f9ad99fd412303.tar.xz
glibc-b0d20a87b5f0ba27496abcb6a4f9ad99fd412303.zip
Sat Apr 20 18:13:00 1996 Roland McGrath <roland@delasyd.gnu.ai.mit.edu> cvs/libc-960423 cvs/libc-960422 cvs/libc-960421
	* Makerules (no-whole-archive): Test $(have-no-whole-archive), not
	$(libc_cv_ld_no_whole_archive).

Sat Apr 20 17:07:17 1996  Ulrich Drepper  <drepper@cygnus.com>

	* assert/assert.h, ctype/ctype.h, dirent/dirent.h, errno.h,
	grp/grp.h, io/fcntl.h, io/sys/stat.h, io/utime.h, locale/locale.h,
	math/math.h, misc/nlist.h, misc/sgtty.h, misc/sys/file.h,
	misc/sys/ioctl.h, misc/sys/uio.h, posix/sys/times.h,
	posix/sys/types.h, posix/sys/utsname.h, posix/sys/wait.h,
	posix/tar.h, posix/wordexp.h, pwd/pwd.h, resource/sys/vlimit.h,
	resource/sys/vtimes.h, setjmp/setjmp.h, signal/signal.h,
	stdio-common/printf.h, stdlib/alloca.h, stdlib/stdlib.h,
	string/string.h, sysdeps/generic/sigaction.h,
	sysdeps/generic/sigset.h, sysdeps/generic/sys/ptrace.h,
	sysdeps/generic/sys/ptrace.h, sysdeps/unix/bsd/osf/sigaction.h,
	sysdeps/unix/sysv/linux/sys/ptrace.h,
	sysdeps/unix/sysv/minix/sigaction.h,
	sysdeps/unix/sysv/sco3.2.4/sigaction.h,
	sysdeps/unix/sysv/sysv4/sigaction.h,
	sysdeps/unix/sysv/sysv4/sigset.h, termios/termios.h,
	time/sys/time.h, time/time.h: Fix copyright comment.

	* sysdeps/generic/dl-sysdep.c (_dl_sysdep_start): If uids and gids are
	not given in stack aux vector, fetch them with syscalls.
Diffstat (limited to 'sysdeps/generic/dl-sysdep.c')
-rw-r--r--sysdeps/generic/dl-sysdep.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sysdeps/generic/dl-sysdep.c b/sysdeps/generic/dl-sysdep.c
index 546993dbd1..4d5faad69f 100644
--- a/sysdeps/generic/dl-sysdep.c
+++ b/sysdeps/generic/dl-sysdep.c
@@ -40,6 +40,7 @@ _dl_sysdep_start (void **start_argptr,
   Elf32_auxv_t *av;
   uid_t uid, euid;
   gid_t gid, egid;
+  unsigned int seen;
 
   user_entry = (Elf32_Addr) &_start;
   _dl_argc = *(int *) start_argptr;
@@ -49,7 +50,12 @@ _dl_sysdep_start (void **start_argptr,
   while (*start_argptr)
     ++start_argptr;
 
-  for (av = (void *) ++start_argptr; av->a_type != AT_NULL; ++av)
+  seen = 0;
+#define M(type) (1 << (type))
+
+  for (av = (void *) ++start_argptr;
+       av->a_type != AT_NULL;
+       seen |= M ((++av)->a_type))
     switch (av->a_type)
       {
       case AT_PHDR:
@@ -75,6 +81,16 @@ _dl_sysdep_start (void **start_argptr,
 	break;
       }
 
+  /* Linux doesn't provide us with any of these values on the stack
+     when the dynamic linker is run directly as a program.  */
+
+#define SEE(UID, uid) if ((seen & M (AT_##UID)) == 0) uid = __get##uid ()
+  SEE (UID, uid);
+  SEE (GID, gid);
+  SEE (EUID, euid);
+  SEE (EGID, egid);
+
+
   _dl_secure = uid != euid || gid != egid;
 
 #ifdef DL_SYSDEP_INIT