History log of /dragonfly/libexec/rtld-elf/rtld.c (Results 1 – 25 of 98)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.2.1, v6.2.0, v6.3.0, v6.0.1, v6.0.0, v6.0.0rc1, v6.1.0
# 145e5c8a 03-Nov-2020 zrj <rimvydas.jasinskas@gmail.com>

rtld: Handle non-PLT type 37 relocations.

Mainly to unbreak certain use cases of ifunc.


Revision tags: v5.8.3, v5.8.2, v5.8.1
# 4c898ae5 07-Mar-2020 Matthew Dillon <dillon@apollo.backplane.com>

rtld - Use kern.tls_extra

* Use kern.tls_extra, if available, to calculate the extra tls
space to allocate for late library loads.

* If not available, default to 6144 bytes instead of 1280 bytes

rtld - Use kern.tls_extra

* Use kern.tls_extra, if available, to calculate the extra tls
space to allocate for late library loads.

* If not available, default to 6144 bytes instead of 1280 bytes
to support greater use of static tls sections in late-loaded
libraries (read: mesa 19.3).

Reported-by: ftigeot

show more ...


Revision tags: v5.8.0, v5.9.0, v5.8.0rc1, v5.6.3
# 721505de 12-Nov-2019 Matthew Dillon <dillon@apollo.backplane.com>

libc - Implement sigblockall() and sigunblockall()

* Signal safety is becoming a defacto requirement for most of libc and
pthreads. In particular, the memory allocator. Given the chances of
te

libc - Implement sigblockall() and sigunblockall()

* Signal safety is becoming a defacto requirement for most of libc and
pthreads. In particular, the memory allocator. Given the chances of
teaching tens of thousands of programmers about signal safety, and
just making it work in libc and pthreads, only one of these two
possibilities is actually realizable.

In particular, high-level languages have become so complex, and some
applications (chrome, firefox, etc) have become so complex, that the
code is regularly tripping over signal safety issues.

However, implementing signal safety with current mechanisms is extremely
expensive due to the need for multiple system calls. To whit,
DragonFlyBSD now has a mechanism that does not require system calls
in the critical path.

* Implement sigblockall() and sigunblockall(). These functions
leverage the new /dev/lpmap per-thread shared page mechanism
to provide a way to temporary block the dispatch of all maskable
signals without having to make any system calls.

These are extremely fast routines.

- Reentrant / Recursable

- Temporarily blocks any dispatch of a maskable asynchronous signal
to the calling thread. Other threads are not affected... this is
a per-thread mechanism.

- The last sigunblockall() will immediately dispatch any blocked
signals.

- The normal signal mask is not affected by these routines.

- Does not block signals caused by synchronous traps.

- The current recursion count is retained on [v]fork() to ease
coding and to also allow signals to be temporarily blocked across a
fork until the child process is ready to deal with them, if desired.

* Implement signal safety for most of pthreads. All temporary internal
mutexes are now wrapped with sigblockall() and sigunblockall().

* Implement signal safety for the malloc subsystem. All functions
are wrawpped with sigblockall() and sigunblockall().

These implementations make lang/mono and lang/rust far more reliable
than they were before. Where 9 out of 10 builds used to fail, now
they succeed.

show more ...


# 5280ff77 18-Oct-2019 zrj <rimvydas.jasinskas@gmail.com>

Cleanup <sys/uio.h> includes.

No longer needed after <sys/ktrace.h> cleanup.


# 161c3d83 13-Oct-2019 Sascha Wildner <saw@online.de>

world/kernel: Use the powerof2() macro in various places.


# eeb69571 09-Aug-2019 Matthew Dillon <dillon@apollo.backplane.com>

rtld - Support static TLS bindings for late-loaded shared libraries

* Allow late (manual) dlopen()s to load shared libraries which
use static TLS variables, as long as there is space. Do proper

rtld - Support static TLS bindings for late-loaded shared libraries

* Allow late (manual) dlopen()s to load shared libraries which
use static TLS variables, as long as there is space. Do proper
late-binding and initialize the area for all threads.

* rtld will cache a symbol lookup on first-need for:
"_pthread_distribute_static_tls" and then call it as needed to
initialize late-bound static TLS space.

This symbol is weakly bounded to __libc_distribute_static_tls in libc,
and strongly overridden by _libthread_distribute_static_tls in
libthread_xu.

* Fixes mesa glx-tls and others.

* Test code from FreeBSD. Also tested with other combinations
including a pthread_create() and -static compilation.

https://github.com/dumbbell/test-tls-initial-exec

show more ...


Revision tags: v5.6.2, v5.6.1, v5.6.0, v5.6.0rc1, v5.7.0, v5.4.3
# 50caca1a 12-May-2019 Matthew Dillon <dillon@apollo.backplane.com>

rtld-elf - Notify thread state to optimize relocations

* Add shims to allow libthread_xu to notify rtld when threading
is being used.

* Requires weak symbols in libc which are overriden by rtld-e

rtld-elf - Notify thread state to optimize relocations

* Add shims to allow libthread_xu to notify rtld when threading
is being used.

* Requires weak symbols in libc which are overriden by rtld-elf.

* Implement the feature in rtld-elf and use it to avoid making calls
to lwp_gettid(). When threaded, use tls_get_tcb() (which does not
require a system call) instead of lwp_gettid(). When not threaded,
just use a constant.

NOTE: We cannot use tls_get_tcb() unconditionally because the tcb
is not setup during early relocations. So do this whack-a-mole
to make it work.

* This leaves just the sigprocmask wrappers around rtld-elf (which
are needed to prevent stacked relocations from signal handlers).

Poked-by: mjg

show more ...


Revision tags: v5.4.2
# 1f732d3d 11-Feb-2019 Matthew Dillon <dillon@apollo.backplane.com>

rtld-elf - Allow dynamic (late) relocations to relro section

* Normally the relro section is mprotect()ed to read-only after normal
load relocations.

* It appears that some programs can issue dyn

rtld-elf - Allow dynamic (late) relocations to relro section

* Normally the relro section is mprotect()ed to read-only after normal
load relocations.

* It appears that some programs can issue dynamic relocations at
run-time to such sections.

* If the relro mprotect has been done on an object, temporarily mprotect
the object back to RW to execute the relocation, then mprotect it back
to RO.

Reported-by: marino

show more ...


Revision tags: v5.4.1, v5.4.0, v5.5.0, v5.4.0rc1, v5.2.2, v5.2.1, v5.2.0, v5.3.0, v5.2.0rc
# adb07258 05-Dec-2017 Matthew Dillon <dillon@apollo.backplane.com>

rtld - Fix ifunc relocations

* ifunc relocations had a bug that caused an immediate seg-fault.
Apparently this type of relocation is not used very much, we've
never encountered it before. But t

rtld - Fix ifunc relocations

* ifunc relocations had a bug that caused an immediate seg-fault.
Apparently this type of relocation is not used very much, we've
never encountered it before. But the qemu port uses it.

* Fix the bug. Basically missing lockstate and the top level in
rtld was expected to hold the bind lock.

show more ...


Revision tags: v5.0.2, v5.0.1, v5.0.0, v5.0.0rc2, v5.1.0, v5.0.0rc1, v4.8.1, v4.8.0, v4.6.2, v4.9.0, v4.8.0rc, v4.6.1
# 143ed6ad 16-Sep-2016 zrj <rimvydas.jasinskas@gmail.com>

rtld: Fix handling of DT_TEXTREL for object with multiple read-only segments.

Taken-from: FreeBSD (r296319)


# 8e691ff8 19-Nov-2016 Sascha Wildner <saw@online.de>

Remove some old architecture handling.

Affected #ifdefs:

__arm__
hp300
__ia64__
__mips__
__powerpc__
__sparc64__


Revision tags: v4.6.0, v4.6.0rc2, v4.6.0rc, v4.7.0, v4.4.3, v4.4.2, v4.4.1, v4.4.0, v4.5.0, v4.4.0rc, v4.2.4, v4.3.1, v4.2.3, v4.2.1, v4.2.0, v4.0.6, v4.3.0, v4.2.0rc
# 921fe3b4 26-Apr-2015 Imre Vadasz <imre@vdsz.com>

rtld: Fix a memory leak on thread termination

* Plugs a memory leak in the free_tls() function which was leaking
some memory on every thread termination.


Revision tags: v4.0.5, v4.0.4, v4.0.3, v4.0.2
# 7a6072cc 30-Nov-2014 John Marino <draco@marino.st>

rtld: Add a postinit debugger hook

FreeBSD's dtrace(1) uses this hook to halt the "victim" process before its
entry point is called, at which point probes and DOF data are registered
with the kernel

rtld: Add a postinit debugger hook

FreeBSD's dtrace(1) uses this hook 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_debg_state hook cannot be used for this purpose,
as it is called before the program's init routines are invoked and in
particular before ODF is registered. It may or may not be useful for
DragonFly by itself, but if dtrace every comes in, rtld will be ready.

Taken from: FreeBSD svn 265456 (6 May 2014)
FreeBSD svn 265578 (7 May 2014)

show more ...


# ff452243 30-Nov-2014 John Marino <draco@marino.st>

rtld: Handle IFUNC symbols at non-PLT relocations

An example of this is initializing a global variable with a pointer to
ifunc. This adds a symble type check and call resolver for STT_GNU_IFNC
symb

rtld: Handle IFUNC symbols at non-PLT relocations

An example of this is initializing a global variable with a pointer to
ifunc. This adds a symble type check and call resolver for STT_GNU_IFNC
symbol types whien processing non-PLT relocations, but only after
non-IFUNC relocations are done. The two-phase processing is required
since resolvers may reference other symbols which most be ready to use
when resolver calls are done.

This restructures reloc_non_plt() to call find_symdef() and handle IFUNC
in a single place.

Taken from: FreeBSD svn 270798 (29 Aug 2014)
FreeBSD svn 270802 (29 Aug 2014)

show more ...


# 98e4cb42 30-Nov-2014 John Marino <draco@marino.st>

rtld: Add support for LD_LIBRARY_PATH_FDS env variable

This variable allows loading of shared libraries via directory descriptors
rather than via library paths. if LD_LIBRARY_PATH_FDS=3:4:12, the
di

rtld: Add support for LD_LIBRARY_PATH_FDS env variable

This variable allows loading of shared libraries via directory descriptors
rather than via library paths. if LD_LIBRARY_PATH_FDS=3:4:12, the
directories represented by file descriptors 3, 4, and 12 will be searched
for shared libraries before the normal path-based mechanisms are used.
This allows the execution of unpriviledge binaries from within a Capsicum
sandbox even if they require shared libraries. Note that Capsicum is not
available on DragonFly yet.

While here, adjust whitespace and rearrange a bit to minimize differences
with FreeBSD rtld.

Taken from: FreeBSD svn 267678 (20 June 2014)

show more ...


# 9c476037 30-Nov-2014 John Marino <draco@marino.st>

rtld: Allows return pathname in dl_iterate_phdr dlpi_name

This is the behavior of Linux and also of FreeBSD since October 2014.
Until this point, dlpi_name returned the short name of the object unle

rtld: Allows return pathname in dl_iterate_phdr dlpi_name

This is the behavior of Linux and also of FreeBSD since October 2014.
Until this point, dlpi_name returned the short name of the object unless
it wasn't defined, so the fallback was to return the pathname.

Returning the pathname in all cases is considered more useful and matches
the definition of Linux.

Taken from: FreeBSD svn 272842 (9 Oct 2014)

show more ...


Revision tags: v4.0.1, v4.0.0, v4.0.0rc3, v4.0.0rc2, v4.0.0rc, v4.1.0, v3.8.2, v3.8.1, v3.6.3, v3.8.0, v3.8.0rc2, v3.9.0, v3.8.0rc, v3.6.2
# d84fc918 03-Mar-2014 Sascha Wildner <saw@online.de>

rtld(1): Fix a typo in inactive code.

Confirmed-by: kib@freebsd via marino


# 72e717d2 25-Feb-2014 Sascha Wildner <saw@online.de>

rtld(1): Comment out max_stack_flags and the setting of it for now.

It is only used in code that's already commented out.


# a041f24d 23-Feb-2014 Sascha Wildner <saw@online.de>

rtld: Fix indent.


Revision tags: v3.6.1
# 73ff5bd2 30-Nov-2013 John Marino <draco@marino.st>

rtld: Add directory mapping functionality

Partially taken from:
FreeBSD SVN 255765 (21 SEP 2013)


# 7d311ee5 30-Nov-2013 John Marino <draco@marino.st>

rtld: dl_iterate_phdr change

The dynamic linker needs to include itself when iterating over loaded
ELF objects in dl_iterate_phdr(3).

Taken by:
FreeBSD SVN 257811 (07 NOV 2013)


# 22f5846a 30-Nov-2013 John Marino <draco@marino.st>

rtld: Implement Interpose DSO flag

This implementation was sponsored by FreeBSD Foundation.

Taken from:
SVN 256101 (07 OCT 2013)


Revision tags: v3.6.0, v3.7.1, v3.6.0rc, v3.7.0, v3.4.3
# 086a8efc 16-Aug-2013 Matthew Dillon <dillon@apollo.backplane.com>

vkernel - Module loading for vkernel64

* Fix a missing vm_object_drop() in the kldload error path.

* Load modules using sbrk()'d memory (for now).

* Hack rtld to accept a new environment variable,

vkernel - Module loading for vkernel64

* Fix a missing vm_object_drop() in the kldload error path.

* Load modules using sbrk()'d memory (for now).

* Hack rtld to accept a new environment variable, LD_SHAREDLIB_BASE,
which forces shared libraries to be mmap()'d at the specified address.

* Hack the vkernel64 binary to re-exec itself in order to set
LD_SHAREDLIB_BASE to low memory. This forces shared libraries into
low memory which the KLD module loader can relocate against, instead
of high memory which it can't.

* test/vkernel/Makefile now builds and installs modules by default

With-fixes-from: tuxillo

show more ...


# f03f3171 13-Jun-2013 John Marino <draco@marino.st>

rtld: Sync 7/7 - Use symbol versioning instead of exports mapping

Now that DragonFly has the symbol versioning framework in place, rtld
can leverage it by offloading the symbol export duties to it.

rtld: Sync 7/7 - Use symbol versioning instead of exports mapping

Now that DragonFly has the symbol versioning framework in place, rtld
can leverage it by offloading the symbol export duties to it. This
further reduces differences between FreeBSD and DragonFly linkers.
Keeping the exports table up to date after FreeBSD removed it was extra
work.

show more ...


# 8e58da1e 13-Jun-2013 John Marino <draco@marino.st>

rtld: Sync 6/7 - Minimize differences from FreeBSD

DragonFly developed some rtld features before FreeBSD, and consequently
those features were ported back to FreeBSD. Some portions of these
new lin

rtld: Sync 6/7 - Minimize differences from FreeBSD

DragonFly developed some rtld features before FreeBSD, and consequently
those features were ported back to FreeBSD. Some portions of these
new lines were modified for various reasons, e.g. the variable names
weren't liked or additional constraints were deemed necessary such as
the ability to maintain the old (incorrect) behavior of RUNPATH.

In any case, there were minor differences including whitespace, and
this commit reduces those differences to ease future syncing.

show more ...


1234