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

[commits] r12550 - in /fsf/trunk/libc: ./ elf/ include/ include/sys/ nptl/ nss/nss_files/ sysdeps/posix/ sysdeps/unix/sysv/linux/ sysd...



Author: eglibc
Date: Fri Jan 14 00:03:33 2011
New Revision: 12550

Log:
Import glibc-mainline for 2011-01-14

Modified:
    fsf/trunk/libc/ChangeLog
    fsf/trunk/libc/NEWS
    fsf/trunk/libc/elf/Makefile
    fsf/trunk/libc/elf/check-execstack.c
    fsf/trunk/libc/include/alloca.h
    fsf/trunk/libc/include/sys/resource.h
    fsf/trunk/libc/nptl/ChangeLog
    fsf/trunk/libc/nptl/Versions
    fsf/trunk/libc/nptl/alloca_cutoff.c
    fsf/trunk/libc/nss/nss_files/files-hosts.c
    fsf/trunk/libc/sysdeps/posix/spawni.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/getrlimit64.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/getrlimit64.c
    fsf/trunk/libc/sysdeps/unix/sysv/linux/mkdirat.c

Modified: fsf/trunk/libc/ChangeLog
==============================================================================
--- fsf/trunk/libc/ChangeLog (original)
+++ fsf/trunk/libc/ChangeLog Fri Jan 14 00:03:33 2011
@@ -1,3 +1,31 @@
+2010-12-28  Andreas Schwab  <schwab@xxxxxxxxxxxxxx>
+
+	* elf/Makefile (check-execstack): Revert last change.  Depend on
+	check-execstack.h.
+	(check-execstack.h): New target.
+	(generated): Add check-execstack.h.
+	* elf/check-execstack.c: Include "check-execstack.h".
+	(main): Revert last change.
+	(handle_file): Return zero if GNU_STACK is absent and
+	DEFAULT_STACK_PERMS doesn't include PF_X.
+
+2011-01-13  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	* sysdeps/posix/spawni.c (__spawni): Don't fail if close file action
+	in child fails because the descriptor is already closed.
+	* include/sys/resource.h: Add libc_hidden_proto for getrlimit64.
+	* sysdeps/unix/sysv/linux/getrlimit64.c: Add libc_hidden_def.
+	* sysdeps/unix/sysv/linux/i386/getrlimit64.c: Likewise.
+
+	[BZ #12397]
+	* sysdeps/unix/sysv/linux/mkdirat.c (mkdirat): Fix handling of missing
+	syscall.
+
+	[BZ #10484]
+	* nss/nss_files/files-hosts.c (HOST_DB_LOOKUP): Handle overflows of
+	temporary buffer used to handle multi lookups locally.
+	* include/alloca.h: Add libc_hidden_proto for __libc_alloca_cutoff.
+
 2011-01-12  Ulrich Drepper  <drepper@xxxxxxxxx>
 
 	* elf/dl-dst.h (DL_DST_REQUIRED): Allow l_origin to be NULL when

Modified: fsf/trunk/libc/NEWS
==============================================================================
--- fsf/trunk/libc/NEWS (original)
+++ fsf/trunk/libc/NEWS Fri Jan 14 00:03:33 2011
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes.  2011-1-12
+GNU C Library NEWS -- history of user-visible changes.  2011-1-13
 Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
 See the end for copying conditions.
 
@@ -9,10 +9,10 @@
 
 * The following bugs are resolved with this release:
 
-  3268, 7066, 10085, 10851, 11149, 11155, 11611, 11640, 11655, 11701,
-  11840, 11856, 11883, 11903, 11904, 11968, 11979, 12005, 12037,
-  12067, 12077, 12078, 12092, 12093, 12107, 12108, 12113, 12140,
-  12159, 12167, 12191, 12194, 12201, 12204, 12205, 12207, 12348, 12394
+  3268, 7066, 10085, 10484, 10851, 11149, 11155, 11611, 11640, 11655, 11701,
+  11840, 11856, 11883, 11903, 11904, 11968, 11979, 12005, 12037, 12067,
+  12077, 12078, 12092, 12093, 12107, 12108, 12113, 12140, 12159, 12167,
+  12191, 12194, 12201, 12204, 12205, 12207, 12348, 12394, 12397
 
 * New Linux interfaces: prlimit, prlimit64, fanotify_init, fanotify_mark
 
@@ -1924,8 +1924,7 @@
 ----------------------------------------------------------------------
 Copyright information:
 
-Copyright (C) 1992-1999,2000,2001,2002,2003,2004,2005,2006
-	Free Software Foundation, Inc.
+Copyright (C) 1992-2009, 2010, 2011 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
@@ -1939,4 +1938,5 @@
 
 Local variables:
 version-control: never
+fill-column: 76
 End:

Modified: fsf/trunk/libc/elf/Makefile
==============================================================================
--- fsf/trunk/libc/elf/Makefile (original)
+++ fsf/trunk/libc/elf/Makefile Fri Jan 14 00:03:33 2011
@@ -898,15 +898,17 @@
 $(objpfx)check-textrel: check-textrel.c
 	$(native-compile)
 
-check-execstack-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99
-# Perform the same operation as $(native-compile) but add the sysdeps
-# directories as header search locations.
-$(objpfx)check-execstack: check-execstack.c
+check-execstack-CFLAGS = -O -Wall -D_XOPEN_SOURCE=600 -D_BSD_SOURCE -std=gnu99 \
+			 $(objpfx:%/=-I%)
+$(objpfx)check-execstack: check-execstack.c $(objpfx)check-execstack.h
+	$(native-compile)
+$(objpfx)check-execstack.h: $(first-word $(wildcard $(sysdirs:%=%/stackinfo.h)))
 	$(make-target-directory)
-	$(patsubst %/,cd % &&,$(objpfx)) \
-	$(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
-	$(addprefix -I$(shell pwd)/,$(sysdirs)) -I$(shell pwd) \
-	$(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(@F)
+	{ echo '#include <stackinfo.h>'; echo '@@@DEFAULT_STACK_PERMS@@@'; } | \
+	$(CC) $(CFLAGS) $(CPPFLAGS) -E -x c-header - | \
+	sed -n -e 's/^@@@\(.*\)@@@/#define DEFAULT_STACK_PERMS \1/p' > $@T
+	mv -f $@T $@
+generated += check-execstack.h
 
 check-localplt-CFLAGS = -O -Wall -D_GNU_SOURCE -std=gnu99
 $(objpfx)check-localplt: check-localplt.c

Modified: fsf/trunk/libc/elf/check-execstack.c
==============================================================================
--- fsf/trunk/libc/elf/check-execstack.c (original)
+++ fsf/trunk/libc/elf/check-execstack.c Fri Jan 14 00:03:33 2011
@@ -26,7 +26,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
-#include <stackinfo.h>
+#include "check-execstack.h"
 
 
 #ifdef BITS
@@ -92,8 +92,13 @@
 	return 0;
       }
 
-  printf ("%s: no PT_GNU_STACK entry\n", fname);
-  return 1;
+  if (DEFAULT_STACK_PERMS & PF_X)
+    {
+      printf ("%s: no PT_GNU_STACK entry\n", fname);
+      return 1;
+    }
+
+  return 0;
 }
 
 # undef BITS
@@ -151,13 +156,8 @@
   int cnt;
   int result = 0;
 
-  /* We can return successfully, i.e., not fail, if PF_X isn't present.  If it
-   * is present then check for the GNU_STACK header.  */
-  if (DEFAULT_STACK_PERMS & PF_X)
-    {
-      for (cnt = 1; cnt < argc; ++cnt)
-	result |= handle_file (argv[cnt]);
-     }
+  for (cnt = 1; cnt < argc; ++cnt)
+    result |= handle_file (argv[cnt]);
   return result;
 }
 #endif

Modified: fsf/trunk/libc/include/alloca.h
==============================================================================
--- fsf/trunk/libc/include/alloca.h (original)
+++ fsf/trunk/libc/include/alloca.h Fri Jan 14 00:03:33 2011
@@ -14,6 +14,7 @@
 
 extern int __libc_use_alloca (size_t size) __attribute__ ((const));
 extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const));
+libc_hidden_proto (__libc_alloca_cutoff)
 
 #define __MAX_ALLOCA_CUTOFF	65536
 

Modified: fsf/trunk/libc/include/sys/resource.h
==============================================================================
--- fsf/trunk/libc/include/sys/resource.h (original)
+++ fsf/trunk/libc/include/sys/resource.h Fri Jan 14 00:03:33 2011
@@ -3,6 +3,7 @@
 
 libc_hidden_proto (getpriority)
 libc_hidden_proto (setpriority)
+libc_hidden_proto (getrlimit64)
 
 /* Now define the internal interfaces.  */
 extern int __getrlimit (enum __rlimit_resource __resource,

Modified: fsf/trunk/libc/nptl/ChangeLog
==============================================================================
--- fsf/trunk/libc/nptl/ChangeLog (original)
+++ fsf/trunk/libc/nptl/ChangeLog Fri Jan 14 00:03:33 2011
@@ -1,3 +1,9 @@
+2011-01-13  Ulrich Drepper  <drepper@xxxxxxxxx>
+
+	[BZ #10484]
+	* Versions [libc] (GLIBC_PRIVATE): Export __libc_alloca_cutoff.
+	* alloca_cutoff.c: Add libc_hidden_def.
+
 2010-10-13  H.J. Lu  <hongjiu.lu@xxxxxxxxx>
 
 	[BZ #12113]

Modified: fsf/trunk/libc/nptl/Versions
==============================================================================
--- fsf/trunk/libc/nptl/Versions (original)
+++ fsf/trunk/libc/nptl/Versions Fri Jan 14 00:03:33 2011
@@ -27,6 +27,7 @@
     pthread_cond_broadcast; pthread_cond_timedwait;
   }
   GLIBC_PRIVATE {
+    __libc_alloca_cutoff;
     # Internal libc interface to libpthread
     __libc_dl_error_tsd;
   }

Modified: fsf/trunk/libc/nptl/alloca_cutoff.c
==============================================================================
--- fsf/trunk/libc/nptl/alloca_cutoff.c (original)
+++ fsf/trunk/libc/nptl/alloca_cutoff.c Fri Jan 14 00:03:33 2011
@@ -1,5 +1,5 @@
 /* Determine whether block of given size can be allocated on the stack or not.
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2011 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
@@ -34,3 +34,4 @@
 			  assume the maximum available stack space.  */
 		       ?: __MAX_ALLOCA_CUTOFF * 4));
 }
+libc_hidden_def (__libc_alloca_cutoff)

Modified: fsf/trunk/libc/nss/nss_files/files-hosts.c
==============================================================================
--- fsf/trunk/libc/nss/nss_files/files-hosts.c (original)
+++ fsf/trunk/libc/nss/nss_files/files-hosts.c Fri Jan 14 00:03:33 2011
@@ -1,5 +1,5 @@
 /* Hosts file parser in nss_files module.
-   Copyright (C) 1996-2001, 2003-2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 1996-2001, 2003-2009, 2011 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
@@ -129,19 +129,22 @@
 	  && _res_hconf.flags & HCONF_FLAG_MULTI)			      \
 	{								      \
 	  /* We have to get all host entries from the file.  */		      \
-	  const size_t tmp_buflen = MIN (buflen, 4096);			      \
-	  char tmp_buffer[tmp_buflen]					      \
+	  size_t tmp_buflen = MIN (buflen, 4096);			      \
+	  char tmp_buffer_stack[tmp_buflen]				      \
 	    __attribute__ ((__aligned__ (__alignof__ (struct hostent_data))));\
+	  char *tmp_buffer = tmp_buffer_stack;				      \
 	  struct hostent tmp_result_buf;				      \
 	  int naddrs = 1;						      \
 	  int naliases = 0;						      \
 	  char *bufferend;						      \
+	  bool tmp_buffer_malloced = false;				      \
 									      \
 	  while (result->h_aliases[naliases] != NULL)			      \
 	    ++naliases;							      \
 									      \
 	  bufferend = (char *) &result->h_aliases[naliases + 1];	      \
 									      \
+	again:								      \
 	  while ((status = internal_getent (&tmp_result_buf, tmp_buffer,      \
 					    tmp_buflen, errnop H_ERRNO_ARG    \
 					    EXTRA_ARGS_VALUE))		      \
@@ -182,7 +185,7 @@
 		    }							      \
 		  /* If the real name is different add it also to the	      \
 		     aliases.  This means that there is a duplication	      \
-		     in the alias list but this is really the users	      \
+		     in the alias list but this is really the user's	      \
 		     problem.  */					      \
 		  if (strcmp (old_result->h_name,			      \
 			      tmp_result_buf.h_name) != 0)		      \
@@ -204,7 +207,7 @@
 		      *errnop = ERANGE;					      \
 		      *herrnop = NETDB_INTERNAL;			      \
 		      status = NSS_STATUS_TRYAGAIN;			      \
-		      break;						      \
+		      goto out;						      \
 		    }							      \
 									      \
 		  new_h_addr_list =					      \
@@ -268,8 +271,54 @@
 		}							      \
 	    }								      \
 									      \
-	  if (status != NSS_STATUS_TRYAGAIN)				      \
+	  if (status == NSS_STATUS_TRYAGAIN)				      \
+	    {								      \
+	      size_t newsize = 2 * tmp_buflen;				      \
+	      if (tmp_buffer_malloced)					      \
+		{							      \
+		  char *newp = realloc (tmp_buffer, newsize);		      \
+		  if (newp != NULL)					      \
+		    {							      \
+		      assert ((((uintptr_t) newp)			      \
+			       & (__alignof__ (struct hostent_data) - 1))     \
+			      == 0);					      \
+		      tmp_buffer = newp;				      \
+		      tmp_buflen = newsize;				      \
+		      goto again;					      \
+		    }							      \
+		}							      \
+	      else if (!__libc_use_alloca (buflen + newsize))		      \
+		{							      \
+		  tmp_buffer = malloc (newsize);			      \
+		  if (tmp_buffer != NULL)				      \
+		    {							      \
+		      assert ((((uintptr_t) tmp_buffer)			      \
+			       & (__alignof__ (struct hostent_data) - 1))     \
+			      == 0);					      \
+		      tmp_buffer_malloced = true;			      \
+		      tmp_buflen = newsize;				      \
+		      goto again;					      \
+		    }							      \
+		}							      \
+	      else							      \
+		{							      \
+		  tmp_buffer						      \
+		    = extend_alloca (tmp_buffer, tmp_buflen,		      \
+				     newsize				      \
+				     + __alignof__ (struct hostent_data));    \
+		  tmp_buffer = (char *) (((uintptr_t) tmp_buffer	      \
+					  + __alignof__ (struct hostent_data) \
+					  - 1)				      \
+					 & ~(__alignof__ (struct hostent_data)\
+					     - 1));			      \
+		  goto again;						      \
+		}							      \
+	    }								      \
+	  else								      \
 	    status = NSS_STATUS_SUCCESS;				      \
+	out:								      \
+	  if (tmp_buffer_malloced)					      \
+	    free (tmp_buffer);						      \
 	}								      \
 									      \
 									      \

Modified: fsf/trunk/libc/sysdeps/posix/spawni.c
==============================================================================
--- fsf/trunk/libc/sysdeps/posix/spawni.c (original)
+++ fsf/trunk/libc/sysdeps/posix/spawni.c Fri Jan 14 00:03:33 2011
@@ -1,5 +1,5 @@
 /* Guts of POSIX spawn interface.  Generic POSIX.1 version.
-   Copyright (C) 2000-2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2000-2005, 2006, 2011 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
@@ -24,6 +24,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <sys/resource.h>
 #include "spawn_int.h"
 #include <not-cancel.h>
 #include <local-setxid.h>
@@ -164,6 +165,8 @@
   if (file_actions != NULL)
     {
       int cnt;
+      struct rlimit64 fdlimit;
+      bool have_fdlimit = false;
 
       for (cnt = 0; cnt < file_actions->__used; ++cnt)
 	{
@@ -173,8 +176,19 @@
 	    {
 	    case spawn_do_close:
 	      if (close_not_cancel (action->action.close_action.fd) != 0)
-		/* Signal the error.  */
-		_exit (SPAWN_ERROR);
+		{
+		  if (! have_fdlimit)
+		    {
+		      getrlimit64 (RLIMIT_NOFILE, &fdlimit);
+		      have_fdlimit = true;
+		    }
+
+		  /* Only signal errors for file descriptors out of range.  */
+		  if (action->action.close_action.fd < 0
+		      || action->action.close_action.fd >= fdlimit.rlim_cur)
+		    /* Signal the error.  */
+		    _exit (SPAWN_ERROR);
+		}
 	      break;
 
 	    case spawn_do_open:

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/getrlimit64.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/getrlimit64.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/getrlimit64.c Fri Jan 14 00:03:33 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010 Free Software Foundation, Inc.
+/* Copyright (C) 2010, 2011 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
@@ -52,3 +52,4 @@
   return 0;
 #endif
 }
+libc_hidden_def (getrlimit64)

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/getrlimit64.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/getrlimit64.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/i386/getrlimit64.c Fri Jan 14 00:03:33 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999, 2000, 2005, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 1999, 2000, 2005, 2010, 2011 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
@@ -23,3 +23,4 @@
 #undef getrlimit64
 #include <shlib-compat.h>
 versioned_symbol (libc, __new_getrlimit64, getrlimit64, GLIBC_2_2);
+strong_alias (__new_getrlimit64, __GI_getrlimit64)

Modified: fsf/trunk/libc/sysdeps/unix/sysv/linux/mkdirat.c
==============================================================================
--- fsf/trunk/libc/sysdeps/unix/sysv/linux/mkdirat.c (original)
+++ fsf/trunk/libc/sysdeps/unix/sysv/linux/mkdirat.c Fri Jan 14 00:03:33 2011
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc.
+/* Copyright (C) 2005, 2006, 2009, 2011 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,7 +43,7 @@
     {
       res = INLINE_SYSCALL (mkdirat, 3, fd, file, mode);
 # ifndef __ASSUME_ATFCTS
-      if (res == -1 && res == ENOSYS)
+      if (res == -1 && errno == ENOSYS)
 	__have_atfcts = -1;
       else
 # endif