OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.55 / (download) - annotate - [select for diffs], Thu Apr 27 12:27:56 2023 UTC (13 months, 1 week ago) by robert
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.54: +1 -8 lines
Diff to previous 1.54 (colored)

revert cache lookup for full pathnames

Revision 1.54 / (download) - annotate - [select for diffs], Mon Apr 24 08:59:09 2023 UTC (13 months, 2 weeks ago) by robert
Branch: MAIN
Changes since 1.53: +8 -1 lines
Diff to previous 1.53 (colored)

do a cache lookup as well in case a full pathname is passed to dlopen

Revision 1.53 / (download) - annotate - [select for diffs], Mon Nov 7 10:35:26 2022 UTC (19 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.52: +4 -3 lines
Diff to previous 1.52 (colored)

dtors were broken by trying to reuse DF_1_NODELETE to hint that this
library would never unload, and could be immutable.  Pass a seperate
flag for our purposes
Noticed from regress tests by anton, ok kettenis

Revision 1.52 / (download) - annotate - [select for diffs], Sat Aug 20 14:11:31 2022 UTC (21 months, 2 weeks ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.51: +15 -10 lines
Diff to previous 1.51 (colored)

Support RTLD_NOLOAD in ld.so. From guenther@. OK jca@ guenther@

Revision 1.51 / (download) - annotate - [select for diffs], Sat Jan 8 06:49:41 2022 UTC (2 years, 5 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.50: +2 -2 lines
Diff to previous 1.50 (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.50 / (download) - annotate - [select for diffs], Fri Oct 4 17:42:16 2019 UTC (4 years, 8 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, 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.49: +20 -16 lines
Diff to previous 1.49 (colored)

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

ok mpi@

Revision 1.49 / (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.48: +38 -28 lines
Diff to previous 1.48 (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.48 / (download) - annotate - [select for diffs], Mon Aug 28 14:06:22 2017 UTC (6 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.47: +2 -2 lines
Diff to previous 1.47 (colored)

whitespace

Revision 1.47 / (download) - annotate - [select for diffs], Tue Jan 24 07:48:36 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.46: +6 -6 lines
Diff to previous 1.46 (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.46 / (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.45: +37 -24 lines
Diff to previous 1.45 (colored)

Add support for DT_RUNPATH and DT_FLAGS

ok kettenis@

Revision 1.45 / (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_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.44: +21 -4 lines
Diff to previous 1.44 (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.44 / (download) - annotate - [select for diffs], Wed Jun 10 21:16:41 2015 UTC (9 years ago) by sthen
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored)

breath->breadth

Revision 1.43 / (download) - annotate - [select for diffs], Wed Jun 10 20:50:05 2015 UTC (9 years ago) by miod
Branch: MAIN
Changes since 1.42: +6 -6 lines
Diff to previous 1.42 (colored)

Typos: equalivant, fucntion, libary.

Revision 1.42 / (download) - annotate - [select for diffs], Fri Jan 16 16:18:07 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.41: +4 -5 lines
Diff to previous 1.41 (colored)

<sys/param.h> to <limits.h> conversion.  Verified binaries
ok millert, thanks to doug for process advice

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

check all memory allocations; ok miod@ guenther@

Revision 1.40 / (download) - annotate - [select for diffs], Sun Jul 6 17:33:10 2014 UTC (9 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.39: +1 -2 lines
Diff to previous 1.39 (colored)

enable -Wall, explicitly call _dl_strsep, and zap some redundant includes
ok miod@

Revision 1.39 / (download) - annotate - [select for diffs], Tue Dec 3 01:47:05 2013 UTC (10 years, 6 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5
Changes since 1.38: +2 -2 lines
Diff to previous 1.38 (colored)

stop using sys/syslimits.h directly, and use limits.h
prodded by millert

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

prototype & void * math cleanup
ok guenther

Revision 1.37 / (download) - annotate - [select for diffs], Wed Mar 20 21:49:59 2013 UTC (11 years, 2 months ago) by kurt
Branch: MAIN
CVS Tags: OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.36: +19 -52 lines
Diff to previous 1.36 (colored)

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

Revision 1.36 / (download) - annotate - [select for diffs], Wed Mar 21 04:28:45 2012 UTC (12 years, 2 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.35: +2 -2 lines
Diff to previous 1.35 (colored)

Switch ld.so's _dl_opendir functions to use a locally defined
_dl_dirdesc struct (containing just the fields ld.so's implementation
actually needs) instead of reusing libc's _dirdesc struct.

Also, switch ldconfig to use futimens() instead of futimes().

ok deraadt@

Revision 1.35 / (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.34: +2 -2 lines
Diff to previous 1.34 (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.34 / (download) - annotate - [select for diffs], Wed Jul 13 20:49:44 2011 UTC (12 years, 10 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.33: +4 -2 lines
Diff to previous 1.33 (colored)

Delete items on grpreflist when walking them to decrement the count,
otherwise double decrement can occur. ok kurt@ timeout on other reviewers.

Revision 1.33 / (download) - annotate - [select for diffs], Tue Nov 16 18:59:00 2010 UTC (13 years, 6 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_4_9_BASE, OPENBSD_4_9
Changes since 1.32: +2 -8 lines
Diff to previous 1.32 (colored)

Fix error message when ld.so ends up loading a different than expected
library, but other library needs the one loaded. mostly ok kurt@

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

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

Revision 1.31 / (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.30: +18 -5 lines
Diff to previous 1.30 (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.30 / (download) - annotate - [select for diffs], Sun May 9 09:53:28 2010 UTC (14 years, 1 month ago) by matthieu
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

use _dl_memset() instead of bzero() here. Unbreaks sparc build.
ok kettenis@

Revision 1.29 / (download) - annotate - [select for diffs], Sat May 1 07:46:30 2010 UTC (14 years, 1 month ago) by jsg
Branch: MAIN
Changes since 1.28: +3 -1 lines
Diff to previous 1.28 (colored)

bzero a struct to appease gcc4.
ok drahn@

Revision 1.28 / (download) - annotate - [select for diffs], Fri Apr 11 15:30:16 2008 UTC (16 years, 2 months 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.27: +22 -46 lines
Diff to previous 1.27 (colored)

Correct a bug where _dl_error was set to DL_NOT_FOUND when a shared lib
was found but failed to load. Adjust _dl_load_shlib() to only attempt to
load the first matching shared lib which allows the correct _dl_error to
propagate out upon load failure.

okay drahn@

Revision 1.27 / (download) - annotate - [select for diffs], Sat Dec 23 21:08:01 2006 UTC (17 years, 5 months ago) by krw
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
Changes since 1.26: +4 -4 lines
Diff to previous 1.26 (colored)

Spelling.

'preceeding' -> 'preceding'
'preceeds' -> 'precedes'
'preceeded' -> 'preceded'

Revision 1.26 / (download) - annotate - [select for diffs], Mon May 8 20:37:01 2006 UTC (18 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.25: +2 -2 lines
Diff to previous 1.25 (colored)

more spacing

Revision 1.25 / (download) - annotate - [select for diffs], Mon May 8 20:34:36 2006 UTC (18 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.24: +2 -2 lines
Diff to previous 1.24 (colored)

de-space

Revision 1.24 / (download) - annotate - [select for diffs], Tue Nov 15 02:14:47 2005 UTC (18 years, 6 months ago) by kurt
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.23: +3 -2 lines
Diff to previous 1.23 (colored)

correct opencount decrement in _dl_unload_dlopen. was leaving function
with -1 as opencount and interfeering with dtors. problem reported by
espie@. okay drahn@

Revision 1.23 / (download) - annotate - [select for diffs], Wed Nov 2 15:25:00 2005 UTC (18 years, 7 months ago) by kurt
Branch: MAIN
Changes since 1.22: +44 -4 lines
Diff to previous 1.22 (colored)

allow shlibs with paths to use shlib version matching rules too.
previously shlibs with paths would only open an exact match.
initial diff from dale. ok drahn@

Revision 1.22 / (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.21: +18 -10 lines
Diff to previous 1.21 (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.21 / (download) - annotate - [select for diffs], Wed Oct 12 20:36:16 2005 UTC (18 years, 8 months ago) by kurt
Branch: MAIN
Changes since 1.20: +34 -12 lines
Diff to previous 1.20 (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.20 / (download) - annotate - [select for diffs], Sun Oct 9 04:37:13 2005 UTC (18 years, 8 months ago) by kurt
Branch: MAIN
Changes since 1.19: +4 -2 lines
Diff to previous 1.19 (colored)

fix incomplete ref count check in _dl_link_dlopen (use macro now).

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

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

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

rename dload_list to grpsym_list which better represents its usage.

Revision 1.17 / (download) - annotate - [select for diffs], Thu Oct 6 21:53:10 2005 UTC (18 years, 8 months ago) by kurt
Branch: MAIN
Changes since 1.16: +23 -10 lines
Diff to previous 1.16 (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.16 / (download) - annotate - [select for diffs], Wed Oct 5 21:50:53 2005 UTC (18 years, 8 months ago) by kurt
Branch: MAIN
Changes since 1.15: +4 -1 lines
Diff to previous 1.15 (colored)

move opencount increment and dups check to _dl_link_dlopen. fixes cleanup
of partially dlopened (but failed) cleanup.

Revision 1.15 / (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.14: +13 -5 lines
Diff to previous 1.14 (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.14 / (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.13: +5 -22 lines
Diff to previous 1.13 (colored)

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

Revision 1.13 / (download) - annotate - [select for diffs], Wed Sep 28 20:48:00 2005 UTC (18 years, 8 months ago) by kurt
Branch: MAIN
Changes since 1.12: +1 -4 lines
Diff to previous 1.12 (colored)

fix a use after free and let exit clean up instead. ok drahn@

Revision 1.12 / (download) - annotate - [select for diffs], Wed Sep 28 18:17:41 2005 UTC (18 years, 8 months ago) by kurt
Branch: MAIN
Changes since 1.11: +1 -3 lines
Diff to previous 1.11 (colored)

remove _dl_exiting dead code

Revision 1.11 / (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.10: +7 -5 lines
Diff to previous 1.10 (colored)

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

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

knf; ok drahn

Revision 1.9 / (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.8: +5 -1 lines
Diff to previous 1.8 (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.8 / (download) - annotate - [select for diffs], Sat Sep 17 04:15:23 2005 UTC (18 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.7: +54 -69 lines
Diff to previous 1.7 (colored)

refactor this code, much more readable, no operational change.

Revision 1.7 / (download) - annotate - [select for diffs], Sat Sep 17 02:52:43 2005 UTC (18 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.6: +18 -1 lines
Diff to previous 1.6 (colored)

Respect main program's rpath for dependancies of dynamic libraries.

Revision 1.6 / (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.5: +45 -65 lines
Diff to previous 1.5 (colored)

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

Revision 1.5 / (download) - annotate - [select for diffs], Mon May 23 19:22:11 2005 UTC (19 years ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.4: +11 -1 lines
Diff to previous 1.4 (colored)

fixes for dlclose, ok kettenis@

Revision 1.4 / (download) - annotate - [select for diffs], Tue May 10 03:36:07 2005 UTC (19 years, 1 month ago) by drahn
Branch: MAIN
Changes since 1.3: +84 -1 lines
Diff to previous 1.3 (colored)

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

Revision 1.3 / (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.2: +0 -83 lines
Diff to previous 1.2 (colored)

backout -- breaks at least amd64; spotted by marc

Revision 1.2 / (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.1: +84 -1 lines
Diff to previous 1.1 (colored)

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

Revision 1.1 / (download) - annotate - [select for diffs], Wed Mar 23 19:48:05 2005 UTC (19 years, 2 months ago) by drahn
Branch: MAIN

Code reorganization, move copied code in library.c and library_mquery.c
into its own file. no functional change.

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.