about summary refs log tree commit diff
path: root/elf
Commit message (Collapse)AuthorAgeFilesLines
* PowerPC64 ELFv2 ABI 3/6: PLT local entry point optimizationUlrich Weigand2013-12-041-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | This is a follow-on to the previous patch to support the ELFv2 ABI in the dynamic loader, split off into its own patch since it is just an optional optimization. In the ELFv2 ABI, most functions define both a global and a local entry point; the local entry requires r2 to be already set up by the caller to point to the callee's TOC; while the global entry does not require the caller to know about the callee's TOC, but it needs to set up r12 to the callee's entry point address. Now, when setting up a PLT slot, the dynamic linker will usually need to enter the target function's global entry point. However, if the linker can prove that the target function is in the same DSO as the PLT slot itself, and the whole DSO only uses a single TOC (which the linker will let ld.so know via a DT_PPC64_OPT entry), then it is possible to actually enter the local entry point address into the PLT slot, for a slight improvement in performance. Note that this uncovered a problem on the first call via _dl_runtime_resolve, because that routine neglected to restore the caller's TOC before calling the target function for the first time, since it assumed that function would always reload its own TOC anyway ...
* PowerPC64 ELFv2 ABI 2/6: Remove function descriptorsUlrich Weigand2013-12-041-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the ELFv2 ABI feature to remove function descriptors. See this GCC patch for in-depth discussion: http://gcc.gnu.org/ml/gcc-patches/2013-11/msg01141.html This mostly involves two types of changes: updating assembler source files to the new logic, and updating the dynamic loader. After the refactoring in the previous patch, most of the assembler source changes can be handled simply by providing ELFv2 versions of the macros in sysdep.h. One somewhat non-obvious change is in __GI__setjmp: this used to "fall through" to the immediately following __setjmp ENTRY point. This is no longer safe in the ELFv2 since ENTRY defines both a global and a local entry point, and you cannot simply fall through to a global entry point as it requires r12 to be set up. Also, makecontext needs to be updated to set up registers according to the new ABI for calling into the context's start routine. The dynamic linker changes mostly consist of removing special code to handle function descriptors. We also need to support the new PLT and glink format used by the the ELFv2 linker, see: https://sourceware.org/ml/binutils/2013-10/msg00376.html In addition, the dynamic linker now verifies that the dynamic libraries it loads match its own ABI. The hack in VDSO_IFUNC_RET to "synthesize" a function descriptor for vDSO routines is also no longer necessary for ELFv2.
* PowerPC64: Report overflow on @h and @ha relocationsAlan Modra2013-12-041-0/+11
| | | | | | | | | | | | | | | | | This patch updates glibc in accordance with the binutils patch checked in here: https://sourceware.org/ml/binutils/2013-10/msg00372.html This changes the various R_PPC64_..._HI and _HA relocations to report 32-bit overflows. The motivation is that existing uses of @h / @ha are to build up 32-bit offsets (for the "medium model" TOC access that GCC now defaults to), and we'd really like to see failures at link / load time rather than silent truncations. For those rare cases where a modifier is needed to build up a 64-bit constant, new relocations _HIGH / _HIGHA are supported. The patch also fixes a bug in overflow checking for the R_PPC64_ADDR30 and R_PPC64_ADDR32 relocations.
* Return fixed version of breaking of RPATH when $ORIGIN contains colonsOndřej Bílka2013-12-021-10/+16
|
* Don't use broken DL_AUTO_FUNCTION_ADDRESS()Guy Martin2013-11-213-11/+4
| | | | | | | | | | | | On hppa and ia64, the macro DL_AUTO_FUNCTION_ADDRESS() uses the variable fptr[2] in it's own scope. The content of fptr[] is thus undefined right after the macro exits. Newer gcc's (>= 4.7) reuse the stack space of this variable triggering a segmentation fault in dl-init.c:69. To fix this we rewrite the macros to make the call directly to init and fini without needing to pass back a constructed function pointer.
* Adjust AT_EXECFN when using explicit loader invocation.Paul Pluzhnikov2013-11-182-1/+5
| | | | | | | | 2013-11-18 Paul Pluzhnikov <ppluzhnikov@google.com> * elf/Makefile (tst-auxv): New test. * elf/tst-auxv.c: New * elf/rtld.c (dl_main): Adjust AT_EXECFN
* Adjust AT_EXECFN when using explicit loader invocation.Paul Pluzhnikov2013-11-181-0/+45
| | | | | | | | 2013-11-18 Paul Pluzhnikov <ppluzhnikov@google.com> * elf/Makefile (tst-auxv): New test. * elf/tst-auxv.c: New * elf/rtld.c (dl_main): Adjust AT_EXECFN
* Revert b75891075bece24be9fd85618f18af4a2daf7f1cOndřej Bílka2013-11-181-16/+10
|
* Fix breaking of RPATH when $ORIGIN contains colons. Fixes bug 10253Ondřej Bílka2013-11-181-10/+16
| | | | | | We first expanded origin and then split string by colons. This misbehaves when $ORIGIN contain colon so we first split string, then expand $ORIGIN.
* Avoid passing NULL to DSO_FILENAME.Marcus Shawcroft2013-11-131-1/+1
|
* Handle NULL return from htab_find_slot()Marcus Shawcroft2013-11-131-0/+6
|
* Fix vDSO l_name for GDB's: Can't read pathname for load map: Input/output error.Jan Kratochvil2013-11-111-1/+7
|
* Remove unused NONTLS_INIT_TP.Ondřej Bílka2013-11-031-4/+0
|
* Print the reason why preloading failed in do_preload()Michael Stahl2013-10-201-2/+2
|
* Don't include tls.h in test casesSiddhesh Poyarekar2013-10-1823-41/+0
| | | | Remove tls.h includes where they are not needed.
* Clear initfini list after freeing. Fixes bug 15308.Ondřej Bílka2013-10-151-0/+1
|
* ldd: make try_trace more robust and portablePatrick 'P. J.' McDermott2013-10-141-13/+12
| | | | | | | | | | | | | | | | | | | | | | | It was noted in 2005 (BZ #832), 2006 (BZ #3266), and 2007 [1] that ldd fails on shells other than Bash >= 3.0 because of the pipefail option around try_trace (added on 2004-12-08). EGLIBC was patched in 2008 [2] (r6912) to make the pipefail check run only on shells that support it, but RTLD output would still be lost on other shells with certain SELinux policies. This patch rewrites try_trace to work on any POSIX-conformant shell in such a way as to also work with such SELinux policies. It also obviates one difference between glibc and EGLIBC. URL: https://sourceware.org/ml/libc-alpha/2007-01/msg00041.html URL: http://www.eglibc.org/archives/patches/msg00526.html 2013-09-11 P. J. McDermott <pj@pehjota.net> [BZ #832] * elf/ldd.bash.in (try_trace): More robustly and portably work around SELinux terminal write permissions by using a command substitution instead of a pipeline and pipefail option.
* Add AArch64 relocation definitions.Petr Machata2013-09-301-0/+112
|
* BZ #15754: Fix test case for ARM.Carlos O'Donell2013-09-231-0/+3
| | | | | | | Statically built binaries use __pointer_chk_guard_local, while dynamically built binaries use __pointer_chk_guard. Provide the right definition depending on the test case we are building.
* BZ #15754: CVE-2013-4788Carlos O'Donell2013-09-233-2/+210
| | | | | | | | | | | | The pointer guard used for pointer mangling was not initialized for static applications resulting in the security feature being disabled. The pointer guard is now correctly initialized to a random value for static applications. Existing static applications need to be recompiled to take advantage of the fix. The test tst-ptrguard1-static and tst-ptrguard1 add regression coverage to ensure the pointer guards are sufficiently random and initialized to a default value.
* [BZ #15859] Fix memory leak in _dl_map_object_depsVinitha Vijayan2013-09-211-1/+0
|
* MIPS: IEEE 754-2008 NaN encoding supportMaciej W. Rozycki2013-09-182-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It has been a long practice for software using IEEE 754 floating-point arithmetic run on MIPS processors to use an encoding of Not-a-Number (NaN) data different to one used by software run on other processors. And as of IEEE 754-2008 revision [1] this encoding does not follow one recommended in the standard, as specified in section 6.2.1, where it is stated that quiet NaNs should have the first bit (d1) of their significand set to 1 while signalling NaNs should have that bit set to 0, but MIPS software interprets the two bits in the opposite manner. As from revision 3.50 [2][3] the MIPS Architecture provides for processors that support the IEEE 754-2008 preferred NaN encoding format. As the two formats (further referred to as "legacy NaN" and "2008 NaN") are incompatible to each other, tools have to provide support for the two formats to help people avoid using incompatible binary modules. The change is comprised of two functional groups of features, both of which are required for correct support. 1. Dynamic linker support. To enforce the NaN encoding requirement in dynamic linking a new ELF file header flag has been defined. This flag is set for 2008-NaN shared modules and executables and clear for legacy-NaN ones. The dynamic linker silently ignores any incompatible modules it encounters in dependency processing. To avoid unnecessary processing of incompatible modules in the presence of a shared module cache, a set of new cache flags has been defined to mark 2008-NaN modules for the three ABIs supported. Changes to sysdeps/unix/sysv/linux/mips/readelflib.c have been made following an earlier code quality suggestion made here: http://sourceware.org/ml/libc-ports/2009-03/msg00036.html and are therefore a little bit more extensive than the minimum required. Finally a new name has been defined for the dynamic linker so that 2008-NaN and legacy-NaN binaries can coexist on a single system that supports dual-mode operation and that a legacy dynamic linker that does not support verifying the 2008-NaN ELF file header flag is not chosen to interpret a 2008-NaN binary by accident. 2. Floating environment support. IEEE 754-2008 features are controlled in the Floating-Point Control and Status (FCSR) register and updates are needed to floating environment support so that the 2008-NaN flag is set correctly and the kernel default, inferred from the 2008-NaN ELF file header flag at the time an executable is loaded, respected. As the NaN encoding format is a property of GCC code generation that is both a user-selected GCC configuration default and can be overridden with GCC options, code that needs to know what NaN encoding standard it has been configured for checks for the __mips_nan2008 macro that is defined internally by GCC whenever the 2008-NaN mode has been selected. This mode is determined at the glibc configuration time and therefore a few consistency checks have been added to catch cases where compilation flags have been overridden by the user. The 2008 NaN set of features relies on kernel support as the in-kernel floating-point emulator needs to be aware of the NaN encoding used even on hard-float processors and configure the FPU context according to the value of the 2008 NaN ELF file header flag of the executable being started. As at this time work on kernel support is still in progress and the relevant changes have not made their way yet to linux.org master repository. Therefore the minimum version supported has been artificially set to 10.0.0 so that 2008-NaN code is not accidentally run on a Linux kernel that does not suppport it. It is anticipated that the version is adjusted later on to the actual initial linux.org kernel version to support this feature. Legacy NaN encoding support is unaffected, older kernel versions remain supported. [1] "IEEE Standard for Floating-Point Arithmetic", IEEE Computer Society, IEEE Std 754-2008, 29 August 2008 [2] "MIPS Architecture For Programmers, Volume I-A: Introduction to the MIPS32 Architecture", MIPS Technologies, Inc., Document Number: MD00082, Revision 3.50, September 20, 2012 [3] "MIPS Architecture For Programmers, Volume I-A: Introduction to the MIPS64 Architecture", MIPS Technologies, Inc., Document Number: MD00083, Revision 3.50, September 20, 2012
* Fix static-binary lazy FPU context allocationMaciej W. Rozycki2013-09-091-0/+6
| | | | | | | | | | | | | | | | | | | Long ago static startup did not parse the auxiliary vector and therefore could not get at any `AT_FPUCW' tag to check whether upon FPU context allocation the kernel would use a FPU control word setting different to that provided by the `__fpu_control' variable. Static startup therefore always initialized the FPU control word, forcing immediate FPU context allocation even for binaries that otherwise never used the FPU. As from GIT commit f8f900ecb9096ec47f5b7bb7626e29223c69061a static startup supports parsing the auxiliary vector, so now it can avoid explicit initialization of the FPU control word, just as can dynamic startup, in the usual case where the setting written to the FPU control word would be the same as the kernel uses. This defers FPU context allocation until the binary itself actually pokes at the FPU. Note that the `AT_FPUCW' tag is usually absent from the auxiliary vector in which case _FPU_DEFAULT is assumed to be the kernel default.
* Remove --disable-versioning.Joseph Myers2013-09-041-1/+1
|
* Fix typos.Ondřej Bílka2013-08-301-1/+1
|
* Fix typos.Ondřej Bílka2013-08-291-1/+1
|
* Fix typos.Ondřej Bílka2013-08-215-5/+5
|
* * elf/setup-vdso.h (setup_vdso): Fix missing string termination.Andreas Arnez2013-08-201-1/+1
|
* Add GLRO(dl_hwcap2) for new AT_HWCAP2 auxv_t a_type.Ryan S. Arnold2013-06-282-3/+11
|
* Test for mprotect failure in dl-load.c (bug 12492).Pierre Ynard2013-06-281-1/+5
|
* Mark packed structure element used with atomic operation aligned.Nathan Froyd2013-06-281-1/+12
|
* [BZ #15022] Correct global-scope dlopen issues in static executables.Maciej W. Rozycki2013-06-283-31/+46
| | | | | | | | 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
|
* Add AT_HWCAP2 as a new auxv_t a_type to elf.h.Ryan S. Arnold2013-06-261-1/+4
|
* Remove dead DL_DST_REQ_STATIC code.Maciej W. Rozycki2013-06-221-13/+0
|
* Use rtld-CPPFLAGS in rtld-%.os rules for generated sources.Roland McGrath2013-06-181-12/+22
|
* Don't let ld.so that failed its sanity check land in place.Roland McGrath2013-06-131-2/+5
|
* Fix leading whitespaces.Ondrej Bilka2013-06-061-4/+4
|
* Remove trailing whitespace.Joseph Myers2013-06-055-12/+12
|
* Avoid crashing in LD_DEBUG when program name is unavailableSiddhesh Poyarekar2013-05-2914-49/+92
| | | | | | | | | 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 comments in ldconfig.c and dl-hwcaps.c.Carlos O'Donell2013-05-222-8/+10
| | | | | | | | | | | | | | | | | In dl-hwcaps.c the comment read that rounding was done to ElfW(Addr), but it's actually rounded to ElfW(Word). In ldconfig.c we make each comment a sentence and mention that the "tls" pseudo-hwcap is just for legacy installations where TLS was optional. --- 2013-05-22 Carlos O'Donell <carlos@redhat.com> * elf/ldconfig.c (is_hwcap_platform): Make comments full setences. (main): Mention "tls" pseudo-hwcap is legacy. * elf/dl-hwcaps.c (_dl_important_hwcaps): Correct rounding comment.
* Add #include <stdint.h> for uint[32|64]_t usage (except installed headers).Ryan S. Arnold2013-05-167-1/+7
|
* Add comments to vDSO hwcap loading process.Carlos O'Donell2013-05-142-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Loading of the vDSO pseudo-hwcap from the type 2 GNU note is a rather arcane and poorly documented process. Given that I had a chance to review this code today I thought I would add all of the things I had to lookup to verify the validity of the process. With a single .note.GNU the vDSO can register up to 64 flags, though in practice you are limited to 64 - _DL_FIRST_EXTRA bits which on x86 is 12 bits. The only use of this that I know of is in the Xen support in Linux where they use the 1st bit to indicate "nosegneg". I see "We use bit 1 to avoid bugs in some versions of glibc when bit 0 is used; the choice is otherwise arbitrary.", but no reference to a glibc bug anywhere. The code as-is should support bit zero, so we still have that free for future use. The kernel, glibc, and ld.so.cache must coordinate to ensure that bit values don't go too high and are used consistently. --- 2013-05-13 Carlos O'Donell <carlos@redhat.com> * elf/dl-hwcaps.c (_dl_important_hwcaps): Comment vDSO hwcap loading. * elf/ldconfig.c (is_hwcap_platform): Comment each hwcap check. (main): Comment "tls" pseudo-hwcap.
* Use *stat64 instead of *stat in installed programsFlorian Weimer2013-05-101-2/+2
| | | | | This ensures reliable operation on file systems with inode numbers which do not fit into 32 bits.
* Add more comments to dlclose() algorithm.Carlos O'Donell2013-05-091-0/+6
| | | | | | | | | | | | | | The algorithm for scanning dependencies upon dlclose is less than immediately obvious. This patch adds two bits of comments that explain why you start the dependency search at l_initfini[1], and why you need to restart the search. --- 2013-05-09 Carlos O'Donell <carlos@redhat.com> * elf/dl-close.c (_dl_close_worker): Add comments.
* Remove a dead declaration.Roland McGrath2013-05-061-7/+0
|
* Split _dl_writev out from _dl_debug_vdprintf.Roland McGrath2013-05-062-20/+59
|
* Fix NEED_DL_SYSINFO{,_DSO} conditionalization in _dl_sysdep_start.Roland McGrath2013-05-031-4/+9
|
* Move x86_64-specific audit tests to sysdeps/x86_64/.Joseph Myers2013-04-2517-1518/+0
|
* Adding MicroBlaze support to elf/elf.hDavid Holsgrove2013-04-161-0/+32
| | | | Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>