summaryrefslogtreecommitdiff
path: root/elf
diff options
context:
space:
mode:
Diffstat (limited to 'elf')
-rw-r--r--elf/dl-load.c20
-rw-r--r--elf/dl-open.c7
2 files changed, 19 insertions, 8 deletions
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 902ffc4109..36dc123c01 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -749,7 +749,25 @@ _dl_init_paths (const char *llp)
{
size_t nllp;
const char *cp = llp;
- char *llp_tmp = strdupa (llp);
+ char *llp_tmp;
+
+#ifdef SHARED
+ /* Expand DSTs. */
+ size_t cnt = DL_DST_COUNT (llp, 1);
+ if (__builtin_expect (cnt == 0, 1))
+ llp_tmp = strdupa (llp);
+ else
+ {
+ /* Determine the length of the substituted string. */
+ size_t total = DL_DST_REQUIRED (l, llp, strlen (llp), cnt);
+
+ /* Allocate the necessary memory. */
+ llp_tmp = (char *) alloca (total + 1);
+ llp_tmp = _dl_dst_substitute (l, llp, llp_tmp, 1);
+ }
+#else
+ llp_tmp = strdupa (llp);
+#endif
/* Decompose the LD_LIBRARY_PATH contents. First determine how many
elements it has. */
diff --git a/elf/dl-open.c b/elf/dl-open.c
index cdbb6601d2..8d057f82eb 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -221,13 +221,6 @@ dl_open_worker (void *a)
size_t required;
char *new_file;
- /* DSTs must not appear in SUID/SGID programs. */
- if (INTUSE(__libc_enable_secure))
- /* This is an error. */
- _dl_signal_error (0, "dlopen", NULL,
- N_("DST not allowed in SUID/SGID programs"));
-
-
/* Determine how much space we need. We have to allocate the
memory locally. */
required = DL_DST_REQUIRED (call_map, file, len, _dl_dst_count (dst, 0));