OpenBSD CVS

CVS log for src/libexec/ld.so/resolve.c


[BACK] Up to [local] / src / libexec / ld.so

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.102 / (download) - annotate - [select for diffs], Mon Jan 22 02:08:31 2024 UTC (4 months, 1 week ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.101: +4 -4 lines
Diff to previous 1.101 (colored)

ugly whitespaces

Revision 1.101 / (download) - annotate - [select for diffs], Tue Jan 16 19:07:31 2024 UTC (4 months, 2 weeks ago) by deraadt
Branch: MAIN
Changes since 1.100: +83 -1 lines
Diff to previous 1.100 (colored)

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

Revision 1.100 / (download) - annotate - [select for diffs], Sat Jul 8 14:09:43 2023 UTC (10 months, 3 weeks ago) by jasper
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.99: +5 -6 lines
Diff to previous 1.99 (colored)

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

sure deraadt@

Revision 1.99 / (download) - annotate - [select for diffs], Thu Apr 13 19:57:30 2023 UTC (13 months, 2 weeks ago) by millert
Branch: MAIN
Changes since 1.98: +3 -5 lines
Diff to previous 1.98 (colored)

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@

Revision 1.98 / (download) - annotate - [select for diffs], Sun Apr 9 23:41:47 2023 UTC (13 months, 3 weeks ago) by gnezdo
Branch: MAIN
Changes since 1.97: +8 -5 lines
Diff to previous 1.97 (colored)

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@

Revision 1.97 / (download) - annotate - [select for diffs], Sat Jan 8 06:49:41 2022 UTC (2 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.96: +3 -4 lines
Diff to previous 1.96 (colored)

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@

Revision 1.96 / (download) - annotate - [select for diffs], Fri Nov 12 22:28:13 2021 UTC (2 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.95: +3 -1 lines
Diff to previous 1.95 (colored)

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@

Revision 1.95 / (download) - annotate - [select for diffs], Wed Jun 2 07:29:03 2021 UTC (3 years ago) by semarie
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.94: +11 -5 lines
Diff to previous 1.94 (colored)

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@

Revision 1.94 / (download) - annotate - [select for diffs], Fri Oct 4 17:42:16 2019 UTC (4 years, 7 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.93: +2 -3 lines
Diff to previous 1.93 (colored)

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

ok mpi@

Revision 1.93 / (download) - annotate - [select for diffs], Thu Oct 3 06:10:54 2019 UTC (4 years, 8 months ago) by guenther
Branch: MAIN
Changes since 1.92: +25 -13 lines
Diff to previous 1.92 (colored)

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@

Revision 1.92 / (download) - annotate - [select for diffs], Sun Aug 4 23:51:45 2019 UTC (4 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.91: +30 -54 lines
Diff to previous 1.91 (colored)

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@

Revision 1.91 / (download) - annotate - [select for diffs], Sun Jul 21 03:54:16 2019 UTC (4 years, 10 months ago) by guenther
Branch: MAIN
Changes since 1.90: +4 -45 lines
Diff to previous 1.90 (colored)

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@

Revision 1.90 / (download) - annotate - [select for diffs], Sun Jul 14 03:23:12 2019 UTC (4 years, 10 months ago) by guenther
Branch: MAIN
Changes since 1.89: +3 -2 lines
Diff to previous 1.89 (colored)

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@

Revision 1.89 / (download) - annotate - [select for diffs], Sun Apr 21 04:11:42 2019 UTC (5 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.88: +9 -9 lines
Diff to previous 1.88 (colored)

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

Revision 1.88 / (download) - annotate - [select for diffs], Sun Apr 21 03:41:13 2019 UTC (5 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.87: +3 -3 lines
Diff to previous 1.87 (colored)

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@

Revision 1.87 / (download) - annotate - [select for diffs], Wed Nov 28 03:18:00 2018 UTC (5 years, 6 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.86: +108 -18 lines
Diff to previous 1.86 (colored)

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@

Revision 1.86 / (download) - annotate - [select for diffs], Fri Nov 16 21:15:47 2018 UTC (5 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.85: +2 -69 lines
Diff to previous 1.85 (colored)

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@

Revision 1.85 / (download) - annotate - [select for diffs], Fri Nov 16 05:05:44 2018 UTC (5 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.84: +54 -38 lines
Diff to previous 1.84 (colored)

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@

Revision 1.84 / (download) - annotate - [select for diffs], Thu Nov 15 21:25:44 2018 UTC (5 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.83: +60 -72 lines
Diff to previous 1.83 (colored)

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@

Revision 1.83 / (download) - annotate - [select for diffs], Mon Oct 22 01:59:08 2018 UTC (5 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.82: +2 -2 lines
Diff to previous 1.82 (colored)

Use int, not char*, for booleans

ok millert@

Revision 1.82 / (download) - annotate - [select for diffs], Fri Mar 9 14:55:44 2018 UTC (6 years, 2 months ago) by kettenis
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.81: +3 -1 lines
Diff to previous 1.81 (colored)

Add support for the DF_TEXTREL flag.

ok patrick@, millert@

Revision 1.81 / (download) - annotate - [select for diffs], Tue Jan 24 07:48:37 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.80: +3 -3 lines
Diff to previous 1.80 (colored)

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@

Revision 1.80 / (download) - annotate - [select for diffs], Tue Jan 24 02:37:10 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.79: +8 -6 lines
Diff to previous 1.79 (colored)

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

Revision 1.79 / (download) - annotate - [select for diffs], Mon Jan 23 16:20:35 2017 UTC (7 years, 4 months ago) by naddy
Branch: MAIN
Changes since 1.78: +1 -2 lines
Diff to previous 1.78 (colored)

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

Revision 1.78 / (download) - annotate - [select for diffs], Mon Jan 23 13:13:12 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.77: +3 -1 lines
Diff to previous 1.77 (colored)

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

problem reported by semarie@

Revision 1.77 / (download) - annotate - [select for diffs], Mon Jan 23 13:00:09 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.76: +3 -2 lines
Diff to previous 1.76 (colored)

Mark a bunch of stuff static

ok kettenis@

Revision 1.76 / (download) - annotate - [select for diffs], Sun Jan 22 01:20:36 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.75: +30 -13 lines
Diff to previous 1.75 (colored)

Add support for DT_RUNPATH and DT_FLAGS

ok kettenis@

Revision 1.75 / (download) - annotate - [select for diffs], Tue Aug 23 06:46:17 2016 UTC (7 years, 9 months ago) by kettenis
Branch: MAIN
Changes since 1.74: +8 -1 lines
Diff to previous 1.74 (colored)

Implement support for DT_INIT_ARRAY, DT_FINI_ARRAY and DT_PREINIT_ARRAY.
Don't skip DT_INIT and DT_FINI for the main executable.  This matches what
Linux and Solaris do.

ok guenther@

Revision 1.74 / (download) - annotate - [select for diffs], Mon Aug 8 21:59:20 2016 UTC (7 years, 9 months ago) by guenther
Branch: MAIN
Changes since 1.73: +36 -14 lines
Diff to previous 1.73 (colored)

Look for a PT_GNU_RELRO section per object and, if present, mprotect that
range instead of the [__got_start, __got_end) range.
On many archs this will cover _DYNAMIC too, so move up the DT_DEBUG handling
to before relocations and the mprotect are done.

ok kettenis@

Revision 1.73 / (download) - annotate - [select for diffs], Mon Jul 4 21:15:06 2016 UTC (7 years, 10 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.72: +1 -4 lines
Diff to previous 1.72 (colored)

Remove prebind support: binding to symbol table indices is too fragile
for our development process.

ok kettenis@ deraadt@

Revision 1.72 / (download) - annotate - [select for diffs], Sun Mar 20 02:29:51 2016 UTC (8 years, 2 months ago) by guenther
Branch: MAIN
Changes since 1.71: +3 -4 lines
Diff to previous 1.71 (colored)

Export environ and __progname, making the latter a copy of just the filename
portion like crt0 does.  This is prep for eliminating _dl_fixup_user_env()
Mark almost everything in resolve.h as hidden, to improve code generation.

ok kettenis@ mpi@  "good time" deraadt@

Revision 1.71 / (download) - annotate - [select for diffs], Sun Jan 24 03:54:34 2016 UTC (8 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.70: +2 -27 lines
Diff to previous 1.70 (colored)

Delete remnants of grpsym cache setting during symbol search: it's done at
load time only nwo.  Rename _dl_searchnum and lastlookup to _dl_grpsym_gen
and grpsym_gen as they are generation numbers.  Merge _dl_newsymsearch()
into _dl_cache_grpsym_list_setup().

ok millert@

Revision 1.70 / (download) - annotate - [select for diffs], Sun Jan 24 03:45:54 2016 UTC (8 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.69: +11 -5 lines
Diff to previous 1.69 (colored)

Lacking precise dependency-from-relocation tracking, a nodelete object
needs to lock down the entire load group, not just the specific object.

problem report and ok sthen@
been in snaps for a week

Revision 1.69 / (download) - annotate - [select for diffs], Mon Nov 2 07:02:53 2015 UTC (8 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.68: +43 -1 lines
Diff to previous 1.68 (colored)

Factor out the logic for mprotecting the memory between two symbols into
a new MI routine _dl_protect_segment(), and use that for protecting the
GOT and--on some archs--the PLT.

Amazing testing turnaround by miod@, who apparently violated relativity
to get back results on some archs as fast as he did

Revision 1.68 / (download) - annotate - [select for diffs], Thu Jan 22 05:48:17 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.67: +4 -4 lines
Diff to previous 1.67 (colored)

delete annoying white space that annoy

Revision 1.67 / (download) - annotate - [select for diffs], Thu Jul 10 09:03:01 2014 UTC (9 years, 10 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.66: +5 -2 lines
Diff to previous 1.66 (colored)

check all memory allocations; ok miod@ guenther@

Revision 1.66 / (download) - annotate - [select for diffs], Sat Jun 21 08:00:23 2014 UTC (9 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.65: +3 -2 lines
Diff to previous 1.65 (colored)

Move to a non-zeroing _dl_malloc, a _dl_calloc and _dl_reallocarry and
fix _dl_strdup to return NULL instead of crash; ok deraadt@

Revision 1.65 / (download) - annotate - [select for diffs], Wed Nov 27 21:25:25 2013 UTC (10 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.64: +2 -2 lines
Diff to previous 1.64 (colored)

unsigned char for ctype
ok okan kettenis

Revision 1.64 / (download) - annotate - [select for diffs], Wed Nov 13 05:41:42 2013 UTC (10 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.63: +54 -60 lines
Diff to previous 1.63 (colored)

prototype & void * math cleanup
ok guenther

Revision 1.63 / (download) - annotate - [select for diffs], Sat Jun 1 09:57:55 2013 UTC (11 years ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.62: +3 -1 lines
Diff to previous 1.62 (colored)

Introduce ltrace(1). This tool works with ld.so to inject utrace record for
each plt call, allowing to trace a binary linked against shared library at the
public function call level.

To do so, ltrace(1) sets up some environment variables to enable plt tracing
in ld.so, and invokes ktrace(2) for utrace events. ld.so will force lazy
binding and will send an utrace record in the plt resolver, without updating
the plt.

Minimal filtering capabilities are provided, inspired by Solaris' truss -u,
to limit tracing to libraries and/or symbol names. Non-traced libraries and
symbols will have the regular resolver processing, with the expected plt
update.

"Get it in" deraadt

Revision 1.62 / (download) - annotate - [select for diffs], Wed May 8 20:55:14 2013 UTC (11 years ago) by guenther
Branch: MAIN
Changes since 1.61: +5 -1 lines
Diff to previous 1.61 (colored)

Implement symbol caching and RELACOUNT/RELCOUNT optimizations.
Much assistance and testing by miod

ok miod@

Revision 1.61 / (download) - annotate - [select for diffs], Fri Apr 5 12:58:03 2013 UTC (11 years, 1 month ago) by kurt
Branch: MAIN
Changes since 1.60: +165 -3 lines
Diff to previous 1.60 (colored)

- Add ORIGIN, OSNAME, OSREL and PLATFORM substitution support for rpaths.
Improvements and okay matthew@, millert@, guenther@

Revision 1.60 / (download) - annotate - [select for diffs], Wed Mar 20 21:49:59 2013 UTC (11 years, 2 months ago) by kurt
Branch: MAIN
Changes since 1.59: +7 -1 lines
Diff to previous 1.59 (colored)

- Parse colon separated paths into NULL terminated arrays of string
pointers to prepare for adding rpath ORIGIN support.
okay matthew@ millert@

Revision 1.59 / (download) - annotate - [select for diffs], Fri Jul 6 23:15:50 2012 UTC (11 years, 10 months ago) by matthew
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.58: +3 -2 lines
Diff to previous 1.58 (colored)

Fix LD_DEBUG=1 regression introduced by previous commit.

ok kurt

Revision 1.58 / (download) - annotate - [select for diffs], Thu Jun 14 21:30:50 2012 UTC (11 years, 11 months ago) by kettenis
Branch: MAIN
Changes since 1.57: +20 -12 lines
Diff to previous 1.57 (colored)

Add support for DF_1_NOOPEN.  Based on an origional diff from matthew@.

ok matthew@

Revision 1.57 / (download) - annotate - [select for diffs], Mon Nov 28 20:59:03 2011 UTC (12 years, 6 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.56: +13 -3 lines
Diff to previous 1.56 (colored)

Add support for getting some flags from DT_FLAGS_1: new flags
DF_1_NODELETE and DF_1_INITFIRST, as well as DF_1_NOW and DF_1_GLOBAL.

Committing for kurt@ who worked out the final version; ok guenther@ drahn@

Revision 1.56 / (download) - annotate - [select for diffs], Mon Jun 27 16:47:50 2011 UTC (12 years, 11 months ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.55: +6 -123 lines
Diff to previous 1.55 (colored)

Backout the dynamic linker speed improvement diff for now, it still
has some issues. Discussed with various, ok drahn@

Revision 1.55 / (download) - annotate - [select for diffs], Thu May 26 05:10:49 2011 UTC (13 years ago) by otto
Branch: MAIN
Changes since 1.54: +2 -4 lines
Diff to previous 1.54 (colored)

No need to call _dl_newsymsearch() twice; ok drahn@

Revision 1.54 / (download) - annotate - [select for diffs], Sun May 22 22:43:47 2011 UTC (13 years ago) by drahn
Branch: MAIN
Changes since 1.53: +125 -6 lines
Diff to previous 1.53 (colored)

Dynamic linker speed improvement diff. tested by several sinc k2k11.
get it in tree now deraadt@, ok by several ports folks. Thanks for the testing.

Revision 1.53 / (download) - annotate - [select for diffs], Tue May 10 04:50:35 2011 UTC (13 years ago) by otto
Branch: MAIN
Changes since 1.52: +7 -1 lines
Diff to previous 1.52 (colored)

Fix previous. On i386, library.c isn't compiled

Revision 1.52 / (download) - annotate - [select for diffs], Mon Oct 25 20:34:44 2010 UTC (13 years, 7 months ago) by kurt
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.51: +4 -16 lines
Diff to previous 1.51 (colored)

Search loaded libs first and add support for SONAME matching. ok drahn@

Revision 1.51 / (download) - annotate - [select for diffs], Wed Aug 11 01:14:27 2010 UTC (13 years, 9 months ago) by drahn
Branch: MAIN
Changes since 1.50: +5 -4 lines
Diff to previous 1.50 (colored)

Make _dl_searchnum signed as originally intended.
Pointed out by patrick keshish.

Revision 1.50 / (download) - annotate - [select for diffs], Thu Jul 1 19:25:44 2010 UTC (13 years, 11 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.49: +26 -1 lines
Diff to previous 1.49 (colored)

When generating grpsym lists, avoid duplicates without searching the
already generated list. Speeds up startup on deeply nested dlopen binaries.
ok guenther@, tested by ckuethe@ and ajacoutot@

Revision 1.49 / (download) - annotate - [select for diffs], Mon May 5 02:29:02 2008 UTC (16 years, 1 month ago) by kurt
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.48: +7 -9 lines
Diff to previous 1.48 (colored)

Constantly fill in the program header pointer and count in elf_object_t
for all objects which simplifies phdr usage in a few places.
"go for it" drahn@

Revision 1.48 / (download) - annotate - [select for diffs], Wed Apr 9 21:45:26 2008 UTC (16 years, 1 month ago) by kurt
Branch: MAIN
Changes since 1.47: +18 -18 lines
Diff to previous 1.47 (colored)

Improve support for shared libs linked at non-zero addreses:
- rename private values in struct elf_object to better
  describe their meaning:
    s/load_offs/obj_base/ "object's address '0' base"
    s/load_addr/load_base/ "The base address of the loadable
    segments"
- gdb needs the obj_base value so swap positions with load_base in
  struct elf_object
- fix a few occurrences of where load_base was used instead of
  obj_base.

With help and okay drahn@

Revision 1.47 / (download) - annotate - [select for diffs], Wed May 3 16:10:51 2006 UTC (18 years, 1 month ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.46: +14 -1 lines
Diff to previous 1.46 (colored)

prebind - how to prelink a binary without throwing security out the window

Prelink fixes the address of libraries making 'return to libc' attacks trival,
prebind uses a different method to achieve most of the same gains, however
without adding any security conerns.

Still under development, now in-tree.

Revision 1.46 / (download) - annotate - [select for diffs], Wed Nov 9 16:41:29 2005 UTC (18 years, 6 months ago) by kurt
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.45: +2 -2 lines
Diff to previous 1.45 (colored)

add RTLD_NOW support to dlopen and propogate -z now to dep libs.
ok drahn@

Revision 1.45 / (download) - annotate - [select for diffs], Fri Oct 21 15:24:10 2005 UTC (18 years, 7 months ago) by kurt
Branch: MAIN
Changes since 1.44: +1 -2 lines
Diff to previous 1.44 (colored)

using _dl_link_grpsym to increment refcounts made _dl_notify_unload_shlib
simpler, however it broke ldd refcount output. use _dl_link_child to
increment refcounts and adjust _dl_notify_unload_shlib to match.
work by drahn@ and myself. ok drahn@

Revision 1.44 / (download) - annotate - [select for diffs], Mon Oct 17 22:14:18 2005 UTC (18 years, 7 months ago) by kettenis
Branch: MAIN
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored)

Fix possible buffer overflow caused by unknown tags in the range
[DT_LOPROC, DT_HIPROC].
ok kurt@

Revision 1.43 / (download) - annotate - [select for diffs], Wed Oct 12 20:36:16 2005 UTC (18 years, 7 months ago) by kurt
Branch: MAIN
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

Split grpsym_list creation away from child_list creation and change
grpsym_list order to match Sun's docs. Also corrects bugs where
grpsym_list was either not created or partially created.

Revision 1.42 / (download) - annotate - [select for diffs], Sun Oct 9 04:29:13 2005 UTC (18 years, 7 months ago) by kurt
Branch: MAIN
Changes since 1.41: +2 -2 lines
Diff to previous 1.41 (colored)

introduce object ref count macros (suggested by dale). no functional
change.

Revision 1.41 / (download) - annotate - [select for diffs], Fri Oct 7 01:26:34 2005 UTC (18 years, 7 months ago) by kurt
Branch: MAIN
Changes since 1.40: +5 -5 lines
Diff to previous 1.40 (colored)

rename dload_list to grpsym_list which better represents its usage.

Revision 1.40 / (download) - annotate - [select for diffs], Thu Oct 6 22:01:58 2005 UTC (18 years, 7 months ago) by kurt
Branch: MAIN
Changes since 1.39: +1 -8 lines
Diff to previous 1.39 (colored)

remove dep_next "shadow object" dead code.

Revision 1.39 / (download) - annotate - [select for diffs], Thu Oct 6 21:53:10 2005 UTC (18 years, 7 months ago) by kurt
Branch: MAIN
Changes since 1.38: +30 -12 lines
Diff to previous 1.38 (colored)

separate load group references from dep lib child/dload lists. move load
group refs to own per object ref counter (grprefcount) and list
(grpref_list). corrects more complex load group ref cases and side effects
from initial implementation. design ideas and ok drahn@

Revision 1.38 / (download) - annotate - [select for diffs], Mon Oct 3 19:48:24 2005 UTC (18 years, 8 months ago) by kurt
Branch: MAIN
Changes since 1.37: +3 -2 lines
Diff to previous 1.37 (colored)

refcount corrections: count common dep libs once and centralize dep lib
refcount increments to _dl_link_sub. adjust _dl_notify_unload_shlib to
match new refcount method. ok drahn@

Revision 1.37 / (download) - annotate - [select for diffs], Sat Oct 1 19:32:22 2005 UTC (18 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.36: +12 -1 lines
Diff to previous 1.36 (colored)

handle references to load groups caused by dlopen()ing of depenant
members of the load group. work by kurt@ and myself

Revision 1.36 / (download) - annotate - [select for diffs], Wed Sep 28 20:35:23 2005 UTC (18 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.35: +19 -2 lines
Diff to previous 1.35 (colored)

keep a state flag if a library has been unloaded, and then free the list
seperately ok kurt@

Revision 1.35 / (download) - annotate - [select for diffs], Wed Sep 28 15:41:06 2005 UTC (18 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.34: +2 -1 lines
Diff to previous 1.34 (colored)

keep track of opencounts for dlopened objects, so that they
get unloaded the right number of times on exit.

Revision 1.34 / (download) - annotate - [select for diffs], Thu Sep 22 04:07:11 2005 UTC (18 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.33: +8 -9 lines
Diff to previous 1.33 (colored)

knf; ok drahn

Revision 1.33 / (download) - annotate - [select for diffs], Thu Sep 22 01:33:07 2005 UTC (18 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.32: +4 -2 lines
Diff to previous 1.32 (colored)

Use std missing symbol print instead of MD custom, do not warn on weak
undefined symbols, or count them as failures. inspired kurt@

Revision 1.32 / (download) - annotate - [select for diffs], Wed Sep 21 23:12:09 2005 UTC (18 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.31: +21 -19 lines
Diff to previous 1.31 (colored)

Simplify the internal symbol finding API, with some cleanup, prep for
next step. ok kurt@

Revision 1.31 / (download) - annotate - [select for diffs], Mon Sep 19 21:08:43 2005 UTC (18 years, 8 months ago) by kurt
Branch: MAIN
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

stop searching after first matching symbol is found. okay drahn@

Revision 1.30 / (download) - annotate - [select for diffs], Mon Sep 19 02:31:04 2005 UTC (18 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.29: +13 -35 lines
Diff to previous 1.29 (colored)

simplify code by putting executable in misnamed _dlopened_child_list,
also move RTLD_NEXT/RTLD_SELF code into that code, it is a single test.
okay kurt@

Revision 1.29 / (download) - annotate - [select for diffs], Fri Sep 16 23:41:05 2005 UTC (18 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.28: +3 -12 lines
Diff to previous 1.28 (colored)

Now that the bug requiring it has been fixed, remove the lastchance kludge
ok kurt@

Revision 1.28 / (download) - annotate - [select for diffs], Fri Sep 16 23:19:41 2005 UTC (18 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.27: +115 -25 lines
Diff to previous 1.27 (colored)

Rework symbol lookup to more closely match sun's documentation, now
treats dlopens as load groups. ok kurt@

Revision 1.27 / (download) - annotate - [select for diffs], Tue May 10 03:36:07 2005 UTC (19 years ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.26: +7 -6 lines
Diff to previous 1.26 (colored)

Recommit the destructor order fix, now that the amd64 bug was fixed.
'no problem' pval@

Revision 1.26 / (download) - annotate - [select for diffs], Wed Apr 6 00:16:53 2005 UTC (19 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.25: +5 -6 lines
Diff to previous 1.25 (colored)

backout -- breaks at least amd64; spotted by marc

Revision 1.25 / (download) - annotate - [select for diffs], Tue Apr 5 19:29:09 2005 UTC (19 years, 2 months ago) by drahn
Branch: MAIN
Changes since 1.24: +7 -6 lines
Diff to previous 1.24 (colored)

Do a better job of running destructors in the right order.

Revision 1.24 / (download) - annotate - [select for diffs], Mon Jul 5 00:47:40 2004 UTC (19 years, 11 months ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.23: +5 -2 lines
Diff to previous 1.23 (colored)

Fix an issue where a shared library could be loaded at two different
locations by resolving all dlopens back to a dev/inode.

i.e. Don't load a library if the dev/inode it stats back to matches one
already in our list.

fix started (and ok'ed) drahn@. ok deraadt@.
"doesn't break anything yet" pval@ art@ brad@

Revision 1.23 / (download) - annotate - [select for diffs], Tue May 25 18:07:20 2004 UTC (20 years ago) by mickey
Branch: MAIN
Changes since 1.22: +20 -6 lines
Diff to previous 1.22 (colored)

return object* the symbol is in for _dl_find_symbol*; drahn@ ok

Revision 1.22 / (download) - annotate - [select for diffs], Tue May 25 15:56:18 2004 UTC (20 years ago) by deraadt
Branch: MAIN
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (colored)

spacing

Revision 1.21 / (download) - annotate - [select for diffs], Thu Sep 4 19:33:48 2003 UTC (20 years, 9 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.20: +40 -1 lines
Diff to previous 1.20 (colored)

Symbol cache for GOT lookup. When a symbol is found it is saved in a cache
for future lookups in the same GOT relocation table. Uses static buffer
for small symbol tables, mmap for larger ones. ok deraadt@

Revision 1.20 / (download) - annotate - [select for diffs], Tue Sep 2 15:17:51 2003 UTC (20 years, 9 months ago) by drahn
Branch: MAIN
Changes since 1.19: +101 -66 lines
Diff to previous 1.19 (colored)

Fix PR 3371, symbol lookup in dlopen()ed objects is not correct. Correct
behavior for RTLD_GLOBAL/RTLD_LOCAL is now supported. ok espie@

Revision 1.19 / (download) - annotate - [select for diffs], Sun Jun 22 21:39:01 2003 UTC (20 years, 11 months ago) by drahn
Branch: MAIN
Changes since 1.18: +29 -13 lines
Diff to previous 1.18 (colored)

Dynamic linking random order fixes. This enables random library ordering.
Tested by naddy@ and others.

Revision 1.18 / (download) - annotate - [select for diffs], Mon Jun 9 16:10:03 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.17: +1 -7 lines
Diff to previous 1.17 (colored)

pefo 3/4 licence cleanups

Revision 1.17 / (download) - annotate - [select for diffs], Sun Feb 2 16:57:58 2003 UTC (21 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.16: +9 -12 lines
Diff to previous 1.16 (colored)

knf & ansi; drahn ok

Revision 1.16 / (download) - annotate - [select for diffs], Thu Jan 30 03:46:46 2003 UTC (21 years, 4 months ago) by drahn
Branch: MAIN
Changes since 1.15: +3 -1 lines
Diff to previous 1.15 (colored)

Change the constructor execution order to initialize dependant libraries
first. This mirrors the commit espie put in a.out ld.so recently.

Revision 1.15 / (download) - annotate - [select for diffs], Sat Nov 23 04:09:34 2002 UTC (21 years, 6 months ago) by drahn
Branch: MAIN
Changes since 1.14: +9 -11 lines
Diff to previous 1.14 (colored)

Remove some error messages which were incorrectly printed. Some cleanup.
ok pvalchev@

Revision 1.14 / (download) - annotate - [select for diffs], Thu Nov 14 15:15:54 2002 UTC (21 years, 6 months ago) by drahn
Branch: MAIN
Changes since 1.13: +9 -9 lines
Diff to previous 1.13 (colored)

Make error messages on symbol lookup failures more useful.

Revision 1.13 / (download) - annotate - [select for diffs], Fri Aug 23 22:57:03 2002 UTC (21 years, 9 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.12: +37 -7 lines
Diff to previous 1.12 (colored)

Change arguments to _dl_find_symbol() myself, warnnotfound, and inplt into
a single flags field with bits representing each. Use defines to create
the appropriate masks.

Add a new argument sym_size to warn about symbols which have
the incorrect size. This replaces 'ifdef notyet' code which
was in several of the md files with a single version.
sym_size == 0 means do not check, and symbols of type FUNC are
not checked.

Revision 1.12 / (download) - annotate - [select for diffs], Sun Aug 11 16:51:04 2002 UTC (21 years, 9 months ago) by drahn
Branch: MAIN
Changes since 1.11: +10 -4 lines
Diff to previous 1.11 (colored)

Fix for Elfbug, the Xtiherit problem which has been seen on most OpenBSD
ELF dynamic systems. This was due to an oddity in ELF where the address of
fuctions refer to the PLT address in the program, rather than the actual
function address.

Revision 1.11 / (download) - annotate - [select for diffs], Sun Jul 7 08:54:50 2002 UTC (21 years, 11 months ago) by jufi
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)


typos/grammar/better words
in comments.

Revision 1.10 / (download) - annotate - [select for diffs], Tue May 28 00:22:01 2002 UTC (22 years ago) by deraadt
Branch: MAIN
Changes since 1.9: +10 -13 lines
Diff to previous 1.9 (colored)

more KNF

Revision 1.9 / (download) - annotate - [select for diffs], Fri May 24 04:17:00 2002 UTC (22 years ago) by deraadt
Branch: MAIN
Changes since 1.8: +4 -5 lines
Diff to previous 1.8 (colored)

more KNF

Revision 1.8 / (download) - annotate - [select for diffs], Fri May 24 03:44:37 2002 UTC (22 years ago) by deraadt
Branch: MAIN
Changes since 1.7: +30 -42 lines
Diff to previous 1.7 (colored)

various KNF

Revision 1.7 / (download) - annotate - [select for diffs], Sun Mar 17 04:46:53 2002 UTC (22 years, 2 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.6: +5 -1 lines
Diff to previous 1.6 (colored)

Keep _dl_last_object in sync with reality if last element in list is deleted.
allocated memory is not necessarily 0ed, make sure next pointer is inited.

Revision 1.6 / (download) - annotate - [select for diffs], Thu Feb 21 23:17:53 2002 UTC (22 years, 3 months ago) by drahn
Branch: MAIN
Changes since 1.5: +2 -5 lines
Diff to previous 1.5 (colored)

cleanup of MD/MI ld.so (elf), most changes by art@ cleanup by me.
tested on alpha sparc64 powerpc.

Revision 1.5 / (download) - annotate - [select for diffs], Tue Sep 25 14:06:48 2001 UTC (22 years, 8 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.4: +28 -24 lines
Diff to previous 1.4 (colored)

Cleaner hash bucket init and some KNF.

Revision 1.4 / (download) - annotate - [select for diffs], Fri Jun 8 06:46:59 2001 UTC (22 years, 11 months ago) by art
Branch: MAIN
Changes since 1.3: +13 -15 lines
Diff to previous 1.3 (colored)

style

Revision 1.3 / (download) - annotate - [select for diffs], Thu May 31 22:10:06 2001 UTC (23 years ago) by art
Branch: MAIN
Changes since 1.2: +3 -3 lines
Diff to previous 1.2 (colored)

unsigned long, not u_int32_t

Revision 1.2 / (download) - annotate - [select for diffs], Mon Apr 2 23:11:21 2001 UTC (23 years, 2 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.1: +35 -22 lines
Diff to previous 1.1 (colored)

Cleanup for 64bit support.
Pieces by art, niklas and me.
Only tested on powerpc.

Revision 1.1.1.2 / (download) - annotate - [select for diffs] (vendor branch), Tue Jun 13 03:40:07 2000 UTC (23 years, 11 months ago) by rahnds
Branch: per, dsr
CVS Tags: r20000612, OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.1.1.1: +20 -7 lines
Diff to previous 1.1.1.1 (colored)

Updated version of ld.so, contains additional functionality and fixes/
design changes required by egcs.

added support for ldconfig/ld.so.hints

changes to low level relocation code, required by egcs pic
code generation that moved global variable loads to before the
self relocation was performed. Only powerpc supported, mips code not updated.

Code cleaned up somewhat reasonably.

This code needs to be reviewed closely for significant problems
such as correctness and security.

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Tue Jun 13 03:34:07 2000 UTC (23 years, 11 months ago) by rahnds
Branch: per, dsr
CVS Tags: r19990103
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

Initial import of ELF ld.so. This was written indepently of the gnu rtld
code and is fully BSD copyrighted.
This initial import contains a mostly working mips and partially working
powerpc version. No support for ld.so.hints or system run path exists.


Revision 1.1 / (download) - annotate - [select for diffs], Tue Jun 13 03:34:07 2000 UTC (23 years, 11 months ago) by rahnds
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.