aboutsummaryrefslogtreecommitdiff
path: root/libexec
Commit message (Collapse)AuthorAgeFilesLines
* Fix a typo in the same comment, one line below.Ed Schouten2009-06-231-1/+1
| | | | | | | Submitted by: bf1783 googlemail com Notes: svn path=/head/; revision=194705
* Fix typo in comment.Ed Schouten2009-06-231-1/+1
| | | | | | | Submitted by: Christoph Mallon Notes: svn path=/head/; revision=194689
* Allow order of initialization of loaded shared objects to beAlexander Kabaev2009-06-202-48/+47
| | | | | | | | | | | | | | | | | | | | altered through their .init code. This might happen if init vector calls dlopen on its own and that dlopen causes some not yet initialized object to be initialized earlier as part of that dlopened DAG. Do not reset module reference counts to zero on final fini vector run when process is exiting. Just add an additional parameter to force fini vector invocation regardless of current reference count value if object was not destructed yet. This allows dlclose called from fini vector to proceed normally instead of failing with handle validation error. Reviewed by: kib Reported by: venki kaps Notes: svn path=/head/; revision=194531
* FreeBSD returns main object handle from dlopen(NULL, ...) calls.Alexander Kabaev2009-06-161-0/+10
| | | | | | | | | | | | | dlsym seaches using this handle are expected to look for symbol definitions in all objects loaded at the program start time along with all objects currently in RTLD_GLOBAL scope. Discussed with: kib Reported by: Maho NAKATA MFC after: 2 weeks Notes: svn path=/head/; revision=194298
* Increase the size of the static TLS area slightly (required for the NVidia'sDoug Rabson2009-05-271-1/+1
| | | | | | | OpenGL driver on amd64). Notes: svn path=/head/; revision=192922
* Per the man page:Doug Barton2009-05-264-164/+0
| | | | | | | | | | | | The makekey utility has been deprecated and will be removed in a future release of FreeBSD. Actually removing it was approved back on 10/29/2007 by re (kensmith) but I dropped the ball on actually removing it. It's doubtful that it's become more relevant/useful in the intervening time. Notes: svn path=/head/; revision=192776
* Prefer <sys/param.h> to <machine/param.h> for the definition ofRobert Watson2009-04-201-1/+1
| | | | | | | | | | CACHE_LINE_SIZE. Submitted by: bde MFC after: 2 weeks Notes: svn path=/head/; revision=191303
* Explicitly include machine/param.h for CACHE_LINE_SIZE.Robert Watson2009-04-191-0/+2
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=191292
* Now that the kernel defines CACHE_LINE_SIZE in machine/param.h, useRobert Watson2009-04-197-14/+0
| | | | | | | | | | | that definition in the custom locking code for the run-time linker rather than local definitions. Pointed out by: tinderbox MFC after: 2 weeks Notes: svn path=/head/; revision=191291
* Currently, when mapping an object, rtld reserves the whole address spaceKonstantin Belousov2009-04-101-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for the mapping by the object' file with the protection and mode of the first loadable segment over the whole region. Then, it maps other segments at the appropriate addresses inside the region. On amd64, due to default alignment of the segments being 1Gb, the subsequent segment mappings leave the holes in the region, that usually contain mapping of the object' file past eof. Such mappings prevent wiring of the address space, because the pages cannot be faulted in. Change the way the mapping of the ELF objects is constructed, by first mapping PROT_NONE anonymous memory over the whole range, and then mapping the segments of the object over it. Take advantage of this new order and allocate .bss by changing the protection of the range instead of remapping. Note that we cannot simply keep the holes between segments, because other mappings may be made there. Among other issues, when the dso is unloaded, rtld unmaps the whole region, deleting unrelated mappings. The kernel ELF image activator does put the holes between segments, but this is not critical for now because kernel loads only executable image and interpreter, both cannot be unloaded. This will be fixed later, if needed. Reported and tested by: Hans Ottevanger <fbsdhackers beasties demon nl> Suggested and reviewed by: kan, alc Notes: svn path=/head/; revision=190885
* Update comment to the reality, rtld supports any number of loadable segments.Konstantin Belousov2009-04-101-3/+2
| | | | | | | | | Fix spacing. Reviewed by: kan Notes: svn path=/head/; revision=190883
* Move variable externs into extern.h so they are checked against the definitions.David E. O'Brien2009-04-073-30/+29
| | | | Notes: svn path=/head/; revision=190828
* Allow the NULL, RTLD_SELF and RTLD_NEXT handles to work with dlfunc(3).Konstantin Belousov2009-04-032-0/+15
| | | | | | | | | | | | | | | | | | | dlfunc() called dlsym() to do the work, and dlsym() determines the dso that originating the call by the return address. Due to this, dlfunc() operated as if the caller is always the libc. To fix this, move the dlfunc() to rtld, where it can call the internal implementation of dlsym, and still correctly fetch return address. Provide usual weak stub for the symbol from libc for static binaries. dlfunc is put to FBSD_1.0 symver namespace in the ld.so export to override dlfunc@FBSD_1.0 weak symbol, exported by libc. Reported, analyzed and tested by: Tijl Coosemans <tijl ulyssis org> PR: standards/133339 Reviewed by: kan Notes: svn path=/head/; revision=190673
* Document RTLD_NODELETE, -z nodelete and -z origin support.Konstantin Belousov2009-04-011-1/+20
| | | | Notes: svn path=/head/; revision=190624
* Use RTF_LLDATA.Olivier Houchard2009-03-311-1/+1
| | | | Notes: svn path=/head/; revision=190601
* Implement support for RTLD_NODELETE flag for dlopen() and -z nodeleteKonstantin Belousov2009-03-302-4/+20
| | | | | | | | | | static linker option. Do it by incrementing reference count on the loaded object and its dependencies. Reviewed by: davidxu, kan Notes: svn path=/head/; revision=190543
* Do not dereference NULL pointer. refobj is NULL for the objects that areKonstantin Belousov2009-03-281-1/+1
| | | | | | | | | preloaded. Reported and tested by: ed Notes: svn path=/head/; revision=190505
* Support for a new environment variable, LD_ELF_HINTS_PATH for overridingXin LI2009-03-232-3/+15
| | | | | | | | | | | | | | the rtld hints file. This environment variable would be unset if the process is considered as tainted with setuid/setgid. This feature gives a convenient way of using a custom set of shared library that is not located in the default location and switch back. Feature requested by: iXsystems Original patch by: John Hixson MFC after: 2 weeks Notes: svn path=/head/; revision=190324
* Implement the dynamic string token substitution in the rpath andKonstantin Belousov2009-03-183-10/+148
| | | | | | | | | | | | | | | | | | soneeded pathes. The $ORIGIN, $OSNAME, $OSREL and $PLATFORM tokens are supported. Enabling the substitution requires DF_ORIGIN flag in DT_FLAGS or DF_1_ORIGIN if DF_FLAGS_1, that may be set with -z origin gnu ld flag. Translation is unconditionally disabled for setuid/setgid processes. The $ORIGIN translation relies on the AT_EXECPATH auxinfo supplied by kernel. Requested by: maho Tested by: maho, pho Reviewed by: kan Notes: svn path=/head/; revision=189959
* Fix build when WITH_SSP is set explicitly.Ruslan Ermilov2009-02-211-2/+1
| | | | | | | Submitted by: Jeremie Le Hen Notes: svn path=/head/; revision=188895
* o Fix typo: indentical -> identical.Maxim Konovalov2009-01-301-1/+1
| | | | | | | | | PR: docs/131149 Submitted by: Patrick Oonk MFC after: 1 week Notes: svn path=/head/; revision=187913
* Fix handling of pts(4) device names in comsat(8). Also catch fork() errors.Ed Schouten2009-01-171-6/+17
| | | | | | | | | | | | | | | | | | | | Pseudo-terminals allocated with posix_openpt(2) will have more slashes in their path names than comsat(8) allows, so allow slashes when the character device name starts with "pts/". This patch is loosely based on NetBSD's changes, revision 1.33. Because it also included the changes to fork(), I imported them here as well. Maybe we could import even more fixes from the other BSD's? Original commit message from the NetBSD folks: PR/30170: Markus W Kilbinger: src/libexec/comsat complains about: '/' in "/dev/pts/1" Reported by: Robert Huff <roberthuff rcn com> Notes: svn path=/head/; revision=187366
* Prevent cross-site forgery attacks on ftpd(8) due to splittingColin Percival2008-12-233-8/+29
| | | | | | | | | | | | | | | | long commands into multiple requests. [08:12] Avoid calling uninitialized function pointers in protocol switch code. [08:13] Merry Christmas everybody... Approved by: so (cperciva) Approved by: re (kensmith) Security: FreeBSD-SA-08:12.ftpd, FreeBSD-SA-08:13.protosw Notes: svn path=/head/; revision=186405
* This main goals of this project are:Qing Li2008-12-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. separating L2 tables (ARP, NDP) from the L3 routing tables 2. removing as much locking dependencies among these layers as possible to allow for some parallelism in the search operations 3. simplify the logic in the routing code, The most notable end result is the obsolescent of the route cloning (RTF_CLONING) concept, which translated into code reduction in both IPv4 ARP and IPv6 NDP related modules, and size reduction in struct rtentry{}. The change in design obsoletes the semantics of RTF_CLONING, RTF_WASCLONE and RTF_LLINFO routing flags. The userland applications such as "arp" and "ndp" have been modified to reflect those changes. The output from "netstat -r" shows only the routing entries. Quite a few developers have contributed to this project in the past: Glebius Smirnoff, Luigi Rizzo, Alessandro Cerri, and Andre Oppermann. And most recently: - Kip Macy revised the locking code completely, thus completing the last piece of the puzzle, Kip has also been conducting active functional testing - Sam Leffler has helped me improving/refactoring the code, and provided valuable reviews - Julian Elischer setup the perforce tree for me and has helped me maintaining that branch before the svn conversion Notes: svn path=/head/; revision=186119
* Provide custom simple allocator for rtld locks in libthr. The allocatorKonstantin Belousov2008-12-021-0/+1
| | | | | | | | | | | | does not use any external symbols, thus avoiding possible recursion into rtld to resolve symbols, when called. Reviewed by: kan, davidxu Tested by: rink MFC after: 1 month Notes: svn path=/head/; revision=185558
* Add two rtld exported symbols, _rtld_atfork_pre and _rtld_atfork_post.Konstantin Belousov2008-11-274-0/+22
| | | | | | | | | | | | | | | | | Threading library calls _pre before the fork, allowing the rtld to lock itself to ensure that other threads of the process are out of dynamic linker. _post releases the locks. This allows the rtld to have consistent state in the child. Although child may legitimately call only async-safe functions, the call may need plt relocation resolution, and this requires working rtld. Reported and debugging help by: rink Reviewed by: kan, davidxu MFC after: 1 month (anyway, not before 7.1 is out) Notes: svn path=/head/; revision=185369
* Convert telnetd(8) to use posix_openpt(2).Ed Schouten2008-11-131-1/+2
| | | | | | | | | | | | | | | | | | | | | Some time ago I got some reports MPSAFE TTY broke telnetd(8). Even though it turned out to be a different problem within the TTY code, I spotted a small issue with telnetd(8). Instead of allocating PTY's using openpty(3) or posix_openpt(2), it used its own PTY allocation routine. This means that telnetd(8) still uses /dev/ptyXX-style devices. I've also increased the size of line[]. Even though 16 should be enough, we already use 13 bytes ("/dev/pts/999", including '\0'). 32 bytes gives us a little more freedom. Also enable -DSTREAMSPTY. Otherwise telnetd(8) strips the PTY's pathname to the latest slash instead of just removing "/dev/" (e.g. /dev/pts/0 -> 0, instead of pts/0). Reviewed by: rink Notes: svn path=/head/; revision=184935
* Whitespace and style fixes, build at WARNS level 6.Dag-Erling Smørgrav2008-11-042-29/+35
| | | | | | | MFC after: 3 weeks Notes: svn path=/head/; revision=184638
* This code has no copyright. It is fairly obvious to me that we're aWarner Losh2008-10-131-14/+48
| | | | | | | | | | | | | derivitive of NetBSD's mips_reloc.c, so pull in the copyright notice from there. Also, a minor tweak to load/store pointers. Other changes from NetBSD likely would be useful too... Obtained from: NetBSD Notes: svn path=/head/; revision=183841
* MFp4: Fix a bug in the mips relocation code that prevents shared imagesWarner Losh2008-10-101-22/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | from working. From p4 filelog of the upstream file in p4 //depot/projects/mips2-jnpr/src/libexec/rtld-elf/mips/reloc.c ... #6 change 140737 edit on 2008/04/27 by gonzo@gonzo_jeeves (text+ko) o Looks like handler for R_MIPS_REL32 brought by CS 137942 is broken for tradmips. Code from NetBSD's libexec/ld.elf_so/arch/mips/mips_reloc.c works just fine. ... #3 change 137942 edit on 2008/03/17 by rrs@rrs-mips2-jnpr (text+ko) Any relocation symbol lookup if its 0. It looks like this is the way the compiler indicates you need to look in another shared library. When we hit these as we relocate a object we will do the symbol lookups and setup the relocation table with the right value. Submitted by: rrs@, gonzo@ Notes: svn path=/head/; revision=183739
* Allow strong symbols to override weak ones for lookups done throughAlexander Kabaev2008-10-101-4/+21
| | | | | | | | | | | dlsym with RTLD_NEXT/RTLD_SELF handles. Allow symbols from ld-elf.so to be located this way too. Based on report and original patch from sobomax@. Notes: svn path=/head/; revision=183737
* add new build knobs and jigger some existing controls to improveSam Leffler2008-09-211-5/+21
| | | | | | | | | | | control over the result of buildworld and installworld; this especially helps packaging systems such as nanobsd Reviewed by: various (posted to arch) MFC after: 1 month Notes: svn path=/head/; revision=183242
* Allow multiple locks to be acquired by detecting correspondingDavid Xu2008-09-161-2/+2
| | | | | | | | | | | bit flag, otherwise if a thread acquired a lock, another thread or the current thread itself can no longer acquire another lock because thread_mask_set() return whole flag word, this results bit leaking in the word and misbehavior in later locking and unlocking. Notes: svn path=/head/; revision=183061
* Make sure internal rtld malloc routines are not called from unlockedAlexander Kabaev2008-09-031-14/+17
| | | | | | | | | | | | | | | | contexts as rtld's malloc is not thread safe and is only supposed to be called with exclusive bind lock already held. The originating PR submitted a patch on top of different pre-requisite workaroud for unsafe dlopen calls, and the patch was midief slighlty to apply to stock sources for the purpose of this commit. Running rtld malloc from unlocked contexts is a bug on its own. PR: 126950 Submited by: Oleg Dolgov Notes: svn path=/head/; revision=182698
* Remove the now unneeded pt_chown utility.Ed Schouten2008-08-243-112/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Before we had a posix_openpt() that allocated PTY's with proper permissions in place, we used this set-uid utility to change the ownership of PTY slave devices to the real user ID of the process. This utility was used to implement grantpt(). In my first designs of the MPSAFE TTY layer, I replaced this by adding an ioctl() called TIOCGRANTPT, which was used to change the ownership. I left the pt_chown utility, because older C libraries needed it to work properly. After some discussions back in June I changed the PTY code to set permissions properly upon creation. Fortunately the previous grantpt() implementation changed permissions by hand when pt_chown is not installed, which always succeeds. This means grantpt() still works properly, even though the set-uid utility is missing. I've done tests with FreeBSD 5.2.1, FreeBSD 6.3 and FreeBSD 7.0 jails. All of them still work if I remove pt_chown. Reviewed by: philip (ex-mentor) Notes: svn path=/head/; revision=182105
* Mark functions as __dead2 in order to help the LLVM static checkerColin Percival2008-08-041-1/+1
| | | | | | | | | | understand which code paths aren't possible. This commit eliminates 117 false positive bug reports of the form "allocate memory; error out if pointer is NULL; use pointer". Notes: svn path=/head/; revision=181269
* Enable GCC stack protection (aka Propolice) for userland:Ruslan Ermilov2008-06-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | - It is opt-out for now so as to give it maximum testing, but it may be turned opt-in for stable branches depending on the consensus. You can turn it off with WITHOUT_SSP. - WITHOUT_SSP was previously used to disable the build of GNU libssp. It is harmless to steal the knob as SSP symbols have been provided by libc for a long time, GNU libssp should not have been much used. - SSP is disabled in a few corners such as system bootstrap programs (sys/boot), process bootstrap code (rtld, csu) and SSP symbols themselves. - It should be safe to use -fstack-protector-all to build world, however libc will be automatically downgraded to -fstack-protector because it breaks rtld otherwise. - This option is unavailable on ia64. Enable GCC stack protection (aka Propolice) for kernel: - It is opt-out for now so as to give it maximum testing. - Do not compile your kernel with -fstack-protector-all, it won't work. Submitted by: Jeremie Le Hen <jeremie@le-hen.org> Notes: svn path=/head/; revision=180012
* Use sysctl to fetch stats from the kernel instead of reading variablesJohn Baldwin2008-06-102-48/+19
| | | | | | | | | | | directly via libkvm. PR: kern/122875, bin/123014 Tested by: Danny Braniss danny cs.huji.ac.il MFC after: 1 week Notes: svn path=/head/; revision=179710
* Make the meaning of the %A format specifier, as passed toBruce M Simpson2008-05-151-2/+5
| | | | | | | LD_TRACE_LOADED_OBJECTS_FMT[12], more obvious for users like me. Notes: svn path=/head/; revision=179012
* Fix conflicts after heimdal-1.1 import and add build infrastructure. ImportDoug Rabson2008-05-071-2/+2
| | | | | | | all non-style changes made by heimdal to our own libgssapi. Notes: svn path=/head/; revision=178828
* Fix the problem with the C++ exception handling for the multithreadedKonstantin Belousov2008-05-063-4/+8
| | | | | | | | | | | | | | | | | | | | | | | programs. From the PR description: The gcc runtime's _Unwind_Find_FDE function, invoked during exception handling's stack unwinding, is not safe to execute from within multiple threads. FreeBSD' s dl_iterate_phdr() however permits multiple threads to pass through it though. The result is surprisingly reliable infinite looping of one or more threads if they just happen to be unwinding at the same time. Introduce the new lock that is write locked around the dl_iterate_pdr, thus providing required exclusion for the stack unwinders. PR: threads/123062 Submitted by: Andy Newman <an at atrn org> Reviewed by: kan MFC after: 2 weeks Notes: svn path=/head/; revision=178807
* MFp4: Add mips support for dynamic linking.Warner Losh2008-04-045-5/+602
| | | | | | | | | | This code came from the merged mips2 and Juniper mips repositories. Warner Losh, Randall Seager, Oleksandr Tymoshenko and Olivier Houchard worked to merge, debug and integrate this code. This code may also contain code derived from NetBSD. Notes: svn path=/head/; revision=177924
* Fix some "in in" typos in comments.Christian Brueffer2008-03-261-1/+1
| | | | | | | | | | PR: 121490 Submitted by: Anatoly Borodin <anatoly.borodin@gmail.com> Approved by: rwatson (mentor), jkoshy MFC after: 3 days Notes: svn path=/head/; revision=177626
* For un-prototyped static inline functions declared in pthread_md.h onRobert Watson2007-12-011-1/+1
| | | | | | | | | sparc64, use ANSI function headers and specifically indicate the lack of arguments with 'void'. Otherwise, warnings are generated at WARNS=3 for libkse, leading to a compile failure with -Werror. Notes: svn path=/head/; revision=174128
* Add "with" to make the line go smoother.Edwin Groothuis2007-11-231-1/+1
| | | | Notes: svn path=/head/; revision=173854
* Add the -W options, which acts the same as -w but will generateEdwin Groothuis2007-11-233-8/+104
| | | | | | | | | | | | | | unique names based on the submitted filename, a strftime(3) format string and a two digit sequence number. By default the strftime(3) format string is %Y%m%d (YYYYMMDD), but this can be changed by the -F option. PR: bin/106049 (based on patch in that PR) Approved by: grog@ (mentor) Notes: svn path=/head/; revision=173852
* Include an extra header to get a function prototype.John Birrell2007-11-191-0/+1
| | | | Notes: svn path=/head/; revision=173745
* Add a hackish knob to skip rtld, NO_RTLD. In conjunction withYaroslav Tykhiy2007-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | src/Makefile.inc1 rev. 1.590, it can allow installing a world cross-built for a different arch over the live system. The procedure is more or less as follows: cp -R /rescue /rescue.old make installkernel TARGET_ARCH=foo make -DNO_RTLD installworld TARGET_ARCH=foo ^^^^^^^^^ PATH=/rescue.old chflags noschg /libexec/ld-elf.so.1 cp /usr/obj/foo/usr/src/libexec/rtld/ld-elf.so.1 /libexec chflags schg /libexec/ld-elf.so.1 <ditto for ld-elf32.so.1 if installing for amd64> reboot Notes: svn path=/head/; revision=173220
* - Fix the handling of R_SPARC_OLO10, which is a bit of a special caseMarius Strobl2007-10-161-9/+14
| | | | | | | | | | | | | | | | | | | | | | | in the way we implement handling of relocations. As for the kernel part this fixes the loading of lots of modules, which failed to load due to unresolvable symbols when built after the GCC 4.2.0 import. This wasn't due to a change in GCC itself though but one of several changes in configuration done along the import. Specfically, HAVE_AS_REGISTER_PSEUDO_OP, which causes GCC to denote global registers used for scratch purposes and in turn GAS uses R_SPARC_OLO10 relocations for, is now defined. While at it replace some more ELF_R_TYPE which should have been ELF64_R_TYPE_ID but didn't cause problems so far. - Sync a sanity check between kernel and rtld(1) and change it to be maintenance free regarding the type used for the lookup table. - Sprinkle const on lookup tables. - Use __FBSDID. Reported and tested by: yongari MFC after: 5 days Notes: svn path=/head/; revision=172708
* Fixed static linkage (build with -DNO_SHARED).Ruslan Ermilov2007-10-011-1/+1
| | | | | | | Approved by: re (kensmith) Notes: svn path=/head/; revision=172402