History log of /openbsd-src/libexec/ld.so/resolve.c (Results 1 – 25 of 103)
Revision Date Author Comments
# 210cc31e 22-Jan-2024 deraadt <deraadt@openbsd.org>

ugly whitespaces


# 4a066def 16-Jan-2024 deraadt <deraadt@openbsd.org>

Read PT_OPENBSD_SYSCALLS in libc.so, and convert it to a table for
pinsyscalls(2).
ok kettenis


# d198ddd1 08-Jul-2023 jasper <jasper@openbsd.org>

turn an ifdef'd _dl_printf call into DL_DEB and various whitespace fixes

sure deraadt@


# d82bde86 13-Apr-2023 millert <millert@openbsd.org>

Avoid an overflow in the ELF SYSV ABI hash function.
The hash function is supposed to return a value less than or equal
to 0x0fffffff. Due to a bug in the sample code supplied with the
ELF SYSV ABI

Avoid an overflow in the ELF SYSV ABI hash function.
The hash function is supposed to return a value less than or equal
to 0x0fffffff. Due to a bug in the sample code supplied with the
ELF SYSV ABI documentation, the hash function can overflow on 64-bit
systems. Apply the same fix used by GNU libc, MUSL libc and FreeBSD.
Prompted by https://maskray.me/blog/2023-04-12-elf-hash-function
OK tb@ miod@

show more ...


# c51b9268 09-Apr-2023 gnezdo <gnezdo@openbsd.org>

Treat symlinks better in $ORIGIN determination in ld.so

Now symlinking an executable away from the rest of its installation
tree no longer prevents it from finding the libraries. This matches
the be

Treat symlinks better in $ORIGIN determination in ld.so

Now symlinking an executable away from the rest of its installation
tree no longer prevents it from finding the libraries. This matches
the behavior of other OS linkers. Prompted by a behavior change in
lang/ghc test suite.

Swapped the order of dirname/realpath in _dl_origin_path.

Added some regress tests that pass and then bin3 that fails without
this change and reflects the behavior needd for lang/ghc.

Suggestion by semarie@, OK deraadt@

show more ...


# b722ba42 08-Jan-2022 guenther <guenther@openbsd.org>

Prep .c files for removing the #includes from */archdep.h
* replace #include "archdep.h" with #includes of what is used, pulling in
"syscall.h", "util.h", and "archdep.h" as needed
* delete #inc

Prep .c files for removing the #includes from */archdep.h
* replace #include "archdep.h" with #includes of what is used, pulling in
"syscall.h", "util.h", and "archdep.h" as needed
* delete #include <sys/syscall.h> from syscall.h
* only pull in <sys/stat.h> to the three files that use _dl_fstat(),
forward declare struct stat in syscall.h for the others
* NBBY is for <sys/select.h> macros; just use '8' in dl_printf.c
* <machine/vmparam.h> is only needed on i386; conditionalize it
* stop using __LDPGSZ: use _MAX_PAGE_SHIFT (already used by malloc.c)
where necessary
* delete other bogus #includes, order legit per style: <sys/*> then
<*/*>, then <*>, then "*"

dir.c improvement from jsg@
ok and testing assistance deraadt@

show more ...


# b3331980 12-Nov-2021 guenther <guenther@openbsd.org>

Add support for RELR relocations in the executable and share objects.
This doesn't affect ld.so's self-reloc, which still requires DT_REL/DT_RELA

ok kettenis@


# 296fbf9f 02-Jun-2021 semarie <semarie@openbsd.org>

add RTLD_NODELETE support

if RTLD_NODELETE isn't POSIX, it is widely deployed: at least linux,
freebsd, dragonfly, netbsd, solaris, illumos, apple, and fuchsia have
it.

ok kettenis@ on previous ver

add RTLD_NODELETE support

if RTLD_NODELETE isn't POSIX, it is widely deployed: at least linux,
freebsd, dragonfly, netbsd, solaris, illumos, apple, and fuchsia have
it.

ok kettenis@ on previous version
with help from and ok guenther@

diff partially inspired from a diff from brad@

show more ...


# d937a926 04-Oct-2019 guenther <guenther@openbsd.org>

Convert the child_list member from a linked list to a vector.

ok mpi@


# bae526ee 03-Oct-2019 guenther <guenther@openbsd.org>

Use a better algorithm for calculating the grpsym library order.
The existing code did a full recursive walk for O(horrible). Instead,
keep a single list of nodes plus the index of the first node wh

Use a better algorithm for calculating the grpsym library order.
The existing code did a full recursive walk for O(horrible). Instead,
keep a single list of nodes plus the index of the first node whose
children haven't been scanned; lookup until that index catches the
end, appending the unscanned children of the node at the index. This
also makes the grpsym list order match that calculated by FreeBSD and
glibc in dependency trees with inconsistent ordering of dependent libs.

To make this easier and more cache friendly, convert grpsym_list
to a vector: the size is bounded by the number of objects currently
loaded.

Other, related fixes:
* increment the grpsym generation number _after_ pushing the loading
object onto its grpsym list, to avoid double counting it
* increment the grpsym generation number when building the grpsym list
for an already loaded object that's being dlopen()ed, to avoid
incomplete grpsym lists
* use a more accurate test of whether an object already has a grpsym list

Prompted by a diff from Nathanael Rensen (nathanael (at) list.polymorpheus.com)
that pointed to _dl_cache_grpsym_list() as a performance bottleneck.

Much proding from robert@, sthen@, aja@, jca@
no problem reports after being in snaps
ok mpi@

show more ...


# 143e5acc 04-Aug-2019 guenther <guenther@openbsd.org>

Simplify _dl_find_symbol(). Currently, it returns three values:
- the symbol it found, returned via the second argument
- the base offset of the the object it was found in, via the return value
-

Simplify _dl_find_symbol(). Currently, it returns three values:
- the symbol it found, returned via the second argument
- the base offset of the the object it was found in, via the return value
- optionally: the object it was found in, returned via the last argument

Instead, return a struct with the symbol and object pointers and let the
caller get the base offset from the object's obj_base member. On at least
aarch64, amd64, mips64, powerpc, and sparc64, a two word struct like this
is passed in registers.

ok mpi@, kettenis@

show more ...


# 518321a8 21-Jul-2019 guenther <guenther@openbsd.org>

In 2004, we upgraded to binutils 2.14 with did -zcombreloc by default.
In 2013, I implemented the single-entry LRU cache that gets the maximal
symbol reuse from combreloc. Since then, the ld.so gene

In 2004, we upgraded to binutils 2.14 with did -zcombreloc by default.
In 2013, I implemented the single-entry LRU cache that gets the maximal
symbol reuse from combreloc. Since then, the ld.so generic relocation
symcache has been a waste of CPU and memory with 0% hit-rate, so kill it.

ok mpi@

show more ...


# 6eb4f976 14-Jul-2019 guenther <guenther@openbsd.org>

ld.so's $ORIGIN handling when argv[0] is a relative path was broken by
the change in __getcwd(2)'s return value. Fix it by switching to the
__realpath(2) syscall, eliminating the ld.so copy of realp

ld.so's $ORIGIN handling when argv[0] is a relative path was broken by
the change in __getcwd(2)'s return value. Fix it by switching to the
__realpath(2) syscall, eliminating the ld.so copy of realpath().

problem caught by regress and noted by bluhm@
ok deraadt@

show more ...


# 9d9b0c10 21-Apr-2019 deraadt <deraadt@openbsd.org>

Now that all Elf_foo types are correct, we don't need to use Elf32_Word
anywhere and can use Elf_Word instead.
ok guenther


# 4e986f76 21-Apr-2019 guenther <guenther@openbsd.org>

On alpha, the buckets of DT_HASH are 8 bytes instead of 4 bytes. This was
previously 'implemented' by having the Elf_Word typedef in <sys/exec_elf.h>
vary, but that doesn't match the spec and breaks

On alpha, the buckets of DT_HASH are 8 bytes instead of 4 bytes. This was
previously 'implemented' by having the Elf_Word typedef in <sys/exec_elf.h>
vary, but that doesn't match the spec and breaks libelf so it's gone away.
Implement the variation here by defining our own type locally for this.

ok deraadt@

show more ...


# ac51d06c 28-Nov-2018 guenther <guenther@openbsd.org>

Implement support for DT_GNU_HASH, taking all the interesting bits
from Matt Dillon's implementation in DragonFlyBSD commit 7629c631.
One difference is that as long as DT_HASH is still present, ld.so

Implement support for DT_GNU_HASH, taking all the interesting bits
from Matt Dillon's implementation in DragonFlyBSD commit 7629c631.
One difference is that as long as DT_HASH is still present, ld.so
will use that to get the total number of symbols rather than walking
the GNU hash chains. Note that the GPLv2 binutils we have doesn't
support DT_GNU_HASH, so this only helps archs were lld is used.

ok kettenis@ mpi@

show more ...


# 25205068 16-Nov-2018 guenther <guenther@openbsd.org>

Finish ld.so's transition to GNU_RELRO: eliminate support for using
__got_{start,end} to find a region to mark read-only. It was only used
for binaries that didn't have a GNU_RELRO segment, but all

Finish ld.so's transition to GNU_RELRO: eliminate support for using
__got_{start,end} to find a region to mark read-only. It was only used
for binaries that didn't have a GNU_RELRO segment, but all archs have
been using that for over a year. Since support for insecure-PLT layouts
on powerpc and alpha have been removed, all archs handle GNU_RELRO the
same way and the support can be moved from the MD code to the MI code.

ok mpi@

show more ...


# 49fb1b57 16-Nov-2018 guenther <guenther@openbsd.org>

Borrow an idea from DragonFly BSD: factor out the "does this symbol match what
we're looking up?" logic from _dl_find_symbol_obj() into matched_symbol(), so
that the former is just the "iterate acros

Borrow an idea from DragonFly BSD: factor out the "does this symbol match what
we're looking up?" logic from _dl_find_symbol_obj() into matched_symbol(), so
that the former is just the "iterate across the hash" logic.

matched_symbol() returns zero on "not found", one on "found strong
symbol", and negative one on "found weak symbol". The last of those lets
the caller give up on this object after finding a weak symbol, as there's
no point in continuing to search for a strong symbol in the same object.

ok mpi@

show more ...


# b5a21baa 15-Nov-2018 guenther <guenther@openbsd.org>

Put all the symbol lookup parameters (except the object being searched) and
the return pointers into a structure and pass that to _dl_find_symbol_obj().
Set sl->sl_obj_out in _dl_find_symbol_obj() so

Put all the symbol lookup parameters (except the object being searched) and
the return pointers into a structure and pass that to _dl_find_symbol_obj().
Set sl->sl_obj_out in _dl_find_symbol_obj() so that the callers don't
need to each record the object.

ok mpi@

show more ...


# 10200827 22-Oct-2018 guenther <guenther@openbsd.org>

Use int, not char*, for booleans

ok millert@


# 91659d32 09-Mar-2018 kettenis <kettenis@openbsd.org>

Add support for the DF_TEXTREL flag.

ok patrick@, millert@


# 3b50b772 24-Jan-2017 guenther <guenther@openbsd.org>

On fatal errors, kill ourselves with thrkill(0,9,NULL) instead of
simply exiting, via helper functions _dl_die(), _dl_diedie(), and
_dl_oom().

prompted by a complaint from jsing@
ok jsing@ deraadt@


# 439893b0 24-Jan-2017 guenther <guenther@openbsd.org>

Unbreak $ORIGIN support when only one of DT_RUNPATH and DT_RPATH is used


# b053069a 23-Jan-2017 naddy <naddy@openbsd.org>

remove line that slipped in with rev 1.77 but doesn't belong there; ok sthen@


# d8ad95d2 23-Jan-2017 guenther <guenther@openbsd.org>

Whoops, lost the adjustment of DT_RUNPATH value as a DT_STRTAB value.

problem reported by semarie@


12345