about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2007-12-27 09:14:45 +0000
committerJakub Jelinek <jakub@redhat.com>2007-12-27 09:14:45 +0000
commitf163450fc0969ebd6f63c5d9bd059f6f0d107d75 (patch)
tree1d7cb198dead8b16362e6ed6b8f71f52fb50a0d0
parentc5899b63ebb80de72b909a475e1dd41b99a4080c (diff)
downloadglibc-cvs/fedora-glibc-2_7_90-2.tar.gz
glibc-cvs/fedora-glibc-2_7_90-2.tar.xz
glibc-cvs/fedora-glibc-2_7_90-2.zip
Updated to fedora-glibc-20071227T0908 cvs/fedora-glibc-2_7_90-2
-rw-r--r--ChangeLog60
-rw-r--r--elf/tst-execstack.c41
-rw-r--r--fedora/branch.mk4
-rw-r--r--fedora/glibc.spec.in10
-rw-r--r--include/langinfo.h1
-rw-r--r--inet/ether_line.c7
-rw-r--r--locale/nl_langinfo.c56
-rw-r--r--locale/nl_langinfo_l.c43
-rw-r--r--login/forkpty.c4
-rw-r--r--login/openpty.c4
-rw-r--r--login/pty.h6
-rw-r--r--malloc/Makefile4
-rw-r--r--malloc/malloc.c85
-rw-r--r--malloc/tst-trim1.c56
-rw-r--r--manual/terminal.texi4
-rw-r--r--nptl/ChangeLog7
-rw-r--r--nptl/allocatestack.c2
-rw-r--r--nptl/sysdeps/x86_64/pthreaddef.h7
-rw-r--r--nss/nsswitch.c4
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysconf.c1
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h4
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/init-first.c4
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sysdep.h24
-rw-r--r--sysdeps/x86_64/cacheinfo.c1
24 files changed, 320 insertions, 119 deletions
diff --git a/ChangeLog b/ChangeLog
index d0d35d8949..8f9ff963ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,63 @@
+2007-12-26  Ulrich Drepper  <drepper@redhat.com>
+
+	* nss/nsswitch.c (__nss_lookup): Actually use alternative name in
+	second lookup.
+
+2007-12-23  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/x86_64/cacheinfo.c (intel_02_known): New entry 0x3f.
+	* sysdeps/unix/sysv/linux/i386/sysconf.c (intel_02_known): Likewise.
+
+2007-12-17  Roland McGrath  <roland@redhat.com>
+
+	* inet/ether_line.c (ether_line): Remove unused variable.
+
+2007-12-17  Samuel Thibault  <samuel.thibault@ens-lyon.org>
+
+	* login/forkpty.c (forkpty): Add const qualifier to parameters termp
+	and winp.
+	* login/openpty.c (openpty): Likewise.
+	* login/pty.h (openpty, forkpty): Likewise.
+	* manual/terminal.texi (openpty, forkpty): Likewise.
+
+2007-12-17  Ulrich Drepper  <drepper@redhat.com>
+
+	* malloc/malloc.c (public_cALLOc): For arena other than
+	main_arena, count all bytes inside the mprotect_size range of the
+	heap as uninitialized.
+
+2007-12-16  Ulrich Drepper  <drepper@redhat.com>
+
+	* elf/tst-execstack.c (do_test): Don't fail if SELinux forbids
+	executable stacks.
+
+	* malloc/malloc.c (public_mTRIm): Iterate over all arenas and call
+	mTRIm for all of them.
+	(mTRIm): Additionally iterate over all free blocks and use madvise
+	to free memory for all those blocks which contain at least one
+	memory page.
+	* malloc/tst-trim1.c: New file.
+	* malloc/Makefile (tests): Add tst-trim1.
+
+	* malloc/malloc.c (do_check_malloc_state): Minimal cleanups.
+
+2007-12-14  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/unix/sysv/linux/x86_64/sysdep.h (INTERNAL_SYSCALL_ERROR_P):
+	First cast argument to long
+	* sysdeps/unix/sysv/linux/x86_64/init-first.c (__vdso_gettimeofday):
+	Return long.
+	(__vdso_clock_gettime): Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h: Functions
+	return long.
+
+2007-12-13  Ulrich Drepper  <drepper@redhat.com>
+
+	* locale/nl_langinfo.c (nl_langinfo): Just call __nl_langinfo_l.
+	* locale/nl_langinfo_l.c: Real implementation, copied from
+	nl_langinfo.c.
+	* include/langinfo.h: Add libc_hidden_proto for __nl_langinfo_l.
+
 2007-12-01  Jim Meyering  <meyering@redhat.com>
 
 	* posix/regcomp.c (optimize_utf8): Fix a typo, s/idx/ctx_type/,
diff --git a/elf/tst-execstack.c b/elf/tst-execstack.c
index 4b06615451..a835e4c0d6 100644
--- a/elf/tst-execstack.c
+++ b/elf/tst-execstack.c
@@ -2,6 +2,7 @@
    on load of a DSO that requires executable stacks.  */
 
 #include <dlfcn.h>
+#include <stdbool.h>
 #include <stdio.h>
 #include <string.h>
 #include <unistd.h>
@@ -45,9 +46,43 @@ waiter_thread (void *arg)
 }
 #endif
 
+
+static bool allow_execstack = true;
+
+
 static int
 do_test (void)
 {
+  /* Check whether SELinux is enabled and disallows executable stacks.  */
+  FILE *fp = fopen ("/selinux/enforce", "r");
+  if (fp != NULL)
+    {
+      char *line = NULL;
+      size_t linelen = 0;
+
+      bool enabled = false;
+      ssize_t n = getline (&line, &linelen, fp);
+      if (n > 0 && line[0] != '0')
+	enabled = true;
+
+      fclose (fp);
+
+      if (enabled)
+	{
+	  fp = fopen ("/selinux/booleans/allow_execstack", "r");
+	  if (fp != NULL)
+	    {
+	      n = getline (&line, &linelen, fp);
+	      if (n > 0 && line[0] == '0')
+		allow_execstack = false;
+	    }
+
+	  fclose (fp);
+	}
+    }
+
+  printf ("executable stacks %sallowed\n", allow_execstack ? "" : "not ");
+
   static void *f;		/* Address of this is used in other threads. */
 
 #if USE_PTHREADS
@@ -77,7 +112,7 @@ do_test (void)
   if (h == NULL)
     {
       printf ("cannot load: %s\n", dlerror ());
-      return 1;
+      return allow_execstack;
     }
 
   f = dlsym (h, "tryme");
@@ -113,10 +148,10 @@ do_test (void)
      Let them run to test it.  */
   pthread_barrier_wait (&go_barrier);
 
-  pthread_exit (0);
+  pthread_exit (! allow_execstack);
 #endif
 
-  return 0;
+  return ! allow_execstack;
 }
 
 static void
diff --git a/fedora/branch.mk b/fedora/branch.mk
index a411c7dbe3..c4e0c988b5 100644
--- a/fedora/branch.mk
+++ b/fedora/branch.mk
@@ -3,5 +3,5 @@ glibc-branch := fedora
 glibc-base := HEAD
 DIST_BRANCH := devel
 COLLECTION := dist-f8
-fedora-sync-date := 2007-12-12 19:53 UTC
-fedora-sync-tag := fedora-glibc-20071212T1953
+fedora-sync-date := 2007-12-27 09:08 UTC
+fedora-sync-tag := fedora-glibc-20071227T0908
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index ffa7026789..89dd08d64d 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -1,4 +1,4 @@
-%define glibcrelease 1
+%define glibcrelease 2
 %define run_glibc_tests 1
 %define auxarches i586 i686 athlon sparcv9v sparc64v alphaev6
 %define xenarches i686 athlon
@@ -316,7 +316,8 @@ GCC="gcc -m64"
 GXX="g++ -m64"
 %endif
 
-BuildFlags="$BuildFlags -DNDEBUG=1 -fasynchronous-unwind-tables"
+#BuildFlags="$BuildFlags -DNDEBUG=1 -fasynchronous-unwind-tables"
+BuildFlags="$BuildFlags -fasynchronous-unwind-tables"
 EnableKernel="--enable-kernel=%{enablekernel}"
 echo "$GCC" > Gcc
 AddOns=`echo */configure | sed -e 's!/configure!!g;s!\(linuxthreads\|nptl\|rtkaio\|powerpc-cpu\)\( \|$\)!!g;s! \+$!!;s! !,!g;s!^!,!;/^,\*$/d'`
@@ -1010,6 +1011,11 @@ rm -f *.filelist*
 %endif
 
 %changelog
+* Thu Dec 27 2007 Jakub Jelinek <jakub@redhat.com> 2.7.90-2
+- update to trunk
+  - nsswitch fix (#425768)
+- temporarily enable assert checking
+
 * Wed Dec 12 2007 Jakub Jelinek <jakub@redhat.com> 2.7.90-1
 - update to trunk
   - fix __USE_STRING_INLINES on i?86 (#408731, #371711)
diff --git a/include/langinfo.h b/include/langinfo.h
index 8f93671658..37a91c699d 100644
--- a/include/langinfo.h
+++ b/include/langinfo.h
@@ -5,5 +5,6 @@
 libc_hidden_proto (nl_langinfo)
 
 extern __typeof (nl_langinfo_l) __nl_langinfo_l;
+libc_hidden_proto (__nl_langinfo_l)
 
 #endif
diff --git a/inet/ether_line.c b/inet/ether_line.c
index 13c5f394cf..21a4c55679 100644
--- a/inet/ether_line.c
+++ b/inet/ether_line.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1999, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1996,1999,2002,2007 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,10 +26,7 @@
 int
 ether_line (const char *line, struct ether_addr *addr, char *hostname)
 {
-  size_t cnt;
-  char *cp;
-
-  for (cnt = 0; cnt < 6; ++cnt)
+  for (size_t cnt = 0; cnt < 6; ++cnt)
     {
       unsigned int number;
       char ch;
diff --git a/locale/nl_langinfo.c b/locale/nl_langinfo.c
index c5fbf19e15..b873545caa 100644
--- a/locale/nl_langinfo.c
+++ b/locale/nl_langinfo.c
@@ -27,64 +27,10 @@
 
 /* Return a string with the data for locale-dependent parameter ITEM.  */
 
-#ifdef USE_IN_EXTENDED_LOCALE_MODEL
-char *
-__nl_langinfo_l (item, l)
-     nl_item item;
-     __locale_t l;
-#else
 char *
 nl_langinfo (item)
      nl_item item;
-#endif
 {
-  int category = _NL_ITEM_CATEGORY (item);
-  unsigned int index = _NL_ITEM_INDEX (item);
-  const struct locale_data *data;
-
-  if (category < 0 || category == LC_ALL || category >= __LC_LAST)
-    /* Bogus category: bogus item.  */
-    return (char *) "";
-
-  /* Special case value for NL_LOCALE_NAME (category).
-     This is not a real item index in the string table.  */
-  if (index == _NL_ITEM_INDEX (_NL_LOCALE_NAME (category)))
-    {
-#ifdef USE_IN_EXTENDED_LOCALE_MODEL
-# define THISLOCALE l
-#else
-# define THISLOCALE _NL_CURRENT_LOCALE
-#endif
-      return (char *) THISLOCALE->__names[category];
-    }
-
-#ifdef USE_IN_EXTENDED_LOCALE_MODEL
-  data = l->__locales[category];
-#elif defined NL_CURRENT_INDIRECT
-  /* Make direct reference to every _nl_current_CATEGORY symbol,
-     since we know only at runtime which categories are used.  */
-  switch (category)
-    {
-# define DEFINE_CATEGORY(category, category_name, items, a) \
-      case category: data = *_nl_current_##category; break;
-# include "categories.def"
-# undef	DEFINE_CATEGORY
-    default:			/* Should be impossible.  */
-      return (char *) "";
-    }
-#else
-  data = _NL_CURRENT_DATA (category);
-#endif
-
-  if (index >= data->nstrings)
-    /* Bogus index for this category: bogus item.  */
-    return (char *) "";
-
-  /* Return the string for the specified item.  */
-  return (char *) data->values[index].string;
+  return __nl_langinfo_l (item, _NL_CURRENT_LOCALE);
 }
-#ifdef USE_IN_EXTENDED_LOCALE_MODEL
-weak_alias (__nl_langinfo_l, nl_langinfo_l)
-#else
 libc_hidden_def (nl_langinfo)
-#endif
diff --git a/locale/nl_langinfo_l.c b/locale/nl_langinfo_l.c
index ef7b7a1a6a..08e1534a8b 100644
--- a/locale/nl_langinfo_l.c
+++ b/locale/nl_langinfo_l.c
@@ -1,4 +1,5 @@
-/* Copyright (C) 2000 Free Software Foundation, Inc.
+/* User interface for extracting locale-dependent parameters.
+   Copyright (C) 1995-1997,1999-2002,2005,2007 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
@@ -16,5 +17,41 @@
    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
    02111-1307 USA.  */
 
-#define USE_IN_EXTENDED_LOCALE_MODEL 1
-#include <nl_langinfo.c>
+#include <langinfo.h>
+#include <locale.h>
+#include <errno.h>
+#include <stddef.h>
+#include "localeinfo.h"
+
+
+/* Return a string with the data for locale-dependent parameter ITEM.  */
+
+char *
+__nl_langinfo_l (item, l)
+     nl_item item;
+     __locale_t l;
+{
+  int category = _NL_ITEM_CATEGORY (item);
+  unsigned int index = _NL_ITEM_INDEX (item);
+  const struct locale_data *data;
+
+  if (category < 0 || category == LC_ALL || category >= __LC_LAST)
+    /* Bogus category: bogus item.  */
+    return (char *) "";
+
+  /* Special case value for NL_LOCALE_NAME (category).
+     This is not a real item index in the string table.  */
+  if (index == _NL_ITEM_INDEX (_NL_LOCALE_NAME (category)))
+    return (char *) l->__names[category];
+
+  data = l->__locales[category];
+
+  if (index >= data->nstrings)
+    /* Bogus index for this category: bogus item.  */
+    return (char *) "";
+
+  /* Return the string for the specified item.  */
+  return (char *) data->values[index].string;
+}
+libc_hidden_def (__nl_langinfo_l)
+weak_alias (__nl_langinfo_l, nl_langinfo_l)
diff --git a/login/forkpty.c b/login/forkpty.c
index ccd5dbfe0e..482aebcb28 100644
--- a/login/forkpty.c
+++ b/login/forkpty.c
@@ -27,8 +27,8 @@ int
 forkpty (amaster, name, termp, winp)
      int *amaster;
      char *name;
-     struct termios *termp;
-     struct winsize *winp;
+     const struct termios *termp;
+     const struct winsize *winp;
 {
   int master, slave, pid;
 
diff --git a/login/openpty.c b/login/openpty.c
index fe11d49feb..0ff901c3f5 100644
--- a/login/openpty.c
+++ b/login/openpty.c
@@ -84,8 +84,8 @@ pts_name (int fd, char **pts, size_t buf_len)
    according to TERMP and WINP.  Return handles for both ends in
    AMASTER and ASLAVE, and return the name of the slave end in NAME.  */
 int
-openpty (int *amaster, int *aslave, char *name, struct termios *termp,
-	 struct winsize *winp)
+openpty (int *amaster, int *aslave, char *name,
+	 const struct termios *termp, const struct winsize *winp)
 {
 #ifdef PATH_MAX
   char _buf[PATH_MAX];
diff --git a/login/pty.h b/login/pty.h
index 2d4b5e270f..a2ed77d58d 100644
--- a/login/pty.h
+++ b/login/pty.h
@@ -32,12 +32,14 @@ __BEGIN_DECLS
    attributes according to TERMP and WINP and return handles for both
    ends in AMASTER and ASLAVE.  */
 extern int openpty (int *__amaster, int *__aslave, char *__name,
-		    struct termios *__termp, struct winsize *__winp) __THROW;
+		    const struct termios *__termp,
+		    const struct winsize *__winp) __THROW;
 
 /* Create child process and establish the slave pseudo terminal as the
    child's controlling terminal.  */
 extern int forkpty (int *__amaster, char *__name,
-		    struct termios *__termp, struct winsize *__winp) __THROW;
+		    const struct termios *__termp,
+		    const struct winsize *__winp) __THROW;
 
 __END_DECLS
 
diff --git a/malloc/Makefile b/malloc/Makefile
index c39eae5474..22b14eac77 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-1999, 2000, 2001, 2002, 2003, 2005, 2006
+# Copyright (C) 1991-1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007
 # Free Software Foundation, Inc.
 # This file is part of the GNU C Library.
 
@@ -27,7 +27,7 @@ all:
 dist-headers := malloc.h
 headers := $(dist-headers) obstack.h mcheck.h
 tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
-	 tst-mallocstate tst-mcheck tst-mallocfork
+	 tst-mallocstate tst-mcheck tst-mallocfork tst-trim1
 test-srcs = tst-mtrace
 
 distribute = thread-m.h mtrace.pl mcheck-init.c stackinfo.h memusage.h \
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 1e716089a2..fc8a83c328 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1592,7 +1592,7 @@ static Void_t*  _int_pvalloc(mstate, size_t);
 static Void_t** _int_icalloc(mstate, size_t, size_t, Void_t**);
 static Void_t** _int_icomalloc(mstate, size_t, size_t*, Void_t**);
 #endif
-static int      mTRIm(size_t);
+static int      mTRIm(mstate, size_t);
 static size_t   mUSABLe(Void_t*);
 static void     mSTATs(void);
 static int      mALLOPt(int, int);
@@ -2739,8 +2739,6 @@ static void do_check_malloc_state(mstate av)
   mchunkptr p;
   mchunkptr q;
   mbinptr b;
-  unsigned int binbit;
-  int empty;
   unsigned int idx;
   INTERNAL_SIZE_T size;
   unsigned long total = 0;
@@ -2810,8 +2808,8 @@ static void do_check_malloc_state(mstate av)
 
     /* binmap is accurate (except for bin 1 == unsorted_chunks) */
     if (i >= 2) {
-      binbit = get_binmap(av,i);
-      empty = last(b) == b;
+      unsigned int binbit = get_binmap(av,i);
+      int empty = last(b) == b;
       if (!binbit)
         assert(empty);
       else if (!empty)
@@ -3888,6 +3886,12 @@ public_cALLOc(size_t n, size_t elem_size)
       oldtopsize < mp_.sbrk_base + av->max_system_mem - (char *)oldtop)
     oldtopsize = (mp_.sbrk_base + av->max_system_mem - (char *)oldtop);
 #endif
+  if (av != &main_arena)
+    {
+      heap_info *heap = heap_for_ptr (oldtop);
+      if (oldtopsize < (char *) heap + heap->mprotect_size - (char *) oldtop)
+	oldtopsize = (char *) heap + heap->mprotect_size - (char *) oldtop;
+    }
 #endif
   mem = _int_malloc(av, sz);
 
@@ -4013,13 +4017,22 @@ public_cFREe(Void_t* m)
 int
 public_mTRIm(size_t s)
 {
-  int result;
+  int result = 0;
 
   if(__malloc_initialized < 0)
     ptmalloc_init ();
-  (void)mutex_lock(&main_arena.mutex);
-  result = mTRIm(s);
-  (void)mutex_unlock(&main_arena.mutex);
+
+  mstate ar_ptr = &main_arena;
+  do
+    {
+      (void) mutex_lock (&ar_ptr->mutex);
+      result |= mTRIm (ar_ptr, s);
+      (void) mutex_unlock (&ar_ptr->mutex);
+
+      ar_ptr = ar_ptr->next;
+    }
+  while (ar_ptr != &main_arena);
+
   return result;
 }
 
@@ -5489,20 +5502,60 @@ _int_pvalloc(av, bytes) mstate av, size_t bytes;
 */
 
 #if __STD_C
-int mTRIm(size_t pad)
+static int mTRIm(mstate av, size_t pad)
 #else
-int mTRIm(pad) size_t pad;
+static int mTRIm(av, pad) mstate av; size_t pad;
 #endif
 {
-  mstate av = &main_arena; /* already locked */
-
   /* Ensure initialization/consolidation */
-  malloc_consolidate(av);
+  malloc_consolidate (av);
+
+  const size_t ps = mp_.pagesize;
+  int psindex = bin_index (ps);
+  const size_t psm1 = ps - 1;
+
+  int result = 0;
+  for (int i = 1; i < NBINS; ++i)
+    if (i == 1 || i >= psindex)
+      {
+        mbinptr bin = bin_at (av, i);
+
+        for (mchunkptr p = last (bin); p != bin; p = p->bk)
+	  {
+	    INTERNAL_SIZE_T size = chunksize (p);
+
+	    if (size > psm1 + sizeof (struct malloc_chunk))
+	      {
+		/* See whether the chunk contains at least one unused page.  */
+		char *paligned_mem = (char *) (((uintptr_t) p
+						+ sizeof (struct malloc_chunk)
+						+ psm1) & ~psm1);
+
+		assert ((char *) chunk2mem (p) + 4 * SIZE_SZ <= paligned_mem);
+		assert ((char *) p + size > paligned_mem);
+
+		/* This is the size we could potentially free.  */
+		size -= paligned_mem - (char *) p;
+
+		if (size > psm1)
+		  {
+#ifdef MALLOC_DEBUG
+		    /* When debugging we simulate destroying the memory
+		       content.  */
+		    memset (paligned_mem, 0x89, size & ~psm1);
+#endif
+		    madvise (paligned_mem, size & ~psm1, MADV_DONTNEED);
+
+		    result = 1;
+		  }
+	      }
+	  }
+      }
 
 #ifndef MORECORE_CANNOT_TRIM
-  return sYSTRIm(pad, av);
+  return result | (av == &main_arena ? sYSTRIm (pad, av) : 0);
 #else
-  return 0;
+  return result;
 #endif
 }
 
diff --git a/malloc/tst-trim1.c b/malloc/tst-trim1.c
new file mode 100644
index 0000000000..310707e0e1
--- /dev/null
+++ b/malloc/tst-trim1.c
@@ -0,0 +1,56 @@
+#include <malloc.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define N 10000
+
+static void *arr[N];
+
+static int
+do_test (void)
+{
+  for (int i = 0; i < N; ++i)
+    {
+      size_t size = random () % 16384;
+
+      if ((arr[i] = malloc (size)) == NULL)
+	{
+	nomem:
+	  puts ("not enough memory");
+	  return 0;
+	}
+
+      memset (arr[i], size, size);
+    }
+
+  void *p = malloc (256);
+  if (p == NULL)
+    goto nomem;
+  memset (p, 1, 256);
+
+  puts ("==================================================================");
+
+  for (int i = 0; i < N; ++i)
+    if (i % 13 != 0)
+      free (arr[i]);
+
+  puts ("==================================================================");
+
+  malloc_trim (0);
+
+  puts ("==================================================================");
+
+  p = malloc (30000);
+  if (p == NULL)
+    goto nomem;
+
+  memset (p, 2, 30000);
+
+  malloc_trim (0);
+
+  return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/manual/terminal.texi b/manual/terminal.texi
index 96edcf0513..ee4df4ef7e 100644
--- a/manual/terminal.texi
+++ b/manual/terminal.texi
@@ -2075,7 +2075,7 @@ These functions, derived from BSD, are available in the separate
 
 @comment pty.h
 @comment BSD
-@deftypefun int openpty (int *@var{amaster}, int *@var{aslave}, char *@var{name}, struct termios *@var{termp}, struct winsize *@var{winp})
+@deftypefun int openpty (int *@var{amaster}, int *@var{aslave}, char *@var{name}, const struct termios *@var{termp}, const struct winsize *@var{winp})
 This function allocates and opens a pseudo-terminal pair, returning the
 file descriptor for the master in @var{*amaster}, and the file
 descriptor for the slave in @var{*aslave}.  If the argument @var{name}
@@ -2106,7 +2106,7 @@ device instead.
 
 @comment pty.h
 @comment BSD
-@deftypefun int forkpty (int *@var{amaster}, char *@var{name}, struct termios *@var{termp}, struct winsize *@var{winp})
+@deftypefun int forkpty (int *@var{amaster}, char *@var{name}, const struct termios *@var{termp}, const struct winsize *@var{winp})
 This function is similar to the @code{openpty} function, but in
 addition, forks a new process (@pxref{Creating a Process}) and makes the
 newly opened slave pseudo-terminal device the controlling terminal
diff --git a/nptl/ChangeLog b/nptl/ChangeLog
index 0885fe6d9e..e3fb8df949 100644
--- a/nptl/ChangeLog
+++ b/nptl/ChangeLog
@@ -1,3 +1,10 @@
+2007-12-14  Ulrich Drepper  <drepper@redhat.com>
+
+	* sysdeps/x86_64/pthreaddef.h (ARCH_RETRY_MMAP): Take additional
+	parameter.  Passed it as permission to mmap.
+	* allocatestack.c (allocate_stack): Pass prot as second parameter
+	to ARCH_RETRY_MMAP.
+
 2007-12-12  Ulrich Drepper  <drepper@redhat.com>
 
 	* tst-basic7.c: Allocate memory for the stack.
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index f75599c668..66128e455b 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -459,7 +459,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
 	  if (__builtin_expect (mem == MAP_FAILED, 0))
 	    {
 #ifdef ARCH_RETRY_MMAP
-	      mem = ARCH_RETRY_MMAP (size);
+	      mem = ARCH_RETRY_MMAP (size, prot);
 	      if (__builtin_expect (mem == MAP_FAILED, 0))
 #endif
 		{
diff --git a/nptl/sysdeps/x86_64/pthreaddef.h b/nptl/sysdeps/x86_64/pthreaddef.h
index 27896a445c..0195bc928f 100644
--- a/nptl/sysdeps/x86_64/pthreaddef.h
+++ b/nptl/sysdeps/x86_64/pthreaddef.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003, 2007 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -42,9 +42,8 @@
 
 /* If it is not possible to allocate memory there retry without that
    flag.  */
-#define ARCH_RETRY_MMAP(size) \
-  mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC,			      \
-	MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)
+#define ARCH_RETRY_MMAP(size, prot) \
+  mmap (NULL, size, prot, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0)
 
 
 /* XXX Until we have a better place keep the definitions here.  */
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 28aa1b4f34..c0b661feb3 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -150,7 +150,7 @@ __nss_lookup (service_user **ni, const char *fct_name, const char *fct2_name,
 {
   *fctp = __nss_lookup_function (*ni, fct_name);
   if (*fctp == NULL && fct2_name != NULL)
-    *fctp = __nss_lookup_function (*ni, fct_name);
+    *fctp = __nss_lookup_function (*ni, fct2_name);
 
   while (*fctp == NULL
 	 && nss_next_action (*ni, NSS_STATUS_UNAVAIL) == NSS_ACTION_CONTINUE
@@ -160,7 +160,7 @@ __nss_lookup (service_user **ni, const char *fct_name, const char *fct2_name,
 
       *fctp = __nss_lookup_function (*ni, fct_name);
       if (*fctp == NULL && fct2_name != NULL)
-	*fctp = __nss_lookup_function (*ni, fct_name);
+	*fctp = __nss_lookup_function (*ni, fct2_name);
     }
 
   return *fctp != NULL ? 0 : (*ni)->next == NULL ? 1 : -1;
diff --git a/sysdeps/unix/sysv/linux/i386/sysconf.c b/sysdeps/unix/sysv/linux/i386/sysconf.c
index 78877fb2a1..38bb5337ba 100644
--- a/sysdeps/unix/sysv/linux/i386/sysconf.c
+++ b/sysdeps/unix/sysv/linux/i386/sysconf.c
@@ -90,6 +90,7 @@ static const struct intel_02_cache_info
     { 0x3c, _SC_LEVEL2_CACHE_SIZE, 262144, 4, 64 },
     { 0x3d, _SC_LEVEL2_CACHE_SIZE, 393216, 6, 64 },
     { 0x3e, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 64 },
+    { 0x3f, _SC_LEVEL2_CACHE_SIZE, 262144, 2, 64 },
     { 0x41, _SC_LEVEL2_CACHE_SIZE, 131072, 4, 32 },
     { 0x42, _SC_LEVEL2_CACHE_SIZE, 262144, 4, 32 },
     { 0x43, _SC_LEVEL2_CACHE_SIZE, 524288, 4, 32 },
diff --git a/sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h b/sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h
index 6e08d3b203..d7123c9bb5 100644
--- a/sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h
+++ b/sysdeps/unix/sysv/linux/x86_64/bits/libc-vdso.h
@@ -25,10 +25,10 @@
 
 #ifdef SHARED
 
-extern int (*__vdso_gettimeofday) (struct timeval *, void *)
+extern long int (*__vdso_gettimeofday) (struct timeval *, void *)
   attribute_hidden;
 
-extern int (*__vdso_clock_gettime) (clockid_t, struct timespec *);
+extern long int (*__vdso_clock_gettime) (clockid_t, struct timespec *);
 
 #endif
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/init-first.c b/sysdeps/unix/sysv/linux/x86_64/init-first.c
index e9cf5646b5..ead7dbcc38 100644
--- a/sysdeps/unix/sysv/linux/x86_64/init-first.c
+++ b/sysdeps/unix/sysv/linux/x86_64/init-first.c
@@ -20,9 +20,9 @@
 # include <dl-vdso.h>
 # include <bits/libc-vdso.h>
 
-int (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden;
+long int (*__vdso_gettimeofday) (struct timeval *, void *) attribute_hidden;
 
-int (*__vdso_clock_gettime) (clockid_t, struct timespec *)
+long int (*__vdso_clock_gettime) (clockid_t, struct timespec *)
   __attribute__ ((nocommon));
 strong_alias (__vdso_clock_gettime, __GI___vdso_clock_gettime attribute_hidden)
 
diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index 44d5650549..2b9ea85d8e 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -224,34 +224,34 @@
 # undef INLINE_SYSCALL
 # define INLINE_SYSCALL(name, nr, args...) \
   ({									      \
-    unsigned long resultvar = INTERNAL_SYSCALL (name, , nr, args);	      \
+    unsigned long int resultvar = INTERNAL_SYSCALL (name, , nr, args);	      \
     if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (resultvar, ), 0))	      \
       {									      \
 	__set_errno (INTERNAL_SYSCALL_ERRNO (resultvar, ));		      \
-	resultvar = (unsigned long) -1;					      \
+	resultvar = (unsigned long int) -1;				      \
       }									      \
-    (long) resultvar; })
+    (long int) resultvar; })
 
 # undef INTERNAL_SYSCALL_DECL
 # define INTERNAL_SYSCALL_DECL(err) do { } while (0)
 
 # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
   ({									      \
-    unsigned long resultvar;						      \
+    unsigned long int resultvar;					      \
     LOAD_ARGS_##nr (args)						      \
     LOAD_REGS_##nr							      \
     asm volatile (							      \
     "syscall\n\t"							      \
     : "=a" (resultvar)							      \
     : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx");		      \
-    (long) resultvar; })
+    (long int) resultvar; })
 # undef INTERNAL_SYSCALL
 # define INTERNAL_SYSCALL(name, err, nr, args...) \
   INTERNAL_SYSCALL_NCS (__NR_##name, err, nr, ##args)
 
 # undef INTERNAL_SYSCALL_ERROR_P
 # define INTERNAL_SYSCALL_ERROR_P(val, err) \
-  ((unsigned long) (val) >= -4095L)
+  ((unsigned long int) (long int) (val) >= -4095L)
 
 # undef INTERNAL_SYSCALL_ERRNO
 # define INTERNAL_SYSCALL_ERRNO(val, err)	(-(val))
@@ -319,7 +319,7 @@
 # define ASM_ARGS_0
 
 # define LOAD_ARGS_1(a1)				\
-  long int __arg1 = (long) (a1);			\
+  long int __arg1 = (long int) (a1);			\
   LOAD_ARGS_0 ()
 # define LOAD_REGS_1					\
   register long int _a1 asm ("rdi") = __arg1;		\
@@ -327,7 +327,7 @@
 # define ASM_ARGS_1	ASM_ARGS_0, "r" (_a1)
 
 # define LOAD_ARGS_2(a1, a2)				\
-  long int __arg2 = (long) (a2);			\
+  long int __arg2 = (long int) (a2);			\
   LOAD_ARGS_1 (a1)
 # define LOAD_REGS_2					\
   register long int _a2 asm ("rsi") = __arg2;		\
@@ -335,7 +335,7 @@
 # define ASM_ARGS_2	ASM_ARGS_1, "r" (_a2)
 
 # define LOAD_ARGS_3(a1, a2, a3)			\
-  long int __arg3 = (long) (a3);			\
+  long int __arg3 = (long int) (a3);			\
   LOAD_ARGS_2 (a1, a2)
 # define LOAD_REGS_3					\
   register long int _a3 asm ("rdx") = __arg3;		\
@@ -343,7 +343,7 @@
 # define ASM_ARGS_3	ASM_ARGS_2, "r" (_a3)
 
 # define LOAD_ARGS_4(a1, a2, a3, a4)			\
-  long int __arg4 = (long) (a4);			\
+  long int __arg4 = (long int) (a4);			\
   LOAD_ARGS_3 (a1, a2, a3)
 # define LOAD_REGS_4					\
   register long int _a4 asm ("r10") = __arg4;		\
@@ -351,7 +351,7 @@
 # define ASM_ARGS_4	ASM_ARGS_3, "r" (_a4)
 
 # define LOAD_ARGS_5(a1, a2, a3, a4, a5)		\
-  long int __arg5 = (long) (a5);			\
+  long int __arg5 = (long int) (a5);			\
   LOAD_ARGS_4 (a1, a2, a3, a4)
 # define LOAD_REGS_5					\
   register long int _a5 asm ("r8") = __arg5;		\
@@ -359,7 +359,7 @@
 # define ASM_ARGS_5	ASM_ARGS_4, "r" (_a5)
 
 # define LOAD_ARGS_6(a1, a2, a3, a4, a5, a6)		\
-  long int __arg6 = (long) (a6);			\
+  long int __arg6 = (long int) (a6);			\
   LOAD_ARGS_5 (a1, a2, a3, a4, a5)
 # define LOAD_REGS_6					\
   register long int _a6 asm ("r9") = __arg6;		\
diff --git a/sysdeps/x86_64/cacheinfo.c b/sysdeps/x86_64/cacheinfo.c
index 83e7b3c60b..6403081c90 100644
--- a/sysdeps/x86_64/cacheinfo.c
+++ b/sysdeps/x86_64/cacheinfo.c
@@ -48,6 +48,7 @@ static const struct intel_02_cache_info
     { 0x3c, _SC_LEVEL2_CACHE_SIZE,   262144,  4, 64 },
     { 0x3d, _SC_LEVEL2_CACHE_SIZE,   393216,  6, 64 },
     { 0x3e, _SC_LEVEL2_CACHE_SIZE,   524288,  4, 64 },
+    { 0x3f, _SC_LEVEL2_CACHE_SIZE,   262144,  2, 64 },
     { 0x41, _SC_LEVEL2_CACHE_SIZE,   131072,  4, 32 },
     { 0x42, _SC_LEVEL2_CACHE_SIZE,   262144,  4, 32 },
     { 0x43, _SC_LEVEL2_CACHE_SIZE,   524288,  4, 32 },