[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r8458 - in /fsf/trunk/libc: ./ assert/ csu/ ctype/ debug/ dirent/ elf/ gmon/ gnulib/ grp/ hurd/ include/ include/bits/ inet/...



Author: eglibc
Date: Sat May 16 07:53:25 2009
New Revision: 8458

Log:
Import glibc-mainline for 2009-05-16

Added:
    fsf/trunk/libc/.gitignore
    fsf/trunk/libc/csu/.gitignore
    fsf/trunk/libc/debug/longjmp_chk.c
    fsf/trunk/libc/debug/tst-longjmp_chk.c
    fsf/trunk/libc/elf/check-execstack.c
    fsf/trunk/libc/include/bits/setjmp2.h
    fsf/trunk/libc/manual/.gitignore
    fsf/trunk/libc/po/.gitignore
    fsf/trunk/libc/setjmp/bits/
    fsf/trunk/libc/setjmp/bits/setjmp2.h
    fsf/trunk/libc/sunrpc/.gitignore
    fsf/trunk/libc/sysdeps/i386/____longjmp_chk.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/Versions
    fsf/trunk/libc/sysdeps/x86_64/____longjmp_chk.S
Removed:
    fsf/trunk/libc/.cvsignore
    fsf/trunk/libc/assert/.cvsignore
    fsf/trunk/libc/csu/.cvsignore
    fsf/trunk/libc/ctype/.cvsignore
    fsf/trunk/libc/dirent/.cvsignore
    fsf/trunk/libc/elf/.cvsignore
    fsf/trunk/libc/gmon/.cvsignore
    fsf/trunk/libc/gnulib/.cvsignore
    fsf/trunk/libc/grp/.cvsignore
    fsf/trunk/libc/hurd/.cvsignore
    fsf/trunk/libc/inet/.cvsignore
    fsf/trunk/libc/intl/.cvsignore
    fsf/trunk/libc/io/.cvsignore
    fsf/trunk/libc/libio/.cvsignore
    fsf/trunk/libc/locale/.cvsignore
    fsf/trunk/libc/mach/.cvsignore
    fsf/trunk/libc/manual/.cvsignore
    fsf/trunk/libc/math/.cvsignore
    fsf/trunk/libc/misc/.cvsignore
    fsf/trunk/libc/po/.cvsignore
    fsf/trunk/libc/posix/.cvsignore
    fsf/trunk/libc/pwd/.cvsignore
    fsf/trunk/libc/resolv/.cvsignore
    fsf/trunk/libc/resource/.cvsignore
    fsf/trunk/libc/setjmp/.cvsignore
    fsf/trunk/libc/signal/.cvsignore
    fsf/trunk/libc/socket/.cvsignore
    fsf/trunk/libc/stdio-common/.cvsignore
    fsf/trunk/libc/stdlib/.cvsignore
    fsf/trunk/libc/string/.cvsignore
    fsf/trunk/libc/sunrpc/.cvsignore
    fsf/trunk/libc/sysdeps/mach/hurd/.cvsignore
    fsf/trunk/libc/sysdeps/unix/common/.cvsignore
    fsf/trunk/libc/sysvipc/.cvsignore
    fsf/trunk/libc/termios/.cvsignore
    fsf/trunk/libc/time/.cvsignore
    fsf/trunk/libc/wcsmbs/.cvsignore
    fsf/trunk/libc/wctype/.cvsignore
Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/Versions.def
    fsf/trunk/libc/debug/Makefile
    fsf/trunk/libc/debug/Versions
    fsf/trunk/libc/elf/Makefile
    fsf/trunk/libc/include/atomic.h
    fsf/trunk/libc/include/stdio.h
    fsf/trunk/libc/mach/err_boot.sub
    fsf/trunk/libc/mach/err_ipc.sub
    fsf/trunk/libc/mach/err_mach.sub
    fsf/trunk/libc/math/libm-test.inc
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/cancellation.c
    fsf/trunk/libc/nptl/libc-cancellation.c
    fsf/trunk/libc/nptl/pthread_cancel.c
    fsf/trunk/libc/nscd/nscd-client.h
    fsf/trunk/libc/nscd/nscd.c
    fsf/trunk/libc/nscd/nscd.h
    fsf/trunk/libc/nscd/nscd_getai.c
    fsf/trunk/libc/nscd/nscd_getgr_r.c
    fsf/trunk/libc/nscd/nscd_gethst_r.c
    fsf/trunk/libc/nscd/nscd_getpw_r.c
    fsf/trunk/libc/nscd/nscd_getserv_r.c
    fsf/trunk/libc/nscd/nscd_helper.c
    fsf/trunk/libc/nscd/nscd_initgroups.c
    fsf/trunk/libc/nscd/selinux.c
    fsf/trunk/libc/nscd/selinux.h
    fsf/trunk/libc/resolv/ns_date.c
    fsf/trunk/libc/setjmp/Makefile
    fsf/trunk/libc/setjmp/longjmp.c
    fsf/trunk/libc/setjmp/setjmp.h
    fsf/trunk/libc/sysdeps/i386/__longjmp.S
    fsf/trunk/libc/sysdeps/unix/sysv/linux/Versions
    fsf/trunk/libc/sysdeps/unix/sysv/linux/fallocate64.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/Versions
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/fallocate64.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
    fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/Versions
    fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
    fsf/trunk/libc/sysdeps/x86_64/__longjmp.S
    fsf/trunk/libc/version.h

Added: fsf/trunk/libc/.gitignore
==============================================================================
--- fsf/trunk/libc/.gitignore (added)
+++ fsf/trunk/libc/.gitignore Sat May 16 07:53:25 2009
@@ -1,0 +1,51 @@
+*~
+*.d
+*.o
+*.so
+*.po
+*.go
+*.bo
+stamp.*
+*.stamp
+*.ustamp
+*.udeps
+*.gz
+*.Z
+*.tar
+*.tgz
+*.bz2
+=*
+TODO
+AUTHORS
+copyr-*
+copying.*
+glibc-*
+
+configparms
+
+sun[43]*
+i[345]86*
+hp300*
+
+ieeetest
+hppa-sysdeps
+regex
+
+gpl2lgpl.sed
+distinfo
+
+test-include
+analysis
+docs
+releases
+
+libc.prj
+.libc.prcs_aux
+libc.proj
+.snprj
+
+TODO.html
+
+autom4te*.cache
+
+rtkaio

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Sat May 16 07:53:25 2009
@@ -1,3 +1,82 @@
+2009-05-15  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* nscd/nscd.h: Move Definition for BLOCK_ALIGN_LOG, BLOCK_ALIGN, and
+	BLOCK_ALIGN_M1 to ...
+	* nscd/nscd-client.h: ...here.
+	* nscd/nscd_helper.c (__nscd_cache_search): Introduce loop counter.
+	Use it if we absolutely cannot reach any more correct list elements
+	because that many do not fit into the currently mapped database.
+
+2009-05-14  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* nscd/nscd_helper.c: Include stddef.h.
+	(__nscd_cache_search): Add datalen argument.  Use atomic_forced_read
+	in a couple of places.  Return NULL if trail is not less than
+	datasize, don't consider dataheads with length smaller than
+	offsetof (struct datahead, data) + datalen.
+	* nscd/nscd_client.h (__nscd_cache_search): Adjust prototype.
+	* nscd/nscd_gethst_r.c (nscd_gethst_r): Adjust callers.
+	* nscd/nscd_getpw_r.c (nscd_getpw_r): Likewise.
+	* nscd/nscd_getgr_r.c (nscd_getgr_r): Likewise.
+	* nscd/nscd_getai.c (__nscd_getai): Likewise.
+	* nscd/nscd_initgroups.c (__nscd_getgrouplist): Likewise.
+	* nscd/nscd_getserv_r.c (nscd_getserv_r): Likewise.
+
+	* sysdeps/unix/sysv/linux/i386/fallocate64.c (__fallocate64_l64):
+	Rename ...
+	(fallocate64): ... to this.
+	* sysdeps/unix/sysv/linux/fallocate64.c (__fallocate64_l64):
+	Rename ...
+	(fallocate64): ... to this.
+	* sysdeps/unix/sysv/linux/Versions (libc): Remove fallocate64.
+	* sysdeps/unix/sysv/linux/wordsize-64/Versions (libc): Add
+	fallocate64@@GLIBC_2.10.
+	* sysdeps/unix/sysv/linux/i386/Versions (libc): Add
+	fallocate64@@GLIBC_2.11.
+	* sysdeps/unix/sysv/linux/s390/s390-32/Versions (libc): Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions (libc): Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/Versions (libc): Likewise.
+	* sysdeps/unix/sysv/linux/sh/Versions (libc): Likewise.
+
+	* nscd/selinux.c (nscd_avc_destroy): Removed.
+	* nscd/selinux.h (nscd_avc_destroy): Likewise.
+	* nscd/nscd.c (termination_handler): Don't call
+	nscd_avc_destroy.
+
+2009-05-12  Jakub Jelinek  <jakub@xxxxxxxxxx>
+
+	* include/atomic.h: Formatting.
+	(catomic_compare_and_exchange_val_acq): Don't define if already
+	defined by bits/atomic.h.
+
+2009-05-15  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* math/libm-test.inc (expm1_test): Add test for range error.
+
+	* Versions.def: Add GLIBC_2.11 for libc.
+	* debug/Makefile (routines): Add longjmp_chk.
+	Add rules to build and run tst-longjmp_chk.
+	* debug/Versions: Export __longjmp_chk for GLIBC_2.11.
+	* debug/longjmp_chk.c: New file.
+	* debug/tst-longjmp_chk.c: New file.
+	* include/bits/setjmp2.: New file.
+	* include/stdio.h: Mark __fortify_fail as internal_function.
+	* setjmp/Makefile (headers): Add bits/setjmp2.h.
+	* setjmp/bits/setjmp2.h: New file.
+	* setjmp/longjmp.c: If __libc_siglongjmp is defined, don't define any
+	of the aliases.
+	* setjmp/setjmp.h: Include <bits/setjmp2.h> if _FORTIFY_SOURCE is
+	defined.
+	* sysdeps/i386/____longjmp_chk.S: New file.
+	* sysdeps/x86_64/____longjmp_chk.S: New file.
+	* sysdeps/i386/__longjmp.S: If CHECK_ESP is defined, use it.
+	* sysdeps/x86_64/__longjmp.S: Likewise.
+
+	* version.h: Bump for 2.11 development.
+
+	* elf/check-execstack.c: New file.
+	* elf/Makefile: Add rules to build and run check-execstack.
+
 2009-05-10  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* version.h (VERSION): Bump to 2.10.1.

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Sat May 16 07:53:25 2009
@@ -1,9 +1,15 @@
-GNU C Library NEWS -- history of user-visible changes.  2009-4-23
+GNU C Library NEWS -- history of user-visible changes.  2009-5-15
 Copyright (C) 1992-2008, 2009 Free Software Foundation, Inc.
 See the end for copying conditions.
 
 Please send GNU C library bug reports via <http://sources.redhat.com/bugzilla/>
 using `glibc' in the "product" field.
+
+Version 2.11
+
+* checking version of longjmp added that fails if an uninitialized stack
+  frame would be created.  Implemented by Ulrich Drepper.
+
 
 Version 2.10
 

Modified: fsf/trunk/libc/Versions.def
==============================================================================
--- fsf/trunk/libc/Versions.def (original)
+++ fsf/trunk/libc/Versions.def Sat May 16 07:53:25 2009
@@ -27,6 +27,7 @@
   GLIBC_2.8
   GLIBC_2.9
   GLIBC_2.10
+  GLIBC_2.11
 %ifdef USE_IN_LIBIO
   HURD_CTHREADS_0.3
 %endif

Added: fsf/trunk/libc/csu/.gitignore
==============================================================================
--- fsf/trunk/libc/csu/.gitignore (added)
+++ fsf/trunk/libc/csu/.gitignore Sat May 16 07:53:25 2009
@@ -1,0 +1,1 @@
+specs

Modified: fsf/trunk/libc/debug/Makefile
==============================================================================
--- fsf/trunk/libc/debug/Makefile (original)
+++ fsf/trunk/libc/debug/Makefile Sat May 16 07:53:25 2009
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2001,2004-2008 Free Software Foundation, Inc.
+# Copyright (C) 1998-2001,2004-2008, 2009 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
@@ -43,6 +43,7 @@
 	    wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
 	    wcstombs_chk asprintf_chk vasprintf_chk dprintf_chk \
 	    vdprintf_chk obprintf_chk \
+	    longjmp_chk ____longjmp_chk \
 	    stack_chk_fail fortify_fail \
 	    $(static-only-routines)
 static-only-routines := warning-nop stack_chk_fail_local
@@ -79,6 +80,8 @@
 CFLAGS-pread64_chk.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-recv_chk.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-recvfrom_chk.c = -fexceptions -fasynchronous-unwind-tables
+CFLAGS-tst-longjmp_chk.c = -fexceptions -fasynchronous-unwind-tables \
+			   -D_FORTIFY_SOURCE=1
 
 # We know these tests have problems with format strings, this is what
 # we are testing.  Disable that warning.
@@ -113,7 +116,7 @@
 LDFLAGS-tst-lfschk5 = -lstdc++
 LDFLAGS-tst-lfschk6 = -lstdc++
 
-tests = backtrace-tst tst-chk1 tst-chk2 tst-chk3 \
+tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
 	tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
 	tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6
 

Modified: fsf/trunk/libc/debug/Versions
==============================================================================
--- fsf/trunk/libc/debug/Versions (original)
+++ fsf/trunk/libc/debug/Versions Sat May 16 07:53:25 2009
@@ -46,6 +46,9 @@
     __asprintf_chk; __vasprintf_chk;  __dprintf_chk; __vdprintf_chk;
     __obstack_printf_chk; __obstack_vprintf_chk;
   }
+  GLIBC_2.11 {
+    __longjmp_chk;
+  }
   GLIBC_PRIVATE {
     __fortify_fail;
   }

Added: fsf/trunk/libc/debug/longjmp_chk.c
==============================================================================
--- fsf/trunk/libc/debug/longjmp_chk.c (added)
+++ fsf/trunk/libc/debug/longjmp_chk.c Sat May 16 07:53:25 2009
@@ -1,0 +1,28 @@
+/* Copyright (C) 2009 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <setjmp.h>
+
+// XXX Should move to include/setjmp.h
+extern void ____longjmp_chk (__jmp_buf __env, int __val)
+     __attribute__ ((__noreturn__));
+
+#define __longjmp ____longjmp_chk
+#define __libc_siglongjmp __longjmp_chk
+
+#include <setjmp/longjmp.c>

Added: fsf/trunk/libc/debug/tst-longjmp_chk.c
==============================================================================
--- fsf/trunk/libc/debug/tst-longjmp_chk.c (added)
+++ fsf/trunk/libc/debug/tst-longjmp_chk.c Sat May 16 07:53:25 2009
@@ -1,0 +1,86 @@
+#include <errno.h>
+#include <fcntl.h>
+#include <paths.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static jmp_buf b;
+
+
+static void
+__attribute__ ((noinline))
+f (void)
+{
+  char buf[1000];
+  asm volatile ("" : "=m" (buf));
+
+  if (setjmp (b) != 0)
+    {
+      puts ("second longjmp succeeded");
+      exit (1);
+    }
+}
+
+
+static bool expected_to_fail;
+
+
+static void
+handler (int sig)
+{
+  if (expected_to_fail)
+    _exit (0);
+  else
+    {
+      static const char msg[] = "unexpected longjmp failure\n";
+      TEMP_FAILURE_RETRY (write (STDOUT_FILENO, msg, sizeof (msg) - 1));
+      _exit (1);
+    }
+}
+
+
+int
+main (void)
+{
+  struct sigaction sa;
+  sa.sa_handler = handler;
+  sa.sa_flags = 0;
+  sigemptyset (&sa.sa_mask);
+
+  sigaction (SIGABRT, &sa, NULL);
+
+  /* Avoid all the buffer overflow messages on stderr.  */
+  int fd = open (_PATH_DEVNULL, O_WRONLY);
+  if (fd == -1)
+    close (STDERR_FILENO);
+  else
+    {
+      dup2 (fd, STDERR_FILENO);
+      close (fd);
+    }
+  setenv ("LIBC_FATAL_STDERR_", "1", 1);
+
+
+  expected_to_fail = false;
+
+  if (setjmp (b) == 0)
+    {
+      longjmp (b, 1);
+      /* NOTREACHED */
+      printf ("first longjmp returned\n");
+      return 1;
+    }
+
+
+  expected_to_fail = true;
+
+  f ();
+  longjmp (b, 1);
+
+  puts ("second longjmp returned");
+  return 1;
+}

Modified: fsf/trunk/libc/elf/Makefile
==============================================================================
--- fsf/trunk/libc/elf/Makefile (original)
+++ fsf/trunk/libc/elf/Makefile Sat May 16 07:53:25 2009
@@ -93,7 +93,7 @@
 		   order2mod1.c order2mod2.c order2mod3.c order2mod4.c \
 		   tst-stackguard1.c tst-stackguard1-static.c \
 		   tst-array5.c tst-array5-static.c tst-array5dep.c \
-		   tst-array5.exp tst-leaks1.c
+		   tst-array5.exp tst-leaks1.c check-execstack.c
 
 CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
@@ -842,18 +842,28 @@
 $(objpfx)check-textrel: check-textrel.c
 	$(native-compile)
 
+check-execstack-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99
+$(objpfx)check-execstack: check-execstack.c
+	$(native-compile)
+
 check-localplt-CFLAGS = -O -Wall -D_GNU_SOURCE -std=gnu99
 $(objpfx)check-localplt: check-localplt.c
 	$(native-compile)
 
 ifeq (yes,$(build-shared))
-tests: $(objpfx)check-textrel.out
+tests: $(objpfx)check-textrel.out $(objpfx)check-execstack.out
 
 $(objpfx)check-textrel.out: $(objpfx)check-textrel
 	$(dir $<)$(notdir $<) $(common-objpfx)libc.so \
 	  $(sort $(wildcard $(common-objpfx)*/lib*.so \
 			    $(common-objpfx)iconvdata/*.so)) > $@
 generated += check-textrel check-textrel.out
+
+$(objpfx)check-execstack.out: $(objpfx)check-execstack
+	$(dir $<)$(notdir $<) $(common-objpfx)libc.so \
+	  $(sort $(wildcard $(common-objpfx)*/lib*.so \
+			    $(common-objpfx)iconvdata/*.so)) > $@
+generated += check-execstack check-execstack.out
 
 $(objpfx)tst-dlmodcount: $(libdl)
 $(objpfx)tst-dlmodcount.out: $(test-modules)

Added: fsf/trunk/libc/elf/check-execstack.c
==============================================================================
--- fsf/trunk/libc/elf/check-execstack.c (added)
+++ fsf/trunk/libc/elf/check-execstack.c Sat May 16 07:53:25 2009
@@ -1,0 +1,158 @@
+/* Check for executable stacks in DSOs.
+   Copyright (C) 2009 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contribute by Ulrich Drepper <drepper@xxxxxxxxxx>. 2009.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#include <byteswap.h>
+#include <elf.h>
+#include <endian.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+
+#ifdef BITS
+
+# define AB(name) _AB (name, BITS)
+# define _AB(name, bits) __AB (name, bits)
+# define __AB(name, bits) name##bits
+# define E(name) _E (name, BITS)
+# define _E(name, bits) __E (name, bits)
+# define __E(name, bits) Elf##bits##_##name
+# define SWAP(val) \
+  ({ __typeof (val) __res;						      \
+     if (((ehdr.e_ident[EI_DATA] == ELFDATA2MSB				      \
+	   && BYTE_ORDER == LITTLE_ENDIAN)				      \
+	  || (ehdr.e_ident[EI_DATA] == ELFDATA2LSB			      \
+	      && BYTE_ORDER == BIG_ENDIAN))				      \
+	 && sizeof (val) != 1)						      \
+       {								      \
+	 if (sizeof (val) == 2)						      \
+	   __res = bswap_16 (val);					      \
+	 else if (sizeof (val) == 4)					      \
+	   __res = bswap_32 (val);					      \
+	 else								      \
+	   __res = bswap_64 (val);					      \
+       }								      \
+     else								      \
+       __res = (val);							      \
+     __res; })
+
+
+static int
+AB(handle_file) (const char *fname, int fd)
+{
+  E(Ehdr) ehdr;
+
+  if (pread (fd, &ehdr, sizeof (ehdr), 0) != sizeof (ehdr))
+    {
+    read_error:
+      printf ("%s: read error: %m\n", fname);
+      return 1;
+    }
+
+  const size_t phnum = SWAP (ehdr.e_phnum);
+  const size_t phentsize = SWAP (ehdr.e_phentsize);
+
+  /* Read the program header.  */
+  E(Phdr) *phdr = alloca (phentsize * phnum);
+  if (pread (fd, phdr, phentsize * phnum, SWAP (ehdr.e_phoff))
+      != phentsize * phnum)
+    goto read_error;
+
+  /* Search for the PT_GNU_STACK entry.  */
+  for (size_t cnt = 0; cnt < phnum; ++cnt)
+    if (SWAP (phdr[cnt].p_type) == PT_GNU_STACK)
+      {
+	unsigned int flags = SWAP(phdr[cnt].p_flags);
+	if (flags & PF_X)
+	  {
+	    printf ("%s: executable stack signaled\n", fname);
+	    return 1;
+	  }
+
+	return 0;
+      }
+
+  printf ("%s: no PT_GNU_STACK entry\n", fname);
+  return 1;
+}
+
+# undef BITS
+#else
+
+# define BITS 32
+# include "check-execstack.c"
+
+# define BITS 64
+# include "check-execstack.c"
+
+
+static int
+handle_file (const char *fname)
+{
+  int fd = open (fname, O_RDONLY);
+  if (fd == -1)
+    {
+      printf ("cannot open %s: %m\n", fname);
+      return 1;
+    }
+
+  /* Read was is supposed to be the ELF header.  Read the initial
+     bytes to determine whether this is a 32 or 64 bit file.  */
+  char ident[EI_NIDENT];
+  if (read (fd, ident, EI_NIDENT) != EI_NIDENT)
+    {
+      printf ("%s: read error: %m\n", fname);
+      close (fd);
+      return 1;
+    }
+
+  if (memcmp (&ident[EI_MAG0], ELFMAG, SELFMAG) != 0)
+    {
+      printf ("%s: not an ELF file\n", fname);
+      close (fd);
+      return 1;
+    }
+
+  int result;
+  if (ident[EI_CLASS] == ELFCLASS64)
+    result = handle_file64 (fname, fd);
+  else
+    result = handle_file32 (fname, fd);
+
+  close (fd);
+
+  return result;
+}
+
+
+int
+main (int argc, char *argv[])
+{
+  int cnt;
+  int result = 0;
+
+  for (cnt = 1; cnt < argc; ++cnt)
+    result |= handle_file (argv[cnt]);
+
+  return result;
+}
+#endif

Modified: fsf/trunk/libc/include/atomic.h
==============================================================================
--- fsf/trunk/libc/include/atomic.h (original)
+++ fsf/trunk/libc/include/atomic.h Sat May 16 07:53:25 2009
@@ -95,14 +95,15 @@
 #endif
 
 
-#if !defined catomic_compare_and_exchange_val_acq \
-    && defined __arch_c_compare_and_exchange_val_32_acq
-# define catomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+#ifndef catomic_compare_and_exchange_val_acq
+# ifdef __arch_c_compare_and_exchange_val_32_acq
+#  define catomic_compare_and_exchange_val_acq(mem, newval, oldval) \
   __atomic_val_bysize (__arch_c_compare_and_exchange_val,acq,		      \
 		       mem, newval, oldval)
-#else
-# define catomic_compare_and_exchange_val_acq(mem, newval, oldval) \
+# else
+#  define catomic_compare_and_exchange_val_acq(mem, newval, oldval) \
   atomic_compare_and_exchange_val_acq (mem, newval, oldval)
+# endif
 #endif
 
 
@@ -125,8 +126,8 @@
 #  define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
   __atomic_bool_bysize (__arch_compare_and_exchange_bool,acq,		      \
 		        mem, newval, oldval)
-#  else
-#   define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+# else
+#  define atomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
   ({ /* Cannot use __oldval here, because macros later in this file might     \
 	call this macro with __oldval argument.	 */			      \
      __typeof (oldval) __atg3_old = (oldval);				      \
@@ -142,8 +143,8 @@
 #  define catomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
   __atomic_bool_bysize (__arch_c_compare_and_exchange_bool,acq,		      \
 		        mem, newval, oldval)
-#  else
-#   define catomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
+# else
+#  define catomic_compare_and_exchange_bool_acq(mem, newval, oldval) \
   ({ /* Cannot use __oldval here, because macros later in this file might     \
 	call this macro with __oldval argument.	 */			      \
      __typeof (oldval) __atg4_old = (oldval);				      \

Added: fsf/trunk/libc/include/bits/setjmp2.h
==============================================================================
--- fsf/trunk/libc/include/bits/setjmp2.h (added)
+++ fsf/trunk/libc/include/bits/setjmp2.h Sat May 16 07:53:25 2009
@@ -1,0 +1,1 @@
+#include <setjmp/bits/setjmp2.h>

Modified: fsf/trunk/libc/include/stdio.h
==============================================================================
--- fsf/trunk/libc/include/stdio.h (original)
+++ fsf/trunk/libc/include/stdio.h Sat May 16 07:53:25 2009
@@ -90,7 +90,8 @@
 extern void __libc_fatal (__const char *__message)
      __attribute__ ((__noreturn__));
 extern void __libc_message (int do_abort, __const char *__fnt, ...);
-extern void __fortify_fail (const char *msg) __attribute__ ((noreturn));
+extern void __fortify_fail (const char *msg)
+     __attribute__ ((__noreturn__)) internal_function;
 libc_hidden_proto (__fortify_fail)
 
 /* Acquire ownership of STREAM.  */

Modified: fsf/trunk/libc/mach/err_boot.sub
==============================================================================
--- fsf/trunk/libc/mach/err_boot.sub (original)
+++ fsf/trunk/libc/mach/err_boot.sub Sat May 16 07:53:25 2009
@@ -25,7 +25,7 @@
  */
 /*
  * HISTORY
- * $Log: err_boot.sub,v $
+ * $Log$
  * Revision 1.1  1992/10/06 18:29:52  roland
  * entered into RCS
  *

Modified: fsf/trunk/libc/mach/err_ipc.sub
==============================================================================
--- fsf/trunk/libc/mach/err_ipc.sub (original)
+++ fsf/trunk/libc/mach/err_ipc.sub Sat May 16 07:53:25 2009
@@ -25,7 +25,7 @@
  */
 /*
  * HISTORY
- * $Log: err_ipc.sub,v $
+ * $Log$
  * Revision 1.1  1992/10/06 18:29:52  roland
  * entered into RCS
  *

Modified: fsf/trunk/libc/mach/err_mach.sub
==============================================================================
--- fsf/trunk/libc/mach/err_mach.sub (original)
+++ fsf/trunk/libc/mach/err_mach.sub Sat May 16 07:53:25 2009
@@ -25,7 +25,7 @@
  */
 /*
  * HISTORY
- * $Log: err_mach.sub,v $
+ * $Log$
  * Revision 1.1  1992/10/06 18:29:52  roland
  * entered into RCS
  *

Added: fsf/trunk/libc/manual/.gitignore
==============================================================================
--- fsf/trunk/libc/manual/.gitignore (added)
+++ fsf/trunk/libc/manual/.gitignore Sat May 16 07:53:25 2009
@@ -1,0 +1,29 @@
+*.aux
+*.c.texi
+*.cp
+*.cps
+*.dvi*
+*.fn
+*.fns
+*.info*
+*.ky
+*.kys
+*.log
+*.pdf
+*.pg
+*.pgs
+*.ps
+*.tmp
+*.toc
+*.tp
+*.tps
+*.vr
+*.vrs
+chapters.texi
+dir-add.texi
+dir-add.texinfo
+libm-err.texi
+stamp-*
+summary.texi
+texis
+top-menu.texi

Modified: fsf/trunk/libc/math/libm-test.inc
==============================================================================
--- fsf/trunk/libc/math/libm-test.inc (original)
+++ fsf/trunk/libc/math/libm-test.inc Sat May 16 07:53:25 2009
@@ -2603,6 +2603,10 @@
   TEST_f_f (expm1, 1, M_El - 1.0);
   TEST_f_f (expm1, 0.75L, 1.11700001661267466854536981983709561L);
 
+  errno = 0;
+  TEST_f_f (expm1, 100000.0, plus_infty);
+  check_int ("errno for expm1(large) == ERANGE", errno, ERANGE, 0, 0, 0);
+
   END (expm1);
 }
 

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Sat May 16 07:53:25 2009
@@ -1,3 +1,15 @@
+2009-05-15  Ulrich Drepper  <drepper@xxxxxxxxxx>
+
+	* cancellation.c (__pthread_disable_asynccancel): Correct the bits
+	to test when deciding on the delay.
+	* libc-cancellation.c (__libc_disable_asynccancel): Likewise.
+	* pthread_cancel.c: Close race between deciding on sending a signal
+	and setting the CANCELING_BIT bit.
+
+	* cancellation.c (__pthread_disable_asynccancel): Don't return if
+	thread is canceled.
+	* libc-cancellation.c (__libc_disable_asynccancel): Likewise.
+
 2009-04-27  Ulrich Drepper  <drepper@xxxxxxxxxx>
 
 	* cancellation.c (__pthread_disable_asynccancel): Use THREAD_ATOMIC_AND

Modified: fsf/trunk/libc/nptl/cancellation.c
==============================================================================
--- fsf/trunk/libc/nptl/cancellation.c (original)
+++ fsf/trunk/libc/nptl/cancellation.c Sat May 16 07:53:25 2009
@@ -70,15 +70,13 @@
     return;
 
   struct pthread *self = THREAD_SELF;
+  int newval;
 
-#ifdef THREAD_ATOMIC_AND
-  THREAD_ATOMIC_AND (self, cancelhandling, ~CANCELTYPE_BITMASK);
-#else
   int oldval = THREAD_GETMEM (self, cancelhandling);
 
   while (1)
     {
-      int newval = oldval & ~CANCELTYPE_BITMASK;
+      newval = oldval & ~CANCELTYPE_BITMASK;
 
       if (newval == oldval)
 	break;
@@ -91,5 +89,15 @@
       /* Prepare the next round.  */
       oldval = curval;
     }
-#endif
+
+  /* We cannot return when we are being canceled.  Upon return the
+     thread might be things which would have to be undone.  The
+     following loop should loop until the cancellation signal is
+     delivered.  */
+  while (__builtin_expect ((newval & (CANCELING_BITMASK | CANCELED_BITMASK))
+			   == CANCELING_BITMASK, 0))
+    {
+      lll_futex_wait (&self->cancelhandling, newval, LLL_PRIVATE);
+      newval = THREAD_GETMEM (self, cancelhandling);
+    }
 }

Modified: fsf/trunk/libc/nptl/libc-cancellation.c
==============================================================================
--- fsf/trunk/libc/nptl/libc-cancellation.c (original)
+++ fsf/trunk/libc/nptl/libc-cancellation.c Sat May 16 07:53:25 2009
@@ -86,15 +86,13 @@
     return;
 
   struct pthread *self = THREAD_SELF;
+  int newval;
 
-#ifdef THREAD_ATOMIC_AND
-  THREAD_ATOMIC_AND (self, cancelhandling, ~CANCELTYPE_BITMASK);
-#else
   int oldval = THREAD_GETMEM (self, cancelhandling);
 
   while (1)
     {
-      int newval = oldval & ~CANCELTYPE_BITMASK;
+      newval = oldval & ~CANCELTYPE_BITMASK;
 
       if (newval == oldval)
 	break;
@@ -107,7 +105,17 @@
       /* Prepare the next round.  */
       oldval = curval;
     }
-#endif
+
+  /* We cannot return when we are being canceled.  Upon return the
+     thread might be things which would have to be undone.  The
+     following loop should loop until the cancellation signal is
+     delivered.  */
+  while (__builtin_expect ((newval & (CANCELING_BITMASK | CANCELED_BITMASK))
+			   == CANCELING_BITMASK, 0))
+    {
+      lll_futex_wait (&self->cancelhandling, newval, LLL_PRIVATE);
+      newval = THREAD_GETMEM (self, cancelhandling);
+    }
 }
 
 

Modified: fsf/trunk/libc/nptl/pthread_cancel.c
==============================================================================
--- fsf/trunk/libc/nptl/pthread_cancel.c (original)
+++ fsf/trunk/libc/nptl/pthread_cancel.c Sat May 16 07:53:25 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2004, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2002.
 
@@ -44,6 +44,7 @@
   int newval;
   do
     {
+    again:
       oldval = pd->cancelhandling;
       newval = oldval | CANCELING_BITMASK | CANCELED_BITMASK;
 
@@ -59,7 +60,10 @@
       if (CANCEL_ENABLED_AND_CANCELED_AND_ASYNCHRONOUS (newval))
 	{
 	  /* Mark the cancellation as "in progress".  */
-	  atomic_bit_set (&pd->cancelhandling, CANCELING_BIT);
+	  if (atomic_compare_and_exchange_bool_acq (&pd->cancelhandling,
+						    oldval | CANCELING_BITMASK,
+						    oldval))
+	    goto again;
 
 	  /* The cancellation handler will take care of marking the
 	     thread as canceled.  */

Modified: fsf/trunk/libc/nscd/nscd-client.h
==============================================================================
--- fsf/trunk/libc/nscd/nscd-client.h (original)
+++ fsf/trunk/libc/nscd/nscd-client.h Sat May 16 07:53:25 2009
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 1999, 2000, 2003, 2004, 2005, 2006, 2007
+/* Copyright (c) 1998, 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@xxxxxxx>, 1998.
@@ -44,8 +44,13 @@
 /* Path for the configuration file.  */
 #define _PATH_NSCDCONF	 "/etc/nscd.conf"
 
-/* Maximu allowed length for the key.  */
+/* Maximum allowed length for the key.  */
 #define MAXKEYLEN 1024
+
+/* Maximum alignment requirement we will encounter.  */
+#define BLOCK_ALIGN_LOG 3
+#define BLOCK_ALIGN (1 << BLOCK_ALIGN_LOG)
+#define BLOCK_ALIGN_M1 (BLOCK_ALIGN - 1)
 
 
 /* Available services.  */
@@ -329,7 +334,8 @@
 extern struct datahead *__nscd_cache_search (request_type type,
 					     const char *key,
 					     size_t keylen,
-					     const struct mapped_database *mapped);
+					     const struct mapped_database *mapped,
+					     size_t datalen);
 
 /* Wrappers around read, readv and write that only read/write less than LEN
    bytes on error or EOF.  */

Modified: fsf/trunk/libc/nscd/nscd.c
==============================================================================
--- fsf/trunk/libc/nscd/nscd.c (original)
+++ fsf/trunk/libc/nscd/nscd.c Sat May 16 07:53:25 2009
@@ -488,10 +488,6 @@
 	msync (dbs[cnt].head, dbs[cnt].memsize, MS_ASYNC);
     }
 
-  /* Shutdown the SELinux AVC.  */
-  if (selinux_enabled)
-    nscd_avc_destroy ();
-
   _exit (EXIT_SUCCESS);
 }
 

Modified: fsf/trunk/libc/nscd/nscd.h
==============================================================================
--- fsf/trunk/libc/nscd/nscd.h (original)
+++ fsf/trunk/libc/nscd/nscd.h Sat May 16 07:53:25 2009
@@ -110,11 +110,6 @@
 
 /* Path used when not using persistent storage.  */
 #define _PATH_NSCD_XYZ_DB_TMP	"/var/run/nscd/dbXXXXXX"
-
-/* Maximum alignment requirement we will encounter.  */
-#define BLOCK_ALIGN_LOG 3
-#define BLOCK_ALIGN (1 << BLOCK_ALIGN_LOG)
-#define BLOCK_ALIGN_M1 (BLOCK_ALIGN - 1)
 
 /* Default value for the maximum size of the database files.  */
 #define DEFAULT_MAX_DB_SIZE	(32 * 1024 * 1024)

Modified: fsf/trunk/libc/nscd/nscd_getai.c
==============================================================================
--- fsf/trunk/libc/nscd/nscd_getai.c (original)
+++ fsf/trunk/libc/nscd/nscd_getai.c Sat May 16 07:53:25 2009
@@ -1,4 +1,5 @@
-/* Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2004.
 
@@ -75,7 +76,7 @@
   if (mapped != NO_MAPPING)
     {
       struct datahead *found = __nscd_cache_search (GETAI, key, keylen,
-						    mapped);
+						    mapped, sizeof ai_resp);
       if (found != NULL)
 	{
 	  respdata = (char *) (&found->data[0].aidata + 1);

Modified: fsf/trunk/libc/nscd/nscd_getgr_r.c
==============================================================================
--- fsf/trunk/libc/nscd/nscd_getgr_r.c (original)
+++ fsf/trunk/libc/nscd/nscd_getgr_r.c Sat May 16 07:53:25 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2000, 2002-2005, 2006, 2007
+/* Copyright (C) 1998-2000, 2002-2005, 2006, 2007, 2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@xxxxxxxxxxxxxxxx>, 1998.
@@ -107,7 +107,8 @@
 
   if (mapped != NO_MAPPING)
     {
-      struct datahead *found = __nscd_cache_search (type, key, keylen, mapped);
+      struct datahead *found = __nscd_cache_search (type, key, keylen, mapped,
+						    sizeof gr_resp);
       if (found != NULL)
 	{
 	  len = (const uint32_t *) (&found->data[0].grdata + 1);

Modified: fsf/trunk/libc/nscd/nscd_gethst_r.c
==============================================================================
--- fsf/trunk/libc/nscd/nscd_gethst_r.c (original)
+++ fsf/trunk/libc/nscd/nscd_gethst_r.c Sat May 16 07:53:25 2009
@@ -1,4 +1,5 @@
-/* Copyright (C) 1998-2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2005, 2006, 2007, 2008, 2009
+   Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1998.
 
@@ -137,7 +138,8 @@
   if (mapped != NO_MAPPING)
     {
       /* No const qualifier, as it can change during garbage collection.  */
-      struct datahead *found = __nscd_cache_search (type, key, keylen, mapped);
+      struct datahead *found = __nscd_cache_search (type, key, keylen, mapped,
+						    sizeof hst_resp);
       if (found != NULL)
 	{
 	  h_name = (char *) (&found->data[0].hstdata + 1);

Modified: fsf/trunk/libc/nscd/nscd_getpw_r.c
==============================================================================
--- fsf/trunk/libc/nscd/nscd_getpw_r.c (original)
+++ fsf/trunk/libc/nscd/nscd_getpw_r.c Sat May 16 07:53:25 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999, 2003, 2004, 2005, 2007
+/* Copyright (C) 1998, 1999, 2003, 2004, 2005, 2007, 2009
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@xxxxxxxxxxxxxxxx>, 1998.
@@ -104,7 +104,8 @@
 
   if (mapped != NO_MAPPING)
     {
-      struct datahead *found = __nscd_cache_search (type, key, keylen, mapped);
+      struct datahead *found = __nscd_cache_search (type, key, keylen, mapped,
+						    sizeof pw_resp);
       if (found != NULL)
 	{
 	  pw_name = (const char *) (&found->data[0].pwdata + 1);

Modified: fsf/trunk/libc/nscd/nscd_getserv_r.c
==============================================================================
--- fsf/trunk/libc/nscd/nscd_getserv_r.c (original)
+++ fsf/trunk/libc/nscd/nscd_getserv_r.c Sat May 16 07:53:25 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2007.
 
@@ -104,7 +104,8 @@
 
   if (mapped != NO_MAPPING)
     {
-      struct datahead *found = __nscd_cache_search (type, key, keylen, mapped);
+      struct datahead *found = __nscd_cache_search (type, key, keylen, mapped,
+						    sizeof serv_resp);
 
       if (found != NULL)
 	{

Modified: fsf/trunk/libc/nscd/nscd_helper.c
==============================================================================
--- fsf/trunk/libc/nscd/nscd_helper.c (original)
+++ fsf/trunk/libc/nscd/nscd_helper.c Sat May 16 07:53:25 2009
@@ -21,6 +21,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdbool.h>
+#include <stddef.h>
 #include <string.h>
 #include <time.h>
 #include <unistd.h>
@@ -472,18 +473,21 @@
    garbage collection.  */
 struct datahead *
 __nscd_cache_search (request_type type, const char *key, size_t keylen,
-		     const struct mapped_database *mapped)
+		     const struct mapped_database *mapped, size_t datalen)
 {
   unsigned long int hash = __nis_hash (key, keylen) % mapped->head->module;
   size_t datasize = mapped->datasize;
 
   ref_t trail = mapped->head->array[hash];
+  trail = atomic_forced_read (trail);
   ref_t work = trail;
+  size_t loop_cnt = datasize / (offsetof (struct datahead, data) + datalen);
   int tick = 0;
 
   while (work != ENDREF && work + sizeof (struct hashentry) <= datasize)
     {
       struct hashentry *here = (struct hashentry *) (mapped->data + work);
+      ref_t here_key, here_packet;
 
 #ifndef _STRING_ARCH_unaligned
       /* Although during garbage collection when moving struct hashentry
@@ -498,13 +502,14 @@
 
       if (type == here->type
 	  && keylen == here->len
-	  && here->key + keylen <= datasize
-	  && memcmp (key, mapped->data + here->key, keylen) == 0
-	  && here->packet + sizeof (struct datahead) <= datasize)
+	  && (here_key = atomic_forced_read (here->key)) + keylen <= datasize
+	  && memcmp (key, mapped->data + here_key, keylen) == 0
+	  && ((here_packet = atomic_forced_read (here->packet))
+	      + sizeof (struct datahead) <= datasize))
 	{
 	  /* We found the entry.  Increment the appropriate counter.  */
 	  struct datahead *dh
-	    = (struct datahead *) (mapped->data + here->packet);
+	    = (struct datahead *) (mapped->data + here_packet);
 
 #ifndef _STRING_ARCH_unaligned
 	  if ((uintptr_t) dh & (__alignof__ (*dh) - 1))
@@ -513,14 +518,17 @@
 
 	  /* See whether we must ignore the entry or whether something
 	     is wrong because garbage collection is in progress.  */
-	  if (dh->usable && here->packet + dh->allocsize <= datasize)
+	  if (dh->usable
+	      && here_packet + dh->allocsize <= datasize
+	      && (here_packet + offsetof (struct datahead, data) + datalen
+		  <= datasize))
 	    return dh;
 	}
 
-      work = here->next;
+      work = atomic_forced_read (here->next);
       /* Prevent endless loops.  This should never happen but perhaps
 	 the database got corrupted, accidentally or deliberately.  */
-      if (work == trail)
+      if (work == trail || loop_cnt-- > 0)
 	break;
       if (tick)
 	{
@@ -532,7 +540,11 @@
 	  if ((uintptr_t) trailelem & (__alignof__ (*trailelem) - 1))
 	    return NULL;
 #endif
-	  trail = trailelem->next;
+
+	  if (trail + sizeof (struct hashentry) > datasize)
+	    return NULL;
+
+	  trail = atomic_forced_read (trailelem->next);
 	}
       tick = 1 - tick;
     }

Modified: fsf/trunk/libc/nscd/nscd_initgroups.c
==============================================================================
--- fsf/trunk/libc/nscd/nscd_initgroups.c (original)
+++ fsf/trunk/libc/nscd/nscd_initgroups.c Sat May 16 07:53:25 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 2004.
 
@@ -55,7 +55,8 @@
   if (mapped != NO_MAPPING)
     {
       struct datahead *found = __nscd_cache_search (INITGROUPS, user,
-						    userlen, mapped);
+						    userlen, mapped,
+						    sizeof initgr_resp);
       if (found != NULL)
 	{
 	  respdata = (char *) (&found->data[0].initgrdata + 1);

Modified: fsf/trunk/libc/nscd/selinux.c
==============================================================================
--- fsf/trunk/libc/nscd/selinux.c (original)
+++ fsf/trunk/libc/nscd/selinux.c Sat May 16 07:53:25 2009
@@ -1,5 +1,5 @@
 /* SELinux access controls for nscd.
-   Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Matthew Rickard <mjricka@xxxxxxxxxxxxxx>, 2004.
 
@@ -418,15 +418,4 @@
 	  cstats->cav_probes, cstats->cav_misses);
 }
 
-
-/* Clean up the AVC before exiting.  */
-void
-nscd_avc_destroy (void)
-{
-  avc_destroy ();
-#ifdef HAVE_LIBAUDIT
-  audit_close (audit_fd);
-#endif
-}
-
 #endif /* HAVE_SELINUX */

Modified: fsf/trunk/libc/nscd/selinux.h
==============================================================================
--- fsf/trunk/libc/nscd/selinux.h (original)
+++ fsf/trunk/libc/nscd/selinux.h Sat May 16 07:53:25 2009
@@ -1,5 +1,5 @@
 /* Header for nscd SELinux access controls.
-   Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006, 2007, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Matthew Rickard <mjricka@xxxxxxxxxxxxxx>, 2004.
 
@@ -35,8 +35,6 @@
 
 /* Initialize the userspace AVC.  */
 extern void nscd_avc_init (void);
-/* Destroy the userspace AVC.  */
-extern void nscd_avc_destroy (void);
 /* Determine if we are running on an SELinux kernel.  */
 extern void nscd_selinux_enabled (int *selinux_enabled);
 /* Check if the client has permission for the request type.  */
@@ -55,7 +53,6 @@
 #else
 # define selinux_enabled 0
 # define nscd_avc_init() (void) 0
-# define nscd_avc_destroy() (void) 0
 # define nscd_selinux_enabled(selinux_enabled) (void) 0
 # define nscd_request_avc_has_perm(fd, req) 0
 # define nscd_avc_cache_stats(cstats) (void) 0

Added: fsf/trunk/libc/po/.gitignore
==============================================================================
--- fsf/trunk/libc/po/.gitignore (added)
+++ fsf/trunk/libc/po/.gitignore Sat May 16 07:53:25 2009
@@ -1,0 +1,2 @@
+*.mo
+libc.pot.files

Modified: fsf/trunk/libc/resolv/ns_date.c
==============================================================================
--- fsf/trunk/libc/resolv/ns_date.c (original)
+++ fsf/trunk/libc/resolv/ns_date.c Sat May 16 07:53:25 2009
@@ -16,7 +16,7 @@
  */
 
 #if !defined(_LIBC) && !defined(lint)
-static const char rcsid[] = "$Id: ns_date.c,v 1.1 2008/08/01 17:15:09 drepper Exp $";
+static const char rcsid[] = "$Id$";
 #endif
 
 /* Import. */

Modified: fsf/trunk/libc/setjmp/Makefile
==============================================================================
--- fsf/trunk/libc/setjmp/Makefile (original)
+++ fsf/trunk/libc/setjmp/Makefile Sat May 16 07:53:25 2009
@@ -1,4 +1,4 @@
-# Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc.
+# Copyright (C) 1991, 92, 93, 94, 95, 97, 2009 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
@@ -21,7 +21,7 @@
 #
 subdir	:= setjmp
 
-headers	:= setjmp.h bits/setjmp.h
+headers	:= setjmp.h bits/setjmp.h bits/setjmp2.h
 
 routines	:= setjmp sigjmp bsd-setjmp bsd-_setjmp \
 		   longjmp __longjmp jmp-unwind

Added: fsf/trunk/libc/setjmp/bits/setjmp2.h
==============================================================================
--- fsf/trunk/libc/setjmp/bits/setjmp2.h (added)
+++ fsf/trunk/libc/setjmp/bits/setjmp2.h Sat May 16 07:53:25 2009
@@ -1,0 +1,41 @@
+/* Checking macros for setjmp functions.
+ * Copyright (C) 2009 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
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * The GNU C Library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the GNU C Library; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307 USA.  */
+
+#ifndef _SETJMP_H
+# error "Never include <bits/setjmp2.h> directly; use <setjmp.h> instead."
+#endif
+
+/* Variant of the longjmp functions which perform some sanity checking.  */
+#ifdef __REDIRECT_NTH
+extern void __REDIRECT_NTH (longjmp,
+			    (struct __jmp_buf_tag __env[1], int __val),
+			    __longjmp_chk) __attribute__ ((__noreturn__));
+extern void __REDIRECT_NTH (_longjmp,
+			    (struct __jmp_buf_tag __env[1], int __val),
+			    __longjmp_chk) __attribute__ ((__noreturn__));
+extern void __REDIRECT_NTH (siglongjmp,
+			    (struct __jmp_buf_tag __env[1], int __val),
+			    __longjmp_chk) __attribute__ ((__noreturn__));
+#else
+extern void __longjmp_chk (struct __jmp_buf_tag __env[1], int __val),
+     __THROW __attribute__ ((__noreturn__));
+# define longjmp __longjmp_chk
+# define _longjmp __longjmp_chk
+# define siglongjmp __longjmp_chk
+#endif

Modified: fsf/trunk/libc/setjmp/longjmp.c
==============================================================================
--- fsf/trunk/libc/setjmp/longjmp.c (original)
+++ fsf/trunk/libc/setjmp/longjmp.c Sat May 16 07:53:25 2009
@@ -1,4 +1,5 @@
-/* Copyright (C) 1991,92,94,95,97,98,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,94,95,97,98,2000,2002,2009
+   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
@@ -39,8 +40,10 @@
   __longjmp (env[0].__jmpbuf, val ?: 1);
 }
 
+#ifndef __libc_siglongjmp
 strong_alias (__libc_siglongjmp, __libc_longjmp)
 libc_hidden_def (__libc_longjmp)
 weak_alias (__libc_siglongjmp, _longjmp)
 weak_alias (__libc_siglongjmp, longjmp)
 weak_alias (__libc_siglongjmp, siglongjmp)
+#endif

Modified: fsf/trunk/libc/setjmp/setjmp.h
==============================================================================
--- fsf/trunk/libc/setjmp/setjmp.h (original)
+++ fsf/trunk/libc/setjmp/setjmp.h Sat May 16 07:53:25 2009
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-1999, 2001, 2002, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 1991-1999,2001,2002,2007,2009 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
@@ -111,6 +111,12 @@
      __THROW __attribute__ ((__noreturn__));
 #endif /* Use POSIX.  */
 
+
+/* Define helper functions to catch unsafe code.  */
+#if __USE_FORTIFY_LEVEL > 0
+# include <bits/setjmp2.h>
+#endif
+
 __END_DECLS
 
 #endif /* setjmp.h  */

Added: fsf/trunk/libc/sunrpc/.gitignore
==============================================================================
--- fsf/trunk/libc/sunrpc/.gitignore (added)
+++ fsf/trunk/libc/sunrpc/.gitignore Sat May 16 07:53:25 2009
@@ -1,0 +1,1 @@
+rpcsrc-4.0

Added: fsf/trunk/libc/sysdeps/i386/____longjmp_chk.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/____longjmp_chk.S (added)
+++ fsf/trunk/libc/sysdeps/i386/____longjmp_chk.S Sat May 16 07:53:25 2009
@@ -1,0 +1,45 @@
+/* Copyright (C) 2001,2004,2005,2006,2009 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+	.section .rodata.str1.1,"aMS",@progbits,1
+	.type	longjmp_msg,@object
+longjmp_msg:
+	.string "longjmp causes uninitialized stack frame"
+	.size	longjmp_msg, .-longjmp_msg
+
+
+#define __longjmp ____longjmp_chk
+
+#ifdef PIC
+# define CALL_FAIL	movl	%ebx, %ecx;				      \
+			cfi_register(%ebx,%ecx);			      \
+			LOAD_PIC_REG (bx);				      \
+			leal	longjmp_msg@GOTOFF(%ebx), %eax;		      \
+			call	__GI___fortify_fail@PLT
+#else
+# define CALL_FAIL	movl	$longjmp_msg, %eax;			      \
+			call	__fortify_fail
+#endif
+
+#define CHECK_ESP(reg) \
+	cmpl	reg, %esp;						      \
+	jbe	.Lok;							      \
+	CALL_FAIL;							      \
+.Lok:
+
+#include "__longjmp.S"

Modified: fsf/trunk/libc/sysdeps/i386/__longjmp.S
==============================================================================
--- fsf/trunk/libc/sysdeps/i386/__longjmp.S (original)
+++ fsf/trunk/libc/sysdeps/i386/__longjmp.S Sat May 16 07:53:25 2009
@@ -1,5 +1,6 @@
 /* longjmp for i386.
-   Copyright (C) 1995-1998,2000,2002,2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1995-1998,2000,2002,2005,2006,2009
+   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
@@ -40,6 +41,9 @@
 	movl (JB_SP*4)(%eax), %ecx
 	PTR_DEMANGLE (%edx)
 	PTR_DEMANGLE (%ecx)
+# ifdef CHECK_ESP
+	CHECK_ESP (%ecx)
+# endif
 	cfi_def_cfa(%eax, 0)
 	cfi_register(%eip, %edx)
 	cfi_register(%esp, %ecx)
@@ -63,6 +67,11 @@
 	movl JBUF(%esp), %ecx	/* User's jmp_buf in %ecx.  */
 	CHECK_BOUNDS_BOTH_WIDE (%ecx, JBUF(%esp), $JB_SIZE)
 
+# ifdef CHECK_ESP
+	movl (JB_SP*4)(%ecx), %eax
+	CHECK_ESP (%eax)
+# endif
+
 	movl VAL(%esp), %eax	/* Second argument is return value.  */
 	/* Save the return address now.  */
 	movl (JB_PC*4)(%ecx), %edx

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/Versions
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/Versions (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/Versions Sat May 16 07:53:25 2009
@@ -139,7 +139,7 @@
     epoll_create1; inotify_init1;
   }
   GLIBC_2.10 {
-    fallocate; fallocate64;
+    fallocate;
   }
   GLIBC_PRIVATE {
     # functions used in other libraries

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/fallocate64.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/fallocate64.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/fallocate64.c Sat May 16 07:53:25 2009
@@ -23,7 +23,7 @@
 
 /* Reserve storage for the data of the file associated with FD.  */
 int
-__fallocate64_l64 (int fd, int mode, __off64_t offset, __off64_t len)
+fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
 {
 #ifdef __NR_fallocate
   return INLINE_SYSCALL (fallocate, 6, fd, mode,

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/Versions
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/Versions (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/Versions Sat May 16 07:53:25 2009
@@ -41,6 +41,10 @@
     # v*
     vm86;
   }
+  GLIBC_2.11 {
+    # f*
+    fallocate64;
+  }
   GLIBC_PRIVATE {
     __modify_ldt;
   }

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/fallocate64.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/fallocate64.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/fallocate64.c Sat May 16 07:53:25 2009
@@ -26,7 +26,7 @@
 
 /* Reserve storage for the data of the file associated with FD.  */
 int
-__fallocate64_l64 (int fd, int mode, __off64_t offset, __off64_t len)
+fallocate64 (int fd, int mode, __off64_t offset, __off64_t len)
 {
   return __call_fallocate (fd, mode, offset, len);
 }

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/Versions Sat May 16 07:53:25 2009
@@ -27,4 +27,7 @@
   GLIBC_2.3.4 {
     setcontext; getcontext; swapcontext; makecontext;
   }
+  GLIBC_2.11 {
+    fallocate64;
+  }
 }

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/s390/s390-32/Versions Sat May 16 07:53:25 2009
@@ -43,6 +43,9 @@
     getutmp;
     getutmpx;
   }
+  GLIBC_2.11 {
+    fallocate64;
+  }
 }
 
 libutil {

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/Versions
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/Versions (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sh/Versions Sat May 16 07:53:25 2009
@@ -24,4 +24,7 @@
   GLIBC_2.3.3 {
     posix_fadvise64; posix_fallocate64;
   }
+  GLIBC_2.11 {
+    fallocate64;
+  }
 }

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/Versions
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/Versions (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/sparc/sparc32/Versions Sat May 16 07:53:25 2009
@@ -20,4 +20,7 @@
   GLIBC_2.3.3 {
     posix_fadvise64; posix_fallocate64;
   }
+  GLIBC_2.11 {
+    fallocate64;
+  }
 }

Added: fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/Versions
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/Versions (added)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/wordsize-64/Versions Sat May 16 07:53:25 2009
@@ -1,0 +1,5 @@
+libc {
+  GLIBC_2.10 {
+    fallocate64;
+  }
+}

Added: fsf/trunk/libc/sysdeps/x86_64/____longjmp_chk.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/____longjmp_chk.S (added)
+++ fsf/trunk/libc/sysdeps/x86_64/____longjmp_chk.S Sat May 16 07:53:25 2009
@@ -1,0 +1,42 @@
+/* Copyright (C) 2001,2004,2005,2006,2009 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+	.section .rodata.str1.1,"aMS",@progbits,1
+	.type	longjmp_msg,@object
+longjmp_msg:
+	.string "longjmp causes uninitialized stack frame"
+	.size	longjmp_msg, .-longjmp_msg
+
+
+#define __longjmp ____longjmp_chk
+
+#ifdef PIC
+# define CALL_FAIL	leaq	longjmp_msg(%rip), %rdi;		      \
+			call	__GI___fortify_fail
+#else
+# define CALL_FAIL	movq	$longjmp_msg, %rdi;			      \
+			call	__fortify_fail
+#endif
+
+#define CHECK_RSP(reg) \
+	cmpq	reg, %rsp;						      \
+	jbe	.Lok;							      \
+	CALL_FAIL;							      \
+.Lok:
+
+#include "__longjmp.S"

Modified: fsf/trunk/libc/sysdeps/x86_64/__longjmp.S
==============================================================================
--- fsf/trunk/libc/sysdeps/x86_64/__longjmp.S (original)
+++ fsf/trunk/libc/sysdeps/x86_64/__longjmp.S Sat May 16 07:53:25 2009
@@ -33,6 +33,9 @@
 	PTR_DEMANGLE (%r9)
 	PTR_DEMANGLE (%rdx)
 #endif
+#ifdef CHECK_RSP
+	CHECK_RSP (%r8)
+#endif
 	/* We add unwind information for the target here.  */
 	cfi_def_cfa(%rdi, 0)
 	cfi_register(%rsp,%r8)

Modified: fsf/trunk/libc/version.h
==============================================================================
--- fsf/trunk/libc/version.h (original)
+++ fsf/trunk/libc/version.h Sat May 16 07:53:25 2009
@@ -1,4 +1,4 @@
 /* This file just defines the current version number of libc.  */
 
-#define RELEASE "stable"
-#define VERSION "2.10.1"
+#define RELEASE "development"
+#define VERSION "2.10.90"