Commit Graph

2010 Commits

Author SHA1 Message Date
Guy Martin daf75146de Don't use broken DL_AUTO_FUNCTION_ADDRESS()
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-21 15:52:31 -05:00
Paul Pluzhnikov 5c3499508e Adjust AT_EXECFN when using explicit loader invocation.
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-18 15:11:55 -08:00
Paul Pluzhnikov 038b56f3da Adjust AT_EXECFN when using explicit loader invocation.
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-18 15:11:30 -08:00
Ondřej Bílka 246a7c1bc2 Revert b75891075b 2013-11-18 23:42:58 +01:00
Ondřej Bílka b75891075b Fix breaking of RPATH when $ORIGIN contains colons. Fixes bug 10253
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-18 19:59:46 +01:00
Marcus Shawcroft 50727aa76b Avoid passing NULL to DSO_FILENAME. 2013-11-13 12:40:31 +00:00
Marcus Shawcroft a615be4675 Handle NULL return from htab_find_slot() 2013-11-13 12:37:41 +00:00
Jan Kratochvil 9182aa6799 Fix vDSO l_name for GDB's: Can't read pathname for load map: Input/output error. 2013-11-11 18:03:58 +01:00
Ondřej Bílka 17c8c3dc72 Remove unused NONTLS_INIT_TP. 2013-11-03 18:15:24 +01:00
Michael Stahl 4db5b08f91 Print the reason why preloading failed in do_preload() 2013-10-20 10:34:09 +02:00
Siddhesh Poyarekar c7738d0822 Don't include tls.h in test cases
Remove tls.h includes where they are not needed.
2013-10-18 19:45:36 +05:30
Ondřej Bílka 4b1a6d8bc9 Clear initfini list after freeing. Fixes bug 15308. 2013-10-15 09:47:33 +02:00
Patrick 'P. J.' McDermott 94bf958a94 ldd: make try_trace more robust and portable
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-10-14 01:57:46 -04:00
Petr Machata fd96752258 Add AArch64 relocation definitions. 2013-09-30 12:38:10 +01:00
Carlos O'Donell 0b1f8e3564 BZ #15754: Fix test case for ARM.
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-23 01:44:38 -04:00
Carlos O'Donell c61b4d41c9 BZ #15754: CVE-2013-4788
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-23 00:52:09 -04:00
Vinitha Vijayan f5f4e7b48b [BZ #15859] Fix memory leak in _dl_map_object_deps 2013-09-21 19:18:23 +02:00
Maciej W. Rozycki 9c21573c02 MIPS: IEEE 754-2008 NaN encoding support
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-18 21:33:50 +01:00
Maciej W. Rozycki 95e7cf295e Fix static-binary lazy FPU context allocation
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 f8f900ecb9 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-09 22:36:57 +01:00
Joseph Myers 3f2e46a494 Remove --disable-versioning. 2013-09-04 15:25:42 +00:00
Ondřej Bílka 382466e04e Fix typos. 2013-08-30 18:08:59 +02:00
Ondřej Bílka 6f65e66895 Fix typos. 2013-08-29 09:11:45 +02:00
Ondřej Bílka c0c3f78afb Fix typos. 2013-08-21 19:48:48 +02:00
Andreas Arnez f315524e03 * elf/setup-vdso.h (setup_vdso): Fix missing string termination. 2013-08-20 14:03:04 +02:00
Ryan S. Arnold 1ae8bfe07c Add GLRO(dl_hwcap2) for new AT_HWCAP2 auxv_t a_type. 2013-06-28 16:50:48 -05:00
Pierre Ynard 0432680e8c Test for mprotect failure in dl-load.c (bug 12492). 2013-06-28 21:43:42 +00:00
Nathan Froyd ce61a2ad2e Mark packed structure element used with atomic operation aligned. 2013-06-28 21:42:19 +00:00
Maciej W. Rozycki f91f1c0fb8 [BZ #15022] Correct global-scope dlopen issues in static executables.
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-28 16:22:20 +01:00
Maciej W. Rozycki b003710377 [BZ #15022] Avoid repeated calls to DL_STATIC_INIT for the same module. 2013-06-26 19:14:29 +01:00
Ryan S. Arnold c18c701d03 Add AT_HWCAP2 as a new auxv_t a_type to elf.h. 2013-06-26 08:50:20 -05:00
Maciej W. Rozycki d1d5471579 Remove dead DL_DST_REQ_STATIC code. 2013-06-22 00:39:42 +01:00
Roland McGrath bfcacbdec0 Use rtld-CPPFLAGS in rtld-%.os rules for generated sources. 2013-06-18 16:29:25 -07:00
Roland McGrath f4a29fba07 Don't let ld.so that failed its sanity check land in place. 2013-06-13 10:26:44 -07:00
Ondrej Bilka 350635a59a Fix leading whitespaces. 2013-06-06 20:36:07 +02:00
Joseph Myers 9c84384cc1 Remove trailing whitespace. 2013-06-05 20:44:03 +00:00
Siddhesh Poyarekar b937534868 Avoid crashing in LD_DEBUG when program name is unavailable
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-29 21:34:12 +05:30
Carlos O'Donell 13e23af76e Update comments in ldconfig.c and dl-hwcaps.c.
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-22 23:22:36 -04:00
Ryan S. Arnold e054f49430 Add #include <stdint.h> for uint[32|64]_t usage (except installed headers). 2013-05-16 11:32:54 -05:00
Carlos O'Donell 141af660d8 Add comments to vDSO hwcap loading process.
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-14 00:06:35 -04:00
Florian Weimer 4c0fe6fe42 Use *stat64 instead of *stat in installed programs
This ensures reliable operation on file systems with inode numbers
which do not fit into 32 bits.
2013-05-10 11:42:17 +02:00
Carlos O'Donell 3612972234 Add more comments to dlclose() algorithm.
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-09 17:37:15 -04:00
Roland McGrath 976e2f0381 Remove a dead declaration. 2013-05-06 17:06:50 -07:00
Roland McGrath d5e8275481 Split _dl_writev out from _dl_debug_vdprintf. 2013-05-06 11:30:41 -07:00
Roland McGrath 60bfd54cbb Fix NEED_DL_SYSINFO{,_DSO} conditionalization in _dl_sysdep_start. 2013-05-03 15:09:48 -07:00
Joseph Myers 73709b2611 Move x86_64-specific audit tests to sysdeps/x86_64/. 2013-04-25 19:23:11 +00:00
David Holsgrove 9fbf9acabe Adding MicroBlaze support to elf/elf.h
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
2013-04-16 09:48:08 +10:00
Andreas Schwab 273cdee86d Fix invalid free of memory allocated during rtld init 2013-04-11 09:22:05 +02:00
Carlos O'Donell 7208a313b9 dl_open_worker: Memset all of seen array.
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-04-06 17:00:02 -04:00
Roland McGrath dc0a026385 Make _dl_phdr pointer to const. 2013-03-28 15:39:32 -07:00
Roland McGrath 3d3436ae68 Consolidate declarations of _dl_phdr, _dl_phnum. 2013-03-28 15:33:57 -07:00