X-Git-Url: https://rtime.felk.cvut.cz/gitweb/l4.git/blobdiff_plain/f4122e6e085938b6d216a9ec724b974a603f6992..983fe7c4ac262f56d38a143b1efab1e4afb77a52:/l4/pkg/uclibc/lib/contrib/uclibc/ldso/ldso/ldso.c.orig diff --git a/l4/pkg/uclibc/lib/contrib/uclibc/ldso/ldso/ldso.c.orig b/l4/pkg/uclibc/lib/contrib/uclibc/ldso/ldso/ldso.c.orig index b9b150072..8d8b733da 100644 --- a/l4/pkg/uclibc/lib/contrib/uclibc/ldso/ldso/ldso.c.orig +++ b/l4/pkg/uclibc/lib/contrib/uclibc/ldso/ldso/ldso.c.orig @@ -47,7 +47,9 @@ /* Global variables used within the shared library loader */ char *_dl_library_path = NULL; /* Where we look for libraries */ +#ifdef __LDSO_PRELOAD_ENV_SUPPORT__ char *_dl_preload = NULL; /* Things to be loaded before the libs */ +#endif char *_dl_ldsopath = NULL; /* Location of the shared lib loader */ int _dl_errno = 0; /* We can't use the real errno in ldso */ size_t _dl_pagesize = 0; /* Store the page size for use later */ @@ -390,7 +392,9 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, 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)) { _dl_secure = 0; +#ifdef __LDSO_PRELOAD_ENV_SUPPORT__ _dl_preload = _dl_getenv("LD_PRELOAD", envp); +#endif _dl_library_path = _dl_getenv("LD_LIBRARY_PATH", envp); } else { static const char unsecure_envvars[] = @@ -407,7 +411,9 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, /* We could use rawmemchr but this need not be fast. */ nextp = _dl_strchr(nextp, '\0') + 1; } while (*nextp != '\0'); +#ifdef __LDSO_PRELOAD_ENV_SUPPORT__ _dl_preload = NULL; +#endif _dl_library_path = NULL; /* SUID binaries can be exploited if they do LAZY relocation. */ unlazy = RTLD_NOW; @@ -418,19 +424,6 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, _dl_init_static_tls = &_dl_nothread_init_static_tls; #endif -#ifdef __UCLIBC_HAS_SSP__ - /* Set up the stack checker's canary. */ - stack_chk_guard = _dl_setup_stack_chk_guard (); -# ifdef THREAD_SET_STACK_GUARD - THREAD_SET_STACK_GUARD (stack_chk_guard); -# ifdef __UCLIBC_HAS_SSP_COMPAT__ - __guard = stack_chk_guard; -# endif -# 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 @@ -667,6 +660,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, _dl_map_cache(); +#ifdef __LDSO_PRELOAD_ENV_SUPPORT__ if (_dl_preload) { char c, *str, *str2; @@ -722,6 +716,7 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, str++; } } +#endif /* __LDSO_PRELOAD_ENV_SUPPORT__ */ #ifdef __LDSO_PRELOAD_FILE_SUPPORT__ do { @@ -990,6 +985,19 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, DL_LOADADDR_TYPE load_addr, tcbp = init_tls (); } #endif +#ifdef __UCLIBC_HAS_SSP__ + /* Set up the stack checker's canary. */ + stack_chk_guard = _dl_setup_stack_chk_guard (); +# ifdef THREAD_SET_STACK_GUARD + THREAD_SET_STACK_GUARD (stack_chk_guard); +# ifdef __UCLIBC_HAS_SSP_COMPAT__ + __guard = stack_chk_guard; +# endif +# else + __stack_chk_guard = stack_chk_guard; +# endif +#endif + _dl_debug_early("Beginning relocation fixups\n");