public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo commit in src/patchsets/glibc/2.12.1: 0061_all_glibc-double-expansion.patch 0062_all_glibc-no-ORIGIN-setuid.patch README.history
@ 2010-10-31 21:02 Diego Petteno (flameeyes)
  0 siblings, 0 replies; only message in thread
From: Diego Petteno (flameeyes) @ 2010-10-31 21:02 UTC (permalink / raw
  To: gentoo-commits

flameeyes    10/10/31 21:02:55

  Modified:             README.history
  Added:                0061_all_glibc-double-expansion.patch
                        0062_all_glibc-no-ORIGIN-setuid.patch
  Log:
  New patches for the recent security issues.

Revision  Changes    Path
1.10                 src/patchsets/glibc/2.12.1/README.history

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/README.history?rev=1.10&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/README.history?rev=1.10&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/README.history?r1=1.9&r2=1.10

Index: README.history
===================================================================
RCS file: /var/cvsroot/gentoo/src/patchsets/glibc/2.12.1/README.history,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- README.history	26 Oct 2010 15:01:20 -0000	1.9
+++ README.history	31 Oct 2010 21:02:55 -0000	1.10
@@ -1,3 +1,7 @@
+6		31.10.2010
+	+ 0061_all_glibc-double-expansion.patch
+	+ 0062_all_glibc-no-ORIGIN-setuid.patch
+
 5		26.10.2010
 	+ 0060_all_glibc-ld-audit-setuid.patch
 



1.1                  src/patchsets/glibc/2.12.1/0061_all_glibc-double-expansion.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/0061_all_glibc-double-expansion.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/0061_all_glibc-double-expansion.patch?rev=1.1&content-type=text/plain

Index: 0061_all_glibc-double-expansion.patch
===================================================================
From 22cd1c9bcf57c5829d65b6da825f7a459d40c9eb Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Sun, 24 Oct 2010 20:40:14 -0400
Subject: [PATCH] Don't expand DST twice in dl_open

---
 ChangeLog     |    5 +++++
 elf/dl-open.c |   29 -----------------------------
 2 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/elf/dl-open.c b/elf/dl-open.c
index 754a263..c394b3f 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -221,35 +221,6 @@ dl_open_worker (void *a)
 
   assert (_dl_debug_initialize (0, args->nsid)->r_state == RT_CONSISTENT);
 
-  /* Maybe we have to expand a DST.  */
-  if (__builtin_expect (dst != NULL, 0))
-    {
-      size_t len = strlen (file);
-
-      /* Determine how much space we need.  We have to allocate the
-	 memory locally.  */
-      size_t required = DL_DST_REQUIRED (call_map, file, len,
-					 _dl_dst_count (dst, 0));
-
-      /* Get space for the new file name.  */
-      char *new_file = (char *) alloca (required + 1);
-
-      /* Generate the new file name.  */
-      _dl_dst_substitute (call_map, file, new_file, 0);
-
-      /* If the substitution failed don't try to load.  */
-      if (*new_file == '\0')
-	_dl_signal_error (0, "dlopen", NULL,
-			  N_("empty dynamic string token substitution"));
-
-      /* Now we have a new file name.  */
-      file = new_file;
-
-      /* It does not matter whether call_map is set even if we
-	 computed it only because of the DST.  Since the path contains
-	 a slash the value is not used.  See dl-load.c.  */
-    }
-
   /* Load the named object.  */
   struct link_map *new;
   args->map = new = _dl_map_object (call_map, file, 0, lt_loaded, 0,
-- 
1.7.2




1.1                  src/patchsets/glibc/2.12.1/0062_all_glibc-no-ORIGIN-setuid.patch

file : http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/0062_all_glibc-no-ORIGIN-setuid.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo/src/patchsets/glibc/2.12.1/0062_all_glibc-no-ORIGIN-setuid.patch?rev=1.1&content-type=text/plain

Index: 0062_all_glibc-no-ORIGIN-setuid.patch
===================================================================
From: Andreas Schwab <schwab at redhat dot com>
Subject: [PATCH] Never expand $ORIGIN in privileged programs
Date: Mon, 18 Oct 2010 15:12:09 +0200

Path elements containing $ORIGIN should always be ignored in privileged
programs.

Andreas.

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)
-- 
1.7.2.3


-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."







^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2010-10-31 21:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-31 21:02 [gentoo-commits] gentoo commit in src/patchsets/glibc/2.12.1: 0061_all_glibc-double-expansion.patch 0062_all_glibc-no-ORIGIN-setuid.patch README.history Diego Petteno (flameeyes)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox