aboutsummaryrefslogtreecommitdiff
path: root/elf
AgeCommit message (Collapse)AuthorFilesLines
2013-11-21Don't use broken DL_AUTO_FUNCTION_ADDRESS()Guy Martin3-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.
2013-11-18Adjust AT_EXECFN when using explicit loader invocation.Paul Pluzhnikov2-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
2013-11-18Adjust AT_EXECFN when using explicit loader invocation.Paul Pluzhnikov1-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
2013-11-18Revert b75891075bece24be9fd85618f18af4a2daf7f1cOndřej Bílka1-16/+10
2013-11-18Fix breaking of RPATH when $ORIGIN contains colons. Fixes bug 10253Ondřej Bílka1-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.
2013-11-13Avoid passing NULL to DSO_FILENAME.Marcus Shawcroft1-1/+1
2013-11-13Handle NULL return from htab_find_slot()Marcus Shawcroft1-0/+6
2013-11-11Fix vDSO l_name for GDB's: Can't read pathname for load map: Input/output error.Jan Kratochvil1-1/+7
2013-11-03Remove unused NONTLS_INIT_TP.Ondřej Bílka1-4/+0
2013-10-20Print the reason why preloading failed in do_preload()Michael Stahl1-2/+2
2013-10-18Don't include tls.h in test casesSiddhesh Poyarekar23-41/+0
Remove tls.h includes where they are not needed.
2013-10-15Clear initfini list after freeing. Fixes bug 15308.Ondřej Bílka1-0/+1
2013-10-14ldd: make try_trace more robust and portablePatrick 'P. J.' McDermott1-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.
2013-09-30Add AArch64 relocation definitions.Petr Machata1-0/+112
2013-09-23BZ #15754: Fix test case for ARM.Carlos O'Donell1-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.
2013-09-23BZ #15754: CVE-2013-4788Carlos O'Donell3-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.
2013-09-21[BZ #15859] Fix memory leak in _dl_map_object_depsVinitha Vijayan1-1/+0
2013-09-18MIPS: IEEE 754-2008 NaN encoding supportMaciej W. Rozycki2-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
2013-09-09Fix static-binary lazy FPU context allocationMaciej W. Rozycki1-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.
2013-09-04Remove --disable-versioning.Joseph Myers1-1/+1
2013-08-30Fix typos.Ondřej Bílka1-1/+1
2013-08-29Fix typos.Ondřej Bílka1-1/+1
2013-08-21Fix typos.Ondřej Bílka5-5/+5
2013-08-20 * elf/setup-vdso.h (setup_vdso): Fix missing string termination.Andreas Arnez1-1/+1
2013-06-28Add GLRO(dl_hwcap2) for new AT_HWCAP2 auxv_t a_type.Ryan S. Arnold2-3/+11
2013-06-28Test for mprotect failure in dl-load.c (bug 12492).Pierre Ynard1-1/+5
2013-06-28Mark packed structure element used with atomic operation aligned.Nathan Froyd1-1/+12
2013-06-28[BZ #15022] Correct global-scope dlopen issues in static executables.Maciej W. Rozycki3-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.
2013-06-26[BZ #15022] Avoid repeated calls to DL_STATIC_INIT for the same module.Maciej W. Rozycki1-4/+4
2013-06-26Add AT_HWCAP2 as a new auxv_t a_type to elf.h.Ryan S. Arnold1-1/+4
2013-06-22Remove dead DL_DST_REQ_STATIC code.Maciej W. Rozycki1-13/+0
2013-06-18Use rtld-CPPFLAGS in rtld-%.os rules for generated sources.Roland McGrath1-12/+22
2013-06-13Don't let ld.so that failed its sanity check land in place.Roland McGrath1-2/+5
2013-06-06Fix leading whitespaces.Ondrej Bilka1-4/+4
2013-06-05Remove trailing whitespace.Joseph Myers5-12/+12
2013-05-29Avoid crashing in LD_DEBUG when program name is unavailableSiddhesh Poyarekar14-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.
2013-05-22Update comments in ldconfig.c and dl-hwcaps.c.Carlos O'Donell2-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.
2013-05-16Add #include <stdint.h> for uint[32|64]_t usage (except installed headers).Ryan S. Arnold7-1/+7
2013-05-14Add comments to vDSO hwcap loading process.Carlos O'Donell2-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.
2013-05-10Use *stat64 instead of *stat in installed programsFlorian Weimer1-2/+2
This ensures reliable operation on file systems with inode numbers which do not fit into 32 bits.
2013-05-09Add more comments to dlclose() algorithm.Carlos O'Donell1-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.
2013-05-06Remove a dead declaration.Roland McGrath1-7/+0
2013-05-06Split _dl_writev out from _dl_debug_vdprintf.Roland McGrath2-20/+59
2013-05-03Fix NEED_DL_SYSINFO{,_DSO} conditionalization in _dl_sysdep_start.Roland McGrath1-4/+9
2013-04-25Move x86_64-specific audit tests to sysdeps/x86_64/.Joseph Myers17-1518/+0
2013-04-16Adding MicroBlaze support to elf/elf.hDavid Holsgrove1-0/+32
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2013-04-11Fix invalid free of memory allocated during rtld initAndreas Schwab1-0/+6
2013-04-06dl_open_worker: Memset all of seen array.Carlos O'Donell1-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.
2013-03-28Make _dl_phdr pointer to const.Roland McGrath1-2/+2
2013-03-28Consolidate declarations of _dl_phdr, _dl_phnum.Roland McGrath1-4/+0