OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.37 / (download) - annotate - [select for diffs], Sat Nov 5 18:48:31 2022 UTC (18 months, 3 weeks ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.36: +3 -1 lines
Diff to previous 1.36 (colored)

The /var/run/ld.so.hints file is mapped into memory.  It is never replaced,
so the mapping can be immutable.
ok kettenis

Revision 1.36 / (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_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.35: +4 -8 lines
Diff to previous 1.35 (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.35 / (download) - annotate - [select for diffs], Tue Dec 12 15:33:34 2017 UTC (6 years, 5 months ago) by deraadt
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, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.34: +4 -2 lines
Diff to previous 1.34 (colored)

ld.so's syscall _dl_* API/ABI doesn't reurn errno, but -errno.
Reviewing behaviour artifacts with pledge, I discover a close(-ENOSYS)..
ok guenther

Revision 1.34 / (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.33: +8 -14 lines
Diff to previous 1.33 (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.33 / (download) - annotate - [select for diffs], Thu Oct 29 13:07:41 2015 UTC (8 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.32: +2 -5 lines
Diff to previous 1.32 (colored)

remove tests for LD_HINTS_VERSION_1; ok kettenis

Revision 1.32 / (download) - annotate - [select for diffs], Tue Nov 18 20:51:00 2014 UTC (9 years, 6 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.31: +1 -2 lines
Diff to previous 1.31 (colored)

Nuke some obvious #include duplications.

ok espie@ deraadt@ millert@ tedu@

Revision 1.31 / (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.30: +7 -4 lines
Diff to previous 1.30 (colored)

check all memory allocations; ok miod@ guenther@

Revision 1.30 / (download) - annotate - [select for diffs], Wed Jul 9 12:54:03 2014 UTC (9 years, 10 months ago) by guenther
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

Use O_CLOEXEC to make sure fork+exec in a threaded process can't
see the fds used by dlopen()

ok otto@ miod@

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

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

Revision 1.28 / (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.27: +4 -1 lines
Diff to previous 1.27 (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.27 / (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.26: +4 -4 lines
Diff to previous 1.26 (colored)

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

Revision 1.26 / (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.25: +4 -3 lines
Diff to previous 1.25 (colored)

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

Revision 1.25 / (download) - annotate - [select for diffs], Sat Jan 19 20:04:05 2013 UTC (11 years, 4 months ago) by miod
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.24: +4 -1 lines
Diff to previous 1.24 (colored)

Do not divide by zero in _dl_findhint() if there is a valid hints file but
no buckets in it (could happen if the administrator reruns ldconfig with
bogus paths). ok matthew@ kurt@ drahn

Revision 1.24 / (download) - annotate - [select for diffs], Tue Jun 12 20:32:17 2012 UTC (11 years, 11 months ago) by matthew
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.23: +12 -1 lines
Diff to previous 1.23 (colored)

Fix loaded object sod matching: when we load libfoo.so.X.Y into
memory, we should be able to match other requests for libfoo.so.X.Z
against that same object.

ok kurt, kettenis

Revision 1.23 / (download) - annotate - [select for diffs], Thu Oct 2 20:12:08 2008 UTC (15 years, 8 months ago) by kurt
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.22: +3 -3 lines
Diff to previous 1.22 (colored)

Fix mmap() error checking to be correct 64-bit addresses. Consistently
use _dl_mmap_error() to check for mmap() errors. Adjust datatypes of
some local vars for 64-bit safety.

okay millert@ drahn@

Revision 1.22 / (download) - annotate - [select for diffs], Sun Oct 17 03:56:49 2004 UTC (19 years, 7 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4, 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, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.21: +12 -6 lines
Diff to previous 1.21 (colored)

Fix some problems related to LD_LIBRARY_PATH parsing where it would not
correctly deal with current directory searches specified by "::", ":foo" or
"foo:"

Revision 1.21 / (download) - annotate - [select for diffs], Tue May 18 16:50:31 2004 UTC (20 years ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.20: +2 -2 lines
Diff to previous 1.20 (colored)

fix includes scoping; drahn@ ok

Revision 1.20 / (download) - annotate - [select for diffs], Tue Nov 11 14:51:01 2003 UTC (20 years, 6 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.19: +11 -15 lines
Diff to previous 1.19 (colored)

Better fix to the library name parsing. now correctly handles
libpython2.2.so.0.0 vs libpython2.1.so.0.0. Clean up a potential
memory leak if the filename is not a valid library.
ok brad@

Revision 1.19 / (download) - annotate - [select for diffs], Sun Oct 26 23:23:12 2003 UTC (20 years, 7 months ago) by drahn
Branch: MAIN
Changes since 1.18: +9 -3 lines
Diff to previous 1.18 (colored)

Work around a problem with shared libraries named as libX-A.B.so.X.Y.
Without this patch, the standard major:minor version matching failed.
ok brad@

Revision 1.18 / (download) - annotate - [select for diffs], Sun Jul 6 20:03:57 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.17: +4 -3 lines
Diff to previous 1.17 (colored)

various proto, ansi, and knf repair.  tested on all architectures that
use it. (build may require make cleandir because of .depend balony)

Revision 1.16.2.1 / (download) - annotate - [select for diffs], Sat May 31 00:53:01 2003 UTC (21 years ago) by margarida
Branch: OPENBSD_3_3
Changes since 1.16: +31 -42 lines
Diff to previous 1.16 (colored) next main 1.17 (colored)

Pull patch from -current:
Fix by millert@

Previously, ld.so would use a single page for mapping the hints file
and then, if that was not big enough, map the rest of it contiguously.
However, there is no guarantee that the address space after the
first mmap has not already been used by something else.

Instead, just fstat the file and map up to st_size.  Also reorganized
the code a tad and added some sanity checks for st_size.

Problem tracked down by dhartmei@ and mickey@; drahn@ OK.

Ok deraadt@

Revision 1.17 / (download) - annotate - [select for diffs], Thu May 8 16:30:52 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.16: +31 -42 lines
Diff to previous 1.16 (colored)

Previously, ld.so would use a single page for mapping the hints file
and then, if that was not big enough, map the rest of it contiguously.
However, there is no guarantee that the address space after the
first mmap has not already been used by something else.

Instead, just fstat the file and map up to st_size.  Also reorganized
the code a tad and added some sanity checks for st_size.

Problem tracked down by dhartmei@ and mickey@; drahn@ OK.

Revision 1.16 / (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
Branch point for: OPENBSD_3_3
Changes since 1.15: +7 -14 lines
Diff to previous 1.15 (colored)

knf & ansi; drahn ok

Revision 1.15 / (download) - annotate - [select for diffs], Mon Jul 29 22:43:36 2002 UTC (21 years, 10 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.14: +3 -2 lines
Diff to previous 1.14 (colored)

minor formatting

Revision 1.14 / (download) - annotate - [select for diffs], Fri Jul 12 20:18:30 2002 UTC (21 years, 10 months ago) by drahn
Branch: MAIN
Changes since 1.13: +8 -3 lines
Diff to previous 1.13 (colored)

Change ld.so search order/method to match the a.out ld.so.

run destructors on dlclose()

Move more symbols into _dl_ private space, so that the proper (libc)
version of the function will be used.

Add readdir() functionality to perform the proper library searching.

Support DL_PRELOAD

Do not relocate symbols if ld.so is being traced (and will exit).

Misc lint cleanup.

ok art@

Revision 1.13 / (download) - annotate - [select for diffs], Mon May 27 23:37:25 2002 UTC (22 years ago) by deraadt
Branch: MAIN
Changes since 1.12: +7 -7 lines
Diff to previous 1.12 (colored)

KNF

Revision 1.12 / (download) - annotate - [select for diffs], Sat May 25 02:46:09 2002 UTC (22 years ago) by drahn
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

use _dl_strncmp() not strncmp(), _dl version is already present and used.

Revision 1.11 / (download) - annotate - [select for diffs], Sat May 25 02:34:45 2002 UTC (22 years ago) by drahn
Branch: MAIN
Changes since 1.10: +5 -5 lines
Diff to previous 1.10 (colored)

_dl_strcmp() and _dl_strchr() exist, do not pull these routines
from libsa source.

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

more KNF

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

various KNF

Revision 1.8 / (download) - annotate - [select for diffs], Thu Feb 21 23:17:53 2002 UTC (22 years, 3 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.7: +3 -4 lines
Diff to previous 1.7 (colored)

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

Revision 1.7 / (download) - annotate - [select for diffs], Sat Sep 22 04:58:18 2001 UTC (22 years, 8 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.6: +3 -11 lines
Diff to previous 1.6 (colored)

Upon futher contemplation, the notion of unmaphints is just wrong.
First the maphints code is not cleaning up after itself, by leaving
a file descriptor open and trying to clean up after the dynamic linker
is done loading by removing data needed during dlopen() is nonsense.
the _dl_unmaphints() function and it's references have been removed.
_dl_maphints() now cleans up it's file descriptor before returning.
static data used later during dlopen() is left intact.

Revision 1.6 / (download) - annotate - [select for diffs], Sat Sep 22 04:29:32 2001 UTC (22 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.5: +4 -4 lines
Diff to previous 1.5 (colored)

The unmaphints routine should not destroy the hint mapping.
Otherwise shared modules which depend on libraries cannot find
them because the list of trusted directories has been lost.
However we need to be careful that the unmapping of the hints frees
the file descriptor, but will not free it multiple times.

Revision 1.5 / (download) - annotate - [select for diffs], Fri Jun 8 06:49:20 2001 UTC (22 years, 11 months ago) by art
Branch: MAIN
Changes since 1.4: +5 -3 lines
Diff to previous 1.4 (colored)

Be consistent. If we have inveted our of strlen, use it everywhere.

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

When opening the hints file, check for error return < 0, not -1.
_dl_open is not necessarily like the regular open(2).
XXX - maybe we should check with _dl_check_error?

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

MAP_COPY -> MAP_PRIVATE

Revision 1.2 / (download) - annotate - [select for diffs], Fri May 11 16:21:11 2001 UTC (23 years ago) by art
Branch: MAIN
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

-1 -> MAP_FAILED.

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Tue Jun 13 03:40:14 2000 UTC (23 years, 11 months ago) by rahnds
Branch: dsr
CVS Tags: r20000612, OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.1: +0 -0 lines
Diff to previous 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 / (download) - annotate - [select for diffs], Tue Jun 13 03:40:14 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.