Commit Graph

329 Commits

Author SHA1 Message Date
Ondřej Bílka 2a939a7e6d Return fixed version of breaking of RPATH when $ORIGIN contains colons 2013-12-02 14:53:14 +01: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
Ondřej Bílka c0c3f78afb Fix typos. 2013-08-21 19:48:48 +02:00
Pierre Ynard 0432680e8c Test for mprotect failure in dl-load.c (bug 12492). 2013-06-28 21:43:42 +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
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
Andreas Schwab 273cdee86d Fix invalid free of memory allocated during rtld init 2013-04-11 09:22:05 +02:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
H.J. Lu c515fb5148 Cast to __intptr_t before casting pointer to int64 2012-11-26 16:45:36 -08:00
Chris Metcalf 47cc1490e0 Invoke DL_AFTER_LOAD if defined
This hook is useful for any arch-specific functionality that
should be done on loaded objects.  For the tile architecture,
the hook is already provided (though we switch to using the new
macro name with this commit) and implements a simulator notifier
so that the simulator can load Elf symbols to match the object
and generate better error messages for PC's.

Also, remove a spurious definition of DL_UNMAP in dl-runtime.c
2012-10-30 14:16:18 -04:00
Siddhesh Poyarekar 88481c1638 Retry read in ld.so if the entire ELF header is not read in
[BZ #13601]

A read operation could return less than requested data for a number of
reasons.
2012-10-20 08:03:54 +05:30
Roland McGrath f57f805541 Clean up conditionalize of ld.so.cache support. 2012-10-03 16:13:14 -07:00
Roland McGrath 408223d403 Use ElfW(Off) rather than off_t for offsets within ELF files. 2012-10-02 16:02:56 -07:00
Roland McGrath 4b4f2771c2 Fix dl-load.c for [!_LIBC_REENTRANT] case. 2012-08-15 17:05:10 -07:00
Gary Benson 815e6fa3e0 Add SystemTap static probes to the runtime linker. [BZ #14298] 2012-07-27 14:03:20 +01:00
Siddhesh Poyarekar 73d65cc378 New ld.so argument --inhibit-ldcache to disable ld.so.cache lookup
It may sometimes be desirable to make the dynamic linker only pick up
libraries from the library path and rpath and not look at the
ld.so.cache that ldconfig generates. An example of such a use case is
the glibc testsuite where the dynamic linker must not be influenced by
any external paths or caches.

This change adds a new option --inhibit-ldcache that when used, tells
the dynamic linker to not use ld.so.cache even if it is available.
2012-04-11 00:13:52 +05:30
Paul Eggert 59ba27a63a Replace FSF snail mail address with URLs. 2012-02-09 23:18:22 +00:00
Marek Polacek fde56e5cc5 elf/dl-load.c: Avoid warning 2011-10-07 11:00:13 -04:00
Andreas Schwab 610f9ab43e Fix crash during error handling 2011-09-08 12:03:11 +02:00
Ulrich Drepper b49865be8e Use O_CLOEXEC when loading objects in ld.so 2011-09-08 00:00:01 -04:00
Ulrich Drepper c966526aa4 Fix memory leak in case of failed dlopen 2011-09-07 22:58:47 -04:00
Ulrich Drepper 07df30d995 Better check for last patch
Don't indicate that dependencies of dynamically loaded objects are
also dynamically loaded.
2011-08-12 13:32:10 -04:00
Ulrich Drepper 9ac533d31b Better debug information from ld.so
Differentiate between loading as a dependency and loading on request.
2011-08-12 13:20:11 -04:00
Ulrich Drepper 22836f52e3 Fix up testing for valid $ORIGIN use 2011-05-11 00:15:38 -04:00
Ulrich Drepper 47c3cd7a74 Allow $ORIGIN to reference trusted directoreis in SUID binaries. 2011-05-07 11:44:26 -04:00
Andreas Schwab 34fe483e12 Don't leave empty element in rpath when skipping an element 2011-04-09 14:55:26 -04:00
Ulrich Drepper 6a5ee1029b Fix loading first object along a path when tracing. 2011-03-06 00:01:50 -05:00
Andreas Schwab 4bff6e0175 Fix memory leak in dlopen with RTLD_NOLOAD. 2011-02-25 20:49:48 -05:00
Ryan S. Arnold 30950a5fd2 Make PowerPC64 default to nonexecutable stack 2010-12-19 22:49:01 -05:00
Andreas Krebbel f09677388a Fix concurrency problem between dl_open and dl_iterate_phdr 2010-10-26 00:23:14 -04:00
Andreas Schwab 8e9f92e9d5 Require suid bit on audit objects in privileged programs 2010-10-24 21:43:15 -04:00
Andreas Schwab bc5fb0374c Don't try to free rpath strings allocated during startup 2010-09-15 07:20:57 -07:00
Andreas Schwab 5a2a1d7504 Don't deadlock in __dl_iterate_phdr while (un)loading objects. 2010-05-03 08:08:28 -07:00
Ulrich Drepper 04f2902d9f Future safety in checking ELF header.
If we should use further fields in the e_ident array in the ELF header
of files we want zero to mean the default.  Enforce zero for now so
that non-optional features indicated by nonzero values are not go
unnoticed when using an old dynamic linker.
2010-03-18 13:15:27 -07:00
Ulrich Drepper d8c47894ca Extended ELF ABI version handling only for Linux.
If the OSABI is generic we should not allow the ABI version to be nonzero.
Move all the new functionality into Linux-specific files.
2010-03-16 23:34:59 -07:00
Ulrich Drepper 92ad15a8f1 Implement handling of libc ABI in ELF header. 2010-03-15 11:44:58 -07:00
Ulrich Drepper 844c394a05 Fix comment. 2010-02-24 19:27:24 -08:00
Andreas Schwab 96961bf71d Fix descriptor leak when calling dlopen with RTLD_NOLOAD 2009-10-07 10:25:38 +02:00
Ulrich Drepper 6cc8844f1d * sysdeps/unix/sysv/linux/dl-osinfo.h (dl_fatal): Remove inline
from definition.

	* sysdeps/x86_64/dl-machine.h (elf_machine_rela): Don't define
	label if it is not used.

	* elf/dl-profile.c (_dl_start_profile): Define real-type variant
	of gmon_hist_hdr and gmon_hdr structures and use them.

	* elf/dl-load.c (open_verify): Add temporary variable to avoid
	warning.

	* nscd/nscd_helper.c (get_mapping): Avoid casts to avoid warnings.

	* sunrpc/clnt_raw.c (clntraw_private_s): Use union in definition
	to avoid cast.

	* inet/rexec.c (rexec_af): Make sa2 a union to avoid warnings.
	* inet/rcmd.c (rcmd_af): Make from a union of the various needed types
	to avoid warnings.
	(iruserok_af): Use ss_family instead of casts.

	* gmon/gmon.c (write_hist): Define real-type variant of
	gmon_hist_hdr structure and use it.
	(write_gmon): Likewise for gmon_hdr.

	* sysdeps/unix/sysv/linux/readv.c: Avoid declaration of replacement
	function if we are not going to define it.
	* sysdeps/unix/sysv/linux/writev.c: Likewise.

	* inet/inet6_option.c (optin_alloc): Add temporary variable to
	avoid warning.

	* libio/strfile.h (struct _IO_streambuf): Use correct type and
	name of VTable element.
	* libio/iovsprintf.c: Avoid casts to avoid warnings.
	* libio/iovsscanf.c: Likewise.
	* libio/vasprintf.c: Likewise.
	* libio/vsnprintf.c: Likewise.
	* stdio-common/isoc99_vsscanf.c: Likewise.
	* stdlib/strfmon_l.c: Likewise.
	* debug/vasprintf_chk.c: Likewise.
	* debug/vsnprintf_chk.c: Likewise.
	* debug/vsprintf_chk.c: Likewise.
2009-04-26 20:12:37 +00:00
Ulrich Drepper 22c8319345 * elf/dl-open.c: Keep track of used name spaces and only iterate over
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.
2009-04-01 00:26:36 +00:00
Ulrich Drepper 20739e5454 * elf/dl-load.c: Remove support for systems without MAP_ANON.
* elf/dl-minimal.c: Likewise.
	* elf/dl-misc.c: Likewise.
	* elf/rtld.c: Likewise.
	* sysdeps/generic/ldsodefs.h: Likewise.
2009-03-31 22:03:24 +00:00
Ulrich Drepper 2ca285b098 [BZ #9733]
* 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.
2009-03-16 02:16:30 +00:00
Ulrich Drepper 40e2fc8b70 * elf/dl-load.c (open_verify): In case VALID_ELF_HEADER is
defined, allow additional data to be added using the optional
	MORE_ELF_HEADER_DATA macro.
	* sysdeps/unix/sysv/linux/ldsodefs.h (VALID_ELF_HEADER,
	VALID_ELF_OSABI, VALID_ELF_ABIVERSION, MORE_ELF_HEADER_DATA): Define.
2009-02-10 17:21:29 +00:00
Ulrich Drepper ff0bf75374 * sunrpc/clnt_udp.c (__libc_clntudp_bufcreate): Namespace cleanup.
* elf/dl-load.c (local_strdup): Remove inline.
	(_dl_map_object_from_fd): Don't allocate l_symbolic_searchlist.r_list.
	* elf/dl-object.c (_dl_new_object): Allocate symbolic searchlist as
	part of the object.

	* sysdeps/unix/sysv/linux/dl-origin.c: Add const to avoid warning.
2008-07-26 08:42:54 +00:00
Ulrich Drepper 88197030d5 [BZ #5222]
2007-10-28  Ulrich Drepper  <drepper@redhat.com>
	[BZ #5222]
	* elf/dl-load.c (_dl_rtld_di_serinfo): Correct handling of short
	path elements in counting mode.
2007-10-28 08:24:07 +00:00
Ulrich Drepper ce31a3b1c5 * intl/dcigettext.c (_nl_find_msg): Free encoding if __gconv_open
failed.
	* intl/finddomain.c (_nl_find_domain): Free normalized_codeset
	on failure.

	* elf/dl-load.c (decompose_rpath): Free copy if result couldn't be
	allocated.

2007-08-03  Jakub Jelinek  <jakub@redhat.com>
2007-08-03 15:50:30 +00:00
Ulrich Drepper 1c298d0887 [BZ #4775, BZ #4776]
2007-07-12  Jakub Jelinek  <jakub@redhat.com>
	[BZ #4775]
	* math/tgmath.h (__tgmath_real_type_sub): Formatting.
	(__tgmath_real_type): Fix if expr is const int or other const
	qualified integral type.
	(__TGMATH_UNARY_REAL_ONLY): Rewritten to avoid using statement
	expressions and handle const qualified arguments.
	(__TGMATH_BINARY_FIRST_REAL_ONLY, __TGMATH_UNARY_REAL_IMAG,
	__TGMATH_UNARY_REAL_IMAG_RET_REAL): Likewise.
	(__TGMATH_UNARY_REAL_RET_ONLY): Rewritten to avoid using
	statement expressions.
	(__TGMATH_BINARY_REAL_ONLY, __TGMATH_TERNARY_FIRST_SECOND_REAL_ONLY,
	__TGMATH_TERNARY_REAL_ONLY, __TGMATH_BINARY_REAL_IMAG): Likewise.
	(__TGMATH_UNARY_IMAG): Define.
	(conj, cproj): Use __TGMATH_UNARY_IMAG macro.
	* math/Makefile (tests): Add test-tgmath2.
	(CFLAGS-test-tgmath2.c): Add.
	* math/test-tgmath.c (fy, dy, ly, fz, dz, lz, count_cdouble,
	count_cfloat, count_cldouble): New variables.
	(NCCALLS): Define.
	(main): Check number of complex calls as well.
	(F(compile_test)): Add complex tests and tests with const qualified
	arguments.
	(y, z, ccount): Define.
	(F(cacos), F(casin), F(catan), F(ccos), F(csin), F(ctan), F(cacosh),
	F(casinh), F(catanh), F(ccosh), F(csinh), F(ctanh), F(cexp), F(clog),
	F(csqrt), F(cpow), F(cabs), F(carg), F(creal), F(cimag), F(conj),
	F(cproj)): New functions.
	* math/test-tgmath2.c: New test.

2007-07-11  Jakub Jelinek  <jakub@redhat.com>

	[BZ #4776]
	* elf/dl-load.c (_dl_rtld_di_serinfo): Output / in LD_LIBRARY_PATH,
	RPATH etc. as "/" rather than "", don't segfault on empty paths,
	instead output ".".
	* dlfcn/Makefile (distribute): Add glreflib3.c.
	(module-names): Add glreflib3.
	($(objpfx)tst-dlinfo.out): Depend on glreflib3.so rather than
	glreflib1.so.
	(LDFLAGS_glreflib3.so): New.
	* dlfcn/tst-dlinfo.c (do_test): Load glreflib3.so instead of
	glreflib1.so.
	* dlfcn/glreflib3.c: New file.

	* intl/finddomain.c (_nl_find_domain): If _nl_explode_name
	returned -1, return NULL.
	* intl/explodename.c (_nl_explode_name): Return -1 if
	_nl_normalize_codeset failed.
2007-07-12 18:17:11 +00:00
Ulrich Drepper 2f6773b574 (open_verify): Find .note.ABI-tag notes even in PT_NOTE segments with multiple notes. 2007-06-30 17:01:07 +00:00
Ulrich Drepper 9be09e060f * sysdeps/generic/ldsodefs.h (rtld_global): Reorder some elements
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.
2007-06-19 22:59:48 +00:00