summaryrefslogtreecommitdiffstats
path: root/libexec
Commit message (Collapse)AuthorAgeFilesLines
* Turn off default generation of userland dot symbols on powerpc64 now thatnwhitehorn2011-02-181-3/+3
| | | | | we have a binutils that supports it. Kernel dot symbols remain on to assist DDB.
* Use sigsetjmp/siglongjmp with disabled signal mask access forkib2011-02-093-5/+5
| | | | | | lock upgrade in rtld. There is no need to care about the mask, which causes a lot of unneeded sigprocmask(2) calls during each symbol lookup.
* Fix grammar in comment.kib2011-01-301-1/+1
| | | | | Pointy hat to: kib MFC after: 1 week
* Make ldd(1) work when versioned dependency file is cannot be loaded.kib2011-01-301-4/+13
| | | | | | | | | | Instead of aborting in locate_dependency(), propagate the error to caller. The rtld startup function does the right thing with an error from rtld_verify_versions(), depending on the mode of operation. Reported by: maho In collaboration with: kan MFC after: 1 week
* Eliminate the use of symlook_needed function in favor of DAGS.kan2011-01-281-67/+47
| | | | | | | | | | | | | | | | | | | | | | Place elements on DAG lists in breadth-first order. This allows us to walk pre-built list in all cases where breadth-first dependency chain enumeration is required. Fix dlsym on special handle obtained by dlopen(NULL, ...) to do what comment claims it does. Take advantage of recently added symlook_global function to iterate over main objects and global DAGs lists properly in search of a symbol. Since rtld itself provides part of the global namespace, search rtld_obj too. Remove recursion from init_dag and symlook_needed functions. Use symlook_needed for ELF filtee processing only and change lookup order used in the function to match the order used by Solaris runtime linker under same circumstances. While there, fix weak symbol handling in the loop so that we return the first weak symbol definition if no strong one was found, instead of the last one. Reviewed by: kib MFC after: 1 month
* Remove SuperH architecture from a comment as we do not support it.pluknet2011-01-281-1/+1
| | | | | | | Presumably it was leaked from NetBSD together with rtld-elf mips support. Approved by: kib (mentor) MFC after: 3 days
* When loading dso without PT_GNU_STACK phdr, only callkib2011-01-2510-2/+26
| | | | | | | __pthread_map_stacks_exec() on architectures that allow executable stacks. Reported and tested by: marcel (ia64)
* Fix get_program_var_addr() when type of the resolved symbol is functional.kib2011-01-251-1/+6
| | | | | | Use make_function_pointer then, otherwise ia64 is broken. Reported and tested by: marcel
* Add my copyright.kib2011-01-221-0/+1
| | | | Discussed with: kan
* Mark rtld on PowerPC as not requiring executable stack.kib2011-01-142-1/+2
| | | | Reviewed and tested by: nwhitehorn
* get_program_var_addr() must prefer the strong symbol to the weakkib2011-01-101-65/+84
| | | | | | | | | | | | | | one. Search global objects, together with main object and dependencies, for the requested symbol. Move the common code from symlook_default() into new helper symlook_global(), and use it both in symlook_global() and get_program_var_addr(). Supply lock state to get_program_var_addr(). Reviewed by: kan Tested by: Mykola Dzham <i levsha me>
* In rtld, read the initial stack access mode from AT_STACKPROT as setkib2011-01-084-0/+51
| | | | | | | | | | | | | | | by kernel, and parse PT_GNU_STACK phdr from linked and loaded dsos. If the loaded dso requires executable stack, as specified by PF_X bit of p_flags of PT_GNU_STACK phdr, but current stack protection does not permit execution, the __pthread_map_stacks_exec symbol is looked up and called. It should be implemented in libc or threading library and change the protection mode of all thread stacks to be executable. Provide a private interface _rtld_get_stack_prot() to export the stack access mode as calculated by rtld. Reviewed by: kan
* Add section .note.GNU-stack for assembly files used by 386 and amd64.kib2011-01-072-0/+4
|
* Sort -mno-(mmx|3dnow|sse|sse2|sse3) options consistently throughout thedim2011-01-052-2/+2
| | | | | | tree. Submitted by: arundel
* On amd64 and i386, tell the compiler to refrain from generating SSE,dim2011-01-042-0/+2
| | | | | | | | | | | | | | | | 3DNow, MMX and floating point instructions in rtld-elf. Otherwise, _rtld_bind() (and whatever it calls) could possibly clobber function arguments that are passed in SSE/3DNow/MMX/FP registers, usually floating point values. This can happen, for example, when clang generates SSE code for memset() or memcpy() calls. One symptom of this is sshd dying early on amd64 with "PRNG not seeded", which is ultimately caused by libcrypto.so.6 calling RAND_add() with a double parameter. That parameter is passed via %xmm0, which gets wiped out by an SSE memset() in _rtld_bind(). Reviewed by: kib, kan
* Remove '-elf' from build flags for libexec/rtld-elf for amd64 and i386.dim2011-01-042-4/+0
| | | | ELF has been the default format for almost 12 years now.
* Make format string a string literal. (Discovered by clang.)emaste2011-01-041-1/+1
| | | | MFC After: 1 week
* Handle failure from ftpd_popen in statfilecmd().emaste2011-01-041-0/+4
| | | | | Reviewed by: attilio MFC after: 1 week
* Add support for R_PPC64_UADDR64 relocations.nwhitehorn2011-01-031-1/+2
|
* expand checkuser() to support the propagation of error codes back tocsjp2011-01-031-8/+27
| | | | | | | | | | | the caller. Currently, checkuser() does not differentiate between the failure to open the file and the absence of a user in the file. Check to see if there was an error opening the file. If there are any errors, terminate the connection. Currently, the only exception to this rule is ENOENT, since there is nothing that says the /etc/ftpuser and /etc/ftpchroot has to exist. MFC after: 3 weeks
* Fix an error in the ABI in rtld_bind_start(). When passing arguments to anwhitehorn2010-12-281-44/+44
| | | | | | | | | C function, the caller's stack frame must have room to store all of the arguments to that function. While here, fix stack frame alignment issues. Without this change, the compiler will save r3 and r4 into the caller's stack frame before calling setjmp() in _rtld_bind(). These would then overwrite arguments to the newly-bound function, causing eventual failures.
* Fix an apparent cop-and-paste mistake in previous commit.kan2010-12-271-1/+1
| | | | This makes dlsym(RTLD_DEFAULT) work properly again.
* Implement support for ELF filters in rtld. Both normal and auxillarykib2010-12-2513-411/+767
| | | | | | | | | | | | | | | | | filters are implemented. Filtees are loaded on demand, unless LD_LOADFLTR environment variable is set or -z loadfltr was specified during the linking. This forces rtld to upgrade read-locked rtld_bind_lock to write lock when it encounters an object with filter during symbol lookup. Consolidate common arguments of the symbol lookup functions in the SymLook structure. Track the state of the rtld locks in the RtldLockState structure. Pass local RtldLockState through the rtld symbol lookup calls to allow lock upgrades. Reviewed by: kan Tested by: Mykola Dzham <i levsha me>, nwhitehorn (powerpc)
* Add a hook to pass debug flags to the build of rtld when doing make inkib2010-12-251-1/+1
| | | | | | the rtld directory. Reviewed by: kan
* Add __unusedcharnier2010-12-201-1/+1
|
* Add __unusedcharnier2010-12-201-5/+5
|
* Add __unused. Ansi prototypes.charnier2010-12-202-8/+6
|
* add __unusedcharnier2010-12-191-6/+4
|
* If dlclose() is called recursively from a _fini() function, the innerjh2010-12-161-16/+38
| | | | | | | | | | | | | | | | | dlclose() call may unload the object of the outer call prematurely because objects are unreferenced before _fini() calls. Fix this by unreferencing objects after calling objlist_call_fini() in dlclose(). Therefore objlist_call_fini() now calls the fini function if the reference count of an object is 1. In addition we must restart the list_fini traversal after every _fini() call because another dlclose() call might have modified the reference counts. Add an XXX comment to objlist_call_fini() about possible race with dlopen(). PR: 133246, 149464 Reviewed by: kan, kib
* Fix double ;;kevlo2010-12-061-1/+1
|
* Catch up with kernel using time_uptime to drive ARP timeouts.glebius2010-12-061-3/+3
| | | | Noticed by: jilles
* Use -fPIC to build libexec/rtld-elf on sparc64, so it will also be abledim2010-11-111-1/+6
| | | | | | to link with newer binutils, without overflowing the GOT. Obtained from: projects/binutils-2.17
* Fix typos.brucec2010-11-091-1/+1
| | | | | PR: bin/148894 Submitted by: olgeni
* In r214728, if dlopen() is called for the object that has been alreadykib2010-11-041-5/+5
| | | | | | | | | | | | | | | | | loaded as a dependency and marked -z nodlopen, object' DAG is already initialized by load_needed_objects(). Due to this, the init_dag() call from dlopen() does not increment refcount for the object [1]. Change init_dag() to not increment DAG refcount. Require explicit calls to ref_dag() to increment, and assert that ref_dag() and unref_dag() are called for root that has dag initialized. To fix the noted issue, unconditionally call both init_dag() and ref_dag() in dlopen() for the case when the object was already loaded, making it similar to the case of newly loaded object. Noted by: jh [1] Reviewed by: jh, kan MFC after: 6 days
* Fix style.kib2010-11-041-1/+1
| | | | MFC after: 6 days
* If dlopen() is called for the dso that has been already loaded as akib2010-11-032-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dependency, then the dso never has its DAG initialized. Empty DAG makes ref_dag() call in dlopen() a nop, and the dso refcount is off by one. Initialize the DAG on the first dlopen() call, using a boolean flag to prevent double initialization. From the PR (edited): Assume we have a library liba.so, containing a function a(), and a library libb.so, containing function b(). liba.so needs functionality from libb.so, so liba.so links in libb.so. An application doesn't know about the relation between these libraries, but needs to call a() and b(). It dlopen()s liba.so and obtains a pointer to a(), then it dlopen()s libb.so and obtains a pointer to b(). As soon as the application doesn't need a() anymore, it dlclose()s liba.so. Expected result: the pointer to b() is still valid and can be called Actual result: the pointer to b() has become invalid, even though the application did not dlclose() the handle to libb.so. On calling b(), the application crashes with a segmentation fault. PR: misc/151861 Based on patch by: jh Reviewed by: kan Tested by: Arjan van Leeuwen <freebsd-maintainer opera com> MFC after: 1 week
* Add a new libc function: cfmakesane(3).ed2010-11-022-9/+12
| | | | | | | | | | | I've noticed various terminal emulators that need to obtain a sane default termios structure use very complex `hacks'. Even though POSIX doesn't provide any functionality for this, extend our termios API with cfmakesane(3), which is similar to the commonly supported cfmakeraw(3), except that it fills the termios structure with sane defaults. Change all code in our base system to use this function, instead of depending on <sys/ttydefaults.h> to provide TTYDEF_*.
* Unbreak ia64.marcel2010-10-222-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | With r169630 I disabled symbol versioning because it broke rtld. With r211706 rtld got broken for ia64 & powerpc64. It was fixed for powerpc64 with r212497. In between, r211749 removed the exports table because the version script handled the exports. But wait, symbol versioning was disabled on ia64. With exports controlled by the version script and symbol versioning disabled, all symbols are exported and too many symbols bind to the definition in rtld. Let's just say that waird things happen. So, enable symbol versioning on ia64 and apply a work-around for the SIGSEGV that triggered r169630 to begin with: when rtld relocates itself, it comes across r_debug_state and for some reason can't find the definition. This causes a failure, relocation aborts and null pointers galore. The work-around is to ignore the missing definition when rtld is relocating itself and keep going. Maybe with the next binutils this will all go away. Maybe not, in which case I still need to figure out why r_debug_state cannot be found. BTW: r_debug_state is in the symbol map -- I don't think any other rtld symbols that rtld references are in the symbol map...
* mdoc: drop even more redundant .Pp callsuqs2010-10-191-1/+0
| | | | | | No change in rendered output, less mandoc lint warnings. Tool provided by: Nobuyuki Koganemaru n-kogane at syd.odn.ne.jp
* mdoc: drop redundant .Pp and .LP callsuqs2010-10-083-4/+0
| | | | They have no effect when coming in pairs, or before .Bl/.Bd
* Use a defined FreeBSD version.delphij2010-10-061-2/+2
| | | | MFC after: 3 days
* Fix two subtle problems in PPC32 RTLD. The first is a concurrency issuenwhitehorn2010-10-041-2/+5
| | | | | | | | | where long PLT calls in multi-threaded environments could end up with incorrect jmptab values. The second is that, after the addition of extended PLT support, I forgot to update the PLT icache synchronization code to cover the extended PLT instead of just the basic PLT. MFC after: 10 days
* Remove the duplicate logging of failed read requests, whose error messagemarius2010-09-241-1/+0
| | | | | | | | | also was inappropriate as it triggered for every EACCESS and ENOTFOUND, not just the case the -n option is intended to deal with and thus really spammed us with ~20 messages in the default configuration when booting a diskless FreeBSD client, introduced with r207608 again. MFC after: 1 week
* Make WARNS=6 clean.marius2010-09-246-44/+37
| | | | MFC after: 1 week
* Try to adhere to style.Makefile(5).marius2010-09-231-5/+3
| | | | MFC after: 3 days
* Move the pfrom initialization from before the setjmp to after theimp2010-09-151-2/+1
| | | | setjmp to avoid warnings on the powerpc build...
* Remove an explicit assignment of the CFLAGS variable intended forrpaulo2010-09-151-1/+0
| | | | debugging purposes only.
* Check for undefined weak symbols during PLT binding on powerpc64, and donwhitehorn2010-09-123-3/+9
| | | | | | | not attempt to copy NULL function descriptors. This fixes LD_BIND_NOW on powerpc64 after r211706. Reviewed by: kib
* Fix incorrect usage of 'assure' and 'insure'.brucec2010-08-281-1/+1
| | | | Approved by: rrs (mentor)
* Make RTLD work on powerpc64 again. If there is a sub-directory namednwhitehorn2010-08-241-7/+10
| | | | | | MACHINE_ARCH, use that specific one, otherwise use MACHINE_CPUARCH. Reviewed by: imp
OpenPOWER on IntegriCloud