| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Handle protected symbols in rtld.
|
|
|
|
|
|
| |
Fix acquisition of nested write compat rtld locks.
PR: 215826
|
|
|
|
| |
Take write lock for rtld_bind before modifying obj_list in dl_iterate_phdr().
|
|
|
|
|
| |
For the main binary, postpone enforcing relro read-only protection
until copy relocations are done.
|
|
|
|
| |
Use ANSI C definitions, update comment.
|
|
|
|
| |
Fix typo.
|
|
|
|
|
|
|
|
| |
When symbol versioning was added to rtld, the boolean 'in_plt' argument
to find_symdef() was converted to a bitmask of flags. The first flag
added was 'SYMLOOK_IN_PLT' which replaced the 'in_plt' bool. This
happened to still work by accident as SYMLOOK_IN_PLT had the value of 1
which is the same as 'true', so there should be no functional change.
|
|
|
|
|
|
|
|
|
|
| |
Pass CPUID[1] %edx (cpu_feature), %ecx (cpu_feature2) and
CPUID[7].%ebx (cpu_stdext_feature), %ecx (cpu_stdext_feature2) to the
ifunc resolvers on x86.
MFC r308925:
Adjust r308689 to make rtld compilable with either in-tree or
(hopefully) stock gcc 4.2.1 on i386 and other arches.
|
|
|
|
| |
Assert that there is no unresolved symbols during rtld linking.
|
|
|
|
| |
Update hint to utilize user variable.
|
|
|
|
| |
Fill phdr and phsize for rtld object.
|
|
|
|
| |
Remove all remaining uses of TAILQ_FOREACH_FROM() from rtld-elf.
|
|
|
|
|
| |
Fix dlsym(RTLD_NEXT) handling to only return the next library in last library
cases.
|
|
|
|
| |
Fix issues found by Coverity in the rtld-elf.c:gethints().
|
|
|
|
|
|
|
| |
Fix handling of DT_TEXTREL for an object with more than one read-only
segment.
PR: 207631
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Use LIBEXECDIR for /usr/libexec.
|
|
|
|
|
| |
Allow PT_NOTES segments to be located anywhere in the executable
image.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
Always do token substitution, do not require -z origin to do it.
|
|
|
|
|
| |
This is only an interim fix; MIPS should be using the MI code instead,
which does not have this issue.
|
|
|
|
| |
Sponsored by: The FreeBSD Foundation
|
|
|
|
| |
Implement support for -z global linker option.
|
| |
|
|
|
|
| |
Change default visibility for rtld to hidden, on x86.
|
|
|
|
|
| |
Pass MAP_ALIGNED_SUPER to allocate the whole dso region if its text is large
enough for the superpage mapping.
|
|
|
|
| |
Use realpath(3) to properly expand $ORIGIN to its absolute path.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
Use powerof2(). Remove single-use variable.
|
|
|
|
|
| |
Add rtld private interface for dso to detect dynamic loading
vs. static linking.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
| |
Document the whole settings needed to build a debug version of rtld.
|
|
|
|
|
|
| |
Always check the limits of array index variables before using them.
Obtained from: DragonFlyBSD
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
| |
Change the _rtld_atfork() to lock the bind lock in write mode.
|
|
|
|
| |
Fix LD_LIBMAP.
|
|
|
|
|
| |
Add dwarf annotations to the amd64 _rtld_bind_start to allow debuggers
to unwind around the calls from PLT to binder.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
Remove the 3rd clause ("advertising clause") of the BSD license as
permitted by the University of Berkeley on July 22, 1999.
Reviewed by: imp
|
|
|
|
|
|
|
| |
For variant II static TLS, properly align tls segments.
MFC r259072:
Cast Elf_Addr to void * to match the free_aligned() argument type.
|
|
|
|
|
| |
Build an allocator for the aligned memory on top of the rtld-private
malloc.
|
|
|
|
|
|
|
|
| |
Requested by: bf
Reviewed by: kan
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Approved by: re (glebius)
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
This WIP should not have been committed yet.
Pointyhat to: avg
|