History log of /netbsd-src/libexec/ld.elf_so/rtld.c (Results 1 – 25 of 217)
Revision Date Author Comments
# b1f732fc 19-Jan-2024 christos <christos@NetBSD.org>

use header decl of __fork()


# aecd65a0 03-Oct-2023 martin <martin@NetBSD.org>

PR 57628: at the end of _rtld_init() explicitly initialize the ld.elf_so
local copy of the atomic access support functions for machines that do not
implement all required ops in hardware (like 32bit

PR 57628: at the end of _rtld_init() explicitly initialize the ld.elf_so
local copy of the atomic access support functions for machines that do not
implement all required ops in hardware (like 32bit sparc).

XXX would be better to figure out a way to share this copy with libc
(thereby using half as many RAS sections). But even if we would share it,
we have to init it early enough for ld.elf_so internal uses.

show more ...


# eeb15e76 30-Jul-2023 riastradh <riastradh@NetBSD.org>

ld.elf_so: Split hash functions into a separate file.

This way we can test them in isolation.

No functional change intended.


# 1c559787 04-Jun-2023 riastradh <riastradh@NetBSD.org>

ld.elf_so: Sprinkle more debug messages on dlopen and error.

PR pkg/57445


# b8bbdc68 23-Apr-2023 riastradh <riastradh@NetBSD.org>

dlopen(3): Read _rtld_objtail under the lock.

XXX pullup-8
XXX pullup-9
XXX pullup-10


# 65715c61 13-Sep-2022 riastradh <riastradh@NetBSD.org>

ld.elf_so(8): Make fork take a shared, not exclusive, lock.

We only need to ensure that there are no concurrent modifications to
the rtld data structures in flight, since the threads that began
thos

ld.elf_so(8): Make fork take a shared, not exclusive, lock.

We only need to ensure that there are no concurrent modifications to
the rtld data structures in flight, since the threads that began
those modifications will not exist in the child and will therefore be
unable to complete them in the child.

A shared lock suffices to ensure there are no such concurrent
modifications in flight; an exclusive lock is not necessary, and can
cause deadlock if fork is executed from a signal handler, which is
explicitly allowed by POSIX (and our own sigaction(2) man page) which
marks fork as async-signal-safe.

PR lib/56979

show more ...


# 207d8867 09-Apr-2022 riastradh <riastradh@NetBSD.org>

rtld: Convert membar_exit/enter to membar_release/acquire.

These are basic CAS-based locking primitives needing release and
acquire semantics, nothing fancy here -- except the membar_sync parts
whic

rtld: Convert membar_exit/enter to membar_release/acquire.

These are basic CAS-based locking primitives needing release and
acquire semantics, nothing fancy here -- except the membar_sync parts
which are questionable but not relevant to the present audit.

show more ...


# 45f12ca2 04-Dec-2021 skrll <skrll@NetBSD.org>

Restore the fptr_t type of {init,fini}{,_array} that was removed when initial
support for indirect functions was added. This fixes {init,fini}_array support
on hppa where each member of the array is

Restore the fptr_t type of {init,fini}{,_array} that was removed when initial
support for indirect functions was added. This fixes {init,fini}_array support
on hppa where each member of the array is (already) a plabel.

Discussed with joerg.

4 files changed, 29 insertions(+), 39 deletions(-)
: ----------------------------------------------------------------------

show more ...


# 07fb20a3 16-Jun-2021 riastradh <riastradh@NetBSD.org>

ld.elf_so(1): Omit needless membar_enter.

The use of membar_enter is to separate atomic r/m/w on a lock from
the body of the critical section so two different critical sections
happen in order:

b

ld.elf_so(1): Omit needless membar_enter.

The use of membar_enter is to separate atomic r/m/w on a lock from
the body of the critical section so two different critical sections
happen in order:

body of previous critical section;

exit critical section:
membar_exit();
atomic_r/m/w(lock stuff);

enter critical section:
atomic_r/m/w(lock stuff);
membar_enter();

body of next critical section;

_rtld_shared_enter does this, but it _also_ issued an extraneous
membar_enter before the atomic_r/m/w part, which doesn't impose any
semantically important order but may cost some performance.

show more ...


# 130482d9 30-May-2021 joerg <joerg@NetBSD.org>

Don't use the return address hack with clang.


# f420d54c 22-Sep-2020 kamil <kamil@NetBSD.org>

Correct r_ldbase valuse

It shall be the relocbase value, not linkmap.


# f3656ffa 21-Sep-2020 kamil <kamil@NetBSD.org>

Upgrade the SVR4 RTLD r_debug protocol to version 1

Changes:
- Add a new field r_ldbase in the r_debug struct.
- Set r_version to 1.

This harmonizes the support with OpenBSD and Linux.
FreeBSD us

Upgrade the SVR4 RTLD r_debug protocol to version 1

Changes:
- Add a new field r_ldbase in the r_debug struct.
- Set r_version to 1.

This harmonizes the support with OpenBSD and Linux.
FreeBSD uses version 0 (or no version).
Solaris uses version 2 that is not implemented elsewhere and relies on
SVR4 specific design and interfaces.

Update the code comments as r_debug and link_map is used by other software
than GDB, namely: sanitizers, rump, LLDB.

show more ...


# 25a494ec 19-Apr-2020 joerg <joerg@NetBSD.org>

Rename __atomic_fork to __locked_fork and give it &errno as argument.
rtld and libc use different storage, so the initial version would
incorrectly report the failure reason for fork().

There is sti

Rename __atomic_fork to __locked_fork and give it &errno as argument.
rtld and libc use different storage, so the initial version would
incorrectly report the failure reason for fork().

There is still a small race condition inside ld.elf_so as it doesn't use
thread-safe errno internally, but that's a more contained internal
issue.

show more ...


# 11954c74 16-Apr-2020 joerg <joerg@NetBSD.org>

Introduce intermediate locking for fork, so that the dynamic linker is
in a consistent state. This most importantly avoids races between dlopen
and friends and fork, potentially resulting in dead loc

Introduce intermediate locking for fork, so that the dynamic linker is
in a consistent state. This most importantly avoids races between dlopen
and friends and fork, potentially resulting in dead locks in the child
when it itself tries to acquire locks.

show more ...


# da570a62 04-Mar-2020 thorpej <thorpej@NetBSD.org>

PT_GNU_RELRO segments are arranged such that their vaddr + memsz ends
on a linker common page size boundary. However, if the common page size
used by the linker is less than the VM page size being u

PT_GNU_RELRO segments are arranged such that their vaddr + memsz ends
on a linker common page size boundary. However, if the common page size
used by the linker is less than the VM page size being used by the kernel,
this can end up in the middle of a VM page and when the region is write-
protected, this can cause objects in neighboring .data to get incorrectly
write-protected, resulting in a crash.

Avoid this situation by calculating the end of the RELRO region not by
rounding memsz up to the VM page size, but rather by adding vaddr + memsz
and then truncating to the VM page size.

Fixes PR toolchain/55043.

XXX pullup-9

show more ...


# 4e9bea3d 29-Feb-2020 kamil <kamil@NetBSD.org>

Implement and integrate GNU Hashing function

Define Elf_Hash struct that contains ELF/SYSV and GNU hash checksum.
Implement _rtld_gnu_hash() for DT_GNU_HASH.
Adapt existing code to compute all Elf_H

Implement and integrate GNU Hashing function

Define Elf_Hash struct that contains ELF/SYSV and GNU hash checksum.
Implement _rtld_gnu_hash() for DT_GNU_HASH.
Adapt existing code to compute all Elf_Hash types, instead of only
the ELF/SYSV one.
Rename _rtld_elf_hash() to _rtld_sysv_hash() to match the GNU toolchain
terminology.

_rtld_gnu_hash() uses Dan Bernstein's string hash function posted eons ago
on comp.lang.c.

show more ...


# 9332bf7c 08-Dec-2019 uwe <uwe@NetBSD.org>

_rtld_relro - fix debug printf format for a size_t argument


# 7519806b 04-Oct-2019 christos <christos@NetBSD.org>

use __func__ (c99, c++11) instead of __FUNCTION__


# e91fbc78 03-Oct-2019 tnn <tnn@NetBSD.org>

improve error message


# 3b610a6e 15-Sep-2019 kamil <kamil@NetBSD.org>

Return the ELF loader dl_phdr_info information for dl_iterate_phdr(3)

Sync the behavior of dl_iterate_phdr(3) with Linux/FreeBSD/OpenBSD.


# fb007af0 14-Apr-2019 christos <christos@NetBSD.org>

undo previous unlock/relock; it is not needed now that we added the tls model
declaration to all externs in jemalloc (suggested by joerg@)


# 15018ca0 13-Apr-2019 christos <christos@NetBSD.org>

Fix c++ exceptions on arm; jemalloc calls _rtld_tls_get_addr from inside
dl_iterate_phdr, so we need to unlock and relock.


# 61268f23 30-Dec-2018 christos <christos@NetBSD.org>

binutils 2.31.1 can put copy relocations in the relro segment. Delay
protecting the relro segment for the main object until copy relocations
are done.


# ba044c63 27-Dec-2018 christos <christos@NetBSD.org>

explain why we skip objmain.


# 4312beab 17-Oct-2018 joerg <joerg@NetBSD.org>

Move compatibility for pre-2.0 ELF binaries into separate file.
Early ELF binaries defined dlopen and friends in crt0.o by
using function pointers in the object handle passed from rtld.
This contract

Move compatibility for pre-2.0 ELF binaries into separate file.
Early ELF binaries defined dlopen and friends in crt0.o by
using function pointers in the object handle passed from rtld.
This contract wastes space when many shared objects are allocated
and ties dynamic linker and rest of the system tightly together.
Fake the entry points in a static object and restrict them to the
platforms that had working ELF support at the time. Keep the magic and
version field used by modern crt0.o for all architectures. The checks
will be removed from crt0.o in a follow-up step.

show more ...


123456789