about summary refs log tree commit diff
path: root/elf/dl-open.c
Commit message (Collapse)AuthorAgeFilesLines
* Fuller check for invalid NSID in _dl_open.Roland McGrath2015-04-171-3/+9
|
* Fix DTV race, assert, DTV_SURPLUS Static TLS limit, and nptl_db garbageAlexandre Oliva2015-03-171-11/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for ChangeLog [BZ #17090] [BZ #17620] [BZ #17621] [BZ #17628] * NEWS: Update. * elf/dl-tls.c (_dl_update_slotinfo): Clean up outdated DTV entries with Static TLS too. Skip entries past the end of the allocated DTV, from Alan Modra. (tls_get_addr_tail): Update to glibc_likely/unlikely. Move Static TLS DTV entry set up from... (_dl_allocate_tls_init): ... here (fix modid assertion), ... * elf/dl-reloc.c (_dl_nothread_init_static_tls): ... here... * nptl/allocatestack.c (init_one_static_tls): ... and here... * elf/dlopen.c (dl_open_worker): Drop l_tls_modid upper bound for Static TLS. * elf/tlsdeschtab.h (map_generation): Return size_t. Check that the slot we find is associated with the given map before using its generation count. * nptl_db/db_info.c: Include ldsodefs.h. (rtld_global, dtv_slotinfo_list, dtv_slotinfo): New typedefs. * nptl_db/structs.def (DB_RTLD_VARIABLE): New macro. (DB_MAIN_VARIABLE, DB_RTLD_GLOBAL_FIELD): Likewise. (link_map::l_tls_offset): New struct field. (dtv_t::counter): Likewise. (rtld_global): New struct. (_rtld_global): New rtld variable. (dl_tls_dtv_slotinfo_list): New rtld global field. (dtv_slotinfo_list): New struct. (dtv_slotinfo): Likewise. * nptl_db/td_symbol_list.c: Drop gnu/lib-names.h include. (td_lookup): Rename to... (td_mod_lookup): ... this. Use new mod parameter instead of LIBPTHREAD_SO. * nptl_db/td_thr_tlsbase.c: Include link.h. (dtv_slotinfo_list, dtv_slotinfo): New functions. (td_thr_tlsbase): Check DTV generation. Compute Static TLS addresses even if the DTV is out of date or missing them. * nptl_db/fetch-value.c (_td_locate_field): Do not refuse to index zero-length arrays. * nptl_db/thread_dbP.h: Include gnu/lib-names.h. (td_lookup): Make it a macro implemented in terms of... (td_mod_lookup): ... this declaration. * nptl_db/db-symbols.awk (DB_RTLD_VARIABLE): Override. (DB_MAIN_VARIABLE): Likewise.
* Fix recursive dlopen.Carlos O'Donell2015-01-211-1/+3
| | | | | | | | | | | | | | | | | | | The ability to recursively call dlopen is useful for malloc implementations that wish to load other dynamic modules that implement reentrant/AS-safe functions to use in their own implementation. Given that a user malloc implementation may be called by an ongoing dlopen to allocate memory the user malloc implementation interrupts dlopen and if it calls dlopen again that's a reentrant call. This patch fixes the issues with the ld.so.cache mapping and the _r_debug assertion which prevent this from working as expected. See: https://sourceware.org/ml/libc-alpha/2014-12/msg00446.html
* Update copyright dates with scripts/update-copyrights.Joseph Myers2015-01-021-1/+1
|
* Remove IS_IN_rtldSiddhesh Poyarekar2014-11-241-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace with IS_IN (rtld). Generated code is unchanged on x86_64. * elf/Makefile (CPPFLAGS-.os): Remove IS_IN_rtld. * elf/dl-open.c: Use IS_IN (rtld) instead if IS_IN_rtld. * elf/rtld-Rules: Likewise. * elf/setup-vdso.h: Likewise. * include/assert.h: Likewise. * include/bits/stdlib-float.h: Likewise. * include/errno.h: Likewise. * include/sys/stat.h: Likewise. * include/unistd.h: Likewise. * sysdeps/aarch64/setjmp.S: Likewise. * sysdeps/alpha/setjmp.S: Likewise. * sysdeps/arm/__longjmp.S: Likewise. * sysdeps/arm/aeabi_unwind_cpp_pr1.c: Likewise. * sysdeps/arm/setjmp.S: Likewise. * sysdeps/arm/sysdep.h: Likewise. * sysdeps/generic/_itoa.h: Likewise. * sysdeps/generic/dl-sysdep.h: Likewise. * sysdeps/generic/ldsodefs.h: Likewise. * sysdeps/i386/dl-tls.h: Likewise. * sysdeps/i386/setjmp.S: Likewise. * sysdeps/m68k/setjmp.c: Likewise. * sysdeps/mach/hurd/dl-execstack.c: Likewise. * sysdeps/mach/hurd/opendir.c: Likewise. * sysdeps/posix/getcwd.c: Likewise. * sysdeps/posix/opendir.c: Likewise. * sysdeps/posix/profil.c: Likewise. * sysdeps/powerpc/dl-procinfo.h: Likewise. * sysdeps/powerpc/powerpc32/fpu/__longjmp-common.S: Likewise. * sysdeps/powerpc/powerpc32/fpu/setjmp-common.S: Likewise. * sysdeps/powerpc/powerpc32/power4/multiarch/init-arch.h: Likewise. * sysdeps/powerpc/powerpc32/setjmp-common.S: Likewise. * sysdeps/powerpc/powerpc64/__longjmp-common.S: Likewise. * sysdeps/powerpc/powerpc64/setjmp-common.S: Likewise. * sysdeps/s390/dl-tls.h: Likewise. * sysdeps/s390/s390-32/setjmp.S: Likewise. * sysdeps/s390/s390-64/setjmp.S: Likewise. * sysdeps/sh/sh3/setjmp.S: Likewise. * sysdeps/sh/sh4/setjmp.S: Likewise. * sysdeps/unix/alpha/sysdep.h: Likewise. * sysdeps/unix/arm/sysdep.S: Likewise. * sysdeps/unix/i386/sysdep.S: Likewise. * sysdeps/unix/sysv/linux/aarch64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/getcwd.c: Likewise. * sysdeps/unix/sysv/linux/hppa/nptl/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/i386/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/i386/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/ia64/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/ia64/setjmp.S: Likewise. * sysdeps/unix/sysv/linux/ia64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/lowlevellock-futex.h: Likewise. * sysdeps/unix/sysv/linux/m68k/bits/m68k-vdso.h: Likewise. * sysdeps/unix/sysv/linux/m68k/m68k-helpers.S: Likewise. * sysdeps/unix/sysv/linux/microblaze/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sh/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/sh/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sparc/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/tile/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/tile/sysdep.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/lowlevellock.h: Likewise. * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Likewise. * sysdeps/unix/x86_64/sysdep.S: Likewise. * sysdeps/x86_64/setjmp.S: Likewise.
* Use glibc_likely instead __builtin_expect.Ondřej Bílka2014-02-101-15/+15
|
* Revert "Async-signal safe TLS."Allan McRae2014-02-061-4/+1
| | | | | | | | | This reverts commit 7f507ee17aee720fa423fa38502bc3caa0dd03d7. Conflicts: ChangeLog nptl/tst-tls7.c nptl/tst-tls7mod.c
* Async-signal safe TLS.Andrew Hunter2014-01-031-1/+4
| | | | | | | | | | | | | | | | | | | | | | ChangeLog: 2014-01-03 Andrew Hunter <ahh@google.com> * elf/dl-open.c (): New comment. * elf/dl-reloc.c (_dl_try_allocate_static_tls): Use atomic_compare_and_exchange_bool_acq (_dl_allocate_static_tls): Block signals. * elf/dl-tls.c (allocate_and_init): Return void. (_dl_update_slotinfo): Block signals, use atomic update. nptl/ChangeLog: 2014-01-03 Andrew Hunter <ahh@google.com> * nptl/Makefile (tst-tls7): New test. * nptl/tst-tls7.c: New file. * nptl/tst-tls7mod.c: New file. * nptl/allocatestack.c (init_one_static_tls): Use atomic barrier.
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-011-1/+1
|
* Fix typos.Ondřej Bílka2013-08-301-1/+1
|
* Fix typos.Ondřej Bílka2013-08-211-1/+1
|
* [BZ #15022] Correct global-scope dlopen issues in static executables.Maciej W. Rozycki2013-06-281-17/+1
| | | | | | | | This change creates a link map in static executables to serve as the global search list for dlopen. It fixes a problem with the inability to access the global symbol object and a crash on an attempt to map a DSO into the global scope. Some code that has become dead after the addition of this link map is removed too and test cases are provided.
* [BZ #15022] Avoid repeated calls to DL_STATIC_INIT for the same module.Maciej W. Rozycki2013-06-261-4/+4
|
* Avoid crashing in LD_DEBUG when program name is unavailableSiddhesh Poyarekar2013-05-291-2/+2
| | | | | | | | | Resolves: #15465 The program name may be unavailable if the user application tampers with argc and argv[]. Some parts of the dynamic linker caters for this while others don't, so this patch consolidates the check and fallback into a single macro and updates all users.
* Remove a dead declaration.Roland McGrath2013-05-061-7/+0
|
* dl_open_worker: Memset all of seen array.Carlos O'Donell2013-04-061-1/+1
| | | | | | | | | | | | | The seen array was doubled in size recently, but the memset to clear the array was not adjusted. We adjust the memset to always be correct regardless of the size of seen. --- 2013-04-06 Carlos O'Donell <carlos@redhat.com> [BZ #15309] * elf/dl-open.c (dl_open_worker): memset all of seen array.
* New function _dl_find_dso_for_objectSiddhesh Poyarekar2013-02-181-13/+27
| | | | Consolidate code to search for an address within a DSO.
* Remove bp-sym.h and BP_SYM uses from C code.Joseph Myers2013-02-141-2/+1
|
* Update copyright notices with scripts/update-copyrights.Joseph Myers2013-01-021-1/+1
|
* Check the main application only if SHARED is definedH.J. Lu2012-10-201-0/+2
|
* Clean up conditionalize of ld.so.cache support.Roland McGrath2012-10-031-2/+2
|
* Add a missing #include.Roland McGrath2012-08-141-1/+2
|
* Add SystemTap static probes to the runtime linker. [BZ #14298]Gary Benson2012-07-271-0/+15
|
* Fix a few typos.Marek Polacek2012-07-181-4/+4
|
* 2012-06-21 Jeff Law <law@redhat.com>Jeff Law2012-06-211-4/+4
| | | | | | | | [BZ #13882] * elf/dl-deps.c (_dl_map_object_deps): Fix cycle detection. Use uint16_t for elements in the "seen" array to avoid char overflows. * elf/dl-fini.c (_dl_sort_fini): Likewise. * elf/dl-open.c (dl_open_worker): Likewise.
* Replace FSF snail mail address with URLs.Paul Eggert2012-02-091-3/+2
|
* Sort objects before relocationsUlrich Drepper2012-01-271-30/+94
|
* Print message that there is no scope instead of being silentUlrich Drepper2011-08-201-0/+2
|
* Further improve printing os ELF symbol lookup scope informationUlrich Drepper2011-08-201-3/+12
|
* Improve printing of lookup scopesUlrich Drepper2011-08-161-7/+7
| | | | | | The scope of a new object should be printed earlier and when the scope of an already loaded object is extended only the changes should be printed.
* Avoid warning from last changeUlrich Drepper2011-08-161-1/+1
|
* Fix printing of scope numberUlrich Drepper2011-08-161-7/+2
|
* Implement LD_DEBUG=scopesUlrich Drepper2011-08-131-34/+31
|
* Quash some new warnings from GCC 4.6.Roland McGrath2011-06-101-3/+2
|
* Fix handling of static TLS in dlopen'ed objectsMartin von Gagern2011-05-141-25/+39
| | | | | | | | | | | | When dynamically loading a library along with several dependencies, calls to _dl_add_to_slotinfo and _dl_update_slotinfo can become intermixed. As a consequence, _dl_update_slotinfo will update the generation counter of the dtv although not all of the slots belonging to that generation have been added. Subsequent calls to _dl_add_to_slotinfo will add more slots to the same generation, for which no storage will be allocated, as the dtv generation checks will claim no work is necessary. This will lead to uninitialized dtv entries and will likely cause a SIGSEGV when thread local variables are accessed.
* Require suid bit on audit objects in privileged programsAndreas Schwab2010-10-241-1/+1
|
* Don't expand DST twice in dl_openAndreas Schwab2010-10-241-29/+0
|
* ld.so: Adjust the auxv if ld.so is directly invoked.Andreas Krebbel2010-01-151-4/+5
| | | | | | | | If a binary gets invoked by passing it as argument to ld.so the stack still holds the auxiliary vector of ld.so when entering the _start routine of the executable. So the invocation via ld.so is not fully transparent to the executable. This causes problems if the executable wants to scan the auxv itself.
* Break out _dl_scope_free into its own file.Ulrich Drepper2009-07-271-35/+0
| | | | | This reduces the coarse static callgraph that can be discovered by looking at the object files.
* Implement STB_GNU_UNIQUE handling.Ulrich Drepper2009-07-091-2/+5
| | | | | | | | | Some symbols have to be identified process-wide by their name. This is particularly important for some C++ features (e.g., class local static data and static variables in inline functions). This cannot completely be implemented with ELF functionality so far. The STB_GNU_UNIQUE binding helps by ensuring the dynamic linker will always use the same definition for all symbols with the same name and this binding.
* [BZ #10069]Ulrich Drepper2009-04-191-0/+12
| | | | | | | | 2009-04-19 Ulrich Drepper <drepper@redhat.com> [BZ #10069] * elf/dl-open.c (dl_open_worker): We cannot guarantee that we can load an object that uses static TLS if the TLS modid is higher than the reserve we always allocate. At least for multi-threaded code.
* * elf/dl-open.c (_dl_open): Bump GL(dl_nns) to 1 if no libraries cvs/fedora-glibc-20090416T1610Jakub Jelinek2009-04-161-1/+2
| | | | | | | | are dlopened in statically linked program even for __LM_ID_CALLER. 2009-04-16 Jakub Jelinek <jakub@redhat.com> * elf/dl-open.c (_dl_open): Bump GL(dl_nns) to 1 if no libraries are dlopened in statically linked program even for __LM_ID_CALLER.
* * elf/dl-open.c: Keep track of used name spaces and only iterate over cvs/fedora-glibc-20090401T0935Ulrich Drepper2009-04-011-13/+19
| | | | | | | | | | | | | | those which are used. * elf/dl-addr.c: Likewise. * elf/dl-caller.c: Likewise. * elf/dl-fini.c: Likewise. * elf/dl-iteratephdr.c: Likewise. * elf/dl-libc.c: Likewise. * elf/dl-load.c: Likewise. * elf/dl-support.c: Likewise. * elf/dl-sym.c: Likewise. * elf/rtld.c: Likewise. * sysdeps/generic/ldsodefs.h: Likewise.
* [BZ #9733]Ulrich Drepper2009-03-161-5/+6
| | | | | | | | | | | * elf/dl-load.c (_dl_map_object_from_fd): Only call audit hooks if we are not loading a new audit library. * elf/dl-reloc (_dl_relocate_object): Third parameter is now a bitmask. Only use profiling trampoline for auditing if we are not relocating an audit library. * elf/dl-open.c (dl_open_worker): Adjust _dl_relocate_object call. * elf/rtld.c: Likewise. * sysdeps/generic/ldsodefs.h: Adjust _dl_relocate_object prototype.
* * sysdeps/generic/ldsodefs.h (struct dl_scope_free_list): Store cvs/fedora-glibc-20070929T1859Ulrich Drepper2007-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | | void * pointers instead of struct link_map **. (_dl_scope_free): Change argument type to void *. * include/link.h (struct link_map): Change type of l_reldeps to struct link_map_reldeps, move l_reldepsact into that struct too. * elf/dl-deps.c: Include atomic.h. (_dl_map_object_deps): Only change l->l_initfini when it is fully populated, use _dl_scope_free for freeing it. Optimize removal of libs from reldeps by using l_reserved flag, when some removal is needed, allocate a new list instead of reallocating and free the old with _dl_scope_free. Adjust for l_reldeps and l_reldepsact changes. * elf/dl-lookup.c (add_dependency): Likewise. Reorganize to allow searching in l_initfini and l_reldeps without holding dl_load_lock. * elf/dl-fini.c (_dl_sort_fini): Adjust for l_reldeps and l_reldepsact changes. * elf/dl-close.c (_dl_close_worker): Likewise. * elf/dl-open.c (_dl_scope_free): Change argument type to void *.
* * elf/dl-close.c (free_mem): Free _dl_scope_free_list.Ulrich Drepper2007-06-201-9/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2007-06-13 Jakub Jelinek <jakub@redhat.com> * include/link.h: Don't include rtld-lowlevel.h. (struct link_map): Remove l_scope_lock. * sysdeps/generic/ldsodefs.h: Don't include rtld-lowlevel.h. (_dl_scope_free_list): New field (variable) in _rtld_global. (DL_LOOKUP_SCOPE_LOCK): Remove. (_dl_scope_free): New prototype. * elf/dl-runtime.c (_dl_fixup): Don't use __rtld_mrlock_*lock. Don't pass DL_LOOKUP_SCOPE_LOCK to _dl_lookup_symbol_x. (_dl_profile_fixup): Likewise. * elf/dl-sym.c (do_sym): Likewise. Use wrapped _dl_lookup_symbol_x whenever !RTLD_SINGLE_THREAD_P, use THREAD_GSCOPE_SET_FLAG and THREAD_GSCOPE_RESET_FLAG around it. * elf/dl-close.c (_dl_close_worker): Don't use __rtld_mrlock_{change,done}. Call _dl_scope_free on the old scope. Make sure THREAD_GSCOPE_WAIT () happens if any old scopes were queued or if l_scope_mem has been abandoned. * elf/dl-open.c (_dl_scope_free): New function. (dl_open_worker): Use it. Don't use __rtld_mrlock_{change,done}. * elf/dl-support.c (_dl_scope_free_list): New variable. * elf/dl-lookup.c (add_dependency): Remove flags argument. Remove DL_LOOKUP_SCOPE_LOCK handling. (_dl_lookup_symbol_x): Adjust caller. Remove DL_LOOKUP_SCOPE_LOCK handling. * elf/dl-object.c (_dl_new_object): Don't use __rtld_mrlock_initialize. 2007-06-19 Ulrich Drepper <drepper@redhat.com>
* * sysdeps/generic/ldsodefs.h (rtld_global): Reorder some elementsUlrich Drepper2007-06-191-3/+21
| | | | | | | | | | | | | | | | | | | | | to fill in holes (rtld_global_ro): Likewise. 2007-06-18 Jakub Jelinek <jakub@redhat.com> * elf/dl-addr.c (_dl_addr): Skip PT_LOAD checking if l_contiguous. Move PT_LOAD checking to... (_dl_addr_inside_object): ... here, new function. * elf/dl-sym.c (do_sym): If not l_contiguous, call _dl_addr_inside_object. * elf/dl-iteratephdr.c (__dl_iterate_phdr): Likewise. * dlfcn/dlinfo.c (dlinfo_doit): Likewise. * elf/dl-open.c (dl_open_worker): Likewise. (_dl_addr_inside_object): New function if IS_IN_rtld. * elf/dl-load.c (_dl_map_object_from_fd): Set l_contiguous if no holes are present or are PROT_NONE protected. * include/link.h (struct link_map): Add l_contiguous field. * sysdeps/generic/ldsodefs.h (_dl_addr_inside_object): New prototype.
* * elf/dl-close.c (_dl_close_worker): When removing object fromUlrich Drepper2007-05-191-4/+15
| | | | | | | | | | | | global scope, wait for all lookups to finish afterwards. * elf/dl-open.c (add_to_global): When global scope array must grow, allocate a new one and free old array only after all lookups finish. * elf/dl-runtime.c (_dl_fixup): Protect using global scope. (_dl_lookup_symbol_x): Likewise. * elf/dl-support.c: Define _dl_wait_lookup_done. * sysdeps/generic/ldsodefs.h (struct rtld_global): Add _dl_wait_lookup_done.
* (add_to_global): One more small cleanup patch.Ulrich Drepper2007-05-111-6/+3
|
* * elf/dl-open.c (add_to_global): Introduce variable ns to help gccUlrich Drepper2007-05-111-19/+22
| | | | | optimize. Complerely extend global scope array before making the new entries visible.