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