olga / rpms / glibc

Forked from rpms/glibc 5 years ago
Clone

Blame SOURCES/glibc-rh1540480-3.patch

00db10
commit 10e93d968716ab82931d593bada121c17c0a4b93
00db10
Author: Dmitry V. Levin <ldv@altlinux.org>
00db10
Date:   Mon Dec 18 21:46:07 2017 +0000
00db10
00db10
    elf: remove redundant __libc_enable_secure check from fillin_rpath
00db10
    
00db10
    There are just two users of fillin_rpath: one is decompose_rpath that
00db10
    sets check_trusted argument to 0, another one is _dl_init_paths that
00db10
    sets check_trusted argument to __libc_enable_secure and invokes
00db10
    fillin_rpath only when LD_LIBRARY_PATH is non-empty.
00db10
    
00db10
    Starting with commit
00db10
    glibc-2.25.90-512-gf6110a8fee2ca36f8e2d2abecf3cba9fa7b8ea7d,
00db10
    LD_LIBRARY_PATH is ignored for __libc_enable_secure executables,
00db10
    so check_trusted argument of fillin_rpath is always zero.
00db10
    
00db10
    * elf/dl-load.c (is_trusted_path): Remove.
00db10
    (fillin_rpath): Remove check_trusted argument and its use,
00db10
    all callers changed.
00db10
00db10
Index: glibc-2.17-c758a686/elf/dl-load.c
00db10
===================================================================
00db10
--- glibc-2.17-c758a686.orig/elf/dl-load.c
00db10
+++ glibc-2.17-c758a686/elf/dl-load.c
00db10
@@ -169,24 +169,6 @@ local_strdup (const char *s)
00db10
 
00db10
 
00db10
 static bool
00db10
-is_trusted_path (const char *path, size_t len)
00db10
-{
00db10
-  const char *trun = system_dirs;
00db10
-
00db10
-  for (size_t idx = 0; idx < nsystem_dirs_len; ++idx)
00db10
-    {
00db10
-      if (len == system_dirs_len[idx] && memcmp (trun, path, len) == 0)
00db10
-	/* Found it.  */
00db10
-	return true;
00db10
-
00db10
-      trun += system_dirs_len[idx] + 1;
00db10
-    }
00db10
-
00db10
-  return false;
00db10
-}
00db10
-
00db10
-
00db10
-static bool
00db10
 is_trusted_path_normalize (const char *path, size_t len)
00db10
 {
00db10
   if (len == 0)
00db10
@@ -487,8 +469,7 @@ static size_t max_dirnamelen;
00db10
 
00db10
 static struct r_search_path_elem **
00db10
 fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
00db10
-	      int check_trusted, const char *what, const char *where,
00db10
-	      struct link_map *l)
00db10
+	      const char *what, const char *where, struct link_map *l)
00db10
 {
00db10
   char *cp;
00db10
   size_t nelems = 0;
00db10
@@ -518,13 +499,6 @@ fillin_rpath (char *rpath, struct r_sear
00db10
       if (len > 0 && cp[len - 1] != '/')
00db10
 	cp[len++] = '/';
00db10
 
00db10
-      /* Make sure we don't use untrusted directories if we run SUID.  */
00db10
-      if (__builtin_expect (check_trusted, 0) && !is_trusted_path (cp, len))
00db10
-	{
00db10
-	  free (to_free);
00db10
-	  continue;
00db10
-	}
00db10
-
00db10
       /* See if this directory is already known.  */
00db10
       for (dirp = GL(dl_all_dirs); dirp != NULL; dirp = dirp->next)
00db10
 	if (dirp->dirnamelen == len && memcmp (cp, dirp->dirname, len) == 0)
00db10
@@ -674,7 +648,7 @@ decompose_rpath (struct r_search_path_st
00db10
       _dl_signal_error (ENOMEM, NULL, NULL, errstring);
00db10
     }
00db10
 
00db10
-  fillin_rpath (copy, result, ":", 0, what, where, l);
00db10
+  fillin_rpath (copy, result, ":", what, where, l);
00db10
 
00db10
   /* Free the copied RPATH string.  `fillin_rpath' make own copies if
00db10
      necessary.  */
00db10
@@ -847,8 +821,7 @@ _dl_init_paths (const char *llp)
00db10
 	}
00db10
 
00db10
       (void) fillin_rpath (llp_tmp, env_path_list.dirs, ":;",
00db10
-			   INTUSE(__libc_enable_secure), "LD_LIBRARY_PATH",
00db10
-			   NULL, l);
00db10
+			   "LD_LIBRARY_PATH", NULL, l);
00db10
 
00db10
       if (env_path_list.dirs[0] == NULL)
00db10
 	{