summaryrefslogtreecommitdiff
path: root/libexec/ld.so/resolve.c
AgeCommit message (Collapse)Author
2018-11-28Implement support for DT_GNU_HASH, taking all the interesting bitsPhilip Guenther
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@
2018-11-16Finish ld.so's transition to GNU_RELRO: eliminate support for usingPhilip Guenther
__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@
2018-11-16Borrow an idea from DragonFly BSD: factor out the "does this symbol match whatPhilip Guenther
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@
2018-11-15Put all the symbol lookup parameters (except the object being searched) andPhilip Guenther
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@
2018-10-22Use int, not char*, for booleansPhilip Guenther
ok millert@
2018-03-09Add support for the DF_TEXTREL flag.Mark Kettenis
ok patrick@, millert@
2017-01-24On fatal errors, kill ourselves with thrkill(0,9,NULL) instead ofPhilip Guenther
simply exiting, via helper functions _dl_die(), _dl_diedie(), and _dl_oom(). prompted by a complaint from jsing@ ok jsing@ deraadt@
2017-01-24Unbreak $ORIGIN support when only one of DT_RUNPATH and DT_RPATH is usedPhilip Guenther
2017-01-23remove line that slipped in with rev 1.77 but doesn't belong there; ok sthen@Christian Weisgerber
2017-01-23Whoops, lost the adjustment of DT_RUNPATH value as a DT_STRTAB value.Philip Guenther
problem reported by semarie@
2017-01-23Mark a bunch of stuff staticPhilip Guenther
ok kettenis@
2017-01-22Add support for DT_RUNPATH and DT_FLAGSPhilip Guenther
ok kettenis@
2016-08-23Implement support for DT_INIT_ARRAY, DT_FINI_ARRAY and DT_PREINIT_ARRAY.Mark Kettenis
Don't skip DT_INIT and DT_FINI for the main executable. This matches what Linux and Solaris do. ok guenther@
2016-08-08Look for a PT_GNU_RELRO section per object and, if present, mprotect thatPhilip Guenther
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@
2016-07-04Remove prebind support: binding to symbol table indices is too fragilePhilip Guenther
for our development process. ok kettenis@ deraadt@
2016-03-20Export environ and __progname, making the latter a copy of just the filenamePhilip Guenther
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@
2016-01-24Delete remnants of grpsym cache setting during symbol search: it's done atPhilip Guenther
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@
2016-01-24Lacking precise dependency-from-relocation tracking, a nodelete objectPhilip Guenther
needs to lock down the entire load group, not just the specific object. problem report and ok sthen@ been in snaps for a week
2015-11-02Factor out the logic for mprotecting the memory between two symbols intoPhilip Guenther
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
2015-01-22delete annoying white space that annoyTheo de Raadt
2014-07-10check all memory allocations; ok miod@ guenther@Otto Moerbeek
2014-06-21Move to a non-zeroing _dl_malloc, a _dl_calloc and _dl_reallocarry andOtto Moerbeek
fix _dl_strdup to return NULL instead of crash; ok deraadt@
2013-11-27unsigned char for ctypeTheo de Raadt
ok okan kettenis
2013-11-13prototype & void * math cleanupTheo de Raadt
ok guenther
2013-06-01Introduce ltrace(1). This tool works with ld.so to inject utrace record forMiod Vallat
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
2013-05-08Implement symbol caching and RELACOUNT/RELCOUNT optimizations.Philip Guenther
Much assistance and testing by miod ok miod@
2013-04-05- Add ORIGIN, OSNAME, OSREL and PLATFORM substitution support for rpaths.Kurt Miller
Improvements and okay matthew@, millert@, guenther@
2013-03-20- Parse colon separated paths into NULL terminated arrays of stringKurt Miller
pointers to prepare for adding rpath ORIGIN support. okay matthew@ millert@
2012-07-06Fix LD_DEBUG=1 regression introduced by previous commit.Matthew Dempsky
ok kurt
2012-06-14Add support for DF_1_NOOPEN. Based on an origional diff from matthew@.Mark Kettenis
ok matthew@
2011-11-28Add support for getting some flags from DT_FLAGS_1: new flagsPhilip Guenthe
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@
2011-06-27Backout the dynamic linker speed improvement diff for now, it stillStuart Henderson
has some issues. Discussed with various, ok drahn@
2011-05-26No need to call _dl_newsymsearch() twice; ok drahn@Otto Moerbeek
2011-05-22Dynamic linker speed improvement diff. tested by several sinc k2k11.Dale Rahn
get it in tree now deraadt@, ok by several ports folks. Thanks for the testing.
2011-05-10Fix previous. On i386, library.c isn't compiledOtto Moerbeek
2010-10-25Search loaded libs first and add support for SONAME matching. ok drahn@Kurt Miller
2010-08-11Make _dl_searchnum signed as originally intended.Dale Rahn
Pointed out by patrick keshish.
2010-07-01When generating grpsym lists, avoid duplicates without searching theDale Rahn
already generated list. Speeds up startup on deeply nested dlopen binaries. ok guenther@, tested by ckuethe@ and ajacoutot@
2008-05-05Constantly fill in the program header pointer and count in elf_object_tKurt Miller
for all objects which simplifies phdr usage in a few places. "go for it" drahn@
2008-04-09Improve support for shared libs linked at non-zero addreses:Kurt Miller
- 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@
2006-05-03prebind - how to prelink a binary without throwing security out the windowDale Rahn
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.
2005-11-09add RTLD_NOW support to dlopen and propogate -z now to dep libs.Kurt Miller
ok drahn@
2005-10-21using _dl_link_grpsym to increment refcounts made _dl_notify_unload_shlibKurt Miller
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@
2005-10-17Fix possible buffer overflow caused by unknown tags in the rangeMark Kettenis
[DT_LOPROC, DT_HIPROC]. ok kurt@
2005-10-12Split grpsym_list creation away from child_list creation and changeKurt Miller
grpsym_list order to match Sun's docs. Also corrects bugs where grpsym_list was either not created or partially created.
2005-10-09introduce object ref count macros (suggested by dale). no functionalKurt Miller
change.
2005-10-07rename dload_list to grpsym_list which better represents its usage.Kurt Miller
2005-10-06remove dep_next "shadow object" dead code.Kurt Miller
2005-10-06separate load group references from dep lib child/dload lists. move loadKurt Miller
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@
2005-10-03refcount corrections: count common dep libs once and centralize dep libKurt Miller
refcount increments to _dl_link_sub. adjust _dl_notify_unload_shlib to match new refcount method. ok drahn@