diff options
Diffstat (limited to 'ldso/ldso/ldso.c')
-rwxr-xr-x[-rw-r--r--] | ldso/ldso/ldso.c | 51 |
1 files changed, 26 insertions, 25 deletions
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c index b33547670..435bd43bc 100644..100755 --- a/ldso/ldso/ldso.c +++ b/ldso/ldso/ldso.c @@ -73,6 +73,7 @@ char *_dl_debug_reloc = NULL; char *_dl_debug_detail = NULL; char *_dl_debug_nofixups = NULL; char *_dl_debug_bindings = NULL; +char *_dl_debug_vdso = NULL; int _dl_debug_file = 2; #endif @@ -350,10 +351,9 @@ static void trace_objects(struct elf_resolve *tpnt, char *str_name) static struct elf_resolve * add_ldso(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, ElfW(Addr) ldso_mapaddr, - ElfW(auxv_t) auxvt[AT_EGID + 1], struct dyn_elf *rpnt) { - ElfW(Ehdr) *epnt = (ElfW(Ehdr) *) auxvt[AT_BASE].a_un.a_val; + ElfW(Ehdr) *epnt = (ElfW(Ehdr) *) _dl_auxvt[AT_BASE].a_un.a_val; ElfW(Phdr) *myppnt = (ElfW(Phdr) *) DL_RELOC_ADDR(DL_GET_RUN_ADDR(load_addr, ldso_mapaddr), epnt->e_phoff); @@ -422,7 +422,7 @@ static void _dl_setup_progname(const char *argv0) } void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, - ElfW(auxv_t) auxvt[AT_EGID + 1], char **envp, char **argv + char **envp, char **argv DL_GET_READY_TO_RUN_EXTRA_PARMS) { ElfW(Addr) app_mapaddr = 0, ldso_mapaddr = 0; @@ -461,7 +461,7 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, _dl_memset(app_tpnt, 0, sizeof(*app_tpnt)); /* Store the page size for later use */ - _dl_pagesize = (auxvt[AT_PAGESZ].a_un.a_val) ? (size_t) auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE; + _dl_pagesize = (_dl_auxvt[AT_PAGESZ].a_un.a_val) ? (size_t) _dl_auxvt[AT_PAGESZ].a_un.a_val : PAGE_SIZE; /* Make it so _dl_malloc can use the page of memory we have already * allocated. We shouldn't need to grab any more memory. This must * be first since things like _dl_dprintf() use _dl_malloc()... @@ -485,7 +485,7 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, #endif #ifndef __LDSO_STANDALONE_SUPPORT__ - if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) { + if (_start == (void *) _dl_auxvt[AT_ENTRY].a_un.a_val) { _dl_dprintf(2, "Standalone execution is not enabled\n"); _dl_exit(1); } @@ -504,10 +504,10 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, * Note that for SUID programs we ignore the settings in * LD_LIBRARY_PATH. */ - if ((auxvt[AT_UID].a_un.a_val == (size_t)-1 && _dl_suid_ok()) || - (auxvt[AT_UID].a_un.a_val != (size_t)-1 && - auxvt[AT_UID].a_un.a_val == auxvt[AT_EUID].a_un.a_val && - auxvt[AT_GID].a_un.a_val == auxvt[AT_EGID].a_un.a_val)) { + if ((_dl_auxvt[AT_UID].a_un.a_val == (size_t)-1 && _dl_suid_ok()) || + (_dl_auxvt[AT_UID].a_un.a_val != (size_t)-1 && + _dl_auxvt[AT_UID].a_un.a_val == _dl_auxvt[AT_EUID].a_un.a_val && + _dl_auxvt[AT_GID].a_un.a_val == _dl_auxvt[AT_EGID].a_un.a_val)) { _dl_secure = 0; #ifdef __LDSO_PRELOAD_ENV_SUPPORT__ _dl_preload = _dl_getenv("LD_PRELOAD", envp); @@ -546,7 +546,7 @@ void *_dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, #endif #ifdef __LDSO_STANDALONE_SUPPORT__ - if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) { + if (_start == (void *) _dl_auxvt[AT_ENTRY].a_un.a_val) { ElfW(Addr) *aux_dat = (ElfW(Addr) *) argv; int argc = (int) aux_dat[-1]; @@ -643,11 +643,11 @@ of this helper program; chances are you did not intend to run this program.\n\ */ { unsigned int idx; - ElfW(Phdr) *phdr = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val; + ElfW(Phdr) *phdr = (ElfW(Phdr) *) _dl_auxvt[AT_PHDR].a_un.a_val; - for (idx = 0; idx < auxvt[AT_PHNUM].a_un.a_val; idx++, phdr++) + for (idx = 0; idx < _dl_auxvt[AT_PHNUM].a_un.a_val; idx++, phdr++) if (phdr->p_type == PT_PHDR) { - DL_INIT_LOADADDR_PROG(app_tpnt->loadaddr, auxvt[AT_PHDR].a_un.a_val - phdr->p_vaddr); + DL_INIT_LOADADDR_PROG(app_tpnt->loadaddr, _dl_auxvt[AT_PHDR].a_un.a_val - phdr->p_vaddr); break; } @@ -662,8 +662,8 @@ of this helper program; chances are you did not intend to run this program.\n\ */ debug_addr = _dl_zalloc(sizeof(struct r_debug)); - ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val; - for (i = 0; i < auxvt[AT_PHNUM].a_un.a_val; i++, ppnt++) { + ppnt = (ElfW(Phdr) *) _dl_auxvt[AT_PHDR].a_un.a_val; + for (i = 0; i < _dl_auxvt[AT_PHNUM].a_un.a_val; i++, ppnt++) { if (ppnt->p_type == PT_GNU_RELRO) { relro_addr = ppnt->p_vaddr; relro_size = ppnt->p_memsz; @@ -685,8 +685,8 @@ of this helper program; chances are you did not intend to run this program.\n\ int j; ElfW(Phdr) *ppnt_outer = ppnt; _dl_debug_early("calling mprotect on the application program\n"); - ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val; - for (j = 0; j < auxvt[AT_PHNUM].a_un.a_val; j++, ppnt++) { + ppnt = (ElfW(Phdr) *) _dl_auxvt[AT_PHDR].a_un.a_val; + for (j = 0; j < _dl_auxvt[AT_PHNUM].a_un.a_val; j++, ppnt++) { if (ppnt->p_type == PT_LOAD && !(ppnt->p_flags & PF_W)) _dl_mprotect((void *) (DL_RELOC_ADDR(app_tpnt->loadaddr, ppnt->p_vaddr) & PAGE_ALIGN), (DL_RELOC_ADDR(app_tpnt->loadaddr, ppnt->p_vaddr) & ADDR_ALIGN) + @@ -713,8 +713,8 @@ of this helper program; chances are you did not intend to run this program.\n\ (unsigned long) DL_RELOC_ADDR(app_tpnt->loadaddr, ppnt->p_vaddr), ppnt->p_filesz); _dl_loaded_modules->libtype = elf_executable; - _dl_loaded_modules->ppnt = (ElfW(Phdr) *) auxvt[AT_PHDR].a_un.a_val; - _dl_loaded_modules->n_phent = auxvt[AT_PHNUM].a_un.a_val; + _dl_loaded_modules->ppnt = (ElfW(Phdr) *) _dl_auxvt[AT_PHDR].a_un.a_val; + _dl_loaded_modules->n_phent = _dl_auxvt[AT_PHNUM].a_un.a_val; _dl_symbol_tables = rpnt = _dl_zalloc(sizeof(struct dyn_elf)); rpnt->dyn = _dl_loaded_modules; app_tpnt->mapaddr = app_mapaddr; @@ -792,7 +792,7 @@ of this helper program; chances are you did not intend to run this program.\n\ if (_dl_debug) { if (_dl_strstr(_dl_debug, "all")) { _dl_debug_detail = _dl_debug_move = _dl_debug_symbols - = _dl_debug_reloc = _dl_debug_bindings = _dl_debug_nofixups = (void*)1; + = _dl_debug_reloc = _dl_debug_bindings = _dl_debug_nofixups = _dl_debug_vdso = (void*)1; } else { _dl_debug_detail = _dl_strstr(_dl_debug, "detail"); _dl_debug_move = _dl_strstr(_dl_debug, "move"); @@ -800,6 +800,7 @@ of this helper program; chances are you did not intend to run this program.\n\ _dl_debug_reloc = _dl_strstr(_dl_debug, "reloc"); _dl_debug_nofixups = _dl_strstr(_dl_debug, "nofix"); _dl_debug_bindings = _dl_strstr(_dl_debug, "bind"); + _dl_debug_vdso = _dl_strstr(_dl_debug, "vdso"); } } @@ -856,7 +857,7 @@ of this helper program; chances are you did not intend to run this program.\n\ } #endif - ldso_mapaddr = (ElfW(Addr)) auxvt[AT_BASE].a_un.a_val; + ldso_mapaddr = (ElfW(Addr)) _dl_auxvt[AT_BASE].a_un.a_val; /* * OK, fix one more thing - set up debug_addr so it will point * to our chain. Later we may need to fill in more fields, but this @@ -1046,7 +1047,7 @@ of this helper program; chances are you did not intend to run this program.\n\ if (!ldso_tpnt) { /* Insert the ld.so only once */ ldso_tpnt = add_ldso(tpnt, load_addr, - ldso_mapaddr, auxvt, rpnt); + ldso_mapaddr, rpnt); } else { ldso_tpnt->init_flag |= DL_OPENED2; } @@ -1148,7 +1149,7 @@ of this helper program; chances are you did not intend to run this program.\n\ * again once all libs are loaded. */ if (!ldso_tpnt) { - tpnt = add_ldso(tpnt, load_addr, ldso_mapaddr, auxvt, rpnt); + tpnt = add_ldso(tpnt, load_addr, ldso_mapaddr, rpnt); tpnt->usage_count++; nscope_elem++; } else @@ -1450,11 +1451,11 @@ of this helper program; chances are you did not intend to run this program.\n\ _dl_debug_state(); #ifdef __LDSO_STANDALONE_SUPPORT__ - if (_start == (void *) auxvt[AT_ENTRY].a_un.a_val) + if (_start == (void *) _dl_auxvt[AT_ENTRY].a_un.a_val) return (void *) app_tpnt->l_entry; else #endif - return (void *) auxvt[AT_ENTRY].a_un.a_val; + return (void *) _dl_auxvt[AT_ENTRY].a_un.a_val; } #include "dl-hash.c" |