diff options
author | Jakub Jelinek <jakub@redhat.com> | 2004-09-25 07:55:46 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2004-09-25 07:55:46 +0000 |
commit | bd7c3bed543d02fb01f69b29ea1a736e7a0f618d (patch) | |
tree | 7e9bf02d1315ce177dd95075686ba769057d04b2 | |
parent | 338cc5101b59b64358bab982e1311604fdb64651 (diff) | |
download | glibc-bd7c3bed543d02fb01f69b29ea1a736e7a0f618d.tar.gz glibc-bd7c3bed543d02fb01f69b29ea1a736e7a0f618d.tar.xz glibc-bd7c3bed543d02fb01f69b29ea1a736e7a0f618d.zip |
Updated to fedora-glibc-20040925T0738
35 files changed, 393 insertions, 107 deletions
diff --git a/ChangeLog b/ChangeLog index 7aab6f0bd0..779d045778 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,94 @@ +2004-09-25 Jakub Jelinek <jakub@redhat.com> + + * sysdeps/unix/sysv/linux/i386/setuid.c (__setuid): Remove second + result declaration. + +2004-09-22 Andreas Schwab <schwab@suse.de> + + * sysdeps/unix/sysv/linux/ia64/sysdep.h: Adjust whitespace. + +2004-09-24 Ulrich Drepper <drepper@redhat.com> + + * misc/daemon.c (daemon): Don't succeed if /dev/null cannot be + opened. + + * nis/ypclnt.c (do_ypcall): Add one missing unlock. Simplify the + code a bit. + + * misc/daemon.c (daemon): Define errno in case /dev/null is not + the correct device. + + * nis/ypclnt.c (yp_bind_file): Optimize a bit. Minimal cleanups. + +2004-09-23 Andreas Jaeger <aj@suse.de> + + * locale/weight.h (findidx): Remove static, it's not supported + anymore with GCC 4.0 in a block scope. + * locale/weightwc.h (findidx): Likewise. + * posix/regcomp.c (seek_collating_symbol_entry): Likewise. + (lookup_collation_sequence_value): Likewise. + (build_range_exp): Likewise. + (build_collating_symbol): Likewise. + * iconv/iconvconfig.c (write_output): Likewise. + * elf/do-rel.h (elf_dynamic_do_rel): Likewise. + + * sysdeps/x86_64/dl-machine.h (elf_machine_rela_relative): Remove + static, add always_inline attribute. + (elf_machine_rela): Likewise. + (elf_machine_lazy_rel): Likewise. + + * elf/dynamic-link.h (elf_get_dynamic_info): Make static dependend + on !RESOLVE so that it's not defined in local scope. + +2004-09-23 Kaz Kojima <kkojima@rr.iij4u.or.jp> + + * sysdeps/unix/sysv/linux/sh/sysdep.h (INTERNAL_SYSCALL_NCS): Define. + +2004-09-23 Thorsten Kukuk <kukuk@suse.de> + + * sysdeps/unix/sysv/linux/sys/mount.h: Sync MS_RMT_MASK flag + and BLK* ioctls with linux kernel headers. + +2004-09-23 Ulrich Drepper <drepper@redhat.com> + + * sysdeps/generic/bits/dlfcn.h: Add RTLD_DEEPBIND. + * elf/dl-object.c (_dl_new_object): Add new parameter mode. If mode + has RTLD_DEEPBIND set add local searchlist before global scope. + * sysdeps/generic/ldsodefs.h (_dl_new_object): Adjust prototype. + * elf/rtld.c: Adjust callers of _dl_new_object. + * elf/dl-load.c: Likewise. + (_dl_map_object_from_fd): If RTLD_DEEPBIND is used, don't do anything + for DF_SYMBOLIC. + * elf/dl-open.c (dl_open_writer): Pass RTLD_DEEPBIND flag on to + _dl_map_object_deps. + * elf/tst-deep1.c: New file. + * elf/tst-deep1mod1.c: New file. + * elf/tst-deep1mod2.c: New file. + * elf/tst-deep1mod3.c: New file. + * elf/Makefile: Add rules to build and run new tests. + + * elf/dl-deps.c: Pretty printing. + +2004-09-23 Jakub Jelinek <jakub@redhat.com> + + * sysdeps/unix/alpha/sysdep.h (inline_syscall[0-6]): Change name + argument to numbers from syscall names. + (INLINE_SYSCALL1): Pass __NR_##name to inline_syscall##nr. + (INTERNAL_SYSCALL_NCS): Renamed from... + (INTERNAL_SYSCALL_1): ... this. Use INTERNAL_SYSCALL_NCS. + * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h + (INTERNAL_SYSCALL_NCS): Define. + * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h + (INTERNAL_SYSCALL_NCS): Likewise. + * sysdeps/unix/sysv/linux/sparc/sysdep.h (inline_syscall[0-6]): + Change name argument to numbers from syscall names. + (INLINE_SYSCALL, INTERNAL_SYSCALL): Adjust. + (INTERNAL_SYSCALL_NCS): Define. + 2004-09-22 Ulrich Drepper <drepper@redhat.com> + * malloc/malloc.c (malloc_printerr): Use syslog if writev failed. + * string/string.h: Add __nonnull annotations. * stdlib/stdlib.h: Likewise. diff --git a/configure b/configure index 4e0ea1b765..6f9bde759d 100755 --- a/configure +++ b/configure @@ -6842,15 +6842,10 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext echo "${ECHO_T}$have_selinux" >&6 fi - if test x$with_selinux = xauto ; then + if test x$with_selinux = xyes ; then if test x$have_selinux = xno ; then - { echo "$as_me:$LINENO: WARNING: Sufficiently new SELinux library not found" >&5 -echo "$as_me: WARNING: Sufficiently new SELinux library not found" >&2;} - fi - else - if test x$have_selinux = xno ; then - { { echo "$as_me:$LINENO: error: SELinux explicitly required, and SELinux library not found" >&5 -echo "$as_me: error: SELinux explicitly required, and SELinux library not found" >&2;} + { { echo "$as_me:$LINENO: error: SELinux explicitly required, but sufficiently recent SELinux library not found" >&5 +echo "$as_me: error: SELinux explicitly required, but sufficiently recent SELinux library not found" >&2;} { (exit 1); exit 1; }; } fi fi diff --git a/elf/Makefile b/elf/Makefile index ac8319bc5f..d40d3fd6a7 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -82,7 +82,8 @@ distribute := rtld-Rules \ tst-array1.exp tst-array2.exp tst-array4.exp \ tst-array2dep.c tst-piemod1.c \ tst-execstack-mod.c tst-dlmodcount.c \ - check-textrel.c dl-sysdep.h test-dlopenrpathmod.c + check-textrel.c dl-sysdep.h test-dlopenrpathmod.c \ + tst-deep1mod1.c tst-deep1mod2.c tst-deep1mod3.c CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables @@ -152,7 +153,8 @@ tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \ restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \ circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \ tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-align \ - $(tests-execstack-$(have-z-execstack)) tst-dlmodcount tst-dlopenrpath + $(tests-execstack-$(have-z-execstack)) tst-dlmodcount \ + tst-dlopenrpath tst-deep1 # reldep9 test-srcs = tst-pathopt tests-vis-yes = vismain @@ -185,7 +187,7 @@ modules-names = testobj1 testobj2 testobj3 testobj4 testobj5 testobj6 \ reldep8mod1 reldep8mod2 reldep8mod3 \ reldep9mod1 reldep9mod2 reldep9mod3 \ tst-alignmod $(modules-execstack-$(have-z-execstack)) \ - tst-dlopenrpathmod + tst-dlopenrpathmod tst-deep1mod1 tst-deep1mod2 tst-deep1mod3 ifeq (yes,$(have-initfini-array)) modules-names += tst-array2dep endif @@ -754,3 +756,9 @@ $(objpfx)tst-dlopenrpath: $(objpfx)tst-dlopenrpathmod.so $(libdl) CFLAGS-tst-dlopenrpath.c += -DPFX=\"$(objpfx)\" LDFLAGS-tst-dlopenrpathmod.so += -Wl,-rpath,\$$ORIGIN/test-subdir $(objpfx)tst-dlopenrpath.out: $(objpfx)firstobj.so + +$(objpfx)tst-deep1mod2.so: $(objpfx)tst-deep1mod3.so +$(objpfx)tst-deep1: $(libdl) $(objpfx)tst-deep1mod1.so +$(objpfx)tst-deep1.out: $(objpfx)tst-deep1mod2.so +LDFLAGS-tst-deep1 += -rdynamic +tst-deep1mod3.so-no-z-defs = yes diff --git a/elf/dl-deps.c b/elf/dl-deps.c index b8dee8ab52..1a0fedf988 100644 --- a/elf/dl-deps.c +++ b/elf/dl-deps.c @@ -509,7 +509,7 @@ _dl_map_object_deps (struct link_map *map, runp->map->l_reserved = 0; } - if (__builtin_expect(GLRO(dl_debug_mask) & DL_DEBUG_PRELINK, 0) != 0 + if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK, 0) != 0 && map == GL(dl_loaded)) { /* If we are to compute conflicts, we have to build local scope diff --git a/elf/dl-load.c b/elf/dl-load.c index 73112bce23..15fff3c5e1 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -881,7 +881,7 @@ _dl_map_object_from_fd (const char *name, int fd, struct filebuf *fbp, #endif /* Enter the new object in the list of loaded objects. */ - l = _dl_new_object (realname, name, l_type, loader); + l = _dl_new_object (realname, name, l_type, loader, mode); if (__builtin_expect (! l, 0)) { errstring = N_("cannot create shared object descriptor"); @@ -1355,15 +1355,12 @@ cannot enable executable stack as shared object requires"); /* If this object has DT_SYMBOLIC set modify now its scope. We don't have to do this for the main map. */ - if (__builtin_expect (l->l_info[DT_SYMBOLIC] != NULL, 0) + if ((mode & RTLD_DEEPBIND) == 0 + && __builtin_expect (l->l_info[DT_SYMBOLIC] != NULL, 0) && &l->l_searchlist != l->l_scope[0]) { /* Create an appropriate searchlist. It contains only this map. - - XXX This is the definition of DT_SYMBOLIC in SysVr4. The old - GNU ld.so implementation had a different interpretation which - is more reasonable. We are prepared to add this possibility - back as part of a GNU extension of the ELF format. */ + This is the definition of DT_SYMBOLIC in SysVr4. */ l->l_symbolic_searchlist.r_list = (struct link_map **) malloc (sizeof (struct link_map *)); @@ -1968,7 +1965,8 @@ _dl_map_object (struct link_map *loader, const char *name, int preloaded, /* Enter the new object in the list of loaded objects. */ if ((name_copy = local_strdup (name)) == NULL - || (l = _dl_new_object (name_copy, name, type, loader)) == NULL) + || (l = _dl_new_object (name_copy, name, type, loader, + mode)) == NULL) _dl_signal_error (ENOMEM, name, NULL, N_("cannot create shared object descriptor")); /* Signal that this is a faked entry. */ diff --git a/elf/dl-object.c b/elf/dl-object.c index 52131181b3..91b1fa2187 100644 --- a/elf/dl-object.c +++ b/elf/dl-object.c @@ -32,7 +32,7 @@ struct link_map * internal_function _dl_new_object (char *realname, const char *libname, int type, - struct link_map *loader) + struct link_map *loader, int mode) { struct link_map *l; int idx; @@ -95,7 +95,15 @@ _dl_new_object (char *realname, const char *libname, int type, /* Insert the scope if it isn't the global scope we already added. */ if (idx == 0 || &loader->l_searchlist != new->l_scope[0]) - new->l_scope[idx] = &loader->l_searchlist; + { + if ((mode & RTLD_DEEPBIND) != 0 && idx != 0) + { + new->l_scope[1] = new->l_scope[0]; + idx = 0; + } + + new->l_scope[idx] = &loader->l_searchlist; + } new->l_local_scope[0] = &new->l_searchlist; diff --git a/elf/dl-open.c b/elf/dl-open.c index c352722e27..c9b4a45596 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -272,7 +272,8 @@ dl_open_worker (void *a) } /* Load that object's dependencies. */ - GLRO(dl_map_object_deps) (new, NULL, 0, 0, mode & __RTLD_DLOPEN); + GLRO(dl_map_object_deps) (new, NULL, 0, 0, + mode & (__RTLD_DLOPEN | RTLD_DEEPBIND)); /* So far, so good. Now check the versions. */ for (i = 0; i < new->l_searchlist.r_nlist; ++i) diff --git a/elf/do-rel.h b/elf/do-rel.h index 726418748c..990b9615e0 100644 --- a/elf/do-rel.h +++ b/elf/do-rel.h @@ -1,5 +1,5 @@ /* Do relocations for ELF dynamic linking. - Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1995-2003, 2004 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 @@ -49,7 +49,7 @@ relocations; they should be set up to call _dl_runtime_resolve, rather than fully resolved now. */ -static inline void __attribute__ ((always_inline)) +auto inline void __attribute__ ((always_inline)) elf_dynamic_do_rel (struct link_map *map, ElfW(Addr) reladdr, ElfW(Addr) relsize, int lazy) diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h index 5d48b16511..f9559dc59c 100644 --- a/elf/dynamic-link.h +++ b/elf/dynamic-link.h @@ -64,8 +64,12 @@ elf_machine_lazy_rel (struct link_map *map, /* Read the dynamic section at DYN and fill in INFO with indices DT_*. */ - -static inline void __attribute__ ((unused, always_inline)) +#ifndef RESOLVE +static +#else +auto +#endif +inline void __attribute__ ((unused, always_inline)) elf_get_dynamic_info (struct link_map *l, ElfW(Dyn) *temp) { ElfW(Dyn) *dyn = l->l_ld; diff --git a/elf/rtld.c b/elf/rtld.c index b912124fca..28a33f26f3 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -879,7 +879,7 @@ of this helper program; chances are you did not intend to run this program.\n\ { /* Create a link_map for the executable itself. This will be what dlopen on "" returns. */ - _dl_new_object ((char *) "", "", lt_executable, NULL); + _dl_new_object ((char *) "", "", lt_executable, NULL, 0); if (GL(dl_loaded) == NULL) _dl_fatal_printf ("cannot allocate memory for link map\n"); GL(dl_loaded)->l_phdr = phdr; @@ -1372,7 +1372,8 @@ ERROR: ld.so: object '%s' from %s cannot be preloaded: ignored.\n", better be, since it's read-only and so we couldn't relocate it). We just want our data structures to describe it as if we had just mapped and relocated it normally. */ - struct link_map *l = _dl_new_object ((char *) "", "", lt_library, NULL); + struct link_map *l = _dl_new_object ((char *) "", "", lt_library, NULL, + 0); if (__builtin_expect (l != NULL, 1)) { static ElfW(Dyn) dyn_temp[DL_RO_DYN_TEMP_CNT] attribute_relro; diff --git a/elf/tst-deep1.c b/elf/tst-deep1.c new file mode 100644 index 0000000000..5428d13de4 --- /dev/null +++ b/elf/tst-deep1.c @@ -0,0 +1,36 @@ +#include <dlfcn.h> +#include <stdio.h> + +int +xyzzy (void) +{ + printf ("%s:%s\n", __FILE__, __func__); + return 21; +} + +int +back (void) +{ + printf ("%s:%s\n", __FILE__, __func__); + return 1; +} + +extern int foo (void); + +static int +do_test (void) +{ + void *p = dlopen ("$ORIGIN/tst-deep1mod2.so", RTLD_LAZY|RTLD_DEEPBIND); + + int (*f) (void) = dlsym (p, "bar"); + if (f == NULL) + { + puts (dlerror ()); + return 1; + } + + return foo () + f (); +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/elf/tst-deep1mod1.c b/elf/tst-deep1mod1.c new file mode 100644 index 0000000000..cc922e6ea5 --- /dev/null +++ b/elf/tst-deep1mod1.c @@ -0,0 +1,14 @@ +#include <stdio.h> +int +foo (void) +{ + printf ("%s:%s\n", __FILE__, __func__); + return 1; +} + +int +baz (void) +{ + printf ("%s:%s\n", __FILE__, __func__); + return 20; +} diff --git a/elf/tst-deep1mod2.c b/elf/tst-deep1mod2.c new file mode 100644 index 0000000000..b99caf0328 --- /dev/null +++ b/elf/tst-deep1mod2.c @@ -0,0 +1,16 @@ +#include <stdio.h> +extern int baz (void); +extern int xyzzy (void); +int +bar (void) +{ + printf ("%s:%s\n", __FILE__, __func__); + return baz () + xyzzy ();; +} + +int +back (void) +{ + printf ("%s:%s\n", __FILE__, __func__); + return -1; +} diff --git a/elf/tst-deep1mod3.c b/elf/tst-deep1mod3.c new file mode 100644 index 0000000000..eee7d5c97b --- /dev/null +++ b/elf/tst-deep1mod3.c @@ -0,0 +1,17 @@ +#include <stdio.h> + +extern int back (void); + +int +baz (void) +{ + printf ("%s:%s\n", __FILE__, __func__); + return back (); +} + +int +xyzzy (void) +{ + printf ("%s:%s\n", __FILE__, __func__); + return 0; +} diff --git a/fedora/branch.mk b/fedora/branch.mk index 95e9a8c0c6..e7c3bf9511 100644 --- a/fedora/branch.mk +++ b/fedora/branch.mk @@ -1,5 +1,5 @@ # This file is updated automatically by Makefile. glibc-branch := fedora glibc-base := HEAD -fedora-sync-date := 2004-09-23 01:48 UTC -fedora-sync-tag := fedora-glibc-20040923T0148 +fedora-sync-date := 2004-09-25 07:38 UTC +fedora-sync-tag := fedora-glibc-20040925T0738 diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in index cb92c4ba71..416ad0dfe5 100644 --- a/fedora/glibc.spec.in +++ b/fedora/glibc.spec.in @@ -1,4 +1,4 @@ -%define glibcrelease 56 +%define glibcrelease 57 %define auxarches i586 i686 athlon sparcv9 alphaev6 %define prelinkarches noarch %define nptlarches i386 i686 athlon x86_64 ia64 s390 s390x sparcv9 ppc ppc64 @@ -186,6 +186,7 @@ Summary: A Name Service Caching Daemon (nscd). Group: System Environment/Daemons Conflicts: kernel < 2.2.0 Requires: libselinux >= 1.17.10-1 +Conflicts: selinux-policy-targeted < 1.17.20 Prereq: /sbin/chkconfig, /usr/sbin/useradd, /usr/sbin/userdel, sh-utils Autoreq: true @@ -1238,6 +1239,9 @@ rm -f *.filelist* %endif %changelog +* Sat Sep 25 2004 Jakub Jelinek <jakub@redhat.com> 2.3.3-57 +- update from CVS + * Wed Sep 22 2004 Roland McGrath <roland@redhat.com> 2.3.3-56 - migrated CVS to fedora-branch in sources.redhat.com glibc repository - source tarballs renamed diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index 63d3faf364..63bb29bf73 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,10 @@ +2004-09-24 Roland McGrath <roland@redhat.com> + + [BZ #406] + * sysdeps/i386/tls.h: Move #include "useldt.h" outside + of [__ASSUME_LDT_WORKS > 0] test. + Reported by Carlos Velasco <carlos.velasco@newipnet.com>. + 2004-09-21 Roland McGrath <roland@redhat.com> * Versions: Add comment about linuxthreads' frozen ABI. diff --git a/linuxthreads/sysdeps/i386/tls.h b/linuxthreads/sysdeps/i386/tls.h index 84d87db359..30a6e59963 100644 --- a/linuxthreads/sysdeps/i386/tls.h +++ b/linuxthreads/sysdeps/i386/tls.h @@ -120,10 +120,10 @@ typedef struct # define TLS_LOAD_EBX # endif +# include "useldt.h" /* For the structure. */ # if __ASSUME_LDT_WORKS > 0 # define TLS_DO_MODIFY_LDT_KERNEL_CHECK(doit) (doit) /* Nothing to check. */ # else -# include "useldt.h" /* For the structure. */ # define TLS_DO_MODIFY_LDT_KERNEL_CHECK(doit) \ (__builtin_expect (GLRO(dl_osversion) < 131939, 0) \ ? "kernel too old for thread-local storage support\n" \ diff --git a/locale/weight.h b/locale/weight.h index d67e9d9c24..dc70a00be5 100644 --- a/locale/weight.h +++ b/locale/weight.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996,1997,1998,1999,2000,2003 Free Software Foundation, Inc. +/* Copyright (C) 1996,1997,1998,1999,2000,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper, <drepper@cygnus.com>. @@ -18,7 +18,7 @@ 02111-1307 USA. */ /* Find index of weight. */ -static inline int32_t +auto inline int32_t __attribute ((always_inline)) findidx (const unsigned char **cpp) { diff --git a/locale/weightwc.h b/locale/weightwc.h index 9957893def..ff5e63aeef 100644 --- a/locale/weightwc.h +++ b/locale/weightwc.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2000, 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1996-2000, 2001,2003,2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Ulrich Drepper, <drepper@cygnus.com>. @@ -18,7 +18,7 @@ 02111-1307 USA. */ /* Find index of weight. */ -static inline int32_t +auto inline int32_t __attribute ((always_inline)) findidx (const wint_t **cpp) { diff --git a/malloc/malloc.c b/malloc/malloc.c index 665d7a4b3e..dcc54c46f1 100644 --- a/malloc/malloc.c +++ b/malloc/malloc.c @@ -285,6 +285,8 @@ extern "C" { /* For writev and struct iovec. */ #include <sys/uio.h> + /* For syslog. */ +#include <sys/syslog.h> /* Debugging: @@ -5467,7 +5469,12 @@ malloc_printerr(int action, const char *str, void *ptr) iov[n].iov_base = cp; iov[n].iov_len = &buf[sizeof (buf) - 1] - cp; ++n; - TEMP_FAILURE_RETRY (__writev (STDERR_FILENO, iov, n)); + if (TEMP_FAILURE_RETRY (__writev (STDERR_FILENO, iov, n)) == -1 + && errno == EBADF) + /* Standard error is not opened. Try using syslog. */ + syslog (LOG_ERR, "%s%s%s", (char *) iov[0].iov_base, + (char *) iov[1].iov_base, + n == 3 ? (const char *) iov[2].iov_base : ""); } if (action & 2) abort (); diff --git a/misc/daemon.c b/misc/daemon.c index bc93956e85..7597ce9996 100644 --- a/misc/daemon.c +++ b/misc/daemon.c @@ -61,21 +61,30 @@ daemon(nochdir, noclose) if (!nochdir) (void)__chdir("/"); - if (!noclose - && (fd = open_not_cancel(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + if (!noclose) { struct stat64 st; - if (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) == 0 - && __builtin_expect (S_ISCHR (st.st_mode), 1) != 0 + if ((fd = open_not_cancel(_PATH_DEVNULL, O_RDWR, 0)) != -1 + && (__builtin_expect (__fxstat64 (_STAT_VER, fd, &st), 0) + == 0)) { + if (__builtin_expect (S_ISCHR (st.st_mode), 1) != 0 #if defined DEV_NULL_MAJOR && defined DEV_NULL_MINOR - && st.st_rdev == makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR) + && (st.st_rdev + == makedev (DEV_NULL_MAJOR, DEV_NULL_MINOR)) #endif - ) { - (void)__dup2(fd, STDIN_FILENO); - (void)__dup2(fd, STDOUT_FILENO); - (void)__dup2(fd, STDERR_FILENO); - if (fd > 2) - (void)__close (fd); + ) { + (void)__dup2(fd, STDIN_FILENO); + (void)__dup2(fd, STDOUT_FILENO); + (void)__dup2(fd, STDERR_FILENO); + if (fd > 2) + (void)__close (fd); + } else { + /* We must set an errno value since no + function call actually failed. */ + close_not_cancel_no_status (fd); + __set_errno (ENODEV); + return -1; + } } else { close_not_cancel_no_status (fd); return -1; diff --git a/nis/ypclnt.c b/nis/ypclnt.c index ab28e6002b..f25c7c710b 100644 --- a/nis/ypclnt.c +++ b/nis/ypclnt.c @@ -74,7 +74,7 @@ yp_bind_client_create (const char *domain, dom_binding *ysd, if (ysd->dom_client != NULL) { /* If the program exits, close the socket */ - if (fcntl (ysd->dom_socket, F_SETFD, 1) == -1) + if (fcntl (ysd->dom_socket, F_SETFD, FD_CLOEXEC) == -1) perror ("fcntl: F_SETFD"); } } @@ -83,23 +83,18 @@ yp_bind_client_create (const char *domain, dom_binding *ysd, static void yp_bind_file (const char *domain, dom_binding *ysd) { - struct ypbind_resp ypbr; - char path[sizeof (BINDINGDIR) + strlen (domain) + 10]; - struct iovec vec[2]; - unsigned short port; - int fd; + char path[sizeof (BINDINGDIR) + strlen (domain) + 3 * sizeof (unsigned) + 3]; - sprintf (path, "%s/%s.%d", BINDINGDIR, domain, YPBINDVERS); - fd = open (path, O_RDONLY); + snprintf (path, sizeof (path), "%s/%s.%u", BINDINGDIR, domain, YPBINDVERS); + int fd = open (path, O_RDONLY); if (fd >= 0) { - /* We have a binding file and could save a RPC call */ - vec[0].iov_base = &port; - vec[0].iov_len = sizeof (port); - vec[1].iov_base = &ypbr; - vec[1].iov_len = sizeof (ypbr); + /* We have a binding file and could save a RPC call. The file + contains a port number and the YPBIND_RESP record. The port + number (16 bits) can be ignored. */ + struct ypbind_resp ypbr; - if (readv (fd, vec, 2) == sizeof (port) + sizeof (ypbr)) + if (pread (fd, &ypbr, sizeof (ypbr), 2) == sizeof (ypbr)) yp_bind_client_create (domain, ysd, &ypbr); close (fd); @@ -183,9 +178,9 @@ __yp_bind (const char *domain, dom_binding **ypdb) } #if USE_BINDINGDIR - /* Try binding dir at first if we have no binding */ + /* Try binding dir at first if we have no binding */ if (ysd->dom_client == NULL) - yp_bind_file (domain, ysd); + yp_bind_file (domain, ysd); #endif /* USE_BINDINGDIR */ if (ysd->dom_client == NULL) @@ -309,16 +304,10 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs, status = YPERR_YPERR; __libc_lock_lock (ypbindlist_lock); - if (__ypbindlist != NULL) + ydb = __ypbindlist; + while (ydb != NULL) { - ydb = __ypbindlist; - while (ydb != NULL) - { - if (strcmp (domain, ydb->dom_domain) == 0) - break; - ydb = ydb->dom_pnext; - } - if (ydb != NULL) + if (strcmp (domain, ydb->dom_domain) == 0) { if (__yp_bind (domain, &ydb) == 0) { @@ -327,6 +316,7 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs, resp, &ydb, 0); if (status == YPERR_SUCCESS) { + __libc_lock_unlock (ypbindlist_lock); __set_errno (saved_errno); return status; } @@ -334,7 +324,10 @@ do_ypcall (const char *domain, u_long prog, xdrproc_t xargs, /* We use ypbindlist, and the old cached data is invalid. unbind now and create a new binding */ yp_unbind_locked (domain); + + break; } + ydb = ydb->dom_pnext; } __libc_lock_unlock (ypbindlist_lock); diff --git a/nptl/ChangeLog b/nptl/ChangeLog index b06743dcb7..2aff8c8dbb 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,25 @@ +2004-09-25 Ulrich Drepper <drepper@redhat.com> + + * descr.h (struct pthread): Add stopped_start field. + * sysdeps/pthread/createthread.c (create_thread): Set + start_stopped flag in descriptor for new thread appropriately. + * pthread_create.c (start_thread): Only take lock to be stopped on + startup if stopped_start flag says so. + +2004-09-24 Ulrich Drepper <drepper@redhat.com> + + * pthread_create.c (__pthread_create_2_1): Remember whether thread + is created detached and if yes, do not try to free the stack in case + the thread creation failed. + * sysdeps/pthread/createthread.c (do_clone): Free stack here if clone + call fails. Don't depend on INTERNAL_SYSCALL_ERRNO return zero in + case there has been no error. [BZ #405] + + * pthread_create.c (start_thread): Don't wait for scheduler data + etc to be set at the beginning of the function. The cancellation + infrastructure must have been set up. And enable async + cancellation before potentially going to sleep. [BZ #401] + 2004-09-20 Ulrich Drepper <drepper@redhat.com> * Versions: Remove exports for pthread_set*id_np functions. diff --git a/nptl/descr.h b/nptl/descr.h index 89bfbd25ad..7ef4221e83 100644 --- a/nptl/descr.h +++ b/nptl/descr.h @@ -201,6 +201,9 @@ struct pthread /* True if the user provided the stack. */ bool user_stack; + /* True if thread must stop at startup time. */ + bool stopped_start; + /* Lock to synchronize access to the descriptor. */ lll_lock_t lock; diff --git a/nptl/pthread_create.c b/nptl/pthread_create.c index 160656863d..1bab72d1e9 100644 --- a/nptl/pthread_create.c +++ b/nptl/pthread_create.c @@ -227,11 +227,6 @@ start_thread (void *arg) struct pthread *pd = (struct pthread *) arg; - /* Get the lock the parent locked to force synchronization. */ - lll_lock (pd->lock); - /* And give it up right away. */ - lll_unlock (pd->lock); - #if HP_TIMING_AVAIL /* Remember the time when the thread was started. */ hp_timing_t now; @@ -257,6 +252,18 @@ start_thread (void *arg) /* Store the new cleanup handler info. */ THREAD_SETMEM (pd, cleanup_jmp_buf, &unwind_buf); + if (__builtin_expect (pd->stopped_start, 0)) + { + int oldtype = CANCEL_ASYNC (); + + /* Get the lock the parent locked to force synchronization. */ + lll_lock (pd->lock); + /* And give it up right away. */ + lll_unlock (pd->lock); + + CANCEL_RESET (oldtype); + } + /* Run the code the user provided. */ #ifdef CALL_THREAD_FCT THREAD_SETMEM (pd, result, CALL_THREAD_FCT (pd)); @@ -443,13 +450,19 @@ __pthread_create_2_1 (newthread, attr, start_routine, arg) /* Pass the descriptor to the caller. */ *newthread = (pthread_t) pd; + /* Remember whether the thread is detached or not. In case of an + error we have to free the stacks of non-detached stillborn + threads. */ + bool is_detached = IS_DETACHED (pd); + /* Start the thread. */ err = create_thread (pd, iattr, STACK_VARIABLES_ARGS); if (err != 0) { errout: /* Something went wrong. Free the resources. */ - __deallocate_stack (pd); + if (!is_detached) + __deallocate_stack (pd); return err; } diff --git a/nptl/sysdeps/pthread/createthread.c b/nptl/sysdeps/pthread/createthread.c index 49383cf769..8620519887 100644 --- a/nptl/sysdeps/pthread/createthread.c +++ b/nptl/sysdeps/pthread/createthread.c @@ -66,8 +66,16 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr, if (ARCH_CLONE (fct, STACK_VARIABLES_ARGS, clone_flags, pd, &pd->tid, TLS_VALUE, &pd->tid) == -1) - /* Failed. */ - return errno; + { + /* Failed. If the thread is detached, remove the TCB here since + the caller cannot do this. The caller remembered the thread + as detached and cannot reverify that it is not since it must + not access the thread descriptor again. */ + if (IS_DETACHED (pd)) + __deallocate_stack (pd); + + return errno; + } /* Now we have the possibility to set scheduling parameters etc. */ if (__builtin_expect (stopped != 0, 0)) @@ -95,7 +103,9 @@ do_clone (struct pthread *pd, const struct pthread_attr *attr, (void) INTERNAL_SYSCALL (tkill, err2, 2, pd->tid, SIGCANCEL); #endif - return INTERNAL_SYSCALL_ERRNO (res, err); + return (INTERNAL_SYSCALL_ERROR_P (res, err) + ? INTERNAL_SYSCALL_ERRNO (res, err) + : 0); } } @@ -176,6 +186,9 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, if ((_mask & (__nptl_threads_events.event_bits[_idx] | pd->eventbuf.eventmask.event_bits[_idx])) != 0) { + /* We always must have the thread start stopped. */ + pd->stopped_start = true; + /* Create the thread. We always create the thread stopped so that it does not get far before we tell the debugger. */ int res = do_clone (pd, attr, clone_flags, start_thread, @@ -214,10 +227,11 @@ create_thread (struct pthread *pd, const struct pthread_attr *attr, /* Determine whether the newly created threads has to be started stopped since we have to set the scheduling parameters or set the affinity. */ - int stopped = 0; + bool stopped = false; if (attr != NULL && (attr->cpuset != NULL || (attr->flags & ATTR_FLAG_NOTINHERITSCHED) != 0)) - stopped = 1; + stopped = true; + pd->stopped_start = stopped; /* Actually create the thread. */ int res = do_clone (pd, attr, clone_flags, start_thread, diff --git a/posix/regcomp.c b/posix/regcomp.c index bc9e56bd02..9b435a885e 100644 --- a/posix/regcomp.c +++ b/posix/regcomp.c @@ -2682,7 +2682,7 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) Seek the collating symbol entry correspondings to NAME. Return the index of the symbol in the SYMB_TABLE. */ - static inline int32_t + auto inline int32_t __attribute ((always_inline)) seek_collating_symbol_entry (name, name_len) const unsigned char *name; @@ -2715,7 +2715,7 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) Look up the collation sequence value of BR_ELEM. Return the value if succeeded, UINT_MAX otherwise. */ - static inline unsigned int + auto inline unsigned int __attribute ((always_inline)) lookup_collation_sequence_value (br_elem) bracket_elem_t *br_elem; @@ -2783,7 +2783,7 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) mbcset->range_ends, is a pointer argument sinse we may update it. */ - static inline reg_errcode_t + auto inline reg_errcode_t __attribute ((always_inline)) build_range_exp (sbcset, mbcset, range_alloc, start_elem, end_elem) re_charset_t *mbcset; @@ -2866,7 +2866,7 @@ parse_bracket_exp (regexp, dfa, token, syntax, err) COLL_SYM_ALLOC is the allocated size of mbcset->coll_sym, is a pointer argument sinse we may update it. */ - static inline reg_errcode_t + auto inline reg_errcode_t __attribute ((always_inline)) build_collating_symbol (sbcset, mbcset, coll_sym_alloc, name) re_charset_t *mbcset; diff --git a/sysdeps/generic/bits/dlfcn.h b/sysdeps/generic/bits/dlfcn.h index e96b5c17ae..67fd96a22a 100644 --- a/sysdeps/generic/bits/dlfcn.h +++ b/sysdeps/generic/bits/dlfcn.h @@ -1,5 +1,5 @@ /* System dependent definitions for run-time dynamic loading. - Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1996-2001, 2004 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 @@ -26,6 +26,7 @@ #define RTLD_NOW 0x00002 /* Immediate function call binding. */ #define RTLD_BINDING_MASK 0x3 /* Mask of binding time value. */ #define RTLD_NOLOAD 0x00004 /* Do not load the object. */ +#define RTLD_DEEPBIND 0x00008 /* Use deep binding. */ /* If the following bit is set in the MODE argument to `dlopen', the symbols of the loaded object and its dependencies are made diff --git a/sysdeps/generic/ldsodefs.h b/sysdeps/generic/ldsodefs.h index be3d2dd61f..2b526867ad 100644 --- a/sysdeps/generic/ldsodefs.h +++ b/sysdeps/generic/ldsodefs.h @@ -722,7 +722,8 @@ extern ElfW(Addr) _dl_symbol_value (struct link_map *map, const char *name) /* Allocate a `struct link_map' for a new object being loaded, and enter it into the _dl_main_map list. */ extern struct link_map *_dl_new_object (char *realname, const char *libname, - int type, struct link_map *loader) + int type, struct link_map *loader, + int mode) internal_function attribute_hidden; /* Relocate the given object (if it hasn't already been). diff --git a/sysdeps/unix/sysv/linux/i386/setuid.c b/sysdeps/unix/sysv/linux/i386/setuid.c index a11fb7f60c..0d948fb775 100644 --- a/sysdeps/unix/sysv/linux/i386/setuid.c +++ b/sysdeps/unix/sysv/linux/i386/setuid.c @@ -47,7 +47,6 @@ __setuid (uid_t uid) # ifdef __NR_setuid32 if (__libc_missing_32bit_uids <= 0) { - int result; int saved_errno = errno; result = INLINE_SYSCALL (setuid32, 1, uid); diff --git a/sysdeps/unix/sysv/linux/ia64/sysdep.h b/sysdeps/unix/sysv/linux/ia64/sysdep.h index 0347641dfe..a4453ddcc7 100644 --- a/sysdeps/unix/sysv/linux/ia64/sysdep.h +++ b/sysdeps/unix/sysv/linux/ia64/sysdep.h @@ -165,7 +165,7 @@ #undef PSEUDO_ERRVAL #define PSEUDO_ERRVAL(name, syscall_name, args) \ - ENTRY(name) \ + ENTRY(name) \ DO_CALL (SYS_ify(syscall_name)); \ cmp.eq p6,p0=-1,r10; \ (p6) mov r10=r8; @@ -241,14 +241,14 @@ DO_INLINE_SYSCALL_NCS (__NR_##name, nr, ##args) #undef INLINE_SYSCALL -#define INLINE_SYSCALL(name, nr, args...) \ - ({ \ - DO_INLINE_SYSCALL_NCS(__NR_##name, nr, args)\ - if (_r10 == -1) \ - { \ - __set_errno (_retval); \ - _retval = -1; \ - } \ +#define INLINE_SYSCALL(name, nr, args...) \ + ({ \ + DO_INLINE_SYSCALL_NCS (__NR_##name, nr, args) \ + if (_r10 == -1) \ + { \ + __set_errno (_retval); \ + _retval = -1; \ + } \ _retval; }) #undef INTERNAL_SYSCALL_DECL @@ -257,7 +257,7 @@ #undef INTERNAL_SYSCALL #define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ ({ \ - DO_INLINE_SYSCALL_NCS(name, nr, args) \ + DO_INLINE_SYSCALL_NCS (name, nr, args) \ err = _r10; \ _retval; }) #define INTERNAL_SYSCALL(name, err, nr, args...) \ diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.h b/sysdeps/unix/sysv/linux/sh/sysdep.h index 35b8a58afa..aeec279de0 100644 --- a/sysdeps/unix/sysv/linux/sh/sysdep.h +++ b/sysdeps/unix/sysv/linux/sh/sysdep.h @@ -333,6 +333,20 @@ \ (int) resultvar; }) +/* The _NCS variant allows non-constant syscall numbers. */ +#define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \ + ({ \ + unsigned long int resultvar; \ + register long int r3 asm ("%r3") = (name); \ + SUBSTITUTE_ARGS_##nr(args); \ + \ + asm volatile (SYSCALL_INST_STR##nr SYSCALL_INST_PAD \ + : "=z" (resultvar) \ + : "r" (r3) ASMFMT_##nr \ + : "memory"); \ + \ + (int) resultvar; }) + #undef INTERNAL_SYSCALL_DECL #define INTERNAL_SYSCALL_DECL(err) do { } while (0) diff --git a/sysdeps/unix/sysv/linux/sys/mount.h b/sysdeps/unix/sysv/linux/sys/mount.h index f768d4dc73..b30554987a 100644 --- a/sysdeps/unix/sysv/linux/sys/mount.h +++ b/sysdeps/unix/sysv/linux/sys/mount.h @@ -1,5 +1,5 @@ /* Header file for mounting/unmount Linux filesystems. - Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1998,1999,2000,2004 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 @@ -62,7 +62,8 @@ enum }; /* Flags that can be altered by MS_REMOUNT */ -#define MS_RMT_MASK (MS_RDONLY | MS_MANDLOCK) +#define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_NOATIME \ + |MS_NODIRATIME) /* Magic mount flag number. Has to be or-ed to the flag values. */ @@ -82,6 +83,14 @@ enum #define BLKFLSBUF _IO(0x12, 97) /* Flush buffer cache. */ #define BLKRASET _IO(0x12, 98) /* Set read ahead for block device. */ #define BLKRAGET _IO(0x12, 99) /* Get current read ahead setting. */ +#define BLKFRASET _IO(0x12,100) /* Set filesystem read-ahead. */ +#define BLKFRAGET _IO(0x12,101) /* Get filesystem read-ahead. */ +#define BLKSECTSET _IO(0x12,102) /* Set max sectors per request. */ +#define BLKSECTGET _IO(0x12,103) /* Get max sectors per request. */ +#define BLKSSZGET _IO(0x12,104) /* Get block device sector size. */ +#define BLKBSZGET _IOR(0x12,112,size_t) +#define BLKBSZSET _IOW(0x12,113,size_t) +#define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size. */ /* Possible value for FLAGS parameter of `umount2'. */ diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index 302545f68f..b932f51d15 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -355,7 +355,8 @@ elf_machine_plt_value (struct link_map *map, const Elf64_Rela *reloc, /* Perform the relocation specified by RELOC and SYM (which is fully resolved). MAP is the object containing the reloc. */ -static inline void +auto inline void +__attribute__ ((always_inline)) elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, const Elf64_Sym *sym, const struct r_found_version *version, void *const reloc_addr_arg) @@ -520,7 +521,8 @@ elf_machine_rela (struct link_map *map, const Elf64_Rela *reloc, } } -static inline void +auto inline void +__attribute ((always_inline)) elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, void *const reloc_addr_arg) { @@ -529,7 +531,8 @@ elf_machine_rela_relative (Elf64_Addr l_addr, const Elf64_Rela *reloc, *reloc_addr = l_addr + reloc->r_addend; } -static inline void +auto inline void +__attribute ((always_inline)) elf_machine_lazy_rel (struct link_map *map, Elf64_Addr l_addr, const Elf64_Rela *reloc) { |