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

r4436 - in glibc-package/trunk/debian: . patches patches/any



Author: aurel32
Date: 2010-10-21 17:35:04 +0000 (Thu, 21 Oct 2010)
New Revision: 4436

Added:
   glibc-package/trunk/debian/patches/any/submitted-origin.diff
Modified:
   glibc-package/trunk/debian/changelog
   glibc-package/trunk/debian/patches/series
Log:
  * Add any/submitted-origin.diff from Andreas Schwab to forbid the used 
    of $ORIGIN in privileged programs. CVE-2010-3847. Closes: #600667.



Modified: glibc-package/trunk/debian/changelog
===================================================================
--- glibc-package/trunk/debian/changelog	2010-10-20 20:02:54 UTC (rev 4435)
+++ glibc-package/trunk/debian/changelog	2010-10-21 17:35:04 UTC (rev 4436)
@@ -8,8 +8,10 @@
   
   [ Aurelien Jarno ]
   * Update Portuguese debconf translation, by Pedro Ribeiro.  Closes: #597348.
+  * Add any/submitted-origin.diff from Andreas Schwab to forbid the used 
+    of $ORIGIN in privileged programs. CVE-2010-3847. Closes: #600667.
 
- -- Aurelien Jarno <aurel32@debian.org>  Wed, 20 Oct 2010 22:01:21 +0200
+ -- Aurelien Jarno <aurel32@debian.org>  Thu, 21 Oct 2010 19:33:29 +0200
 
 eglibc (2.11.2-6) unstable; urgency=low
 

Added: glibc-package/trunk/debian/patches/any/submitted-origin.diff
===================================================================
--- glibc-package/trunk/debian/patches/any/submitted-origin.diff	                        (rev 0)
+++ glibc-package/trunk/debian/patches/any/submitted-origin.diff	2010-10-21 17:35:04 UTC (rev 4436)
@@ -0,0 +1,82 @@
+2010-10-18  Andreas Schwab  <schwab@redhat.com>
+
+	* elf/dl-load.c (is_dst): Remove last parameter.
+	(_dl_dst_count): Ignore $ORIGIN in privileged programs.
+	(_dl_dst_substitute): Likewise.
+---
+ elf/dl-load.c |   30 +++++++++++++-----------------
+ 1 files changed, 13 insertions(+), 17 deletions(-)
+
+diff --git a/elf/dl-load.c b/elf/dl-load.c
+index a7162eb..776f7e4 100644
+--- a/elf/dl-load.c
++++ b/elf/dl-load.c
+@@ -169,8 +169,7 @@ local_strdup (const char *s)
+ 
+ 
+ static size_t
+-is_dst (const char *start, const char *name, const char *str,
+-	int is_path, int secure)
++is_dst (const char *start, const char *name, const char *str, int is_path)
+ {
+   size_t len;
+   bool is_curly = false;
+@@ -199,11 +198,6 @@ is_dst (const char *start, const char *name, const char *str,
+ 	   && (!is_path || name[len] != ':'))
+     return 0;
+ 
+-  if (__builtin_expect (secure, 0)
+-      && ((name[len] != '\0' && (!is_path || name[len] != ':'))
+-	  || (name != start + 1 && (!is_path || name[-2] != ':'))))
+-    return 0;
+-
+   return len;
+ }
+ 
+@@ -218,13 +212,12 @@ _dl_dst_count (const char *name, int is_path)
+     {
+       size_t len;
+ 
+-      /* $ORIGIN is not expanded for SUID/GUID programs (except if it
+-	 is $ORIGIN alone) and it must always appear first in path.  */
++      /* $ORIGIN is not expanded for SUID/GUID programs.  */
+       ++name;
+-      if ((len = is_dst (start, name, "ORIGIN", is_path,
+-			 INTUSE(__libc_enable_secure))) != 0
+-	  || (len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0
+-	  || (len = is_dst (start, name, "LIB", is_path, 0)) != 0)
++      if (((len = is_dst (start, name, "ORIGIN", is_path)) != 0
++	   && !INTUSE(__libc_enable_secure))
++	  || (len = is_dst (start, name, "PLATFORM", is_path)) != 0
++	  || (len = is_dst (start, name, "LIB", is_path)) != 0)
+ 	++cnt;
+ 
+       name = strchr (name + len, '$');
+@@ -256,9 +249,12 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
+ 	  size_t len;
+ 
+ 	  ++name;
+-	  if ((len = is_dst (start, name, "ORIGIN", is_path,
+-			     INTUSE(__libc_enable_secure))) != 0)
++	  if ((len = is_dst (start, name, "ORIGIN", is_path)) != 0)
+ 	    {
++	      /* Ignore this path element in SUID/SGID programs.  */
++	      if (INTUSE(__libc_enable_secure))
++		repl = (const char *) -1;
++	      else
+ #ifndef SHARED
+ 	      if (l == NULL)
+ 		repl = _dl_get_origin ();
+@@ -266,9 +262,9 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
+ #endif
+ 		repl = l->l_origin;
+ 	    }
+-	  else if ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0)
++	  else if ((len = is_dst (start, name, "PLATFORM", is_path)) != 0)
+ 	    repl = GLRO(dl_platform);
+-	  else if ((len = is_dst (start, name, "LIB", is_path, 0)) != 0)
++	  else if ((len = is_dst (start, name, "LIB", is_path)) != 0)
+ 	    repl = DL_DST_LIB;
+ 
+ 	  if (repl != NULL && repl != (const char *) -1)
+

Modified: glibc-package/trunk/debian/patches/series
===================================================================
--- glibc-package/trunk/debian/patches/series	2010-10-20 20:02:54 UTC (rev 4435)
+++ glibc-package/trunk/debian/patches/series	2010-10-21 17:35:04 UTC (rev 4436)
@@ -264,3 +264,4 @@
 any/cvs-__block.diff
 any/cvs-sunrpc-license.diff
 any/submitted-resolv.conf-thread.diff
+any/submitted-origin.diff


Reply to: