History log of /netbsd-src/libexec/ld.elf_so/map_object.c (Results 1 – 25 of 69)
Revision Date Author Comments
# ce716eeb 03-Aug-2024 riastradh <riastradh@NetBSD.org>

ld.elf_so(1): Nix trailing whitespace.

No functional change intended.


# a7db91b9 02-Aug-2024 skrll <skrll@NetBSD.org>

KNF


# 3caa8dc7 04-Jun-2023 joerg <joerg@NetBSD.org>

Fix interactions of initial-exec TLS model and dlopen

(1) If an initial-exec relocation was used for a non-local symbol
(i.e. the definition of the symbol is in a different DSO), the
computation of

Fix interactions of initial-exec TLS model and dlopen

(1) If an initial-exec relocation was used for a non-local symbol
(i.e. the definition of the symbol is in a different DSO), the
computation of the static TLS offset used the wrong DSO.
This would effectively mean the wrong address was computed
(PR toolchain/50277, PR pkg/57445).

Fix this by forcing the computation of the correct DSO (the one defining
the symbol).

This code uses __UNCONST to avoid the vast interface changes for this
special case.

(2) If symbols from a DSO loaded via dlopen are used with both
global-dynamic/local-dynamic and initial-exec relocations AND
a initial-exec relocation was resolved first in a thread, a split brain
situation could exist where the dynamic relocations would use one memory
block (separate allocation) and the initial-exec relocations the static
per-thread TLS space.

(3) If the initial-exec relocation in (2) is seen after any thread has
already used a GD/LD allocation, bail out. Since IE relocations are used
only in the GOT, this will prevent the dlopen. This is a bit more
aggressive than necessary, but a full blown reference counting doesn't
seem to be justified.

show more ...


# 3e105dc2 31-May-2023 riastradh <riastradh@NetBSD.org>

ld.elf_so: Sprinkle tls debug messages.

XXX pullup-10


# 2f8ed368 12-Jan-2023 christos <christos@NetBSD.org>

fix the ldd build


# 55509064 12-Jan-2023 christos <christos@NetBSD.org>

Handle program headers properly; fixes c++ exceptions on arm32.


# acf7fb3a 06-Jan-2023 christos <christos@NetBSD.org>

Remove the limitation of only being able to load binaries with 2 PT_LOAD
sections, like the kernel can. From FreeBSD.


# 83241269 30-Mar-2022 hannken <hannken@NetBSD.org>

_rtld_map_object(): no need to mmap an empty bss segment.


# 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 ...


# 06c9aa11 06-Jan-2019 joerg <joerg@NetBSD.org>

When loading a non-PIE main binary, the virtual address must match.
Use MAP_TRYFIXED and verify that the result matches the expectation.


# 08e505b5 04-Jan-2019 joerg <joerg@NetBSD.org>

MAP_ALIGNED has existed for years, just assume it exists.


# e45d4ba0 19-Jun-2017 joerg <joerg@NetBSD.org>

Replace COMBREL with just-in-time check in _rtld_relocate_nonplt_objects.

The COMBREL logic predates thread-safety of the dynamic linker and
breaks the use of shared locks for the common symbol look

Replace COMBREL with just-in-time check in _rtld_relocate_nonplt_objects.

The COMBREL logic predates thread-safety of the dynamic linker and
breaks the use of shared locks for the common symbol lookup case. It is
unlikely to provide any benefit for lazy binding or PLT lookups, so
provide equivalent functionality in the non-PLT relocation handling loop
by checking if the symbol used by the current relocation is the same as
the one used during the last lookup. No inter-object cachine is done as
it is also unlikely to be benefical.

Testing with Firefox startup on AMD64 shows a small performance gain by
the new method.

show more ...


# cfef4500 10-Mar-2017 maya <maya@NetBSD.org>

Revert to version 1.55 of map_object.c. This reverts:

"really unmap the gap between the text and data rather than just removing
all access with mprotect(). the latter results in the kernel having t

Revert to version 1.55 of map_object.c. This reverts:

"really unmap the gap between the text and data rather than just removing
all access with mprotect(). the latter results in the kernel having to
keep track of that range separately since the permissions are different.
avoid calling mmap() with a size of zero."

As per toolchain/52054: src/libexec/ld.elf_so update breaks everything,
this commit is very broken for some people (but not others). chs mentioned
he has a fix, but best not to leave -current broken in the meantime.

show more ...


# cf66c899 09-Mar-2017 chs <chs@NetBSD.org>

really unmap the gap between the text and data rather than just removing
all access with mprotect(). the latter results in the kernel having to
keep track of that range separately since the permissi

really unmap the gap between the text and data rather than just removing
all access with mprotect(). the latter results in the kernel having to
keep track of that range separately since the permissions are different.
avoid calling mmap() with a size of zero.

show more ...


# 4910b5ce 16-Jun-2016 christos <christos@NetBSD.org>

Move relro after we've computed out relocbase and re-enable it.
(Matthias Weckbecker)


# 0e6265fc 14-Jun-2016 christos <christos@NetBSD.org>

Add support for GNU RELRO headers from Matthias Weckbecker.


# 2782e828 30-Oct-2014 martin <martin@NetBSD.org>

Avoid use after free, reported by the coverity scanner.


# ffcdb0b1 03-Aug-2013 skrll <skrll@NetBSD.org>

Fix DEBUG build.


# 3c085045 09-May-2013 christos <christos@NetBSD.org>

convert to SIMPLEQ like the rest of the queues.


# e269a214 08-May-2013 christos <christos@NetBSD.org>

need xfree() instead of free(). Using free() ends us up in an infinite loop.


# a3fedff4 06-May-2013 christos <christos@NetBSD.org>

Fixed handling of DT_SONAME:

- add function to add name aliases for shared libraries loaded
XXX[1]: we don't add a name during load time, only when DT_SONAME
is present.
- search already loa

Fixed handling of DT_SONAME:

- add function to add name aliases for shared libraries loaded
XXX[1]: we don't add a name during load time, only when DT_SONAME
is present.
- search already loaded objects in load_by_name for an already
loaded object that matches our name and return it.
- add missing initialization and cleanup for obj->names
XXX[2]: should we make them SIMPLEQ?
- Add XXX in rtld.c about getting the name of an object.

NB: This makes the jdk work again without resorting to a hack of putting
the build path of libjvm.so into the run path (which is a security
problem).
XXX: Pullup-6?

show more ...


# b49eab8e 06-May-2013 skrll <skrll@NetBSD.org>

Trailing whitespace


# afe1984d 25-Apr-2013 skrll <skrll@NetBSD.org>

Adjust exidx_start by relocbase


# d4d42c7f 25-Apr-2013 skrll <skrll@NetBSD.org>

Handle PT_ARM_EXIDX when mapping objects.


# 9d2c0068 13-Oct-2012 dholland <dholland@NetBSD.org>

Improve the diagnostic messages for invalid/non-ELF files. Proposed a
while back; I forget the context. Has been sitting in one of my trees
awaiting a test run since, apparently, August 2011.


123