about summary refs log tree commit diff
path: root/elf/dl-lookup.c
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright dates with scripts/update-copyrights.Joseph Myers2019-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* elf: Accept absolute (SHN_ABS) symbols whose value is zero [BZ #23307]Maciej W. Rozycki2018-06-291-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have this condition in `check_match' (in elf/dl-lookup.c): if (__glibc_unlikely ((sym->st_value == 0 /* No value. */ && stt != STT_TLS) || ELF_MACHINE_SYM_NO_MATCH (sym) || (type_class & (sym->st_shndx == SHN_UNDEF)))) return NULL; which causes all !STT_TLS symbols whose value is zero to be silently ignored in lookup. This may make sense for regular symbols, however not for absolute (SHN_ABS) ones, where zero is like any value, there's no special meaning attached to it. Consequently legitimate programs fail, for example taking the `elf/tst-absolute-sym' test case, substituting 0 for 0x55aa in `elf/tst-absolute-sym-lib.lds' and then trying to run the resulting program we get this: $ .../elf/tst-absolute-sym .../elf/tst-absolute-sym: symbol lookup error: .../elf/tst-absolute-sym-lib.so: undefined symbol: absolute $ even though the symbol clearly is there: $ readelf --dyn-syms .../elf/tst-absolute-sym-lib.so | grep '\babsolute\b' 7: 00000000 0 NOTYPE GLOBAL DEFAULT ABS absolute $ The check for the zero value has been there since forever or commit d66e34cd4234/08162fa88891 ("Implemented runtime dynamic linker to support ELF shared libraries.") dating back to May 2nd 1995, and the problem triggers regardless of commit e7feec374c63 ("elf: Correct absolute (SHN_ABS) symbol run-time calculation [BZ #19818]") being present or not. Fix the issue then, by permitting `sym->st_value' to be 0 for SHN_ABS symbols in lookup. [BZ #23307] * elf/dl-lookup.c (check_match): Do not reject a symbol whose `st_value' is 0 if `st_shndx' is SHN_ABS. * elf/tst-absolute-zero.c: New file. * elf/tst-absolute-zero-lib.c: New file. * elf/tst-absolute-zero-lib.lds: New file. * elf/Makefile (tests): Add `tst-absolute-zero'. (modules-names): Add `tst-absolute-zero-lib'. (LDLIBS-tst-absolute-zero-lib.so): New variable. ($(objpfx)tst-absolute-zero-lib.so): New dependency. ($(objpfx)tst-absolute-zero: New dependency.
* Use ADDRIDX with DT_GNU_HASHH.J. Lu2018-02-051-6/+2
| | | | | | | | | | The only differences in ld.so are line numbers for asserts. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> * elf/dl-addr.c (determine_info): Use ADDRIDX with DT_GNU_HASH. * elf/dl-lookup.c (_dl_setup_hash): Likewise. * elf/get-dynamic-info.h (elf_get_dynamic_info): Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-011-1/+1
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* elf: Remove internal_function attributeFlorian Weimer2017-08-311-5/+0
|
* ld.so: Introduce struct dl_exceptionFlorian Weimer2017-08-101-32/+16
| | | | | | This commit separates allocating and raising exceptions. This simplifies catching and re-raising them because it is no longer necessary to make a temporary, on-stack copy of the exception message.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2017-01-011-1/+1
|
* Treat STV_HIDDEN and STV_INTERNAL symbols as STB_LOCALMaciej W. Rozycki2016-07-011-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a reference to PR ld/19908 make ld.so respect symbol export classes aka visibility and treat STV_HIDDEN and STV_INTERNAL symbols as local, preventing such symbols from preempting exported symbols. According to the ELF gABI[1] neither STV_HIDDEN nor STV_INTERNAL symbols are supposed to be present in linked binaries: "A hidden symbol contained in a relocatable object must be either removed or converted to STB_LOCAL binding by the link-editor when the relocatable object is included in an executable file or shared object." "An internal symbol contained in a relocatable object must be either removed or converted to STB_LOCAL binding by the link-editor when the relocatable object is included in an executable file or shared object." however some GNU binutils versions produce such symbols in some cases. PR ld/19908 is one and we also have this note in scripts/abilist.awk: so clearly there is linked code out there which contains such symbols which is prone to symbol table misinterpretation, and it'll be more productive if we handle this gracefully, under the Robustness Principle: "be liberal in what you accept, and conservative in what you produce", especially as this is a simple (STV_HIDDEN|STV_INTERNAL) => STB_LOCAL mapping. References: [1] "System V Application Binary Interface - DRAFT - 24 April 2001", The Santa Cruz Operation, Inc., "Symbol Table", <http://www.sco.com/developers/gabi/2001-04-24/ch4.symtab.html> * sysdeps/generic/ldsodefs.h (dl_symbol_visibility_binds_local_p): New inline function. * elf/dl-addr.c (determine_info): Treat hidden and internal symbols as local. * elf/dl-lookup.c (do_lookup_x): Likewise. * elf/dl-reloc.c (RESOLVE_MAP): Likewise.
* Report dlsym, dlvsym lookup errors using dlerror [BZ #19509]Florian Weimer2016-03-311-1/+0
| | | | | | | | * elf/dl-lookup.c (_dl_lookup_symbol_x): Report error even if skip_map != NULL. * elf/tst-dlsym-error.c: New file. * elf/Makefile (tests): Add tst-dlsym-error. (tst-dlsym-error): Link against libdl.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2016-01-041-1/+1
|
* Keep only ELF_RTYPE_CLASS_{PLT|COPY} bits for prelinkH.J. Lu2015-11-071-2/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | prelink runs ld.so with the environment variable LD_TRACE_PRELINKING set to dump the relocation type class from _dl_debug_bindings. prelink has the following relocation type classes: #define RTYPE_CLASS_VALID 8 #define RTYPE_CLASS_PLT (8|1) #define RTYPE_CLASS_COPY (8|2) #define RTYPE_CLASS_TLS (8|4) where ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA has a conflict with RTYPE_CLASS_TLS. Since prelink only uses ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits, we should clear the other bits when the DL_DEBUG_PRELINK bit is set. [BZ #19178] * elf/dl-lookup.c (RTYPE_CLASS_VALID): New. (RTYPE_CLASS_PLT): Likewise. (RTYPE_CLASS_COPY): Likewise. (RTYPE_CLASS_TLS): Likewise. (_dl_debug_bindings): Use RTYPE_CLASS_TLS and RTYPE_CLASS_VALID to set relocation type class for DL_DEBUG_PRELINK. Keep only ELF_RTYPE_CLASS_PLT and ELF_RTYPE_CLASS_COPY bits for DL_DEBUG_PRELINK.
* Move bits/libc-lock.h and bits/libc-lockP.h out of bits/ (bug 14912).Joseph Myers2015-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was noted in <https://sourceware.org/ml/libc-alpha/2012-09/msg00305.html> that the bits/*.h naming scheme should only be used for installed headers. This patch renames bits/libc-lock.h to plain libc-lock.h and bits/libc-lockP.h to plain libc-lockP.h to follow that convention. Note that I don't know where libc-lockP.h comes from for Hurd (the Hurd libc-lock.h includes libc-lockP.h, but the only libc-lockP.h in the glibc source tree is for NPTL) - some unmerged patch? - but I updated the #include in the Hurd libc-lock.h anyway. Tested for x86_64 (testsuite, and that installed stripped shared libraries are unchanged by the patch). [BZ #14912] * bits/libc-lock.h: Move to ... * sysdeps/generic/libc-lock.h: ...here. (_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H. * sysdeps/mach/hurd/bits/libc-lock.h: Move to ... * sysdeps/mach/hurd/libc-lock.h: ...here. (_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H. [_LIBC]: Include <libc-lockP.h> instead of <bits/libc-lockP.h>. * sysdeps/mach/bits/libc-lock.h: Move to ... * sysdeps/mach/libc-lock.h: ...here. (_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H. * sysdeps/nptl/bits/libc-lock.h: Move to ... * sysdeps/nptl/libc-lock.h: ...here. (_BITS_LIBC_LOCK_H): Rename macro to _LIBC_LOCK_H. * sysdeps/nptl/bits/libc-lockP.h: Move to ... * sysdeps/nptl/libc-lockP.h: ...here. (_BITS_LIBC_LOCKP_H): Rename macro to _LIBC_LOCKP_H. * crypt/crypt_util.c: Include <libc-lock.h> instead of <bits/libc-lock.h>. * dirent/scandir-tail.c: Likewise. * dlfcn/dlerror.c: Likewise. * elf/dl-close.c: Likewise. * elf/dl-iteratephdr.c: Likewise. * elf/dl-lookup.c: Likewise. * elf/dl-open.c: Likewise. * elf/dl-support.c: Likewise. * elf/dl-writev.h: Likewise. * elf/rtld.c: Likewise. * grp/fgetgrent.c: Likewise. * gshadow/fgetsgent.c: Likewise. * gshadow/sgetsgent.c: Likewise. * iconv/gconv_conf.c: Likewise. * iconv/gconv_db.c: Likewise. * iconv/gconv_dl.c: Likewise. * iconv/gconv_int.h: Likewise. * iconv/gconv_trans.c: Likewise. * include/link.h: Likewise. * inet/getnameinfo.c: Likewise. * inet/getnetgrent.c: Likewise. * inet/getnetgrent_r.c: Likewise. * intl/bindtextdom.c: Likewise. * intl/dcigettext.c: Likewise. * intl/finddomain.c: Likewise. * intl/gettextP.h: Likewise. * intl/loadmsgcat.c: Likewise. * intl/localealias.c: Likewise. * intl/textdomain.c: Likewise. * libidn/idn-stub.c: Likewise. * libio/libioP.h: Likewise. * locale/duplocale.c: Likewise. * locale/freelocale.c: Likewise. * locale/newlocale.c: Likewise. * locale/setlocale.c: Likewise. * login/getutent_r.c: Likewise. * login/getutid_r.c: Likewise. * login/getutline_r.c: Likewise. * login/utmp-private.h: Likewise. * login/utmpname.c: Likewise. * malloc/mtrace.c: Likewise. * misc/efgcvt.c: Likewise. * misc/error.c: Likewise. * misc/fstab.c: Likewise. * misc/getpass.c: Likewise. * misc/mntent.c: Likewise. * misc/syslog.c: Likewise. * nis/nis_call.c: Likewise. * nis/nis_callback.c: Likewise. * nis/nss-default.c: Likewise. * nis/nss_compat/compat-grp.c: Likewise. * nis/nss_compat/compat-initgroups.c: Likewise. * nis/nss_compat/compat-pwd.c: Likewise. * nis/nss_compat/compat-spwd.c: Likewise. * nis/nss_nis/nis-alias.c: Likewise. * nis/nss_nis/nis-ethers.c: Likewise. * nis/nss_nis/nis-grp.c: Likewise. * nis/nss_nis/nis-hosts.c: Likewise. * nis/nss_nis/nis-network.c: Likewise. * nis/nss_nis/nis-proto.c: Likewise. * nis/nss_nis/nis-pwd.c: Likewise. * nis/nss_nis/nis-rpc.c: Likewise. * nis/nss_nis/nis-service.c: Likewise. * nis/nss_nis/nis-spwd.c: Likewise. * nis/nss_nisplus/nisplus-alias.c: Likewise. * nis/nss_nisplus/nisplus-ethers.c: Likewise. * nis/nss_nisplus/nisplus-grp.c: Likewise. * nis/nss_nisplus/nisplus-hosts.c: Likewise. * nis/nss_nisplus/nisplus-initgroups.c: Likewise. * nis/nss_nisplus/nisplus-network.c: Likewise. * nis/nss_nisplus/nisplus-proto.c: Likewise. * nis/nss_nisplus/nisplus-pwd.c: Likewise. * nis/nss_nisplus/nisplus-rpc.c: Likewise. * nis/nss_nisplus/nisplus-service.c: Likewise. * nis/nss_nisplus/nisplus-spwd.c: Likewise. * nis/ypclnt.c: Likewise. * nptl/libc_pthread_init.c: Likewise. * nss/getXXbyYY.c: Likewise. * nss/getXXent.c: Likewise. * nss/getXXent_r.c: Likewise. * nss/nss_db/db-XXX.c: Likewise. * nss/nss_db/db-netgrp.c: Likewise. * nss/nss_db/nss_db.h: Likewise. * nss/nss_files/files-XXX.c: Likewise. * nss/nss_files/files-alias.c: Likewise. * nss/nsswitch.c: Likewise. * posix/regex_internal.h: Likewise. * posix/wordexp.c: Likewise. * pwd/fgetpwent.c: Likewise. * resolv/res_hconf.c: Likewise. * resolv/res_libc.c: Likewise. * shadow/fgetspent.c: Likewise. * shadow/lckpwdf.c: Likewise. * shadow/sgetspent.c: Likewise. * socket/opensock.c: Likewise. * stdio-common/reg-modifier.c: Likewise. * stdio-common/reg-printf.c: Likewise. * stdio-common/reg-type.c: Likewise. * stdio-common/vfprintf.c: Likewise. * stdio-common/vfscanf.c: Likewise. * stdlib/abort.c: Likewise. * stdlib/cxa_atexit.c: Likewise. * stdlib/fmtmsg.c: Likewise. * stdlib/random.c: Likewise. * stdlib/setenv.c: Likewise. * string/strsignal.c: Likewise. * sunrpc/auth_none.c: Likewise. * sunrpc/bindrsvprt.c: Likewise. * sunrpc/create_xid.c: Likewise. * sunrpc/key_call.c: Likewise. * sunrpc/rpc_thread.c: Likewise. * sysdeps/arm/backtrace.c: Likewise. * sysdeps/generic/ldsodefs.h: Likewise. * sysdeps/generic/stdio-lock.h: Likewise. * sysdeps/generic/unwind-dw2-fde.c: Likewise. * sysdeps/i386/backtrace.c: Likewise. * sysdeps/ieee754/ldbl-opt/nldbl-compat.c: Likewise. * sysdeps/m68k/backtrace.c: Likewise. * sysdeps/mach/hurd/cthreads.c: Likewise. * sysdeps/mach/hurd/dirstream.h: Likewise. * sysdeps/mach/hurd/malloc-machine.h: Likewise. * sysdeps/nptl/malloc-machine.h: Likewise. * sysdeps/nptl/stdio-lock.h: Likewise. * sysdeps/posix/dirstream.h: Likewise. * sysdeps/posix/getaddrinfo.c: Likewise. * sysdeps/posix/system.c: Likewise. * sysdeps/pthread/aio_suspend.c: Likewise. * sysdeps/s390/s390-32/backtrace.c: Likewise. * sysdeps/s390/s390-64/backtrace.c: Likewise. * sysdeps/unix/sysv/linux/check_pf.c: Likewise. * sysdeps/unix/sysv/linux/if_index.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/getutent_r.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/getutid_r.c: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/getutline_r.c: Likewise. * sysdeps/unix/sysv/linux/shm-directory.c: Likewise. * sysdeps/unix/sysv/linux/system.c: Likewise. * sysdeps/x86_64/backtrace.c: Likewise. * time/alt_digit.c: Likewise. * time/era.c: Likewise. * time/tzset.c: Likewise. * wcsmbs/wcsmbsload.c: Likewise. * nptl/tst-initializers1.c (do_test): Refer to <libc-lock.h> instead of <bits/libc-lock.h> in comment.
* Add ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA to x86H.J. Lu2015-03-311-1/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | With copy relocation, address of protected data defined in the shared library may be external. When there is a relocation against the protected data symbol within the shared library, we need to check if we should skip the definition in the executable copied from the protected data. This patch adds ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA and defines it for x86. If ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA isn't 0, do_lookup_x will skip the data definition in the executable from copy reloc. [BZ #17711] * elf/dl-lookup.c (do_lookup_x): When UNDEF_MAP is NULL, which indicates it is called from do_lookup_x on relocation against protected data, skip the data definion in the executable from copy reloc. (_dl_lookup_symbol_x): Pass ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA, instead of ELF_RTYPE_CLASS_PLT, to do_lookup_x for EXTERN_PROTECTED_DATA relocation against STT_OBJECT symbol. * sysdeps/generic/ldsodefs.h * (ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA): New. Defined to 4 if DL_EXTERN_PROTECTED_DATA is defined, otherwise to 0. * sysdeps/i386/dl-lookupcfg.h (DL_EXTERN_PROTECTED_DATA): New. * sysdeps/i386/dl-machine.h (elf_machine_type_class): Set class to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for R_386_GLOB_DAT. * sysdeps/x86_64/dl-lookupcfg.h (DL_EXTERN_PROTECTED_DATA): New. * sysdeps/x86_64/dl-machine.h (elf_machine_type_class): Set class to ELF_RTYPE_CLASS_EXTERN_PROTECTED_DATA for R_X86_64_GLOB_DAT.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2015-01-021-1/+1
|
* Remove unnecessarily nested function in do_lookup_unique.Roland McGrath2014-10-081-27/+30
|
* elf/dl-lookup.c: Use __glibc_likely and __glibc_unlikelyWill Newton2014-06-231-20/+19
| | | | | | | | | | | | | | | | Convert all uses of __builtin_expect to __glibc_likely and __glibc_unlikely. Most of these are trivial boolean expressions but a few were not. In particular the use of __builtin_expect in the switch expression in do_lookup_x has been removed. Verified that there are no code changes on x86_64 and ARM aside from line numbers. ChangeLog: 2014-06-23 Will Newton <will.newton@linaro.org> * elf/dl-lookup.c: Use __glibc_unlikely and __glibc_likely rather than __builtin_expect.
* elf/dl-lookup.c: Remove unnecessary static variableWill Newton2014-06-231-4/+1
| | | | | | | | | | | | undefined_msg is only used once contrary to the comment. ChangeLog: 2014-06-23 Will Newton <will.newton@linaro.org> * elf/dl-lookup.c (undefined_msg): Remove variable. (_dl_lookup_symbol_x): Replace undefined_msg with string literal.
* elf/dl-lookup.c: Move STB_GNU_UNIQUE handling to a functionWill Newton2014-06-231-145/+159
| | | | | | | | | | | | | | | | Move handling of STB_GNU_UNIQUE symbols to a separate function from do_lookup_x in order to make the code more readable. The new function gets inlined with gcc 4.8 on ARM and the do_lookup_x code becomes a few bytes smaller. ChangeLog: 2014-06-23 Will Newton <will.newton@linaro.org> * elf/dl-lookup.c (do_lookup_unique): New function. (do_lookup_x): Move STB_GNU_UNIQUE handling code to a separate function.
* elf/dl-lookup.c: Remove obsolete comment about nested functionWill Newton2014-04-031-5/+4
| | | | | | | | | | | | The nested function referred to has gone away so remove the comment. Also move the variable declaration down to where other variables of a similar lifetime are declared for clarity. 2014-04-03 Will Newton <will.newton@linaro.org> * elf/dl-lookup.c (do_lookup_x): Remove comment referring to nested function and move variable declarations down to before first use.
* Promote do_lookup_x:check_match to a full function.Carlos O'Donell2014-02-281-104/+122
| | | | | | | | | | | | | | | | | While it may be argued that nested functions make the resulting code easier to read, or worse to read the following two bugs make it difficult to debug: Bug 8300 - no local symbol information within nested or nesting procedures https://sourceware.org/bugzilla/show_bug.cgi?id=8300 Bug 53927 - wrong value for DW_AT_static_link http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53927 Until these are fixed I've made check_match a full function. After they are fixed we can resume arguing about the merits of nested functions on readability and maintenance.
* Merge MIPS dl-lookup.c into generic file.Joseph Myers2014-02-111-0/+8
| | | | | | | | | | | | | | | | | | | | | | | MIPS has its own version of dl-lookup.c to deal with differences between undefined symbol semantics in the PIC and non-PIC ABIs. This is often liable to get out of date with respect to the generic file (for example, the recent __builtin_expect changes didn't cover ports, and it's not obvious to anyone changing dl-lookup.c that there would be architecture-specific versions). This patch adds a macro that dl-machine.h can define that is used in the appropriate place in dl-lookup.c, so that MIPS no longer needs its own version of that file. Tested for mips64 that the only changes to disassembly of installed shared libraries appear to be ld.so changes attributable to different line numbers and paths in assertions. * elf/dl-lookup.c (ELF_MACHINE_SYM_NO_MATCH): Define if not already defined. (do_lookup_x): Use ELF_MACHINE_SYM_NO_MATCH. * sysdeps/mips/dl-lookup.c: Remove. * sysdeps/mips/dl-machine.h (ELF_MACHINE_SYM_NO_MATCH): New macro.
* Use glibc_likely instead __builtin_expect.Ondřej Bílka2014-02-101-14/+14
|
* Update copyright notices with scripts/update-copyrightsAllan McRae2014-01-011-1/+1
|
* Avoid passing NULL to DSO_FILENAME.Marcus Shawcroft2013-11-131-1/+1
|
* Avoid crashing in LD_DEBUG when program name is unavailableSiddhesh Poyarekar2013-05-291-15/+7
| | | | | | | | | 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.
* Update copyright notices with scripts/update-copyrights.Joseph Myers2013-01-021-1/+1
|
* Add a missing #include.Roland McGrath2012-08-141-1/+2
|
* Fix DL_DEBUG_UNUSED to elide the VDSO and handle PLT references properly.David S. Miller2012-04-051-1/+2
| | | | | | | | | | * elf/rtld.c (dl_main): If DL_DEBUG_UNUSED is enabled, turn off lazy binding. * elf/dl-lookup (_dl_lookup_symbol_x): If DL_DEBUG_UNUSED, ignore undefined symbol errors. * elf/rtlc.c (dl_main): Skip VDSO when checking for unused DT_NEEDED entries.
* Replace FSF snail mail address with URLs.Paul Eggert2012-02-091-3/+2
|
* Avoid warning in dl-lookup.cUlrich Drepper2011-10-291-2/+2
|
* Fix resizing able for unique symbols when adding symbol for copy relocationPiotr Bury2011-05-121-27/+20
|
* Remove doubled words.Jim Meyering2011-04-221-1/+1
|
* Fix copy relocations handling of unique objects.Ulrich Drepper2011-03-101-4/+14
|
* Fix handling of STB_GNU_UNIQUE in LD_TRACE_PRELINKINGUlrich Drepper2010-03-241-2/+52
|
* Avoid ELF lookup race.Ulrich Drepper2009-12-151-3/+4
| | | | | | On some architectures the update of the l_used field in the lookup functions races with setting the other bits in the bitfield. Simply avoid this and optimize use of l_used in general.
* Fix expanding STB_GNU_UNIQUE hash table.Andreas Schwab2009-08-071-1/+1
| | | | | An invalid symbol name pointer was entered into the hash table while enlarging it.
* Preserve SSE registers in runtime relocations on x86-64.Ulrich Drepper2009-07-291-0/+13
| | | | | | | | | | SSE registers are used for passing parameters and must be preserved in runtime relocations. This is inside ld.so enforced through the tests in tst-xmmymm.sh. But the malloc routines used after startup come from libc.so and can be arbitrarily complex. It's overkill to save the SSE registers all the time because of that. These calls are rare. Instead we save them on demand. The new infrastructure put in place in this patch makes this possible and efficient.
* Fix STB_GNU_UNIQUE handling for > 30 unique symbols.Jakub Jelinek2009-07-271-2/+3
| | | | | | | | | | | | | There were several issues when the initial 31 entries hashtab filled up. size * 3 <= tab->n_elements is always false, table can't have more elements than its size. I assume from libiberty/hashtab.c this meant to be check for 3/4 full. Even after fixing that, _dl_higher_prime_number (31) apparently returns 31, only _dl_higher_prime_number (32) returns 61. And, size variable wasn't updated during reallocation, which means during reallocation the insertion of the new entry was done into a wrong spot. All this lead to a hang in ld.so, because a search with n_elements 31 size 31 wouldn't ever terminate.
* Minor optimization of unloading prevention patch.Ulrich Drepper2009-07-231-5/+5
| | | | | | References to unique symbols from copy relocations can only come from executables which cannot be unloaded anyway. Optimize the code to set the unload flag a bit.
* Fix comment.Ulrich Drepper2009-07-231-1/+1
|
* Some more fixes for the unique symbol handling.Ulrich Drepper2009-07-231-5/+4
| | | | | The hash value can be zero, so we need a different test for empty slots. And unify the way we prevent a DSO from being unloaded.
* Handle unloading of DSO with a unique symbol definition.Ulrich Drepper2009-07-231-2/+9
|
* Remove do-lookup.h.Ulrich Drepper2009-07-101-2/+365
| | | | | It is not necessary/useful anymore to have the content separate from dl-lookup.c.
* Implement STB_GNU_UNIQUE handling.Ulrich Drepper2009-07-091-3/+3
| | | | | | | | | 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.
* libc part of prelink IFUNC support.Jakub Jelinek2009-06-151-6/+11
| | | | | | The dl-lookup.c changes are needed for prelink (support in prelink checked into SVN, tested for both i?86 and x86-64), dl-irel.h just something I discovered by code inspection.
* * sysdeps/generic/ldsodefs.h (struct dl_scope_free_list): Store cvs/fedora-glibc-20070929T1859Ulrich Drepper2007-09-291-48/+108
| | | | | | | | | | | | | | | | | | | | | 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-lookup.c (add_dependency): Handle failing memory cvs/fedora-glibc-20070920T0007Ulrich Drepper2007-09-191-6/+6
| | | | allocation for dependency list. Remove unnecessary check.
* * sysdeps/generic/ldsodefs.h (DL_LOOKUP_GSCOPE_LOCK): New definition.Ulrich Drepper2007-09-181-23/+60
| | | | | | | | | | | | | | | * elf/dl-runtime.c (_dl_fixup, _dl_profile_fixup): Or in DL_LOOKUP_GSCOPE_LOCK into flags after THREAD_GSCOPE_SET_FLAG (). * elf/dl-sym.c (do_sym): Likewise. * include/link.h (struct link_map): Add l_serial field. * elf/dl-object.c (_dl_new_object): Initialize l_serial. * elf/dl-lookup.c (add_dependency): Add flags argument. Remember map->l_serial, if DL_LOOKUP_GSCOPE_LOCK is among flags, use THREAD_GSCOPE_RESET_FLAG before and THREAD_GSCOPE_SET_FLAG after __rtld_lock_lock_recursive (GL(dl_load_lock)) to avoid deadlock. Don't dereference map until it has been found on some list. If map->l_serial changed, return -1.
* * elf/dl-close.c (free_mem): Free _dl_scope_free_list.Ulrich Drepper2007-06-201-22/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* * elf/dl-lookup.c (_dl_lookup_symbol_x): Remove use of r_nlist.Ulrich Drepper2007-06-091-7/+3
|