summaryrefslogtreecommitdiffstats
path: root/libexec
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Add support for GNU RELRO.kib2012-01-303-0/+28
| | | | | Submitted by: John Marino <draco marino st> MFC after: 2 weeks
* Remove unneeded dtv variable.ed2012-01-172-6/+0
| | | | | | | It is only assigned and not used at all. The object files stay identical when the variables are removed. Approved by: kib
* Fix warning when compiling with gcc46:eadler2012-01-101-2/+0
| | | | | | | error: variable 'bp' set but not use Approved by: dim MFC After: 3 days
* Spelling fixes for libexec/uqs2012-01-0719-30/+30
|
* Implement fdlopen(3), an rtld interface to load shared object by filekib2012-01-072-32/+82
| | | | | | | | descriptor. Requested and tested by: des (previous version) Reviewed by: des, kan (previous version) MFC after: 2 weeks
* Postpone the resolution of IRELATIVE relocations and IFUNC-targetedkib2012-01-041-4/+5
| | | | | | | | | | relocations until tls is initialized and stacks permissions correctly set. This allows the ifunc to call malloc(3) and some other heavy services. Add debug banner. MFC after: 3 days
* Replace index() and rindex() calls with strchr() and strrchr().ed2012-01-032-4/+5
| | | | | | | | | | The index() and rindex() functions were marked LEGACY in the 2001 revision of POSIX and were subsequently removed from the 2008 revision. The strchr() and strrchr() functions are part of the C standard. This makes the source code a lot more consistent, as most of these C files also call into other str*() routines. In fact, about a dozen already perform strchr() calls.
* Fix a problem whereby a corrupt DNS record can cause named to crash. [11:06]cperciva2011-12-232-0/+4
| | | | | | | | | | | | | | | | | | | | Add an API for alerting internal libc routines to the presence of "unsafe" paths post-chroot, and use it in ftpd. [11:07] Fix a buffer overflow in telnetd. [11:08] Make pam_ssh ignore unpassphrased keys unless the "nullok" option is specified. [11:09] Add sanity checking of service names in pam_start. [11:10] Approved by: so (cperciva) Approved by: re (bz) Security: FreeBSD-SA-11:06.bind Security: FreeBSD-SA-11:07.chroot Security: FreeBSD-SA-11:08.telnetd Security: FreeBSD-SA-11:09.pam_ssh Security: FreeBSD-SA-11:10.pam
* Additional icache paranoia: non-PLT relocations can modify the text segment.nwhitehorn2011-12-172-2/+9
| | | | | | | It is then important to make sure the icache is synchronized again to prevent (rare) random seg faults and illegal instructions. MFC after: 3 days
* Fix RTLD on PowerPC after r228435. Changing the order of init_pltgot()nwhitehorn2011-12-171-4/+11
| | | | | caused the icache to be invalidated at the wrong time, resulting in an icache full of nonsense in the PLT section.
* Fix the incompatible enum conversions in libexec/ypxfr in another, moredim2011-12-163-22/+24
| | | | | | | | messy way, so as to not disrupt other yp programs: just add casts to convert the incompatible enums, as the numerical values are the same (either by accident, design, or the phase of the moon at that time). MFC after: 1 week
* Revert r228592, as the non-messy way of fixing ypxfr breaks other ypdim2011-12-164-7/+8
| | | | | | | programs (e.g. usr.sbin/rpc.yppasswdd). Spotted by: np MFC after: 1 week
* Attempt to fix the numerous incompatible enum conversions indim2011-12-164-8/+7
| | | | | | libexec/ypxfr in the least disruptive way. MFC after: 1 week
* Fix typos in the comments about clang warnings in severaldim2011-12-162-2/+2
| | | | | | | sendmail-related Makefiles. Spotted by: arundel MFC after: 1 week
* Unfortunately, clang gives warnings about sendmail code that cannot bedim2011-12-161-0/+7
| | | | | | | turned off yet. Since this is contrib code, and we don't really care about the warnings, just turn make them non-fatal for now. MFC after: 1 week
* In libexec/rbootd/utils.c, use the correct printf length modifiers fordim2011-12-161-3/+3
| | | | | | u_int32_t and size_t. MFC after: 1 week
* In libexec/pppoed/pppoed.c, use the correct printf length modifier for adim2011-12-161-2/+2
| | | | | | size_t. MFC after: 1 week
* Unfortunately, clang gives warnings about sendmail code that cannot bedim2011-12-161-0/+7
| | | | | | | turned off yet. Since this is contrib code, and we don't really care about the warnings, just turn make them non-fatal for now. MFC after: 1 week
OpenPOWER on IntegriCloud