1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-30 22:43:12 +03:00
2004-10-14  Ulrich Drepper  <drepper@redhat.com>

	* nscd/connections.c (nscd_init): Remove file if not persistent
	and not shared.  Patch by Jerome Borsboom <j.borsboom@erasmusmc.nl>.

	* sysdeps/unix/sysv/linux/i386/setresuid.c: Handle
	defined __NR_setresuid32 && !defined __NR_setresuid.
	* sysdeps/unix/sysv/linux/i386/setresgid.c: Handle
	defined __NR_setresgid32 && !defined __NR_setresgid.

	* sysdeps/sparc/fpu/bits/mathinline.h (__signbitf, __signbit,
	__signbitl, sqrtf, sqrt, sqrtl, fdim, fdimf): Use __NTH macro.

	* sysdeps/generic/errno-loc.c: Don't undef #errno
	if RTLD_PRIVATE_ERRNO.
	* include/errno.h (__errno_location): If RTLD_PRIVATE_ERRNO,
	add attribute_hidden.

	* dlfcn/dlinfo.c (dlinfo_doit): Replace iteration over GL(dl_loaded)
	chain with iteration over all namespaces' _ns_loaded chains.
	* sysdeps/powerpc/powerpc32/dl-machine.c (__elf_preferred_address):
	Likewise.
	* sysdeps/mips/dl-machine.h (elf_machine_runtime_link_map): Likewise.
This commit is contained in:
Ulrich Drepper
2004-10-14 16:18:09 +00:00
parent 7cb92a99fa
commit 5ca3d19c74
12 changed files with 96 additions and 59 deletions

View File

@ -1,5 +1,29 @@
2004-10-14 Ulrich Drepper <drepper@redhat.com>
* nscd/connections.c (nscd_init): Remove file if not persistent
and not shared. Patch by Jerome Borsboom <j.borsboom@erasmusmc.nl>.
2004-10-14 Jakub Jelinek <jakub@redhat.com> 2004-10-14 Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/i386/setresuid.c: Handle
defined __NR_setresuid32 && !defined __NR_setresuid.
* sysdeps/unix/sysv/linux/i386/setresgid.c: Handle
defined __NR_setresgid32 && !defined __NR_setresgid.
* sysdeps/sparc/fpu/bits/mathinline.h (__signbitf, __signbit,
__signbitl, sqrtf, sqrt, sqrtl, fdim, fdimf): Use __NTH macro.
* sysdeps/generic/errno-loc.c: Don't undef #errno
if RTLD_PRIVATE_ERRNO.
* include/errno.h (__errno_location): If RTLD_PRIVATE_ERRNO,
add attribute_hidden.
* dlfcn/dlinfo.c (dlinfo_doit): Replace iteration over GL(dl_loaded)
chain with iteration over all namespaces' _ns_loaded chains.
* sysdeps/powerpc/powerpc32/dl-machine.c (__elf_preferred_address):
Likewise.
* sysdeps/mips/dl-machine.h (elf_machine_runtime_link_map): Likewise.
* elf/rtld.c (_dl_start): Fix one last dl_loaded. * elf/rtld.c (_dl_start): Fix one last dl_loaded.
* elf/dl-load.c (_dl_map_object_from_fd): Avoid definition of * elf/dl-load.c (_dl_map_object_from_fd): Avoid definition of
label when it is not needed. label when it is not needed.

View File

@ -39,13 +39,15 @@ dlinfo_doit (void *argsblock)
#if 0 #if 0
if (args->handle == RTLD_SELF) if (args->handle == RTLD_SELF)
{ {
Lmid_t nsid;
/* Find the highest-addressed object that CALLER is not below. */ /* Find the highest-addressed object that CALLER is not below. */
for (l = GL(dl_loaded); l != NULL; l = l->l_next) for (nsid = 0; nsid < DL_NNS; ++nsid)
if (caller >= l->l_map_start && caller < l->l_map_end) for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
/* There must be exactly one DSO for the range of the virtual if (caller >= l->l_map_start && caller < l->l_map_end)
memory. Otherwise something is really broken. */ /* There must be exactly one DSO for the range of the virtual
break; memory. Otherwise something is really broken. */
break;
if (l == NULL) if (l == NULL)
GLRO(dl_signal_error) (0, NULL, NULL, N_("\ GLRO(dl_signal_error) (0, NULL, NULL, N_("\

View File

@ -36,7 +36,11 @@ extern __thread int errno attribute_tls_model_ie;
# define __set_errno(val) (errno = (val)) # define __set_errno(val) (errno = (val))
# ifndef __ASSEMBLER__ # ifndef __ASSEMBLER__
extern int *__errno_location (void) __THROW __attribute__ ((__const__)); extern int *__errno_location (void) __THROW __attribute__ ((__const__))
# if RTLD_PRIVATE_ERRNO
attribute_hidden
# endif
;
libc_hidden_proto (__errno_location) libc_hidden_proto (__errno_location)
# endif # endif

View File

@ -1,3 +1,8 @@
2004-10-14 Jakub Jelinek <jakub@redhat.com>
* sysdeps/pthread/errno-loc.c: Don't undef #errno
if RTLD_PRIVATE_ERRNO.
2004-10-05 Dwayne Grant McConnell <dgm69@us.ibm.com> 2004-10-05 Dwayne Grant McConnell <dgm69@us.ibm.com>
* pthread.c: Mask restart signal during cancel signal handler. * pthread.c: Mask restart signal during cancel signal handler.

View File

@ -1,6 +1,6 @@
/* MT support function to get address of `errno' variable, linuxthreads /* MT support function to get address of `errno' variable, linuxthreads
version. version.
Copyright (C) 1996, 1998, 2002, 2003 Free Software Foundation, Inc. Copyright (C) 1996, 1998, 2002, 2003, 2004 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
@ -23,7 +23,7 @@
#include <linuxthreads/internals.h> #include <linuxthreads/internals.h>
#include <sysdep-cancel.h> #include <sysdep-cancel.h>
#if ! USE___THREAD #if ! USE___THREAD && !RTLD_PRIVATE_ERRNO
#undef errno #undef errno
extern int errno; extern int errno;
#endif #endif

View File

@ -327,9 +327,10 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
/* We do not need the file name anymore after we /* We do not need the file name anymore after we
opened another file descriptor in read-only mode. */ opened another file descriptor in read-only mode. */
if (fd != -1 && dbs[cnt].shared) if (fd != -1)
{ {
ro_fd = open (fname, O_RDONLY); if (dbs[cnt].shared)
ro_fd = open (fname, O_RDONLY);
unlink (fname); unlink (fname);
} }

View File

@ -1,6 +1,6 @@
/* MT support function to get address of `errno' variable, non-threaded /* MT support function to get address of `errno' variable, non-threaded
version. version.
Copyright (C) 1996, 1998, 2002 Free Software Foundation, Inc. Copyright (C) 1996, 1998, 2002, 2004 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
@ -21,7 +21,7 @@
#include <errno.h> #include <errno.h>
#include <tls.h> #include <tls.h>
#if ! USE___THREAD #if ! USE___THREAD && !RTLD_PRIVATE_ERRNO
#undef errno #undef errno
extern int errno; extern int errno;
#endif #endif

View File

@ -231,10 +231,11 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
} }
} }
{ struct link_map *l;
struct link_map *l = GL(dl_loaded); Lmid_t nsid;
while (l) for (nsid = 0; nsid < DL_NNS; ++nsid)
for (l = GL(dl_ns)[nsid]._ns_loaded; l != NULL; l = l->l_next)
{ {
ElfW(Addr) base, limit; ElfW(Addr) base, limit;
const ElfW(Phdr) *p = l->l_phdr; const ElfW(Phdr) *p = l->l_phdr;
@ -250,9 +251,7 @@ elf_machine_runtime_link_map (ElfW(Addr) gpreg, ElfW(Addr) stub_pc)
return l; return l;
} }
} }
l = l->l_next;
} }
}
_dl_signal_error (0, NULL, NULL, "cannot find runtime link map"); _dl_signal_error (0, NULL, NULL, "cannot find runtime link map");
return NULL; return NULL;

View File

@ -101,11 +101,12 @@ weak_extern (__cache_line_size)
mapped somewhere else. */ mapped somewhere else. */
ElfW(Addr) ElfW(Addr)
__elf_preferred_address(struct link_map *loader, size_t maplength, __elf_preferred_address (struct link_map *loader, size_t maplength,
ElfW(Addr) mapstartpref) ElfW(Addr) mapstartpref)
{ {
ElfW(Addr) low, high; ElfW(Addr) low, high;
struct link_map *l; struct link_map *l;
Lmid_t nsid;
/* If the object has a preference, load it there! */ /* If the object has a preference, load it there! */
if (mapstartpref != 0) if (mapstartpref != 0)
@ -117,29 +118,30 @@ __elf_preferred_address(struct link_map *loader, size_t maplength,
be superceded by the program's load address). */ be superceded by the program's load address). */
low = 0x0003FFFF; low = 0x0003FFFF;
high = 0x70000000; high = 0x70000000;
for (l = GL(dl_loaded); l; l = l->l_next) for (nsid = 0; nsid < DL_NNS; ++nsid)
{ for (l = GL(dl_ns)[nsid]._ns_loaded; l; l = l->l_next)
ElfW(Addr) mapstart, mapend; {
mapstart = l->l_map_start & ~(GLRO(dl_pagesize) - 1); ElfW(Addr) mapstart, mapend;
mapend = l->l_map_end | (GLRO(dl_pagesize) - 1); mapstart = l->l_map_start & ~(GLRO(dl_pagesize) - 1);
assert (mapend > mapstart); mapend = l->l_map_end | (GLRO(dl_pagesize) - 1);
assert (mapend > mapstart);
/* Prefer gaps below the main executable, note that l == /* Prefer gaps below the main executable, note that l ==
_dl_loaded does not work for static binaries loading _dl_loaded does not work for static binaries loading
e.g. libnss_*.so. */ e.g. libnss_*.so. */
if ((mapend >= high || l->l_type == lt_executable) if ((mapend >= high || l->l_type == lt_executable)
&& high >= mapstart) && high >= mapstart)
high = mapstart; high = mapstart;
else if (mapend >= low && low >= mapstart) else if (mapend >= low && low >= mapstart)
low = mapend; low = mapend;
else if (high >= mapend && mapstart >= low) else if (high >= mapend && mapstart >= low)
{ {
if (high - mapend >= mapstart - low) if (high - mapend >= mapstart - low)
low = mapend; low = mapend;
else else
high = mapstart; high = mapstart;
} }
} }
high -= 0x10000; /* Allow some room between objects. */ high -= 0x10000; /* Allow some room between objects. */
maplength = (maplength | (GLRO(dl_pagesize) - 1)) + 1; maplength = (maplength | (GLRO(dl_pagesize) - 1)) + 1;
@ -341,8 +343,8 @@ __elf_machine_runtime_setup (struct link_map *map, int lazy, int profile)
} }
Elf32_Addr Elf32_Addr
__elf_machine_fixup_plt(struct link_map *map, const Elf32_Rela *reloc, __elf_machine_fixup_plt (struct link_map *map, const Elf32_Rela *reloc,
Elf32_Addr *reloc_addr, Elf32_Addr finaladdr) Elf32_Addr *reloc_addr, Elf32_Addr finaladdr)
{ {
Elf32_Sword delta = finaladdr - (Elf32_Word) reloc_addr; Elf32_Sword delta = finaladdr - (Elf32_Word) reloc_addr;
if (delta << 6 >> 6 == delta) if (delta << 6 >> 6 == delta)

View File

@ -112,7 +112,7 @@
/* Test for negative number. Used in the signbit() macro. */ /* Test for negative number. Used in the signbit() macro. */
__MATH_INLINE int __MATH_INLINE int
__signbitf (float __x) __THROW __NTH (__signbitf (float __x))
{ {
__extension__ union { float __f; int __i; } __u = { __f: __x }; __extension__ union { float __f; int __i; } __u = { __f: __x };
return __u.__i < 0; return __u.__i < 0;
@ -121,14 +121,14 @@ __signbitf (float __x) __THROW
# if __WORDSIZE == 32 # if __WORDSIZE == 32
__MATH_INLINE int __MATH_INLINE int
__signbit (double __x) __THROW __NTH (__signbit (double __x))
{ {
__extension__ union { double __d; int __i[2]; } __u = { __d: __x }; __extension__ union { double __d; int __i[2]; } __u = { __d: __x };
return __u.__i[0] < 0; return __u.__i[0] < 0;
} }
__MATH_INLINE int __MATH_INLINE int
__signbitl (long double __x) __THROW __NTH (__signbitl (long double __x))
{ {
return __signbit ((double)__x); return __signbit ((double)__x);
} }
@ -136,14 +136,14 @@ __signbitl (long double __x) __THROW
# else /* sparc64 */ # else /* sparc64 */
__MATH_INLINE int __MATH_INLINE int
__signbit (double __x) __THROW __NTH (__signbit (double __x))
{ {
__extension__ union { double __d; long int __i; } __u = { __d: __x }; __extension__ union { double __d; long int __i; } __u = { __d: __x };
return __u.__i < 0; return __u.__i < 0;
} }
__MATH_INLINE int __MATH_INLINE int
__signbitl (long double __x) __THROW __NTH (__signbitl (long double __x))
{ {
__extension__ union { long double __l; long int __i[2]; } __u = { __l: __x }; __extension__ union { long double __l; long int __i[2]; } __u = { __l: __x };
return __u.__i[0] < 0; return __u.__i[0] < 0;
@ -156,7 +156,7 @@ __signbitl (long double __x) __THROW
# if !defined __NO_MATH_INLINES && !__GNUC_PREREQ (3, 2) # if !defined __NO_MATH_INLINES && !__GNUC_PREREQ (3, 2)
__MATH_INLINE double __MATH_INLINE double
sqrt (double __x) __THROW __NTH (sqrt (double __x))
{ {
register double __r; register double __r;
__asm ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x)); __asm ("fsqrtd %1,%0" : "=f" (__r) : "f" (__x));
@ -164,7 +164,7 @@ sqrt (double __x) __THROW
} }
__MATH_INLINE float __MATH_INLINE float
sqrtf (float __x) __THROW __NTH (sqrtf (float __x))
{ {
register float __r; register float __r;
__asm ("fsqrts %1,%0" : "=f" (__r) : "f" (__x)); __asm ("fsqrts %1,%0" : "=f" (__r) : "f" (__x));
@ -173,7 +173,7 @@ sqrtf (float __x) __THROW
# if __WORDSIZE == 64 # if __WORDSIZE == 64
__MATH_INLINE long double __MATH_INLINE long double
sqrtl (long double __x) __THROW __NTH (sqrtl (long double __x))
{ {
long double __r; long double __r;
extern void _Qp_sqrt (long double *, __const__ long double *); extern void _Qp_sqrt (long double *, __const__ long double *);
@ -219,16 +219,16 @@ __ieee754_sqrtl (long double __x)
# ifndef __NO_MATH_INLINES # ifndef __NO_MATH_INLINES
__MATH_INLINE double fdim (double __x, double __y) __THROW; __MATH_INLINE double __NTH (fdim (double __x, double __y));
__MATH_INLINE double __MATH_INLINE double
fdim (double __x, double __y) __THROW __NTH (fdim (double __x, double __y))
{ {
return __x <= __y ? 0 : __x - __y; return __x <= __y ? 0 : __x - __y;
} }
__MATH_INLINE float fdimf (float __x, float __y) __THROW; __MATH_INLINE float __NTH (fdimf (float __x, float __y));
__MATH_INLINE float __MATH_INLINE float
fdimf (float __x, float __y) __THROW __NTH (fdimf (float __x, float __y))
{ {
return __x <= __y ? 0 : __x - __y; return __x <= __y ? 0 : __x - __y;
} }

View File

@ -28,7 +28,7 @@
#include <pthread-functions.h> #include <pthread-functions.h>
#ifdef __NR_setresgid #if defined __NR_setresgid || defined __NR_setresgid32
# ifdef __NR_setresgid32 # ifdef __NR_setresgid32
# if __ASSUME_32BITUIDS == 0 # if __ASSUME_32BITUIDS == 0
@ -43,7 +43,7 @@ __setresgid (gid_t rgid, gid_t egid, gid_t sgid)
{ {
int result; int result;
# if __ASSUME_32BITUIDS > 0 # if __ASSUME_32BITUIDS > 0 || !defined __NR_setresgid
result = INLINE_SYSCALL (setresgid32, 3, rgid, egid, sgid); result = INLINE_SYSCALL (setresgid32, 3, rgid, egid, sgid);
# else # else
# ifdef __NR_setresgid32 # ifdef __NR_setresgid32

View File

@ -28,7 +28,7 @@
#include <pthread-functions.h> #include <pthread-functions.h>
#ifdef __NR_setresuid #if defined __NR_setresuid || defined __NR_setresuid32
# ifdef __NR_setresuid32 # ifdef __NR_setresuid32
# if __ASSUME_32BITUIDS == 0 # if __ASSUME_32BITUIDS == 0
@ -43,7 +43,7 @@ __setresuid (uid_t ruid, uid_t euid, uid_t suid)
{ {
int result; int result;
# if __ASSUME_32BITUIDS > 0 # if __ASSUME_32BITUIDS > 0 || !defined __NR_setresuid
result = INLINE_SYSCALL (setresuid32, 3, ruid, euid, suid); result = INLINE_SYSCALL (setresuid32, 3, ruid, euid, suid);
# else # else
# ifdef __NR_setresuid32 # ifdef __NR_setresuid32