mirror of git://sourceware.org/git/glibc.git
Update.
* sysdeps/generic/dl-sysdep.c (_dl_sysdep_start): If HAVE_AUX_XID is defined don't look whether the AT_*ID values were set. If HAVE_AUX_PAGESIZE is defined don't look whether the pagesize is set. (_dl_show_auxv): Rewrite to avoid switch statement. * sysdeps/unix/sysv/linux/kernel-features.h: Define __ASSUME_AT_PAGESIZE for kernel >= 2.4.1. * sysdeps/unix/sysv/linux/ldsodefs.h: Define HAVE_AUX_XID. Define HAVE_AUX_PAGESIZE if __ASSUME_AT_PAGESIZE is defined.
This commit is contained in:
parent
5287b1d872
commit
4e56fdbce3
|
@ -1,5 +1,14 @@
|
||||||
2001-01-18 Ulrich Drepper <drepper@redhat.com>
|
2001-01-18 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/generic/dl-sysdep.c (_dl_sysdep_start): If HAVE_AUX_XID is
|
||||||
|
defined don't look whether the AT_*ID values were set.
|
||||||
|
If HAVE_AUX_PAGESIZE is defined don't look whether the pagesize is set.
|
||||||
|
(_dl_show_auxv): Rewrite to avoid switch statement.
|
||||||
|
* sysdeps/unix/sysv/linux/kernel-features.h: Define
|
||||||
|
__ASSUME_AT_PAGESIZE for kernel >= 2.4.1.
|
||||||
|
* sysdeps/unix/sysv/linux/ldsodefs.h: Define HAVE_AUX_XID.
|
||||||
|
Define HAVE_AUX_PAGESIZE if __ASSUME_AT_PAGESIZE is defined.
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/fxstat64.c: Add one __builtin_expect.
|
* sysdeps/unix/sysv/linux/fxstat64.c: Add one __builtin_expect.
|
||||||
* sysdeps/unix/sysv/linux/lxstat64.c: Likewise.
|
* sysdeps/unix/sysv/linux/lxstat64.c: Likewise.
|
||||||
* sysdeps/unix/sysv/linux/xstat64.c: Likewise.
|
* sysdeps/unix/sysv/linux/xstat64.c: Likewise.
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
Boston, MA 02111-1307, USA. */
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <elf.h>
|
#include <elf.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -87,7 +88,10 @@ _dl_sysdep_start (void **start_argptr,
|
||||||
uid_t euid = 0;
|
uid_t euid = 0;
|
||||||
gid_t gid = 0;
|
gid_t gid = 0;
|
||||||
gid_t egid = 0;
|
gid_t egid = 0;
|
||||||
unsigned int seen;
|
#ifndef HAVE_AUX_X
|
||||||
|
unsigned int seen = 0;
|
||||||
|
# define M(type) (1 << (type))
|
||||||
|
#endif
|
||||||
|
|
||||||
DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, _dl_argv, _environ,
|
DL_FIND_ARG_COMPONENTS (start_argptr, _dl_argc, _dl_argv, _environ,
|
||||||
_dl_auxv);
|
_dl_auxv);
|
||||||
|
@ -95,9 +99,6 @@ _dl_sysdep_start (void **start_argptr,
|
||||||
user_entry = (ElfW(Addr)) &ENTRY_POINT;
|
user_entry = (ElfW(Addr)) &ENTRY_POINT;
|
||||||
_dl_platform = NULL; /* Default to nothing known about the platform. */
|
_dl_platform = NULL; /* Default to nothing known about the platform. */
|
||||||
|
|
||||||
seen = 0;
|
|
||||||
#define M(type) (1 << (type))
|
|
||||||
|
|
||||||
for (av = _dl_auxv; av->a_type != AT_NULL; seen |= M ((++av)->a_type))
|
for (av = _dl_auxv; av->a_type != AT_NULL; seen |= M ((++av)->a_type))
|
||||||
switch (av->a_type)
|
switch (av->a_type)
|
||||||
{
|
{
|
||||||
|
@ -149,16 +150,20 @@ _dl_sysdep_start (void **start_argptr,
|
||||||
/* Linux doesn't provide us with any of these values on the stack
|
/* Linux doesn't provide us with any of these values on the stack
|
||||||
when the dynamic linker is run directly as a program. */
|
when the dynamic linker is run directly as a program. */
|
||||||
|
|
||||||
#define SEE(UID, uid) if ((seen & M (AT_##UID)) == 0) uid = __get##uid ()
|
#ifndef HAVE_AUX_XID
|
||||||
|
# define SEE(UID, uid) if ((seen & M (AT_##UID)) == 0) uid = __get##uid ()
|
||||||
SEE (UID, uid);
|
SEE (UID, uid);
|
||||||
SEE (GID, gid);
|
SEE (GID, gid);
|
||||||
SEE (EUID, euid);
|
SEE (EUID, euid);
|
||||||
SEE (EGID, egid);
|
SEE (EGID, egid);
|
||||||
|
#endif
|
||||||
|
|
||||||
__libc_enable_secure = uid != euid || gid != egid;
|
__libc_enable_secure = uid != euid || gid != egid;
|
||||||
|
|
||||||
|
#ifndef HAVE_AUX_PAGESIZE
|
||||||
if (_dl_pagesize == 0)
|
if (_dl_pagesize == 0)
|
||||||
_dl_pagesize = __getpagesize ();
|
_dl_pagesize = __getpagesize ();
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef DL_SYSDEP_INIT
|
#ifdef DL_SYSDEP_INIT
|
||||||
DL_SYSDEP_INIT;
|
DL_SYSDEP_INIT;
|
||||||
|
@ -206,87 +211,56 @@ _dl_show_auxv (void)
|
||||||
/* Terminate string. */
|
/* Terminate string. */
|
||||||
buf[63] = '\0';
|
buf[63] = '\0';
|
||||||
|
|
||||||
|
/* The following code assumes that the AT_* values are encoded
|
||||||
|
starting from 0 with AT_NULL, 1 for AT_IGNORE, and all other values
|
||||||
|
close by (otherwise the array will be too large). In case we have
|
||||||
|
to support a platform where these requirements are not fulfilled
|
||||||
|
some alternative implementation has to be used. */
|
||||||
for (av = _dl_auxv; av->a_type != AT_NULL; ++av)
|
for (av = _dl_auxv; av->a_type != AT_NULL; ++av)
|
||||||
switch (av->a_type)
|
{
|
||||||
|
static const struct
|
||||||
{
|
{
|
||||||
case AT_PHDR:
|
const char label[16];
|
||||||
_dl_sysdep_message ("AT_PHDR: 0x",
|
enum { dec, hex, str } form;
|
||||||
_itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
|
} auxvars[] =
|
||||||
16, 0),
|
{
|
||||||
"\n", NULL);
|
[AT_EXECFD - 2] = { "AT_EXECFD: ", dec },
|
||||||
break;
|
[AT_PHDR - 2] = { "AT_PHDR: 0x", hex },
|
||||||
case AT_PHNUM:
|
[AT_PHENT - 2] = { "AT_PHENT: ", dec },
|
||||||
_dl_sysdep_message ("AT_PHNUM: ",
|
[AT_PHNUM - 2] = { "AT_PHNUM: ", dec },
|
||||||
_itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
|
[AT_PAGESZ - 2] = { "AT_PAGESZ: ", dec },
|
||||||
10, 0),
|
[AT_BASE - 2] = { "AT_BASE: 0x", hex },
|
||||||
"\n", NULL);
|
[AT_FLAGS - 2] = { "AT_FLAGS: 0x", hex },
|
||||||
break;
|
[AT_ENTRY - 2] = { "AT_ENTRY: 0x", hex },
|
||||||
case AT_PAGESZ:
|
[AT_NOTELF - 2] = { "AT_NOTELF: ", hex },
|
||||||
_dl_sysdep_message ("AT_PAGESZ: ",
|
[AT_UID - 2] = { "AT_UID: ", dec },
|
||||||
_itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
|
[AT_EUID - 2] = { "AT_EUID: ", dec },
|
||||||
10, 0),
|
[AT_GID - 2] = { "AT_GID: ", dec },
|
||||||
"\n", NULL);
|
[AT_EGID - 2] = { "AT_EGID: ", dec },
|
||||||
break;
|
[AT_PLATFORM - 2] = { "AT_PLATFORM: ", str },
|
||||||
case AT_ENTRY:
|
[AT_HWCAP - 2] = { "AT_HWCAP: ", hex },
|
||||||
_dl_sysdep_message ("AT_ENTRY: 0x",
|
[AT_CLKTCK - 2] = { "AT_CLKTCK: ", dec },
|
||||||
_itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
|
[AT_FPUCW - 2] = { "AT_FPUCW: ", hex }
|
||||||
16, 0),
|
};
|
||||||
"\n", NULL);
|
unsigned int idx = (unsigned int) (av->a_type - 2);
|
||||||
break;
|
|
||||||
case AT_BASE:
|
assert (AT_NULL == 0);
|
||||||
_dl_sysdep_message ("AT_BASE: 0x",
|
assert (AT_IGNORE == 1);
|
||||||
_itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
|
if (idx < sizeof (auxvars) / sizeof (auxvars[0]))
|
||||||
16, 0),
|
{
|
||||||
"\n", NULL);
|
if (av->a_type != AT_HWCAP || _dl_procinfo (av->a_un.a_val) < 0)
|
||||||
break;
|
{
|
||||||
case AT_UID:
|
const char *val = av->a_un.a_ptr;
|
||||||
_dl_sysdep_message ("AT_UID: ",
|
|
||||||
_itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
|
if (__builtin_expect (auxvars[idx].form, dec) == dec)
|
||||||
10, 0),
|
val = _itoa_word (av->a_un.a_val, buf + sizeof buf - 1, 10, 0);
|
||||||
"\n", NULL);
|
else if (__builtin_expect (auxvars[idx].form, hex) == hex)
|
||||||
break;
|
val = _itoa_word (av->a_un.a_val, buf + sizeof buf - 1, 16, 0);
|
||||||
case AT_GID:
|
|
||||||
_dl_sysdep_message ("AT_GID: ",
|
_dl_sysdep_message (auxvars[idx].label, val, "\n", NULL);
|
||||||
_itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
|
}
|
||||||
10, 0),
|
}
|
||||||
"\n", NULL);
|
}
|
||||||
break;
|
|
||||||
case AT_EUID:
|
|
||||||
_dl_sysdep_message ("AT_EUID: ",
|
|
||||||
_itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
|
|
||||||
10, 0),
|
|
||||||
"\n", NULL);
|
|
||||||
break;
|
|
||||||
case AT_EGID:
|
|
||||||
_dl_sysdep_message ("AT_EGID: ",
|
|
||||||
_itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
|
|
||||||
10, 0),
|
|
||||||
"\n", NULL);
|
|
||||||
break;
|
|
||||||
case AT_PLATFORM:
|
|
||||||
_dl_sysdep_message ("AT_PLATFORM: ", av->a_un.a_ptr, "\n", NULL);
|
|
||||||
break;
|
|
||||||
case AT_HWCAP:
|
|
||||||
_dl_hwcap = av->a_un.a_val;
|
|
||||||
if (_dl_procinfo (_dl_hwcap) < 0)
|
|
||||||
_dl_sysdep_message ("AT_HWCAP: ",
|
|
||||||
_itoa_word (_dl_hwcap, buf + sizeof buf - 1,
|
|
||||||
16, 0),
|
|
||||||
"\n", NULL);
|
|
||||||
break;
|
|
||||||
case AT_CLKTCK:
|
|
||||||
_dl_sysdep_message ("AT_CLKTCK: ",
|
|
||||||
_itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
|
|
||||||
10, 0),
|
|
||||||
"\n", NULL);
|
|
||||||
break;
|
|
||||||
case AT_FPUCW:
|
|
||||||
_dl_sysdep_message ("AT_FPUCW: ",
|
|
||||||
_itoa_word (av->a_un.a_val, buf + sizeof buf - 1,
|
|
||||||
10, 0),
|
|
||||||
"\n", NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Set flags signalling availability of kernel features based on given
|
/* Set flags signalling availability of kernel features based on given
|
||||||
kernel version number.
|
kernel version number.
|
||||||
Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
|
@ -157,3 +157,9 @@
|
||||||
#if __LINUX_KERNEL_VERSION >= 131939
|
#if __LINUX_KERNEL_VERSION >= 131939
|
||||||
# define __ASSUME_O_DIRECTORY 1
|
# define __ASSUME_O_DIRECTORY 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Starting with one of the 2.4.0 pre-releases the Linux kernel passes
|
||||||
|
up the page size information. */
|
||||||
|
#if __LINUX_KERNEL_VERSION >= 132097
|
||||||
|
# define __ASSUME_AT_PAGESIZE 1
|
||||||
|
#endif
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#ifndef _LDSODEFS_H
|
#ifndef _LDSODEFS_H
|
||||||
|
|
||||||
|
#include "kernel-features.h"
|
||||||
|
|
||||||
/* Get the real definitions. */
|
/* Get the real definitions. */
|
||||||
#include_next <ldsodefs.h>
|
#include_next <ldsodefs.h>
|
||||||
|
|
||||||
|
@ -30,4 +32,14 @@
|
||||||
/* Used by static binaries to check the auxiliary vector. */
|
/* Used by static binaries to check the auxiliary vector. */
|
||||||
extern void _dl_aux_init (ElfW(auxv_t) *av) internal_function;
|
extern void _dl_aux_init (ElfW(auxv_t) *av) internal_function;
|
||||||
|
|
||||||
|
/* We can assume that the kernel always provides the AT_UID, AT_EUID,
|
||||||
|
AT_GID, and AT_EGID values in the auxiliary vector. */
|
||||||
|
#define HAVE_AUX_XID
|
||||||
|
|
||||||
|
/* Starting with one of the 2.4.0 pre-releases the Linux kernel passes
|
||||||
|
up the page size information. */
|
||||||
|
#if __ASSUME_AT_PAGESIZE
|
||||||
|
# define HAVE_AUX_PAGESIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* ldsodefs.h */
|
#endif /* ldsodefs.h */
|
||||||
|
|
Loading…
Reference in New Issue