arrfab / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh1540480-4.patch

147e83
commit 97f13188c9fbafeaab89146996b3cce1f4952b5e
147e83
Author: Dmitry V. Levin <ldv@altlinux.org>
147e83
Date:   Tue Dec 19 21:06:23 2017 +0000
147e83
147e83
    elf: remove redundant code from _dl_dst_substitute
147e83
    
147e83
    There are just two users of _dl_dst_substitute: one is expand_dst that
147e83
    sets is_path argument to 0, another one is expand_dynamic_string_token.
147e83
    The latter function also has just two users: one is _dl_map_object that
147e83
    sets is_path argument to 0, another one is fillin_rpath that sets
147e83
    is_path argument to 1 and name argument contains no ':'.
147e83
    
147e83
    In any case (is_path && name[i] == ':') is always false and all code
147e83
    depending on it can be safely removed.
147e83
    
147e83
    * elf/dl-load.c (_dl_dst_substitute): Remove checks that is_path
147e83
    is set and name contains ':', and all code depending on these checks.
147e83
147e83
Index: glibc-2.17-c758a686/elf/dl-load.c
147e83
===================================================================
147e83
--- glibc-2.17-c758a686.orig/elf/dl-load.c
147e83
+++ glibc-2.17-c758a686/elf/dl-load.c
147e83
@@ -349,13 +349,7 @@ _dl_dst_substitute (struct link_map *l,
147e83
 	      /* We cannot use this path element, the value of the
147e83
 		 replacement is unknown.  */
147e83
 	      wp = last_elem;
147e83
-	      name += len;
147e83
-	      while (*name != '\0' && (!is_path || *name != ':'))
147e83
-		++name;
147e83
-	      /* Also skip following colon if this is the first rpath
147e83
-		 element, but keep an empty element at the end.  */
147e83
-	      if (wp == result && is_path && *name == ':' && name[1] != '\0')
147e83
-		++name;
147e83
+	      break;
147e83
 	    }
147e83
 	  else
147e83
 	    /* No DST we recognize.  */
147e83
@@ -364,19 +358,6 @@ _dl_dst_substitute (struct link_map *l,
147e83
       else
147e83
 	{
147e83
 	  *wp++ = *name++;
147e83
-	  if (is_path && *name == ':')
147e83
-	    {
147e83
-	      /* In SUID/SGID programs, after $ORIGIN expansion the
147e83
-		 normalized path must be rooted in one of the trusted
147e83
-		 directories.  */
147e83
-	      if (__builtin_expect (check_for_trusted, false)
147e83
-		  && !is_trusted_path_normalize (last_elem, wp - last_elem))
147e83
-		wp = last_elem;
147e83
-	      else
147e83
-		last_elem = wp;
147e83
-
147e83
-	      check_for_trusted = false;
147e83
-	    }
147e83
 	}
147e83
     }
147e83
   while (*name != '\0');