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

r5250 - in glibc-package/trunk/debian: . patches patches/hurd-i386



Author: sthibault
Date: 2012-05-12 16:38:33 +0000 (Sat, 12 May 2012)
New Revision: 5250

Added:
   glibc-package/trunk/debian/patches/hurd-i386/local-nice.diff
   glibc-package/trunk/debian/patches/hurd-i386/submitted-getgroups.diff
   glibc-package/trunk/debian/patches/hurd-i386/submitted-getlogin_r.diff
   glibc-package/trunk/debian/patches/hurd-i386/submitted-ptsname.diff
Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/patches/series
Log:
  * patches/hurd-i386/submitted-add-needed.diff: New patch from Pino to reject
    some out of range values.
  * patches/hurd-i386/submitted-getlogin_r.diff: New patch from Pino to fix
    re-entrancy of getlogin_r and return ERANGE when the provided buffer is
    too small.
  * patches/hurd-i386/submitted-add-needed.diff: New patch from Pino to fix
    buffer checks in ptsname.


Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog	2012-05-12 11:24:43 UTC (rev 5249)
+++ glibc-package/trunk/debian/changelog	2012-05-12 16:38:33 UTC (rev 5250)
@@ -13,6 +13,13 @@
     dup3-lock}.diff: Refresh with upstream version and rename to cvs.
   * patches/hurd-i386/cvs-O_CLOEXEC.diff: New patch to accept use of O_CLOEXEC
     in rtld.
+  * patches/hurd-i386/submitted-add-needed.diff: New patch from Pino to reject
+    some out of range values.
+  * patches/hurd-i386/submitted-getlogin_r.diff: New patch from Pino to fix
+    re-entrancy of getlogin_r and return ERANGE when the provided buffer is
+    too small.
+  * patches/hurd-i386/submitted-add-needed.diff: New patch from Pino to fix
+    buffer checks in ptsname.
 
  -- Clint Adams <clint@debian.org>  Fri, 04 May 2012 23:39:00 -0400
 

Added: glibc-package/trunk/debian/patches/hurd-i386/local-nice.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/local-nice.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/local-nice.diff	2012-05-12 16:38:33 UTC (rev 5250)
@@ -0,0 +1,18 @@
+Fix nice granularity
+
+---
+ resource.h |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+--- hurd/hurd/resource.h.orig	2012-05-12 17:23:56.000000000 +0000
++++ hurd/hurd/resource.h	2012-05-12 17:24:01.000000000 +0000
+@@ -43,8 +43,8 @@
+ 
+ /* Convert between Mach priority values and the priority
+    values used by getpriority, setpriority, and nice.  */
+-#define MACH_PRIORITY_TO_NICE(prio) (2 * ((prio) - 12))
+-#define NICE_TO_MACH_PRIORITY(nice) (12 + ((nice) / 2))
++#define MACH_PRIORITY_TO_NICE(prio) ((prio) - 20)
++#define NICE_TO_MACH_PRIORITY(nice) (20 + (nice))
+ 
+ 
+ 

Added: glibc-package/trunk/debian/patches/hurd-i386/submitted-getgroups.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/submitted-getgroups.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/submitted-getgroups.diff	2012-05-12 16:38:33 UTC (rev 5250)
@@ -0,0 +1,30 @@
+hurd: compliance fixes for getgroups
+
+Fail with EINVAL when the requested number of groups is negative,
+or when it is positive but less than the actual number of groups.
+
+2012-04-28  Pino Toscano  <toscano.pino@tiscali.it>
+
+	* sysdeps/mach/hurd/getgroups.c: Return -1 and set EINVAL for
+	negative N or less than NGIDS.
+--- a/sysdeps/mach/hurd/getgroups.c
++++ b/sysdeps/mach/hurd/getgroups.c
+@@ -31,6 +31,9 @@
+   int ngids;
+   void *crit;
+ 
++  if (n < 0)
++    return __hurd_fail (EINVAL);
++
+   crit = _hurd_critical_section_lock ();
+   __mutex_lock (&_hurd_id.lock);
+ 
+@@ -54,7 +57,7 @@
+       /* Now that the lock is released, we can safely copy the
+ 	 group set into the user's array, which might fault.  */
+       if (ngids > n)
+-	ngids = n;
++	return __hurd_fail (EINVAL);
+       memcpy (gidset, gids, ngids * sizeof (gid_t));
+     }
+   else

Added: glibc-package/trunk/debian/patches/hurd-i386/submitted-getlogin_r.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/submitted-getlogin_r.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/submitted-getlogin_r.diff	2012-05-12 16:38:33 UTC (rev 5250)
@@ -0,0 +1,38 @@
+hurd: compliance fixes for getlogin_r
+
+* do not make `login' static, as it would make getlogin_r no more reentrant;
+change its type to string_t.
+* fail with ERANGE if the `name' buffer has not enough space for the actual
+login string
+* copy with memcpy only the chars of the string
+
+2012-04-28  Pino Toscano  <toscano.pino@tiscali.it>
+
+	* sysdeps/mach/hurd/getlogin_r.c: Make LOGIN static and as string_t.
+	Return -1 and set ERANGE if NAME is not big enough.
+--- a/sysdeps/mach/hurd/getlogin_r.c
++++ b/sysdeps/mach/hurd/getlogin_r.c
+@@ -30,13 +30,21 @@
+      char *name;
+      size_t name_len;
+ {
+-  static char login[1024];	/* XXX */
++  string_t login;
+   error_t err;
++  size_t len;
+ 
+   if (err = __USEPORT (PROC, __proc_getlogin (port, login)))
+     return errno = err;
+ 
+-  strncpy (name, login, name_len);
++  len = __strnlen (login, sizeof login - 1) + 1;
++  if (len > name_len)
++    {
++      errno = ERANGE;
++      return errno;
++    }
++
++  memcpy (name, login, len);
+   return 0;
+ }
+ libc_hidden_def (getlogin_r)

Added: glibc-package/trunk/debian/patches/hurd-i386/submitted-ptsname.diff
===================================================================
--- glibc-package/trunk/debian/patches/hurd-i386/submitted-ptsname.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/hurd-i386/submitted-ptsname.diff	2012-05-12 16:38:33 UTC (rev 5250)
@@ -0,0 +1,53 @@
+hurd: fixes for ptsname_r
+
+ptsname_r on failure returns the value that is also set as errno; furthermore,
+add more checks to it.
+* set errno and return it on __term_get_peername failure
+* set errno to ERANGE other than returning it
+Also, change the type of `peername' to string_t, and check its length with
+__strnlen.
+
+In ptsname do not set errno manually, since ptsname_r has set it already.
+
+2012-04-28  Pino Toscano  <toscano.pino@tiscali.it>
+
+	* sysdeps/mach/hurd/ptsname.c (ptsname): Do not manually set errno.
+	(__ptsname_r): Set errno and return it on __term_get_peername failure.
+	Set errno if the buffer is too short.  Make PEERNAME a string_t,
+	and check its length with __strnlen.
+--- a/sysdeps/mach/hurd/ptsname.c
++++ b/sysdeps/mach/hurd/ptsname.c
+@@ -35,8 +35,6 @@
+   error_t err;
+ 
+   err = __ptsname_r (fd, peername, sizeof (peername));
+-  if (err)
+-    __set_errno (err);
+ 
+   return err ? NULL : peername;
+ }
+@@ -47,17 +45,19 @@
+ int
+ __ptsname_internal (int fd, char *buf, size_t buflen, struct stat64 *stp)
+ {
+-  char peername[1024];  /* XXX */
++  string_t peername;
+   size_t len;
+   error_t err;
+ 
+-  peername[0] = '\0';
+   if (err = HURD_DPORT_USE (fd, __term_get_peername (port, peername)))
+-    return _hurd_fd_error (fd, err);
++    return __hurd_dfail (fd, err), errno;
+ 
+-  len = strlen (peername) + 1;
++  len = __strnlen (peername, sizeof peername - 1) + 1;
+   if (len > buflen)
+-    return ERANGE;
++    {
++      errno = ERANGE;
++      return ERANGE;
++    }
+ 
+   memcpy (buf, peername, len);
+   return 0;

Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series	2012-05-12 11:24:43 UTC (rev 5249)
+++ glibc-package/trunk/debian/patches/series	2012-05-12 16:38:33 UTC (rev 5250)
@@ -200,6 +200,9 @@
 hurd-i386/libpthread_librt-link.diff
 hurd-i386/libpthread_version.diff
 hurd-i386/cvs-O_CLOEXEC.diff
+hurd-i386/submitted-getgroups.diff
+hurd-i386/submitted-getlogin_r.diff
+hurd-i386/submitted-ptsname.diff
 
 kfreebsd/submitted-libc_once.diff
 


Reply to: