OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.96 / (download) - annotate - [select for diffs], Fri Apr 5 13:51:47 2024 UTC (2 months ago) by deraadt
Branch: MAIN
CVS Tags: HEAD
Changes since 1.95: +5 -16 lines
Diff to previous 1.95 (colored)

ld.so should stop calling msyscall(2), since it is fully neutered and
about to be removed.  Please be careful building through this, you need
a kernel at least March 29th or so to build through it, otherwise use
snapshots to cross over.
ok various people

Revision 1.95 / (download) - annotate - [select for diffs], Wed Jan 17 13:00:05 2024 UTC (4 months, 3 weeks ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5
Changes since 1.94: +2 -2 lines
Diff to previous 1.94 (colored)

very ugly whitespaces

Revision 1.94 / (download) - annotate - [select for diffs], Tue Jan 16 19:07:31 2024 UTC (4 months, 3 weeks ago) by deraadt
Branch: MAIN
Changes since 1.93: +24 -15 lines
Diff to previous 1.93 (colored)

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

Revision 1.93 / (download) - annotate - [select for diffs], Tue Dec 19 16:13:22 2023 UTC (5 months, 2 weeks ago) by deraadt
Branch: MAIN
Changes since 1.92: +1 -2 lines
Diff to previous 1.92 (colored)

whitespaces

Revision 1.92 / (download) - annotate - [select for diffs], Tue Aug 15 06:23:31 2023 UTC (9 months, 3 weeks ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.91: +2 -2 lines
Diff to previous 1.91 (colored)

Skip the _dl_msyscall() invocation if tracing library loading.

Problem noted by gnezdo@
ok millert@

Revision 1.91 / (download) - annotate - [select for diffs], Wed Jul 12 19:49:06 2023 UTC (10 months, 3 weeks ago) by jasper
Branch: MAIN
Changes since 1.90: +10 -1 lines
Diff to previous 1.90 (colored)

validate alignment of ELF program headers

Revision 1.90 / (download) - annotate - [select for diffs], Sun Jan 29 20:30:56 2023 UTC (16 months, 1 week ago) by gnezdo
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.89: +8 -7 lines
Diff to previous 1.89 (colored)

Accumulate intermediate imutables locally before applying

OK deraadt

Revision 1.89 / (download) - annotate - [select for diffs], Sun Dec 4 15:42:07 2022 UTC (18 months ago) by deraadt
Branch: MAIN
Changes since 1.88: +15 -1 lines
Diff to previous 1.88 (colored)

The next step for mimmutable().  ld.so figures out what regions of memory
of startup shared library mappings can be made immutable, and also does
this for dlope() RTLD_NODELETE and subsidiary libraries.  Complexity in this
diff is due to the GNU_RELRO and OPENBSD_MUTABLE sections.
Tested in snaps for about 3 weeks, with some bootstrap related pain felt in ports
ok kettenis, much help from others.

Revision 1.88 / (download) - annotate - [select for diffs], Mon Nov 7 10:35:26 2022 UTC (19 months ago) by deraadt
Branch: MAIN
Changes since 1.87: +3 -2 lines
Diff to previous 1.87 (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.87 / (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.86: +7 -9 lines
Diff to previous 1.86 (colored)

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

Revision 1.86 / (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.85: +4 -2 lines
Diff to previous 1.85 (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.85 / (download) - annotate - [select for diffs], Mon Dec 9 22:15:15 2019 UTC (4 years, 6 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
Changes since 1.84: +3 -2 lines
Diff to previous 1.84 (colored)

print addresses upon msyscall failure, for now

Revision 1.84 / (download) - annotate - [select for diffs], Fri Nov 29 06:34:44 2019 UTC (4 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.83: +17 -2 lines
Diff to previous 1.83 (colored)

Repurpose the "syscalls must be on a writeable page" mechanism to
enforce a new policy: system calls must be in pre-registered regions.
We have discussed more strict checks than this, but none satisfy the
cost/benefit based upon our understanding of attack methods, anyways
let's see what the next iteration looks like.

This is intended to harden (translation: attackers must put extra
effort into attacking) against a mixture of W^X failures and JIT bugs
which allow syscall misinterpretation, especially in environments with
polymorphic-instruction/variable-sized instructions.  It fits in a bit
with libc/libcrypto/ld.so random relink on boot and no-restart-at-crash
behaviour, particularily for remote problems. Less effective once on-host
since someone the libraries can be read.

For static-executables the kernel registers the main program's
PIE-mapped exec section valid, as well as the randomly-placed sigtramp
page.  For dynamic executables ELF ld.so's exec segment is also
labelled valid; ld.so then has enough information to register libc's
exec section as valid via call-once msyscall(2)

For dynamic binaries, we continue to to permit the main program exec
segment because "go" (and potentially a few other applications) have
embedded system calls in the main program.  Hopefully at least go gets
fixed soon.

We declare the concept of embedded syscalls a bad idea for numerous
reasons, as we notice the ecosystem has many of
static-syscall-in-base-binary which are dynamically linked against
libraries which in turn use libc, which contains another set of
syscall stubs.  We've been concerned about adding even one additional
syscall entry point... but go's approach tends to double the entry-point
attack surface.

This was started at a nano-hackathon in Bob Beck's basement 2 weeks
ago during a long discussion with mortimer trying to hide from the SSL
scream-conversations, and finished in more comfortable circumstances
next to a wood-stove at Elk Lakes cabin with UVM scream-conversations.

ok guenther kettenis mortimer, lots of feedback from others
conversations about go with jsing tb sthen

Revision 1.83 / (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_6_6_BASE, OPENBSD_6_6
Changes since 1.82: +6 -4 lines
Diff to previous 1.82 (colored)

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

ok mpi@

Revision 1.82 / (download) - annotate - [select for diffs], Fri Dec 8 05:25:20 2017 UTC (6 years, 6 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
Changes since 1.81: +4 -4 lines
Diff to previous 1.81 (colored)

Everyone knows this as ld.so, nor by the ancient name rtld.
ok guenther

Revision 1.81 / (download) - annotate - [select for diffs], Wed Feb 8 04:34:29 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: +2 -2 lines
Diff to previous 1.80 (colored)

Provide size-generic ELF_NO_ADDR in <sys/exec_elf.h> and use that instead
of ELFDEFNNAME(NO_ADDR)

ok jca@

Revision 1.80 / (download) - annotate - [select for diffs], Tue Jan 24 07:48:36 2017 UTC (7 years, 4 months ago) by guenther
Branch: MAIN
Changes since 1.79: +2 -2 lines
Diff to previous 1.79 (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.79 / (download) - annotate - [select for diffs], Fri Aug 12 20:39:01 2016 UTC (7 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.78: +2 -2 lines
Diff to previous 1.78 (colored)

the slimmed down random functions inside ld.so are strict clones of the
libc arc4random API, so call them _dl_{arc4random,arcrandombuf}
ok tedu guenther

Revision 1.78 / (download) - annotate - [select for diffs], Mon Aug 8 21:59:20 2016 UTC (7 years, 10 months ago) by guenther
Branch: MAIN
Changes since 1.77: +9 -1 lines
Diff to previous 1.77 (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.77 / (download) - annotate - [select for diffs], Mon Jul 4 21:15:06 2016 UTC (7 years, 11 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.76: +1 -6 lines
Diff to previous 1.76 (colored)

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

ok kettenis@ deraadt@

Revision 1.76 / (download) - annotate - [select for diffs], Wed Jun 8 11:58:59 2016 UTC (8 years ago) by kettenis
Branch: MAIN
Changes since 1.75: +15 -5 lines
Diff to previous 1.75 (colored)

Some ELF ABIs still require a PLT that is both writable and executable.  To
avoid W^X violations, initially map such segments as writable and
non-executable, and change the mapping to non-writable and executable
after initial relocation processing.  As a side-benefit this means we no
longer depend on the __plt_start and __plt_end to make the PLT read-only
after relocation processing.

This will break binaries linked with ld -Z, most notably emacs, on some
of our architectures.

ok deraadt@, guenther@

Revision 1.75 / (download) - annotate - [select for diffs], Sat May 7 19:05:23 2016 UTC (8 years, 1 month ago) by guenther
Branch: MAIN
Changes since 1.74: +15 -1 lines
Diff to previous 1.74 (colored)

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a.  This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes.  'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@

Revision 1.74 / (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.73: +5 -5 lines
Diff to previous 1.73 (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.73 / (download) - annotate - [select for diffs], Tue Dec 22 08:54:16 2015 UTC (8 years, 5 months ago) by mmcc
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)

assign pointers to NULL rather than 0

Revision 1.72 / (download) - annotate - [select for diffs], Fri Nov 6 05:12:30 2015 UTC (8 years, 7 months ago) by guenther
Branch: MAIN
Changes since 1.71: +19 -1 lines
Diff to previous 1.71 (colored)

Fix unloading of load groups when the last reference wasn't on the
load_object but rather some descendent.  Detect that case in
_dl_unload_shlib() and switch to unloading the entire group.

Based on partial analyses by Henri Kemppainen (duclare (at) guu.fi)
and Peter Hajdu (peter.ferenc.hajdu (at) gmail.com)
ok millert@

Revision 1.71 / (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_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.70: +1 -2 lines
Diff to previous 1.70 (colored)

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

Revision 1.70 / (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.69: +3 -1 lines
Diff to previous 1.69 (colored)

check all memory allocations; ok miod@ guenther@

Revision 1.69 / (download) - annotate - [select for diffs], Wed Jul 9 12:54:03 2014 UTC (9 years, 11 months ago) by guenther
Branch: MAIN
Changes since 1.68: +2 -2 lines
Diff to previous 1.68 (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.68 / (download) - annotate - [select for diffs], Sat Jun 21 08:00:22 2014 UTC (9 years, 11 months ago) by otto
Branch: MAIN
Changes since 1.67: +2 -2 lines
Diff to previous 1.67 (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.67 / (download) - annotate - [select for diffs], Mon Aug 20 23:25:07 2012 UTC (11 years, 9 months ago) by matthew
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.66: +13 -2 lines
Diff to previous 1.66 (colored)

Add support for .openbsd.randomdata sections and PT_OPENBSD_RANDOMIZE
segments to the kernel, ld (2.15), and ld.so.  Tested on alpha, amd64,
i386, macppc, and sparc64 (thanks naddy, mpi, and okan!).

Idea discussed for some time; committing now for further testing.
ok deraadt

Revision 1.66 / (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.65: +2 -3 lines
Diff to previous 1.65 (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.65 / (download) - annotate - [select for diffs], Tue May 8 14:32:01 2012 UTC (12 years, 1 month ago) by jsing
Branch: MAIN
Changes since 1.64: +6 -0 lines
Diff to previous 1.64 (colored)

Refuse to load ELF objects that contain a PT_TLS program header.
Otherwise the binary assumes that the requested TLS storage has been
allocated and will happily use it, resulting in unwanted memory corruption.

ok guenther@

Revision 1.64 / (download) - annotate - [select for diffs], Mon Jan 9 17:01:22 2012 UTC (12 years, 5 months ago) by ariane
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.63: +9 -6 lines
Diff to previous 1.63 (colored)

Don't mmap 0 byte areas, treat them as a noop instead.

ok miod@

Revision 1.63 / (download) - annotate - [select for diffs], Mon Nov 28 20:59:03 2011 UTC (12 years, 6 months ago) by guenther
Branch: MAIN
Changes since 1.62: +2 -2 lines
Diff to previous 1.62 (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.62 / (download) - annotate - [select for diffs], Tue May 10 04:50:35 2011 UTC (13 years, 1 month ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0
Changes since 1.61: +1 -8 lines
Diff to previous 1.61 (colored)

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

Revision 1.61 / (download) - annotate - [select for diffs], Mon May 9 18:13:34 2011 UTC (13 years, 1 month ago) by otto
Branch: MAIN
Changes since 1.60: +8 -1 lines
Diff to previous 1.60 (colored)

Outsmart gcc4 on mips* by moving the declaration of _dl_debug_state
outside the file the call is in. Since the function is empty, gcc
optmizes the call away, breaking the gdb hook needed to resolve symbols in
lazy bound shared libs. Analysis by kettenis@; ok miod@ kettenis@

Revision 1.60 / (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.59: +3 -1 lines
Diff to previous 1.59 (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.59 / (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.58: +1 -13 lines
Diff to previous 1.58 (colored)

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

Revision 1.58 / (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_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.57: +8 -8 lines
Diff to previous 1.57 (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.57 / (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_4_BASE, OPENBSD_4_4
Changes since 1.56: +4 -2 lines
Diff to previous 1.56 (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.56 / (download) - annotate - [select for diffs], Wed Apr 9 21:45:26 2008 UTC (16 years, 2 months ago) by kurt
Branch: MAIN
Changes since 1.55: +2 -2 lines
Diff to previous 1.55 (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.55 / (download) - annotate - [select for diffs], Wed Apr 2 02:27:36 2008 UTC (16 years, 2 months ago) by drahn
Branch: MAIN
Changes since 1.54: +2 -2 lines
Diff to previous 1.54 (colored)

Use the proper define for this address, not a incorrect (on 64bit) define.
ok kurt@

Revision 1.54 / (download) - annotate - [select for diffs], Mon May 8 20:34:36 2006 UTC (18 years, 1 month ago) by deraadt
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.53: +2 -2 lines
Diff to previous 1.53 (colored)

de-space

Revision 1.53 / (download) - annotate - [select for diffs], Wed May 3 16:10:51 2006 UTC (18 years, 1 month ago) by drahn
Branch: MAIN
Changes since 1.52: +7 -2 lines
Diff to previous 1.52 (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.52 / (download) - annotate - [select for diffs], Wed Nov 9 16:41:29 2005 UTC (18 years, 7 months ago) by kurt
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.51: +2 -2 lines
Diff to previous 1.51 (colored)

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

Revision 1.51 / (download) - annotate - [select for diffs], Wed Oct 12 20:48:15 2005 UTC (18 years, 8 months ago) by kurt
Branch: MAIN
Changes since 1.50: +3 -1 lines
Diff to previous 1.50 (colored)

add missing grpref unload propogation (sync with library_mquery)

Revision 1.50 / (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.49: +3 -3 lines
Diff to previous 1.49 (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.49 / (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.48: +2 -2 lines
Diff to previous 1.48 (colored)

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

Revision 1.48 / (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.47: +11 -13 lines
Diff to previous 1.47 (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.47 / (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.46: +1 -5 lines
Diff to previous 1.46 (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.46 / (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.45: +19 -1 lines
Diff to previous 1.45 (colored)

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

Revision 1.45 / (download) - annotate - [select for diffs], Wed Sep 28 21:56:24 2005 UTC (18 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.44: +3 -3 lines
Diff to previous 1.44 (colored)

correct last commit, in both files.

Revision 1.44 / (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.43: +3 -2 lines
Diff to previous 1.43 (colored)

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

Revision 1.43 / (download) - annotate - [select for diffs], Tue Sep 27 14:47:00 2005 UTC (18 years, 8 months ago) by kurt
Branch: MAIN
Changes since 1.42: +2 -1 lines
Diff to previous 1.42 (colored)

increment refcount when opening a lib that is already open (dev/inode
case) ok drahn@

Revision 1.42 / (download) - annotate - [select for diffs], Mon Sep 26 14:51:05 2005 UTC (18 years, 8 months ago) by drahn
Branch: MAIN
Changes since 1.41: +6 -1 lines
Diff to previous 1.41 (colored)

Fully unload dependant libraries, fixes gphoto2 bug.

Revision 1.41 / (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.40: +5 -2 lines
Diff to previous 1.40 (colored)

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

Revision 1.40 / (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.39: +1 -8 lines
Diff to previous 1.39 (colored)

fixes for dlclose, ok kettenis@

Revision 1.39 / (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.38: +8 -2 lines
Diff to previous 1.38 (colored)

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

Revision 1.38 / (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.37: +1 -7 lines
Diff to previous 1.37 (colored)

backout -- breaks at least amd64; spotted by marc

Revision 1.37 / (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.36: +8 -2 lines
Diff to previous 1.36 (colored)

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

Revision 1.36 / (download) - annotate - [select for diffs], Wed Mar 23 19:48:05 2005 UTC (19 years, 2 months ago) by drahn
Branch: MAIN
Changes since 1.35: +2 -320 lines
Diff to previous 1.35 (colored)

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

Revision 1.35 / (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_3_7_BASE, OPENBSD_3_7
Changes since 1.34: +13 -1 lines
Diff to previous 1.34 (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.34 / (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_6_BASE, OPENBSD_3_6
Changes since 1.33: +19 -1 lines
Diff to previous 1.33 (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.33 / (download) - annotate - [select for diffs], Tue Sep 2 15:17:51 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.32: +5 -2 lines
Diff to previous 1.32 (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.32 / (download) - annotate - [select for diffs], Fri Jul 18 14:09:02 2003 UTC (20 years, 10 months ago) by drahn
Branch: MAIN
Changes since 1.31: +4 -4 lines
Diff to previous 1.31 (colored)

Fix print if minor of library used is is less than requested. ok tdeval@

Revision 1.31 / (download) - annotate - [select for diffs], Sun Jul 6 20:03:57 2003 UTC (20 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.30: +2 -4 lines
Diff to previous 1.30 (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.30 / (download) - annotate - [select for diffs], Wed Jul 2 08:18:03 2003 UTC (20 years, 11 months ago) by niklas
Branch: MAIN
Changes since 1.29: +36 -22 lines
Diff to previous 1.29 (colored)

Correct library search algorithm, wrt versioned objects

Revision 1.29 / (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.28: +2 -2 lines
Diff to previous 1.28 (colored)

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

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

pefo 3/4 licence cleanups

Revision 1.27 / (download) - annotate - [select for diffs], Fri May 30 01:13:53 2003 UTC (21 years ago) by drahn
Branch: MAIN
Changes since 1.26: +2 -7 lines
Diff to previous 1.26 (colored)

When loading a shared object or libraries dependant object, load them
in random order. This will reduce the possiblity of a buffer overflow
being able to predict the addresss of useful code. Can be disabled
with the LD_NORANDOM environment variable for debugging purposes.
ok deraadt.

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

knf & ansi; drahn ok

Revision 1.25 / (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.24: +28 -1 lines
Diff to previous 1.24 (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.24 / (download) - annotate - [select for diffs], Fri Dec 13 20:45:54 2002 UTC (21 years, 6 months ago) by drahn
Branch: MAIN
Changes since 1.23: +3 -2 lines
Diff to previous 1.23 (colored)

Compare to ELFMAG byte by byte rather than using full fledged function.
Also avoids a gas problem for the moment.

Revision 1.23 / (download) - annotate - [select for diffs], Sun Nov 17 20:27:20 2002 UTC (21 years, 6 months ago) by drahn
Branch: MAIN
Changes since 1.22: +4 -4 lines
Diff to previous 1.22 (colored)

Terminate printed strings with newlines.

Revision 1.22 / (download) - annotate - [select for diffs], Thu Aug 8 17:17:12 2002 UTC (21 years, 10 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.21: +27 -14 lines
Diff to previous 1.21 (colored)

There was a possible off-by-one in ld.so when loading shared libraries.
In some (rare?) cases, where the bss was too small and fit entirely into the
leftovers of the data segment we could map one extra page. This is slightly
dangerous on PMAP_PREFER machines where mmaps allocations do not happen
linearly in the virtual space and we could end up overwriting mappings
that are already in use.

This also changes the initial allocation from being a MAP_ANON to a
MAP_FILE so that we can pass the fd as a PMAP_PREFER hint.

Revision 1.21 / (download) - annotate - [select for diffs], Wed Jul 24 04:11:10 2002 UTC (21 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.20: +9 -9 lines
Diff to previous 1.20 (colored)

ok i found it

Revision 1.20 / (download) - annotate - [select for diffs], Wed Jul 24 04:00:44 2002 UTC (21 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.19: +9 -9 lines
Diff to previous 1.19 (colored)

back out broken stuff until it is fixed

Revision 1.19 / (download) - annotate - [select for diffs], Wed Jul 24 01:05:11 2002 UTC (21 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.18: +6 -6 lines
Diff to previous 1.18 (colored)

spacing

Revision 1.18 / (download) - annotate - [select for diffs], Wed Jul 24 00:13:25 2002 UTC (21 years, 10 months ago) by deraadt
Branch: MAIN
Changes since 1.17: +3 -3 lines
Diff to previous 1.17 (colored)

cope with _dl_mmap() returning void *

Revision 1.17 / (download) - annotate - [select for diffs], Tue Jul 23 23:56:31 2002 UTC (21 years, 10 months ago) by mickey
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)

match _dl_ syscall prototypes w/ the real syscalls prototypes, including args and return values; art@ ok

Revision 1.16 / (download) - annotate - [select for diffs], Fri Jul 12 20:18:30 2002 UTC (21 years, 11 months ago) by drahn
Branch: MAIN
Changes since 1.15: +240 -68 lines
Diff to previous 1.15 (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.15 / (download) - annotate - [select for diffs], Wed Jun 5 19:34:44 2002 UTC (22 years ago) by art
Branch: MAIN
Changes since 1.14: +5 -6 lines
Diff to previous 1.14 (colored)

Get rid of an unnecessary typedef (for future cleanup).

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

more KNF

Revision 1.13 / (download) - annotate - [select for diffs], Fri May 24 18:37:38 2002 UTC (22 years ago) by drahn
Branch: MAIN
Changes since 1.12: +2 -2 lines
Diff to previous 1.12 (colored)

Change _dl_strcpy() to _dl_strlcpy(), implementation taken from libc.

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

more KNF

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

various KNF

Revision 1.10 / (download) - annotate - [select for diffs], Sat Sep 22 04:33:36 2001 UTC (22 years, 8 months ago) by drahn
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1, OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.9: +1 -4 lines
Diff to previous 1.9 (colored)

Do not check for ':' twice, otherwise the rpath loses the first character
after the : in the list of paths.

Revision 1.9 / (download) - annotate - [select for diffs], Tue Aug 21 01:19:35 2001 UTC (22 years, 9 months ago) by drahn
Branch: MAIN
Changes since 1.8: +5 -4 lines
Diff to previous 1.8 (colored)

Fix up comment to indicate order that libraries in which the
libraries are actually searched.

Revision 1.8 / (download) - annotate - [select for diffs], Mon Aug 6 15:09:58 2001 UTC (22 years, 10 months ago) by drahn
Branch: MAIN
Changes since 1.7: +11 -10 lines
Diff to previous 1.7 (colored)

Change the priority of LD_LIBRARY_PATH, -rpath, and ldconfig path
in ELF ld.so to match the behavior in a.out ld.so. The given order
is the new order, previously ldconfig had highest priority, which
made it impossible to override.

Revision 1.7 / (download) - annotate - [select for diffs], Thu May 31 13:47:20 2001 UTC (23 years ago) by art
Branch: MAIN
Changes since 1.6: +3 -4 lines
Diff to previous 1.6 (colored)

random indentation fixes (needs much more work).

Revision 1.6 / (download) - annotate - [select for diffs], Fri May 11 16:19:37 2001 UTC (23 years, 1 month ago) by art
Branch: MAIN
Changes since 1.5: +4 -4 lines
Diff to previous 1.5 (colored)

MAP_COPY -> MAP_PRIVATE

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

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

Revision 1.4 / (download) - annotate - [select for diffs], Fri Mar 30 01:35:20 2001 UTC (23 years, 2 months ago) by drahn
Branch: MAIN
Changes since 1.3: +31 -3 lines
Diff to previous 1.3 (colored)

Add infrastructure to allow mapping of text sections which are normally
RO, RW while ld.so is working. And then the information to set the
sections back to RO (or appropriate mode).

PowerPC now supports the typical NON-PIC relocations in ld.so.
I do not know how well this will work with large shared libraries.
I seem to recall a possible problem with large data where data is
located in a different shared library.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Feb 16 05:28:17 2001 UTC (23 years, 3 months ago) by drahn
Branch: MAIN
Changes since 1.2: +2 -5 lines
Diff to previous 1.2 (colored)

Now that powerpc is using UVM, this shared library hack is no longer necessary.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Oct 6 17:40:17 2000 UTC (23 years, 8 months ago) by rahnds
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.1: +20 -2 lines
Diff to previous 1.1 (colored)

Work around a shared library/pmap bug on the powerpc arch. Somehow
it seems that the instruction cache will not get properly initialized
or a problem exists with mmaping code and being able to execute it.
This workaround is excessive in that it flushes the cache for the
entire mmaped library. This slows down program startup, but seems
to eliminate the problem.

Revision 1.1.1.2 / (download) - annotate - [select for diffs] (vendor branch), Tue Jun 13 03:40:02 2000 UTC (24 years ago) by rahnds
Branch: per, dsr
CVS Tags: r20000612
Changes since 1.1.1.1: +16 -1 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:00 2000 UTC (24 years 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:00 2000 UTC (24 years 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.