summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2006-11-23 04:51:08 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2006-11-23 04:51:08 +0000
commit6504bb4ce73d3504f1df5fe5b9ea3e763a439089 (patch)
tree9dba284f36113b382417323e87c96594b1164179
parent8ad49563faf129758be04b2ccd263fcf102162c9 (diff)
downloaduClibc-alpine-6504bb4ce73d3504f1df5fe5b9ea3e763a439089.tar.bz2
uClibc-alpine-6504bb4ce73d3504f1df5fe5b9ea3e763a439089.tar.xz
Fix regression that showed up from merge done on 20060619. Test 'tst-tls6' was giving an incorrect return code due to memory being dynamically allocated on the stack. This is not allowed when using TLS.
-rw-r--r--ldso/ldso/dl-elf.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c
index 03d7c7a8b..866b2560a 100644
--- a/ldso/ldso/dl-elf.c
+++ b/ldso/ldso/dl-elf.c
@@ -136,13 +136,26 @@ static struct elf_resolve *
search_for_named_library(const char *name, int secure, const char *path_list,
struct dyn_elf **rpnt)
{
+#ifdef USE_TLS
+ char *path, *path_n;
+ char mylibname[2050];
+#else
char *path, *path_n, *mylibname;
+#endif
struct elf_resolve *tpnt;
int done;
if (path_list==NULL)
return NULL;
+#ifdef USE_TLS
+ /* We need a writable copy of this string */
+ path = _dl_strdup(path_list);
+ if (!path) {
+ _dl_dprintf(2, "Out of memory!\n");
+ _dl_exit(0);
+ }
+#else
/* We need a writable copy of this string, but we don't
* need this allocated permanently since we don't want
* to leak memory, so use alloca to put path on the stack */
@@ -152,17 +165,8 @@ search_for_named_library(const char *name, int secure, const char *path_list,
/* another bit of local storage */
mylibname = alloca(2050);
- /* gcc inlines alloca using a single instruction adjusting
- * the stack pointer and no stack overflow check and thus
- * no NULL error return. No point leaving in dead code... */
-#if 0
- if (!path || !mylibname) {
- _dl_dprintf(2, "Out of memory!\n");
- _dl_exit(0);
- }
-#endif
-
_dl_memcpy(path, path_list, done+1);
+#endif
/* Unlike ldd.c, don't bother to eliminate double //s */