|
|
c6d234 |
commit 2a939a7e6d81f109d49306bc2e10b4ac9ceed8f9
|
|
|
c6d234 |
Author: Ondřej Bílka <neleai@seznam.cz>
|
|
|
c6d234 |
Date: Mon Dec 2 14:53:14 2013 +0100
|
|
|
c6d234 |
|
|
|
c6d234 |
Return fixed version of breaking of RPATH when $ORIGIN contains colons
|
|
|
c6d234 |
|
|
|
c6d234 |
Index: glibc-2.17-c758a686/elf/dl-load.c
|
|
|
c6d234 |
===================================================================
|
|
|
c6d234 |
--- glibc-2.17-c758a686.orig/elf/dl-load.c
|
|
|
c6d234 |
+++ glibc-2.17-c758a686/elf/dl-load.c
|
|
|
c6d234 |
@@ -487,14 +487,19 @@ static size_t max_dirnamelen;
|
|
|
c6d234 |
|
|
|
c6d234 |
static struct r_search_path_elem **
|
|
|
c6d234 |
fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
|
|
|
c6d234 |
- int check_trusted, const char *what, const char *where)
|
|
|
c6d234 |
+ int check_trusted, const char *what, const char *where,
|
|
|
c6d234 |
+ struct link_map *l)
|
|
|
c6d234 |
{
|
|
|
c6d234 |
char *cp;
|
|
|
c6d234 |
size_t nelems = 0;
|
|
|
c6d234 |
+ char *to_free;
|
|
|
c6d234 |
|
|
|
c6d234 |
while ((cp = __strsep (&rpath, sep)) != NULL)
|
|
|
c6d234 |
{
|
|
|
c6d234 |
struct r_search_path_elem *dirp;
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+ to_free = cp = expand_dynamic_string_token (l, cp, 1);
|
|
|
c6d234 |
+
|
|
|
c6d234 |
size_t len = strlen (cp);
|
|
|
c6d234 |
|
|
|
c6d234 |
/* `strsep' can pass an empty string. This has to be
|
|
|
c6d234 |
@@ -515,7 +520,10 @@ fillin_rpath (char *rpath, struct r_sear
|
|
|
c6d234 |
|
|
|
c6d234 |
/* Make sure we don't use untrusted directories if we run SUID. */
|
|
|
c6d234 |
if (__builtin_expect (check_trusted, 0) && !is_trusted_path (cp, len))
|
|
|
c6d234 |
- continue;
|
|
|
c6d234 |
+ {
|
|
|
c6d234 |
+ free (to_free);
|
|
|
c6d234 |
+ continue;
|
|
|
c6d234 |
+ }
|
|
|
c6d234 |
|
|
|
c6d234 |
/* See if this directory is already known. */
|
|
|
c6d234 |
for (dirp = GL(dl_all_dirs); dirp != NULL; dirp = dirp->next)
|
|
|
c6d234 |
@@ -576,6 +584,7 @@ fillin_rpath (char *rpath, struct r_sear
|
|
|
c6d234 |
/* Put it in the result array. */
|
|
|
c6d234 |
result[nelems++] = dirp;
|
|
|
c6d234 |
}
|
|
|
c6d234 |
+ free (to_free);
|
|
|
c6d234 |
}
|
|
|
c6d234 |
|
|
|
c6d234 |
/* Terminate the array. */
|
|
|
c6d234 |
@@ -631,9 +640,8 @@ decompose_rpath (struct r_search_path_st
|
|
|
c6d234 |
while (*inhp != '\0');
|
|
|
c6d234 |
}
|
|
|
c6d234 |
|
|
|
c6d234 |
- /* Make a writable copy. At the same time expand possible dynamic
|
|
|
c6d234 |
- string tokens. */
|
|
|
c6d234 |
- copy = expand_dynamic_string_token (l, rpath, 1);
|
|
|
c6d234 |
+ /* Make a writable copy. */
|
|
|
c6d234 |
+ copy = local_strdup (rpath);
|
|
|
c6d234 |
if (copy == NULL)
|
|
|
c6d234 |
{
|
|
|
c6d234 |
errstring = N_("cannot create RUNPATH/RPATH copy");
|
|
|
c6d234 |
@@ -666,7 +674,7 @@ decompose_rpath (struct r_search_path_st
|
|
|
c6d234 |
_dl_signal_error (ENOMEM, NULL, NULL, errstring);
|
|
|
c6d234 |
}
|
|
|
c6d234 |
|
|
|
c6d234 |
- fillin_rpath (copy, result, ":", 0, what, where);
|
|
|
c6d234 |
+ fillin_rpath (copy, result, ":", 0, what, where, l);
|
|
|
c6d234 |
|
|
|
c6d234 |
/* Free the copied RPATH string. `fillin_rpath' make own copies if
|
|
|
c6d234 |
necessary. */
|
|
|
c6d234 |
@@ -714,9 +722,7 @@ _dl_init_paths (const char *llp)
|
|
|
c6d234 |
const char *strp;
|
|
|
c6d234 |
struct r_search_path_elem *pelem, **aelem;
|
|
|
c6d234 |
size_t round_size;
|
|
|
c6d234 |
-#ifdef SHARED
|
|
|
c6d234 |
- struct link_map *l;
|
|
|
c6d234 |
-#endif
|
|
|
c6d234 |
+ struct link_map __attribute__ ((unused)) *l = NULL;
|
|
|
c6d234 |
/* Initialize to please the compiler. */
|
|
|
c6d234 |
const char *errstring = NULL;
|
|
|
c6d234 |
|
|
|
c6d234 |
@@ -865,7 +871,7 @@ _dl_init_paths (const char *llp)
|
|
|
c6d234 |
|
|
|
c6d234 |
(void) fillin_rpath (llp_tmp, env_path_list.dirs, ":;",
|
|
|
c6d234 |
INTUSE(__libc_enable_secure), "LD_LIBRARY_PATH",
|
|
|
c6d234 |
- NULL);
|
|
|
c6d234 |
+ NULL, l);
|
|
|
c6d234 |
|
|
|
c6d234 |
if (env_path_list.dirs[0] == NULL)
|
|
|
c6d234 |
{
|