summaryrefslogtreecommitdiff
path: root/libexec/ld.so
AgeCommit message (Collapse)Author
2015-05-06Fix a memory leak in _dl_load_dep_libs()Jonathan Gray
ok otto@ guenther@
2015-04-28tidy up the prebind text; prompted by zhukJason McIntyre
2015-02-08Fix cross-build. OK jsing@ miod@ guenther@ deraadt@Masao Uebayashi
2015-02-06Raise ELF_RANDOMIZE_LIMIT to 64K, so that programs and libraries canTheo de Raadt
legitimately use random section variables without execve failures... Because this section is not demand faulted, yield() every page during the fill otherwise the costs are charged poorly. ok tedu matthew
2015-01-22delete annoying white space that annoyTheo de Raadt
2015-01-20If _dl_progname exceeds half the syslog buffer, truncate it with "...",Theo de Raadt
so that the remaining information is more visible ok kettenis miod
2015-01-20Add support for tracing libraries in static PIE binaries. rcrt does notTheo de Raadt
contain "LD_TRACE_LOADED_OBJECTS" support, so this gets done by calling RTLD_TRACE directly. ok guenther
2015-01-19gcc does not understand that the loop conditionally sets bsod beforeTheo de Raadt
using it, so it warns... Copy the warning silencing code from the same function in ../ld.so
2015-01-18do not require <a.out.h>Theo de Raadt
2015-01-16<sys/param.h> to <limits.h> conversion. Verified binariesTheo de Raadt
ok millert, thanks to doug for process advice
2014-12-30self-relocating crt0 bits for sh, and enable static pie by default. With someMiod Vallat
archdep.h help from kettenis@
2014-12-30Clean up and optimize _dl_start a bit by using immediate addressing forMiod Vallat
the constants whenever they fit, and avoiding saving and restoring registers we don't need to preserve.
2014-12-30Fix handling of R_MIPS_REL32_64 relocations that reference a symbol.Mark Kettenis
Fixes remaining problems with static PIE on mips64.
2014-12-27Static PIE for mips64. Still something not quite right as a full make buildMark Kettenis
fails. ok kurt@
2014-12-27Make ld.so process only R_ALPHA_RELATIVE relocations during early GOTMark Kettenis
relocation in _reloc_alpha_got(), and teach RELOC_RELA() to skip R_ALPHA_NONE relocations (which are just nops used to fill out the relocation table). Handling R_ALPHA_NONE relocations will be necessary for static PIE support and it is not inconceivable that ld.so will end up with such relocations at some point. ok kurt@
2014-12-24Expand Elf_Rel relocations to include DT_JMPREL. Inspect DT_PLTREL valueKurt Miller
to determine if DT_JMPREL relocations are REL or RELA and conditionally perform DT_JMPREL in either REL or RELA as needed (idea from kettenis@). Remove unneeded i386 RELA implementation. i386 static pie working now. okay kettenis@
2014-12-22Self-relocation code for i386.Kurt Miller
2014-12-22Static PIE has been delayed for quite a while. By pushing hard with pascalTheo de Raadt
towards a wimpy (but sufficient) model, kurt and kettenis got upset enough to do it the right way, right away before we got out of hand. Bravo! We no longer need /sbin/ld.so on the new roadmap.
2014-12-22Introduce new csu0 variant for -static -pie binaries to use calledKurt Miller
rcsu0.o where the initial 'r' is for relocatable. rcsu0.o performs self-relocation on static pie binaries by calling a slightly modified copy of ld.so's _dl_boot_bind() in boot.h. The first arch implementatation is also included for amd64 where __start calls _dl_boot_bind() and then calls ___start(). Includes parts from kettenis@ to help get R_X86_64_64 relocations working and proper handling for undefined weak symbols. This is the first part of several to get static pie self-relocating binaries working. binutils, gcc and kernel changes are forthcoming to complete the solution, then per-arch implementations are needed for MD_RCRT0_START in csu. okay kettenis@ pascal@ deraadt@
2014-12-19place the afterinstall: target correctly for static-only architecturesTheo de Raadt
2014-12-16install both ld.so with mode 444Theo de Raadt
2014-12-16Install a copy of ld.so into /sbin. Soon to be used in order to make "static"Pascal Stumpf
PIE possible. ok deraadt@ tedu@
2014-12-14Revert r1.10: properly built shared libraries will never have any DISP26Miod Vallat
relocations, but will always call public symbols through the library's PLT.
2014-12-09avoid void arithmetic. from david carlierTed Unangst
2014-11-25When a public symbol in a library is referenced by the main program's plt,Miod Vallat
the address of the symbol must always resolve to the entry in the main program's plt, regardless of which object the address resolution is performed for, so that addresses (pointers) can be compared reliably. However, depending on how far away library load address randomization places the library, the main program's plt address might be too far away from the library itself for its DISP26 relocations to fit in the required relative displacement range. Since DISP26 relocations can only be used in code for branches, it is safe to resolve them to the actual address within the library, and avoid producing out of bounds displacements.
2014-11-24Make the scope of the symbol caching variables added in 1.49 a bit larger soMiod Vallat
that these don't get reset for every relocation being processed (oops). ok guenther@ deraadt@
2014-11-22mop up a barely started project... getting in the way of grepping the tree!Theo de Raadt
2014-11-19Nuke yet more obvious #include duplications.Kenneth R Westerback
ok deraadt@
2014-11-18Nuke some obvious #include duplications.Kenneth R Westerback
ok espie@ deraadt@ millert@ tedu@
2014-11-15ELF files have moved up a levelPhilip Guenther
pointed out by deraadt@
2014-11-03Eliminate RTLD_PROTECT_PLT: ld.so is built with -Bsymbolic so thePhilip Guenther
PLT is empty/unused. On at least macppc and sparc64, ld.so's attempt to mprotect its PLT could instead hit its own allocated data and cause a segfault shortly there after. While here, take a shot at preventing the same issue with the GOT by checking for __got_start != __got_end. reproduction *with ktracing* by afresh1@ provided the key data ok miod@ deraadt@
2014-11-03arc4random_uniform() transformation was off, resulting in badly skewedPhilip Guenther
distribution in the placement of malloc's dir_info. ok otto@ deraadt@
2014-10-19Revert last commit due to changed semantics found by make release.Doug Hogan
2014-10-18Better POSIX compliance in realpath(3).Doug Hogan
millert@ made changes to realpath.c based on FreeBSD's version. I merged Todd's changes into dl_realpath.c. ok millert@, guenther@
2014-10-18Convert some malloc() and realloc() calls to reallocarray().Doug Hogan
ok deraadt@
2014-10-18Simple malloc() to reallocarray() conversion.Doug Hogan
ok deraadt@
2014-09-22Correct the token used.Brad Smith
Pointed out by LLVM. ldasm.S:111:74: error: unexpected token in '.type' directive .section ".text" ; .align 4 ; .global _dl_issetugid ; .type _dl_issetugid%function ;_dl_issetugid: ; movl $253,%eax; int $0x80 ; jb .L_cerr ; ret ^ ok guenther@
2014-09-01Sync readlink(2) with IEEE Std 1003.1-2008.Doug Hogan
discussion, help and ok guenther@
2014-08-30Make the handling of PLT entries above the 32k mark thread-safe.Philip Guenther
Also, make a comment not lie: use the V9 ISA's relative branch immediate instruction for short (with in 2^19 words) PLT branches. ok miod@
2014-08-19ld.so(1): Missing stack var initializationMasao Uebayashi
Explicitly zero-clear stack array to read dynamic segments. This code has been working because stack is mapped as anon and zero'ed right after execve(2). Found by work-in-progress Valgrind port for OpenBSD/amd64. OK millert@ guenther@
2014-07-28_dl_sigprocmask() works better when it actually saves the returned sigmaskPhilip Guenther
asm suggestion from kettenis@ tested by miod@, suffering under the brain-destroying summer heat
2014-07-14Now that we have sendsyslog(2), we can directly use it in theTheo de Raadt
(previously completely retarded) stack_smash_handler of ld.so ok beck miod tedu
2014-07-10check all memory allocations; ok miod@ guenther@Otto Moerbeek
2014-07-10typo in previousMiod Vallat
2014-07-09Use O_CLOEXEC to make sure fork+exec in a threaded process can'tPhilip Guenther
see the fds used by dlopen() ok otto@ miod@
2014-07-09_dl_fcntl() is no longer used; kill the stubsPhilip Guenther
ok otto@ miod@
2014-07-09Resync _dl_opendir() with libc: use O_CLOEXEC and O_DIRECTORY insteadPhilip Guenther
of post-open tests and fixups. Also, reorder _dl_dirdesc to save 8 bytes on LP64. ok otto@ miod@
2014-07-09Fix backtraces through _dl_bind_start by adding dwarf annotations forPhilip Guenther
the stack adjustments/handling in the asm. Based on FreeBSD. ok kettenis@ matthew@
2014-07-06allocate two things, test two pointers; ok miod@ guenther@Otto Moerbeek
2014-07-06int all fields, so calloc can become malloc; ok miod@Otto Moerbeek