diff options
Diffstat (limited to 'ldso')
| -rw-r--r-- | ldso/include/dl-syscall.h | 6 | ||||
| -rw-r--r-- | ldso/include/unsecvars.h | 13 | ||||
| -rw-r--r-- | ldso/ldso/dl-elf.c | 4 | ||||
| -rw-r--r-- | ldso/ldso/ldso.c | 36 | ||||
| -rw-r--r-- | ldso/ldso/powerpc/elfinterp.c | 10 |
5 files changed, 49 insertions, 20 deletions
diff --git a/ldso/include/dl-syscall.h b/ldso/include/dl-syscall.h index d4348afc0..70b79f6cf 100644 --- a/ldso/include/dl-syscall.h +++ b/ldso/include/dl-syscall.h @@ -105,6 +105,12 @@ static inline _syscall0(gid_t, _dl_getpid); #define __NR__dl_readlink __NR_readlink static inline _syscall3(int, _dl_readlink, const char *, path, char *, buf, size_t, bufsiz); +#ifdef __UCLIBC_HAS_SSP__ +#include <sys/time.h> +#define __NR__dl_gettimeofday __NR_gettimeofday +static inline _syscall2(int, _dl_gettimeofday, struct timeval *, tv, struct timezone *, tz); +#endif + #ifdef __NR_mmap #ifdef MMAP_HAS_6_ARGS #define __NR__dl_mmap __NR_mmap diff --git a/ldso/include/unsecvars.h b/ldso/include/unsecvars.h index 0d996a91f..3555934e3 100644 --- a/ldso/include/unsecvars.h +++ b/ldso/include/unsecvars.h @@ -5,22 +5,21 @@ */ #define UNSECURE_ENVVARS \ - "LD_AOUT_PRELOAD\0" \ - "LD_AOUT_LIBRARY_PATH\0" \ "LD_PRELOAD\0" \ "LD_LIBRARY_PATH\0" \ "LD_DEBUG\0" \ "LD_DEBUG_OUTPUT\0" \ "LD_TRACE_LOADED_OBJECTS\0" \ - "HOSTALIASES\0" \ - "LOCALDOMAIN\0" \ - "RES_OPTIONS\0" \ "TMPDIR\0" /* + * LD_TRACE_LOADED_OBJECTS is not in glibc-2.3.5's unsecvars.h + * though used by ldd + * * These environment variables are defined by glibc but ignored in * uClibc, but may very well have an equivalent in uClibc. * - * MALLOC_TRACE, RESOLV_HOST_CONF, TZDIR, GCONV_PATH, LD_USE_LOAD_BIAS, - * LD_PROFILE, LD_ORIGIN_PATH, LOCPATH, NLSPATH + * LD_ORIGIN_PATH, LD_PROFILE, LD_USE_LOAD_BIAS, LD_DYNAMIC_WEAK, LD_SHOW_AUXV, + * GCONV_PATH, GETCONF_DIR, HOSTALIASES, LOCALDOMAIN, LOCPATH, MALLOC_TRACE, + * NLSPATH, RESOLV_HOST_CONF, RES_OPTIONS, TZDIR */ diff --git a/ldso/ldso/dl-elf.c b/ldso/ldso/dl-elf.c index 6b1ccd047..ca7470fa3 100644 --- a/ldso/ldso/dl-elf.c +++ b/ldso/ldso/dl-elf.c @@ -729,7 +729,9 @@ int _dl_fixup(struct dyn_elf *rpnt, int now_flag) ElfW(Addr) reloc_addr; if (rpnt->next) - goof += _dl_fixup(rpnt->next, now_flag); + goof = _dl_fixup(rpnt->next, now_flag); + if (goof) + return goof; tpnt = rpnt->dyn; if(!(tpnt->init_flag & RELOCS_DONE)) diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index 197392a0e..43bbe675e 100644 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -89,6 +89,16 @@ static struct elf_resolve **init_fini_list; static int nlist; /* # items in init_fini_list */ extern void _start(void); +#ifdef __UCLIBC_HAS_SSP__ +#include <dl-osinfo.h> +#ifndef THREAD_SET_STACK_GUARD +/* Only exported for architectures that don't store the stack guard canary + * in local thread area. */ +uintptr_t __stack_chk_guard attribute_relro; +strong_alias(__stack_chk_guard,__guard) +#endif +#endif + static void __attribute__ ((destructor)) __attribute_used__ _dl_fini(void) { int i; @@ -116,7 +126,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr, ElfW(Phdr) *ppnt; ElfW(Dyn) *dpnt; char *lpntstr; - int i, goof = 0, unlazy = 0, trace_loaded_objects = 0; + int i, unlazy = 0, trace_loaded_objects = 0; struct dyn_elf *rpnt; struct elf_resolve *tcurr; struct elf_resolve *tpnt1; @@ -201,9 +211,20 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr, } #if USE_TLS + _dl_error_catch_tsd = &_dl_initial_error_catch_tsd; _dl_init_static_tls = &_dl_nothread_init_static_tls; #endif +#ifdef __UCLIBC_HAS_SSP__ + /* Set up the stack checker's canary. */ + uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard (); +# ifdef THREAD_SET_STACK_GUARD + THREAD_SET_STACK_GUARD (stack_chk_guard); +# else + __stack_chk_guard = stack_chk_guard; +# endif +#endif + /* At this point we are now free to examine the user application, * and figure out which libraries are supposed to be called. Until * we have this list, we will not be completely ready for dynamic @@ -775,7 +796,13 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr, * order so that COPY directives work correctly. */ if (_dl_symbol_tables) - goof += _dl_fixup(_dl_symbol_tables, unlazy); + if (_dl_fixup(_dl_symbol_tables, unlazy)) + _dl_exit(-1); + + for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) { + if (tpnt->relro_size) + _dl_protect_relro (tpnt); + } /* OK, at this point things are pretty much ready to run. Now we need * to touch up a few items that are required, and then we can let the @@ -828,11 +855,6 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr, } } - for (tpnt = _dl_loaded_modules; tpnt; tpnt = tpnt->next) { - if (tpnt->relro_size) - _dl_protect_relro (tpnt); - } - /* Find the real malloc function and make ldso functions use that from now on */ _dl_malloc_function = (void* (*)(size_t)) (intptr_t) _dl_find_hash("malloc", _dl_symbol_tables, NULL, ELF_RTYPE_CLASS_PLT); diff --git a/ldso/ldso/powerpc/elfinterp.c b/ldso/ldso/powerpc/elfinterp.c index 4ec459854..3dd12f0ee 100644 --- a/ldso/ldso/powerpc/elfinterp.c +++ b/ldso/ldso/powerpc/elfinterp.c @@ -138,7 +138,7 @@ unsigned long _dl_linux_resolver(struct elf_resolve *tpnt, int reloc_entry) finaladdr = (Elf32_Addr) _dl_find_hash(symname, tpnt->symbol_scope, tpnt, ELF_RTYPE_CLASS_PLT); if (unlikely(!finaladdr)) { - _dl_dprintf(2, "%s: can't resolve symbol '%s'\n", _dl_progname, symname); + _dl_dprintf(2, "%s: can't resolve symbol '%s' in lib '%s'.\n", _dl_progname, symname, tpnt->libname); _dl_exit(1); }; finaladdr += this_reloc->r_addend; @@ -379,15 +379,15 @@ _dl_parse(struct elf_resolve *tpnt, struct dyn_elf *scope, { int reloc_type = ELF32_R_TYPE(rpnt->r_info); #if defined (__SUPPORT_LD_DEBUG__) - _dl_dprintf(2, "can't handle reloc type %s\n ", _dl_reltypes(reloc_type)); + _dl_dprintf(2, "can't handle reloc type '%s' in lib '%s'\n", _dl_reltypes(reloc_type), tpnt->libname); #else - _dl_dprintf(2, "can't handle reloc type %x\n", reloc_type); + _dl_dprintf(2, "can't handle reloc type %x in lib '%s'\n", reloc_type, tpnt->libname); #endif - _dl_exit(-res); + return res; } if (unlikely(res >0)) { - _dl_dprintf(2, "can't resolve symbol\n"); + _dl_dprintf(2, "can't resolve symbol in lib '%s'.\n", tpnt->libname); return res; } } |
