summaryrefslogtreecommitdiffstats
path: root/libexec
Commit message (Collapse)AuthorAgeFilesLines
...
* Work around a situation where symlook_obj() could be called for thekib2012-05-051-3/+5
| | | | | | | | | | | | | object for which digest_dynamic1() was not done yet. Just return EINVAL and do not try to dereference NULL buckets hash array. This seems to happen on ia64 for rtld object itself, where the R_IA_64_FPTR64LSB relocations require symbol lookup. The dynamic linker itself does not rely on identity of the C-level function pointers (i.e. function descriptors). Reported and reviewed by: marcel MFC after: 8 days
* Add two special directives to libmap.conf:bapt2012-04-301-30/+132
| | | | | | | | | | | | | | | include <file>: Parse the contents of file before continuing with the current file. includedir <dir>: Parse the contents of every file in dir that ends in .conf before continuing with the current file. Any file or directory encountered while processing include or includedir directives will be parsed exactly once, even if it is encountered multiple times. Reviewed by: kib, des Approved by: des (mentor) MFC after: 1 month
* Add GNU hash support for rtld.kib2012-04-309-19/+163
| | | | | | | Based on dragonflybsd support for GNU hash by John Marino <draco marino st> Reviewed by: kan Tested by: bapt MFC after: 2 weeks
* Split the symlook_obj1 into a loop iterating over the ELF object symbolkib2012-04-302-95/+116
| | | | | | | | | | hash elements, and a helper matched_symbol() which match the given hash entry and request, performing needed type and version checks. Based on dragonflybsd support for GNU hash by John Marino <draco marino st> Reviewed by: kan Tested by: bapt MFC after: 2 weeks
* Fix a missed file in r234580: replace the now-obsolete powerpc_mb() withnwhitehorn2012-04-231-2/+2
| | | | regular mb().
* Do a better job at determining the username of the login session.ed2012-04-191-1/+23
| | | | | | | | | | | When multiple users share the same UID, the old code will simply pick an arbitrary username to attach to the utmpx entries. Make the code a bit more accurate by first checking whether getlogin() returns a username which corresponds to the uid of the calling process. If this fails, simply fall back to picking an arbitrary username. Reported by: saurik on GitHub MFC after: 2 weeks
* Propagate the current state of rtld_bind_lock to dlopen_object() callskib2012-04-121-16/+23
| | | | | | | | | through the filter loading call chain. This fixes attempts to write-lock the already locked rtld_bind_lock when filter loading is initiated by relocation of dlopening dso. Reported and tested by: Taku YAMAMOTO <taku tackymt homeip net> MFC after: 1 week
* Properly handle absent AT_CANARY aux entry.kib2012-04-051-1/+2
| | | | | Submitted by: Andrey Zonov <andrey zonov org> MFC after: 3 days
* Remove extra blank line from revious commit.kan2012-04-021-1/+0
| | | | Submitted by: trema
* Do not try to adjust stacks if dlopen_object is called too early.kan2012-04-021-1/+4
| | | | | | | | This is a follow-up to r233231, which fixed similar issue with object initialization code. Reviewed by: kib MFC after: 1 week (with 233231)
* Fix ia64 build after r233655.kib2012-03-291-0/+6
| | | | MFC after: 1 week
* Import DragonFly BSD commitkib2012-03-291-1/+6
| | | | | | | | | | | | | | From: Sascha Wildner <saw@online.de> Date: Fri, 2 Mar 2012 09:15:56 +0000 (+0100) Subject: rtld: Add a special case in do_dlsym() for TLS stored symbols. X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/1388aaafe730c85693936aaf9bc6d83fc2d981be?hp=bca4412595a8979ab9f1bf36068c806ce88a667a rtld: Add a special case in do_dlsym() for TLS stored symbols. Submitted-by: Markus Pfeiffer <markus.pfeiffer@morphism.de> Discussed with: kan MFC after: 1 week
* Remove trailing whitespace per mdoc lint warningeadler2012-03-291-3/+3
| | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days
* Prevent rtld_verify_object_versions() from being called several timeskib2012-03-272-0/+5
| | | | | | | | | | for the same object. This can happen when object is a dependency of the dlopen()ed dso. When called several times, we waste time due to unneeded processing, and memory, because obj->vertab is allocated anew on each iteration. Reviewed by: kan MFC after: 2 weeks
* mdoc: terminate quoted strings.joel2012-03-261-2/+2
| | | | Reviewed by: brueffer
* Make sure sections are sorted into conventional order.joel2012-03-251-17/+17
|
* Remove libssp_nonshared from the rtld linking set. The only use for thekib2012-03-242-1/+2
| | | | | | | library was definition for the weak alias of __stack_chk_fail. No objections from: kan MFC after: 2 weeks
* Provide short-circuit exit(3) implementation for rtld.kib2012-03-241-0/+11
| | | | | | | | There is no atexit finalizers in rtld to call on rtld exiting (due to errors). Submitted by: bde No objections from: kan MFC after: 2 weeks
* Before jumping to application's entry point set ra == pc in ordergonzo2012-03-231-1/+2
| | | | to let backtracing routine know to go no further.
* Remove superfluous extern keywords.kib2012-03-231-10/+10
| | | | MFC after: 2 weeks
* Centralize the calculation of the top source directory. Thiskib2012-03-231-2/+3
| | | | | | | | simplifies the build of rtld with partial checkout, allowing to override only one place to reference other tree. Submitted by: bde MFC after: 2 weeks
* Implement xstrdup() using strlen()/xmalloc()/memcpy() alreadykib2012-03-231-7/+8
| | | | | | | presented in rtld, instead of pulling in libc strdup(). Submitted by: bde MFC after: 2 weeks
* Use xmalloc() instead of malloc() in the places where malloc() callskib2012-03-225-19/+20
| | | | | | | | | | | | | | | are assumed to not fail. Make the xcalloc() calling conventions follow the calloc(3) calling conventions and replace unchecked calls to calloc() with calls to xcalloc(). Remove redundand declarations from xmalloc.c, which are already present in rtld.h. Reviewed by: kan Discussed with: bde MFC after: 2 weeks
* Remove the fragments which are not needed on FreeBSD. The caltechkib2012-03-221-18/+0
| | | | | | | malloc hardly would ever be updated. Reviewed by: bde, kan MFC after: 2 weeks
* Fix several problems with our ELF filters implementation.kib2012-03-2010-118/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not relocate twice an object which happens to be needed by loaded binary (or dso) and some filtee opened due to symbol resolution when relocating need objects. Record the state of the relocation processing in Obj_Entry and short-circuit relocate_objects() if current object already processed. Do not call constructors for filtees loaded during the early relocation processing before image is initialized enough to run user-provided code. Filtees are loaded using dlopen_object(), which normally performs relocation and initialization. If filtee is lazy-loaded during the relocation of dso needed by the main object, dlopen_object() runs too earlier, when most runtime services are not yet ready. Postpone the constructors call to the time when main binary and depended libraries constructors are run, passing the new flag RTLD_LO_EARLY to dlopen_object(). Symbol lookups callers inform symlook_* functions about early stage of initialization with SYMLOOK_EARLY. Pass flags through all functions participating in object relocation. Use the opportunity and fix flags argument to find_symdef() in arch-specific reloc.c to use proper name SYMLOOK_IN_PLT instead of true, which happen to have the same numeric value. Reported and tested by: theraven Reviewed by: kan MFC after: 2 weeks
* Remove write-only variable.kib2012-03-161-2/+0
| | | | MFC after: 3 days
* Rtld on diet 3.kib2012-03-144-11/+22
| | | | | | | | | | | | | | Stop using strerror(3) in rtld, which brings in msgcat and stdio. Directly access sys_errlist array of errno messages with private rtld_strerror() function. Now, $ size /libexec/ld-elf.so.1 text data bss dec hex filename 96983 2480 8744 108207 1a6af /libexec/ld-elf.so.1 Reviewed by: dim, kan MFC after: 2 weeks
* Use PTR_SUBU instead of subu (missed this one)gonzo2012-03-121-1/+1
|
* Use PTR_(ADD|SUB)U macrosses instead of hardcoded addu/subugonzo2012-03-121-2/+2
| | | | Spotted by: juli
* - Although we pass first 4 arguments in registers, function callinf ABI requiresgonzo2012-03-121-7/+9
| | | | | | | space to be reserved for them in stack. _rtld() prologue saves a1 and a2 in this space. - Whitespace cleanup while I'm at it
* Rtld on diet part 2:kib2012-03-121-72/+76
| | | | | | | | Do not use stdio for libmap.conf read. Directly map the file and parse lines from the mappings. Reviewed by: kan MFC after: 3 weeks
* Rtld on diet part 1:kib2012-03-121-0/+40
| | | | | | | | | | | | | | Provide rtld-private implementations of __stack_chk_guard, __stack_chk_fail() and __chk_fail() symbols, to be used by functions linked from libc_pic.a. This avoids use of libc stack_protector.c, which pulls in syslog(3) and stdio as dependency. Also, do initialize rtld-private copy __stack_chk_guard, previously libc-provided one was not initialized, since we do not call rtld object _init() methods. Reviewed by: kan MFC after: 3 weeks
* Amend r232857, now dropping the casts entirely, as they were notdim2012-03-121-2/+2
| | | | | | necessary at all. Submitted by: stefanf
* Fix the following warning/error with clang:dim2012-03-121-2/+2
| | | | | | | | | | | libexec/rtld-elf/rtld.c:1898:22: error: comparison between pointer and integer ('Elf_Addr *' (aka 'unsigned int *') and 'Elf_Addr' (aka 'unsigned int')) [-Werror] if (preinit_addr == (Elf_Addr)NULL) ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ libexec/rtld-elf/rtld.c:2039:16: error: comparison between pointer and integer ('Elf_Addr *' (aka 'unsigned int *') and 'Elf_Addr' (aka 'unsigned int')) [-Werror] if (init_addr != (Elf_Addr)NULL) { ~~~~~~~~~ ^ ~~~~~~~~~~~~~~ Reviewed by: kib
* When iterating over the dso program headers, the object is not initializedkib2012-03-121-1/+4
| | | | | | | | | yet, and object segments are not yet mapped. Only parse the notes that appear in the first page of the dso (as it should be anyway), and use the preloaded page content. Reported and tested by: stass MFC after: 20 days
* Add support for preinit, init and fini arrays. Some ABIs, inkib2012-03-1113-14/+230
| | | | | | | | | | | | | | | | | | | | | | | | particular on ARM, do require working init arrays. Traditional FreeBSD crt1 calls _init and _fini of the binary, instead of allowing runtime linker to arrange the calls. This was probably done to have the same crt code serve both statically and dynamically linked binaries. Since ABI mandates that first is called preinit array functions, then init, and then init array functions, the init have to be called from rtld now. To provide binary compatibility to old FreeBSD crt1, which calls _init itself, rtld only calls intializers and finalizers for main binary if binary has a note indicating that new crt was used for linking. Add parsing of ELF notes to rtld, and cache p_osrel value since we parsed it anyway. The patch is inspired by init_array support for DragonflyBSD, written by John Marino. Reviewed by: kan Tested by: andrew (arm, previous version), flo (sparc64, previous version) MFC after: 3 weeks
* Optimize tls_get_addr_common(). The change provides around 30% speedupkib2012-03-101-9/+22
| | | | | | | | | | | | | | | | | for TLS microbenchmark using global-dynamic TLS model on amd64 (which is default for PIC dso objects). Split the slow path into tls_get_addr_slow(), for which inlining is disabled. This prevents the registers spill on tls_get_addr_common() entry. Provide static branch hint to the compiler, indicating that slow path is not likely to be taken. While there, do some minimal style adjustments. Reported and tested by: davidxu MFC after: 1 week
* Remove the use of toupper() from rtld_printf.c. Use of the libc functionkib2012-03-091-5/+7
| | | | | | relies on working TLS, which is particulary not true for LD_DEBUG uses. MFC after: 1 week
* Cosmetic nit:pluknet2012-03-061-10/+10
| | | | | | - rename isspace1() macro to the more appropriate rtld_isspace(). Discussed with: kib
* - Switch to saving non-offseted pointer to TLS block in order too keep ↵gonzo2012-03-062-17/+4
| | | | things simple
* The libmap.conf initialization is performed before TLS is functional.kib2012-03-051-10/+15
| | | | | | | | | | | | | Since after r232498 the ctype macros require working access to thread-local variables, rtld crashes when libmap.conf is present. Use hand-made isspace1() macro which is enough to detect spaces in libmap.conf. Reported by: alc, lme, many on current@ Tested by: lme Reviewed by: dim, kan MFC after: 1 week
* Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, todim2012-02-282-6/+2
| | | | | | | | | | | | | | | | | | | | | get rid of testing explicitly for clang (using ${CC:T:Mclang}) in individual Makefiles. Instead, use the following extra macros, for use with clang: - NO_WERROR.clang (disables -Werror) - NO_WCAST_ALIGN.clang (disables -Wcast-align) - NO_WFORMAT.clang (disables -Wformat and friends) - CLANG_NO_IAS (disables integrated assembler) - CLANG_OPT_SMALL (adds flags for extra small size optimizations) As a side effect, this enables setting CC/CXX/CPP in src.conf instead of make.conf! For clang, use the following: CC=clang CXX=clang++ CPP=clang-cpp MFC after: 2 weeks
* Avoid error log for transfer stop w/o error code.emaste2012-02-211-1/+2
| | | | | | | | | | A number of tftp clients, including the one in Intel's pxe boot loader, may intentionally stop a transfer using error code 0 (i.e., EUNDEF). These are not real errors. Avoid spamming log files with these by logging them at level LOG_DEBUG instead. Discussed on -hackers with an initial patch proposal; this change is an improved approach suggested by kan@.
* Add thread-local storage support for ARM to rtld-elfgonzo2012-02-143-11/+83
| | | | | Reviewed by: cognet Obtained from: NetBSD
* Add missed EOL when die() was converted to use rtld_fdputstr() insteadkib2012-02-131-0/+1
| | | | | | | | of errx(). Reported by: amdmi3 PR: bin/165075 MFC after: 3 days
* Add handlers for TLS-related relocation entriesgonzo2012-02-112-3/+87
|
* Remove debug outputgonzo2012-02-101-2/+0
|
* Switch MIPS TLS implementation to Variant Igonzo2012-02-103-9/+44
|
* Fix debug output for MIPS part of rtldgonzo2012-02-101-12/+13
|
* Consistently set RPCGEN_CPP when running rpcgen, so the C preprocessordim2012-02-071-1/+1
| | | | | | set via ${CPP} is used, instead of always using hardcoded /usr/bin/cpp. MFC after: 1 week
OpenPOWER on IntegriCloud