summaryrefslogtreecommitdiffstats
path: root/libexec
Commit message (Collapse)AuthorAgeFilesLines
* In libexec/bootpd/tools/bootptest/print-bootp.c, use the correct printfdim2011-12-161-1/+1
| | | | | | length modifier for the difference between two pointers. MFC after: 1 week
* In libexec/getty/chat.c, replace && with & in chat_send(). The intentdim2011-12-161-1/+1
| | | | | | is to test if the CHATDEBUG_SEND bit is set in the chat_debug global. MFC after: 1 week
* In libexec/bootpd/bootpgw/bootpgw.c, add a cast for the remainingdim2011-12-161-1/+1
| | | | | | | minutes of activity, to avoid a warning on platforms where time_t is a 32-bit integer. MFC after: 1 week
* _rtld_bind() read-locks the bind lock, and possible plt resolutionkib2011-12-143-23/+86
| | | | | | | | | | | | | | | | | | | | | | from the dispatcher would also acquire bind lock in read mode, which is the supported operation. plt is explicitely designed to allow safe multithreaded updates, so the shared lock do not cause problems. The error in r228435 is that it allows read lock acquisition after the write lock for the bind block. If we dlopened the shared object that contains IRELATIVE or jump slot which target is STT_GNU_IFUNC, then possible recursive plt resolve from the dispatcher would cause it. Postpone the resolution for irelative/ifunc right before initializers are called, and drop bind lock around calls to dispatcher. Use initlist to iterate over the objects instead of the ->next, due to drop of the bind lock in iteration. For i386/reloc.c:reloc_iresolve(), fix calculation of the dispatch function address for dso, by taking into account possible non-zero relocbase. MFC after: 3 weeks
* Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions tokib2011-12-1210-36/+335
| | | | | | | | | | | | | | | | | rtld on 386 and amd64. This adds runtime bits neccessary for the use of the dispatch functions from the dynamically-linked executables and shared libraries. To allow use of external references from the dispatch function, resolution of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries for PLT are prepared, and normal resolution of the GOT entries is finished. Similar to how it is done by GNU, IRELATIVE relocations are resolved in advance, instead of normal lazy handling for PLT. Move the init_pltgot() call before the relocations for the object are processed. MFC after: 3 weeks
* Make comsat(8) approximately 15% smaller.ed2011-12-101-10/+10
| | | | | This program only consists of a single C file, so simply mark everything except main() static.
* Typo.kib2011-12-091-1/+1
| | | | MFC after: 3 days
* Fix fd leak.kib2011-11-181-0/+1
| | | | | Reported by: slonoman2011 yandex ru MFC after: 1 week
* Fix a misplaced parenthesis.brueffer2011-10-301-1/+1
| | | | | | PR: 162164 Submitted by: Henning Petersen <henning.petersen@t-online.de> MFC after: 1 week
* - change "is is" to "is" or "it is"eadler2011-10-162-2/+2
| | | | | | | | - change "the the" to "the" Approved by: lstewart Approved by: sahil (mentor) MFC after: 3 days
* Handle the R_386_TLS_TPOFF32 relocation, which is similar to R_386_TLS_TPOFF,kib2011-10-081-2/+7
| | | | | | | | but with negative relocation value. Found by: mpfr test suite, pointed to by ale Reviewed by: kan MFC after: 1 week
* Setting up TLS block for the main thread must be done after thekib2011-10-081-3/+14
| | | | | | | | | | | | relocations are processed, since tls initialization section might be itself subject for relocations. Only set up of the block is postponed, the tls block offsets are allocated before relocation processing, since TLS-related relocations may need offsets ready. Reported by: ale PR: threads/161344 Reviewed by: kan MFC after: 1 week
* Restore the writing of the .bss sections of the dsos (not the mainkib2011-09-201-2/+3
| | | | | | | | | | | | | | executable) after r190885. The whole region for the dso is mmaped with MAP_NOCORE flag, doing only mprotect(2) over .bss prevented it from writing .bss to core files. Revert the optimization of using mprotect(2) to establish .bss, overlap the section with mmap(2). Reported by: attilio Reviewed by: attilio, emaste Approved by: re (bz) MFC after: 2 weeks
* Use the proper dynamic tls block to calculate the tls variable addresskib2011-09-151-1/+1
| | | | | | | | | | in case tls data generation was updated. PR: misc/160721 Submitted by: "Thinker K.F. Li" <thinker codemud net> Tested by: flo Approved by: re (bz) MFC after: 1 week
* Do not use the function pointers for the internal operation of rtld_printf()kib2011-09-061-21/+26
| | | | | | | | | functions. The _rtld_error() function might be called early during the rtld bootstrap, in which case function pointers are not yet functional on ia64 due to required relocations not yet performed. Reported, reviewed and tested by: marcel Approved by: re (bz)
* When libexec/rtld-elf/rtld.c is compiled with clang, the r_debug_state()dim2011-09-031-1/+9
| | | | | | | | | | | | | function (a hook necessary for gdb support), is inlined, but since the function contains no code, no calls to it are generated. When gdb is debugging a dynamically linked program, this causes backtraces to be corrupted. Fix it by marking the function __noinline, and inserting an empty asm statement, that pretends to clobber memory. This forces the compiler to emit calls to r_debug_state() throughout rtld.c. Approved by: re (kib)
* Rtld links with the specially built pic static libc library to get somekib2011-08-249-54/+573
| | | | | | | | | | | | | | | | | C runtime services, like printf(). Unfortunately, the multithread-safeness measures in the libc do not work in rtld environment. Rip the kernel printf() implementation and use it in the rtld instead of libc version. This printf does not require any shared global data and thus is mt-safe. Systematically use rtld_printf() and related functions, remove the calls to err(3). Note that stdio is still pulled from libc due to libmap implementaion using fopen(). This is safe but unoptimal, and can be changed later. Reported and tested by: pgj Diagnosed and reviewed by: kan (previous version) Approved by: re (bz)
* Pull in some wording to the tftpd.8 man pagerodrigc2011-07-311-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | from NetBSD, with some slight changes: ========================================================================================= http://cvsweb.netbsd.org/bsdweb.cgi/src/libexec/tftpd/tftpd.8?only_with_tag=MAIN#rev1.22 Revision 1.22 or diffs], Fri Jan 8 21:05:14 2010 UTC (18 months, 2 weeks ago) by christos Patrick Welche <prlw1@cam.ac.uk> - add -p pathsep option - make wrap to zero work, but produce a warning While here: - fix gcc warnings, in particular variable clobbered warnings (compiling with fewer warnings does not really fix the problem) ========================================================================================= These wording changes clarify the default rollover behavior as a "kludge". Also, the block numbers and octet counts for 65535 blocks and 32767 blocks are more accurate than the existing documented numbers. Requested by: Pawan Gupta <pawang at juniper dot net> Obtained from: Juniper Networks Approved by: re (kib)
* In the old TFTP server, there was an undocumented behavior whererodrigc2011-07-311-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | the block counter would rollover to 0 if a file larger than 65535 blocks was transferred. With the default block size of 512 octets per block, this is a file size of approximately 32 megabytes. The new TFTP server code would report an error and stop transferring the file if a file was larger than 65535 blocks. This patch restores the old TFTP server's behavior to the new TFTP server code. If a TFTP client transfers a file larger than 65535 blocks, and does *not* specify the "rollover" option, then automatically rollover the block counter to 0 every time we reach 65535 blocks. This restores interoperability with the FreeBSD 6 TFTP client. Without this change, if a FreeBSD 6 TFTP client tried to retrieve a file larger than 65535 blocks from a FreeBSD 9 TFTP server , the transfer would fail. The same file could be retrieved successfully if the same FreeBSD 6 TFTP client was used against a FreeBSD 6 TFTP server. Approved by: re (kib) Tested by: Pawan Gupta <pawang at juniper dot net>, Obtained from: Juniper Networks
* Acknowledge Edwin Groothuis for the major rewrite herodrigc2011-06-241-0/+6
| | | | did of the tftpd and tftp code to support TFTP blocksize.
* Bring back synchnet() implementation from olderrodrigc2011-06-241-3/+30
| | | | | | | | | | | | | | | | | tftp implementation. The synchnet() function was converted to a no-op when the new TFTP implementation was committed to FreeBSD. However, this function, as it was in the older code, is needed in order to synchronize between the tftpd server and tftp clients, which may be buggy. Specifically, we had a buggy TFTP client which would send TFTP ACK packets for non-TFTP packets, which would cause the count of packets to get out of whack, causing transfers to fail with the new TFTPD implementation. Obtained from: Juniper Networks Submitted by: Santhanakrishnan Balraj <sbalraj at juniper dot net>
* Update references to RFC's that the newer TFTP implementation supports.rodrigc2011-06-221-3/+25
|
* Fix typo.rodrigc2011-06-221-1/+1
| | | | Reported by: Nick Mann <njm at njm dot me dot uk>
* Clarify tftpd's -d flag in the new TFTP implementation.rodrigc2011-06-221-3/+21
| | | | Bump date.
* Add LOGIN_SETCPUMASK and LOGIN_SETLOGINCLASS to the setusercontext(3)trasz2011-06-221-6/+5
| | | | calls in ftpd(8).
* Minor cleanups to ulog-helper:ed2011-06-212-16/+12
| | | | | | | | | | | | - Remove unneeded linking against libmd. libulog depends on this library, but the ulog-helper tool itself does not. - Change the comment at the top to mention utmpx instead of utmp, wtmp and lastlog. - Simply use user_from_uid() to translate to a username string. - Put variable declarations together.
* Fix clang warnings.benl2011-06-181-4/+4
| | | | Approved by: philip (mentor)
* Clarify that the TFTP blocksize (RFC2348) or non-standardrodrigc2011-06-161-2/+3
| | | | TFTP rollover option can be used to transfer larger files.
* Compile RTLD with global dot symbols on 64-bit PowerPC, as a crutch fornwhitehorn2011-06-081-0/+1
| | | | | GDB's ability to locate r_debug_state (which is actually the only function that need be compiled this way).
* Remove a gratuitous newline. This should be a non-functional change.jh2011-06-071-1/+1
| | | | | | PR: bin/153667 Submitted by: Craig Leres MFC after: 1 week
* Fix tftp_log() usage.rodrigc2011-05-261-1/+1
|
* rtld: eliminate double call to close(2) that may occur in load_objectavg2011-03-251-5/+2
| | | | | | | | | | | The second close(2) call resulted in heisenbugs in some multi-threaded applications where e.g. dlopen(3) call in one thread could close a file descriptor for a file having been opened in other thread concurrently. My litmus test for this issue was an openoffice.org build. Reviewed by: jhb MFC after: 2 weeks
* - Add support for TLS relocations.marius2011-03-111-6/+88
| | | | | | - Emitt an error when encountering an unsupported and in case of the kernel also for unaligned relocations. - Fix R_SPARC_LOX10 relocations. Apparently these are hardly ever used.
* - Remove clause 3 and 4 from TNF licenses. [1]marius2011-03-111-75/+63
| | | | | | | | | | | - Add the _RF_X committed in r212998 also to the tables in the sparc64 reloc.c in order reduce differences between the kernel and the userland source. This results in no functional change though. - Fix further inconsistencies in the abbreviations of the names of the relocations. - Further whitespace fixes. Obtained from: NetBSD [1]
* Remove dead code that snuck in from the 32-bit PowerPC version of thisnwhitehorn2011-03-071-4/+0
| | | | file. The error being checked for does not exist on 64-bit systems.
* - With the addition of TLS support binutils started to make the addendmarius2011-03-061-0/+3
| | | | | | | | | | values for resolved symbols relative to relocbase instead of sections so detect this case and handle as appropriate, which allows using kernel modules linked with affected versions of binutils. Actually I think this is a bug in binutils but given that apparently nobody complained for nearly six years and powerpc has basically the same workaround I decided to put it in for the sparc64 kernel, too. - Fix R_SPARC_HIX22 relocations. Apparently these are hardly ever used.
* - Consistently abbreviate the names of the relocations.marius2011-03-061-38/+43
| | | | | - End sentences with dots. - Fix whitespace.
* Remove a hack made obsolete by the binutils 2.17 merge.nwhitehorn2011-02-201-3/+0
|
* 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
OpenPOWER on IntegriCloud