summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf
Commit message (Collapse)AuthorAgeFilesLines
* MFC r302908:bdrewery2016-07-221-1/+1
| | | | | Fix dlsym(RTLD_NEXT) handling to only return the next library in last library cases.
* MFC r300691:kib2016-06-081-7/+28
| | | | Fix issues found by Coverity in the rtld-elf.c:gethints().
* MFC r296319:kib2016-03-163-19/+42
| | | | | | | Fix handling of DT_TEXTREL for an object with more than one read-only segment. PR: 207631
* MFC r257811 (by markj):kib2016-03-129-96/+176
| | | | | | | | | | | | | | | Include rtld itself when iterating over loaded ELF objects in dl_iterate_phdr(3). MFC r294373: Do not call callbacks for dl_iterate_phdr(3) with the rtld bind and phdr locks locked. MFC r294470 (by kan): Fix initlist_add_object invocation parameters. MFC r294936 (by kan): Do not unlock rtld_phdr_lock over callback invocations.
* MFC r292705: rtld: remove old XXX comment missed in r35529emaste2016-01-071-1/+0
|
* MFC r291348:bdrewery2015-12-041-1/+1
| | | | Use LIBEXECDIR for /usr/libexec.
* MFC r289324:kib2015-10-281-3/+21
| | | | | Allow PT_NOTES segments to be located anywhere in the executable image.
* Disable SSE in libthrvangyzen2015-10-262-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang emits SSE instructions on amd64 in the common path of pthread_mutex_unlock. If the thread does not otherwise use SSE, this usage incurs a context-switch of the FPU/SSE state, which reduces the performance of multiple real-world applications by a non-trivial amount (3-5% in one application). Instead of this change, I experimented with eagerly switching the FPU state at context-switch time. This did not help. Most of the cost seems to be in the read/write of memory--as kib@ stated--and not in the #NM handling. I tested on machines with and without XSAVEOPT. One counter-argument to this change is that most applications already use SIMD, and the number of applications and amount of SIMD usage are only increasing. This is absolutely true. I agree that--in general and in principle--this change is in the wrong direction. However, there are applications that do not use enough SSE to offset the extra context-switch cost. SSE does not provide a clear benefit in the current libthr code with the current compiler, but it does provide a clear loss in some cases. Therefore, disabling SSE in libthr is a non-loss for most, and a gain for some. I refrained from disabling SSE in libc--as was suggested--because I can't make the above argument for libc. It provides a wide variety of code; each case should be analyzed separately. https://lists.freebsd.org/pipermail/freebsd-current/2015-March/055193.html Suggestions from: dim, jmg, rpaulo Sponsored by: Dell Inc.
* MFC r287369:andrew2015-09-081-1/+1
| | | | | | | | | | | | | | | | | | | Ensure we use calculate_first_tls_offset, even if the main program doesn't have TLS program header. This is needed on architectures with Variant I tls, that is arm, arm64, mips, and powerpc. These place the thread control block at the start of the buffer and, without this, this data may be trashed. This appears to not be an issue on mips or powerpc as they include a second adjustment to move the thread local data, however this is on arm64 (with a future change to fix placing this data), and should be on arm. I am unable to trigger this on arm, even after changing the code to move the data around to make it more likely to be hit. This is most likely because my tests didn't use the variable in offset 0. Reviewed by: kib MFC after: 1 week Sponsored by: ABT Systems Ltd
* MFC r282551: Remove historical GNUC testemaste2015-08-312-8/+0
| | | | | | | The requirement is for a GCC-compatible compiler and not necessarily GCC itself. However, we currently expect any compiler used for building the whole of FreeBSD to be GCC-compatible and many things will break if not; there's no longer a need to have an explicit test for this in rtld.
* MFH (r277695): allow tracing dlfunc() / dlsym() eventsdes2015-06-301-4/+13
|
* MFC r282109:kib2015-05-041-36/+45
| | | | Always do token substitution, do not require -z origin to do it.
* MFC r281107: MIPS rtld: report missing symbol rather than segfaultingemaste2015-04-281-1/+1
| | | | | This is only an interim fix; MIPS should be using the MI code instead, which does not have this issue.
* MFC r281005: Make die available as rtld_die for use by MD relocation codeemaste2015-04-282-19/+19
| | | | Sponsored by: The FreeBSD Foundation
* MFC r281549:kib2015-04-222-17/+31
| | | | Implement support for -z global linker option.
* MFC r268182: Initialize page sizes early for ia64.peter2015-04-132-0/+9
|
* MFC r280816:kib2015-04-1212-16/+43
| | | | Change default visibility for rtld to hidden, on x86.
* MFC r264346 (by alc):kib2015-04-124-25/+67
| | | | | Pass MAP_ALIGNED_SUPER to allocate the whole dso region if its text is large enough for the superpage mapping.
* MFC: r279364jkim2015-03-061-8/+7
| | | | Use realpath(3) to properly expand $ORIGIN to its absolute path.
* MFC 275412:jhb2015-02-231-0/+2
| | | | | | | | | | | | | The runtime linker needs to include a path to itself in the link map it exports to the debugger. It currently has two choices: it can use a compiled-in path (/libexec/ld-elf.so.1) or it can use the path stored in the interpreter path in the binary being executed. The runtime linker currently prefers the second. However, this is usually wrong for compat32 binaries since the binary specifies the path of rtld on a 32-bit system (/libexec/ld-elf.so.1) instead of the actual path (/libexec/ld-elf32.so.1). For now, always assume the compiled in path (/libexec/ld-elf32.so.1) as the rtld path and ignore the path in the binary for the 32-bit runtime linker.
* MFC r277936:kib2015-02-061-5/+3
| | | | Use powerof2(). Remove single-use variable.
* MFC r276627:kib2015-01-103-0/+24
| | | | | Add rtld private interface for dso to detect dynamic loading vs. static linking.
* Always return pathname in dl_iterate_phdr's dlpi_name, as Linux doesemaste2014-11-141-2/+1
| | | | | | | | | | | | | Linux LD_ITERATE_PHDR(3): The dlpi_name field is a null-terminated string giving the pathname from which the shared object was loaded. That functionality is much more useful than returning just the short name. Update dl_iterate_phdr(3) to follow r272842 MFC of r272842 and r272848
* MFC r270798:kib2014-09-1210-334/+321
| | | | | | | | | | Process STT_GNU_IFUNC when doing non-plt relocations. MFC r270802: Only do the second pass over non-plt relocations when the first pass found IFUNCs. Approved by: re (gjb)
* MFC r270803:kib2014-09-011-0/+4
| | | | Document the whole settings needed to build a debug version of rtld.
* MFC r270256:pfg2014-08-281-2/+2
| | | | | | Always check the limits of array index variables before using them. Obtained from: DragonFlyBSD
* MFC r265456, r265578:markj2014-08-072-1/+17
| | | | | | | | Add a postinit debugger hook to rtld. This will be used by dtrace(1) to halt the victim process before its entry point is called, at which point probes and DOF data are registered with the kernel. The r_debug_state hook cannot be used for this purpose, as it is called before the program's init routines are invoked and in particular before DOF data is registered (via drti.o).
* MFC r266609:kib2014-06-071-1/+15
| | | | Change the _rtld_atfork() to lock the bind lock in write mode.
* MFC r266411:kib2014-05-251-3/+3
| | | | Fix LD_LIBMAP.
* MFC r264481:kib2014-04-211-0/+43
| | | | | Add dwarf annotations to the amd64 _rtld_bind_start to allow debuggers to unwind around the calls from PLT to binder.
* MFC r262277:davidxu2014-02-271-7/+5
| | | | | | | | | | | | | | | | | | malloc_aligned() may not leave enough space for pointer to allocated memory, saving the pointer will overwrite bytes belongs to another memory block unexpectly, to fix the problem, use (allocated address + sizeof(void *)) as initial value, and slip to next aligned address, so maximum extra bytes is sizeof(void *) + align - 1. Tested by: Andre Albsmeier < mail at ma17 dot ata dot myota dot orgndre > MFC r262334: Increase alignment to size of pointer if the alignment is too small. Some modules do not align data at least to size of pointer, they uses a smaller alignment, but our pointer should be aligned to its native boundary, otherwise on some platforms, hardware alignment checking will cause bus error.
* MFC: r262136brueffer2014-02-241-5/+1
| | | | | | | Remove the 3rd clause ("advertising clause") of the BSD license as permitted by the University of Berkeley on July 22, 1999. Reviewed by: imp
* MFC r259044:kib2013-12-131-15/+20
| | | | | | | For variant II static TLS, properly align tls segments. MFC r259072: Cast Elf_Addr to void * to match the free_aligned() argument type.
* MFC r259043:kib2013-12-132-0/+32
| | | | | Build an allocator for the aligned memory on top of the rtld-private malloc.
* Implement support for the interpose dso flag.kib2013-10-072-2/+33
| | | | | | | | Requested by: bf Reviewed by: kan Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (glebius)
* Populate .rld_map on MIPS for debuggersemaste2013-10-021-5/+1
| | | | | | | | | On MIPS the .dynamic section is read-only, so the pointer to rtld information for debuggers cannot be stored there (in DT_DEBUG). Instead, a special section .rld_map is used. Sponsored by: DARPA, AFRL Approved by: re (delphij)
* Make the directory mapping functionality, which was previously onlydes2013-09-213-9/+5
| | | | | | | | | available in 32-bit compatibility mode, unconditional. Overhaul the man page, which had evolved more by accretion than by design. Approved by: re (gjb) MFC after: 3 weeks
* Revert r253748,253749avg2013-07-282-0/+2
| | | | | | This WIP should not have been committed yet. Pointyhat to: avg
* remove needless inclusion of machine/cpu.h in userlandavg2013-07-282-2/+0
| | | | MFC after: 21 days
* Properly terminate the result string for intermediate results, tokib2013-04-291-1/+2
| | | | | | | | allow the final strcpy() to start at the intended place. Reported and tested by: pgj Pointy hat to: kib MFC after: 3 days
* The origin_subst_one() function limits the length of the string tokib2013-04-151-73/+75
| | | | | | | | | | | | | | | | | | PATH_MAX after the token substitution. This is wrong, because origin_subst_one() performs the substitution on the whole rpath and similar strings, which contain several pathes separated by colon. As result, long (but correct) rpath consisting of many path elements is rejected by the function. Correct the problem by rewriting the origin_subst_one() to perform two passes, first pass to calculate the number of substitutions to be performed, and second pass to generate the resulting string. Second pass allocates the memory for the result based on the count from the first pass, without enforcing a limit. Reported and tested by: pgj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* Map libraries linked with -Ttext-segment=base_addr at base_addr.tijl2013-02-271-1/+1
| | | | | | | | | Normal libraries have base address 0 and are unaffected by this change. PR: 176216 Submitted by: Damjan Jovanovic <damjan.jov@gmail.com> Reviewed by: kib MFC after: 1 week
* Avoid use of register variables, which some compilers (e.g. clang)nwhitehorn2013-02-081-9/+5
| | | | | | don't like. It makes the code a little clearer as well. MFC after: 1 week
* When building for ARM EABI link against libgcc for the __aeabi_* functions.andrew2013-01-191-0/+10
|
* Use absolute path for /usr/libexec/ld-elf.so.1 symlink.pjd2012-12-041-2/+2
| | | | | | | | | Requested by: kan, kib Use -h flags for chflags, so we won't remove 'schg' flag from system's /libexec/ld-elf.so.1. MFC after: 2 weeks
* Do not change entire BINDIR, it might be needed later, just changepjd2012-12-041-2/+2
| | | | | | symlink target. MFC after: 2 weeks
* Change /usr/libexec/ld-elf.so.1 to point at ../../libexec/ld-elf.so.1pjd2012-12-041-1/+1
| | | | | | | | | | | instead of /libexec/ld-elf.so.1. Below in the Makefile we execute 'chflags noschg ${DESTDIR}/usr/libexec/ld-elf.so.1', which follows symlink and removes 'schg' flag from system's /libexec/ld-elf.so.1 instead of the one in DESTDIR. It is also more friendly to use replative paths in symlink in case of jail/chroot environments. Obtained from: WHEEL Systems MFC after: 2 weeks
* rtld: Fix fd leak with parallel dlopen and fork/exec.jilles2012-11-042-4/+4
| | | | | | | | | | | | | | | | Rtld did not set FD_CLOEXEC on its internal file descriptors; therefore, such a file descriptor may be passed to a process created by another thread running in parallel to dlopen() or fdlopen(). No other threads are expected to be running during parsing of the hints and libmap files but the file descriptors need not be passed to child processes so add O_CLOEXEC there as well. This change will break fdlopen() (as used by OpenPAM) on kernels without F_DUPFD_CLOEXEC (added in July). Note that running new userland on old kernels is not supported. Reviewed by: kib
* Do not reference z_nodeflib for !objgiven case, thus fixing LD_PRELOADkib2012-09-191-4/+4
| | | | | | | for a non-absolute path. PR: bin/171604 MFC after: 3 days
* Do not call process_nodelete with NULL object pointer.kan2012-08-201-1/+2
| | | | | | | | The place where the function is called can be reached if object loading and relocation fails too, in which case obj pointer will be NULL. Do not call process_nodelete then, or crash will follow. Pointy hat to: kan
OpenPOWER on IntegriCloud