#
9ea864b5 |
| 13-Feb-2024 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld symlook_obj: move common code to check filtees into helper
Revieved by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43858
|
#
e7951d0b |
| 01-Feb-2024 |
Mark Johnston <markj@FreeBSD.org> |
rtld-elf: Avoid unnecessary lock_restart_for_upgrade() calls
In order to atomically upgrade the rtld bind lock, load_filtees() may trigger a longjmp back to _rtld_bind() so that the binding can be d
rtld-elf: Avoid unnecessary lock_restart_for_upgrade() calls
In order to atomically upgrade the rtld bind lock, load_filtees() may trigger a longjmp back to _rtld_bind() so that the binding can be done with the write lock held. However, the write lock is only needed when filtee objects haven't already been loaded, so move the lock_restart_for_upgrade() call to avoid unnecessary lock upgrades when a filtee is defined.
Reviewed by: kib Tested by: brooks MFC after: 1 week Sponsored by: Innovate UK
show more ...
|
#
9daf6cd0 |
| 29-Nov-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
RTLD_DEEPBIND: make lookup not just symbolic, but walk all refobj' DAGs
before starting the walk over the global list. Effectively we visit needed objects first as well, instead of just the object
RTLD_DEEPBIND: make lookup not just symbolic, but walk all refobj' DAGs
before starting the walk over the global list. Effectively we visit needed objects first as well, instead of just the object itself. This seems to better match the semantic offered by the glibc flag.
Reported by: kevans PR: 275393 Reviewed by: kevans Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D42841
show more ...
|
#
a6fe717c |
| 24-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
libexec: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
R
libexec: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/
Sponsored by: Netflix
show more ...
|
#
95335dd3 |
| 29-Oct-2023 |
Stephen J. Kiernan <stevek@FreeBSD.org> |
rtld: introduce STATIC_TLS_EXTRA
The new STATIC_TLS_EXTRA variable provides a means for applications to increases the size of the extra static TLS space allocated by rtld beyond the default of '128'
rtld: introduce STATIC_TLS_EXTRA
The new STATIC_TLS_EXTRA variable provides a means for applications to increases the size of the extra static TLS space allocated by rtld beyond the default of '128'. This extra static TLS space is used for objects loaded with dlopen.
The value specified in the variable must be no less than the default value and no greater than the maximum allowed value for size_t type.
If an invalid value is specified, rtld will ignore it and just use the default value.
The rtld(1) man page is updated to document this new option.
Obtained from: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D42025
show more ...
|
#
72d97e1d |
| 15-Sep-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: output rtld errors into the dbg channel
Sponsored by: The FreeBSD Foundation MFC after: 1 week
|
#
feaae6ba |
| 30-Jul-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: switch from malloc_aligned() to __crt_aligned_alloc()
Use regular free(), since it works now.
Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision:
rtld: switch from malloc_aligned() to __crt_aligned_alloc()
Use regular free(), since it works now.
Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41150
show more ...
|
#
b1d3e2b7 |
| 18-Aug-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: unlock bind lock when calling into crt __pthread_distribute_static_tls method
The method might require resolving and binding symbols, which means recursing on the bind lock. It is safe to unlo
rtld: unlock bind lock when calling into crt __pthread_distribute_static_tls method
The method might require resolving and binding symbols, which means recursing on the bind lock. It is safe to unlock the bind lock, since we operate on the private object list, and user attempting to unload an object from the list of not yet fully loaded objects caused self-inflicted race.
It is similar to how we treat user' init/fini methods.
Reported by: stevek Sponsored by: The FreeBSD Foundation MFC after: 1 week
show more ...
|
#
1d386b48 |
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
#
1005d3d0 |
| 14-Jul-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: fix dlopen() for an object that is already mapped but not yet initialized
For instance, dso might be mapped as needed but not yet initialized from the other subtree of needed objects, while cu
rtld: fix dlopen() for an object that is already mapped but not yet initialized
For instance, dso might be mapped as needed but not yet initialized from the other subtree of needed objects, while current object' constructor does dlopen() for the dso. Right now rtld does relocations and other processing based on the arrival of new objects in the global list, which is not happens there. Directly check for the initialization state of the object, for which we would return the handle.
One practical use case of this support is e.g. dlopen("libthr.so", RTLD_NOLOAD) by libraries that are threading-aware but happy to live with libc pthread shims if the program is not multithreaded.
Reviewed by: tijl Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
show more ...
|
#
f940929d |
| 09-Jul-2023 |
Jessica Clarke <jrtc27@FreeBSD.org> |
rtld-elf: Migrate from COMPAT_32BIT to generic COMPAT_libcompat/LIBCOMPAT
We still have a tiny amount of libcompat-specific code in rtld_paths.h, but it's been deduplicated as much as possible, and
rtld-elf: Migrate from COMPAT_32BIT to generic COMPAT_libcompat/LIBCOMPAT
We still have a tiny amount of libcompat-specific code in rtld_paths.h, but it's been deduplicated as much as possible, and in future we may wish to just push these variables down to the few consumers of them and make them use the double-underscore variants with a libcompat argument rather than give them names here.
See commit 8fad2cda93c7 ("bsd.compat.mk: Provide new CPP and sub-make variables") for the context behind this change.
Reviewed by: kib, brooks, jhb Differential Revision: https://reviews.freebsd.org/D40925
show more ...
|
#
38efd4df |
| 20-Jun-2023 |
John Baldwin <jhb@FreeBSD.org> |
rtld-elf: Mark tls_init_align __unused in free_tls for Variant I TLS.
Some architectures (powerpc and RISC-V) always use 0 for the post TLS size in which case tls_init_align isn't used by calculate_
rtld-elf: Mark tls_init_align __unused in free_tls for Variant I TLS.
Some architectures (powerpc and RISC-V) always use 0 for the post TLS size in which case tls_init_align isn't used by calculate_tls_post_size. Use __unused to quiet the warning for these platforms.
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D40673
show more ...
|
#
e9a38ed2 |
| 09-Jun-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: fix allocate_module_tls() variant I fallback to static allocation
Submitted by: Joerg Sonnenberger Fixes: 91880e07f605edb90339685bc934699a4344de3bESC MFC after: 1 week
|
#
91880e07 |
| 05-Jun-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: do not allow both dynamic DTV index and static TLS offset
If we are allocating static offset for an object with dynamic index, return failure. In the opposite case, if dynamic index is reques
rtld: do not allow both dynamic DTV index and static TLS offset
If we are allocating static offset for an object with dynamic index, return failure. In the opposite case, if dynamic index is requested for statically allocated TLS area, directly use the offset instead of setting the index.
Taken from NetBSD Joerg Sonnenberger change for src/libexec/ld.elf_so/tls.c rev. 1.18.
Sponsored by: The FreeBSD Foundation MFC after: 1 week
show more ...
|
#
283a4f40 |
| 05-Jun-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: rename tls_done to tls_static
The meaning of the flag is that static TLS allocation was done.
Taken from NetBSD Joerg Sonnenberger change for src/libexec/ld.elf_so/tls.c rev. 1.18.
Sponsored
rtld: rename tls_done to tls_static
The meaning of the flag is that static TLS allocation was done.
Taken from NetBSD Joerg Sonnenberger change for src/libexec/ld.elf_so/tls.c rev. 1.18.
Sponsored by: The FreeBSD Foundation MFC after: 1 week
show more ...
|
#
4d846d26 |
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
show more ...
|
#
7cdfe51f |
| 13-Apr-2023 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: fixes for handling of the grouped options
Do not terminate scanning group when 'd' is encountered. The 'b' option must be last in the group, same as 'f'.
Reviewed by: markj Sponsored by: The
rtld: fixes for handling of the grouped options
Do not terminate scanning group when 'd' is encountered. The 'b' option must be last in the group, same as 'f'.
Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D39544
show more ...
|
#
29e3a065 |
| 12-Apr-2023 |
Ed Maste <emaste@FreeBSD.org> |
rtld: fix SysV hash function overflow
Quoting from https://maskray.me/blog/2023-04-12-elf-hash-function:
The System V Application Binary Interface (generic ABI) specifies the ELF object file format
rtld: fix SysV hash function overflow
Quoting from https://maskray.me/blog/2023-04-12-elf-hash-function:
The System V Application Binary Interface (generic ABI) specifies the ELF object file format. When producing an output executable or shared object needing a dynamic symbol table (.dynsym), a linker generates a .hash section with type SHT_HASH to hold a symbol hash table. A DT_HASH tag is produced to hold the address of .hash.
The function is supposed to return a value no larger than 0x0fffffff. Unfortunately, there is a bug. When unsigned long consists of more than 32 bits, the return value may be larger than UINT32_MAX. For instance, elf_hash((const unsigned char *)"\xff\x0f\x0f\x0f\x0f\x0f\x12") returns 0x100000002, which is clearly unintended, as the function should behave the same way regardless of whether long represents a 32-bit integer or a 64-bit integer.
Reviewed by: kib, Fangrui Song Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39517
show more ...
|
#
87443cb6 |
| 12-Apr-2023 |
Ed Maste <emaste@FreeBSD.org> |
rtld: reindent and style(9) elf_hash()
In preparation for an upcoming change (D39517).
Sponsored by: The FreeBSD Foundation
|
#
b069d3e0 |
| 04-Jan-2023 |
John Baldwin <jhb@FreeBSD.org> |
rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call"
After the removal of ia64 and sparc64, all current architectures support executable stacks at an architectural level.
This rever
rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call"
After the removal of ia64 and sparc64, all current architectures support executable stacks at an architectural level.
This reverts commit 1290d38ac50b3afa7e5781d9d97346a1042c736c.
Reviewed by: kib Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D37904
show more ...
|
Revision tags: release/12.4.0 |
|
#
8cc44a1e |
| 10-Nov-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: add support for the $LIB token
similar to the same token in glibc.
Requested and reviewed by: bapt Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://review
rtld: add support for the $LIB token
similar to the same token in glibc.
Requested and reviewed by: bapt Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D37329
show more ...
|
#
f585d13d |
| 22-Oct-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: remove unused macro FPTR_TARGET
It is a remnant from the ia64 removal
Sponsored by: The FreeBSD Foundation MFC after: 3 days
|
#
2f72ee98 |
| 18-Sep-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
ldd: remove '[preloaded]' marker for the preloaded objects
for the default output. For '-a' (per-object needed printout) the [preloaded] banner is kept.
Instead, use special format2 for printing t
ldd: remove '[preloaded]' marker for the preloaded objects
for the default output. For '-a' (per-object needed printout) the [preloaded] banner is kept.
Instead, use special format2 for printing the preloaded objects (and vdso), which does not include DT_NEEDED, since there is no object needing the printed one.
In this way, the output is more compatible with glibc.
Example: LD_PRELOAD=/lib/libthr.so.3 LD_TRACE_LOADED_OBJECTS=1 /libexec/ld-elf.so.1 /bin/ls libutil.so.9 => /lib/libutil.so.9 (0x801099000) libncursesw.so.9 => /lib/libncursesw.so.9 (0x8010b0000) libc.so.7 => /lib/libc.so.7 (0x801123000) [vdso] (0x7ffffffff000) /lib/libthr.so.3 (0x80106c000) Note the absense of the part before and including '=>' for preloaded libthr.so.3, and for vdso.
PR: 265750 Reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D36616
show more ...
|
#
daa85548 |
| 15-Sep-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld: teach LD_SHOW_AUXV about AT_USRSTACK*
Reviewed by: brooks, imp (previous version) Discussed with: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://r
rtld: teach LD_SHOW_AUXV about AT_USRSTACK*
Reviewed by: brooks, imp (previous version) Discussed with: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36540
show more ...
|
#
832b40f7 |
| 31-Aug-2022 |
Konstantin Belousov <kib@FreeBSD.org> |
rtld.c: remove extra blank line
Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D36396
|