aboutsummaryrefslogtreecommitdiff
path: root/libexec
Commit message (Collapse)AuthorAgeFilesLines
* MFC r357223:Dimitry Andric2020-02-041-1/+2
| | | | | | | | | | | | | Merge r357222 from the clang1000-import branch: Fix the following -Werror warning from clang 10.0.0 in rbootd: libexec/rbootd/rmpproto.c:335:49: error: multiple unsequenced modifications to 'filename' [-Werror,-Wunsequenced] filename = (filename = strrchr(filepath,'/'))? ++filename: filepath; ~ ^ Notes: svn path=/stable/10/; revision=357517
* MFC r338216:Alan Somers2018-10-011-5/+5
| | | | | | | | | | | | | | | | | | | tftpd: Fix data corruption bug with netascii Transferring files in netascii format requires, among other things, translating all CR characters to a CR,NUL pair. tftpd does this correctly except when the CR occurs as the last octet of a packet. In that case, it erroneously drops the NUL which should be part of the following packet. The bug was caused by using 0 as a sentinel value in a variable that could legitimately hold 0. Fix it by switching the sentinel value to -1. PR: 178055 Reported by: Richard <rsitze@gmail.com> Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D16853 Notes: svn path=/stable/10/; revision=339062
* MFC r336609:Alan Somers2018-10-012-9/+11
| | | | | | | | | | | | | | | | | | Fix several Coverity warnings in tftp Some of the changes are in the libexec/tftpd directory, but to functions that are only used by tftp(1) (they share some code). * strcpy => strlcpy (1006793, 1006794, 1006796, 1006741) * Unchecked return value and TOCTTOU (1009314) * NULL pointer dereference (1018035, 1018036) Reported by: Coverity CID: 1006793, 1006794, 1006796, 1006741, 1009314, 1018035 CID: 1018036 Notes: svn path=/stable/10/; revision=339060
* MFC r336605:Alan Somers2018-10-014-17/+17
| | | | | | | | | | | | | | | | | Fix multiple Coverity warnings in tftpd(8) * Initialize uninitialized variable (CID 1006502) * strcpy => strlcpy (CID 1006792, 1006791, 1006790) * Check function return values (CID 1009442, 1009441, 1009440) * Delete dead code in receive_packet (not reported by Coverity) * Remove redundant alarm(3) in receive_packet (not reported by Coverity) Reported by: Coverity CID: 1006502, 1006792, 1006791, 1006790, 1009442, 1009441, 1009440 Differential Revision: https://reviews.freebsd.org/D11287 Notes: svn path=/stable/10/; revision=339059
* MFC r336587:Alan Somers2018-10-011-2/+2
| | | | | | | | | | | | | | tftpd(8): when completing an WRQ, flush the file before acknowleding receipt tftpd(8) should flush a newly written file to disk before ACKing the final DATA packet. Otherwise there is a narrow race window when a subsequent read may not see the file. This is somewhat related to r330710, but the race window is much smaller. Hopefully this will fix the intermittent tests in Jenkins. Reported by: Jenkins Notes: svn path=/stable/10/; revision=339058
* MFC r330720:Alan Somers2018-08-032-4/+3
| | | | | | | | | | | | | tftpd: reject unknown opcodes If tftpd receives a command with an unknown opcode, it simply exits 1. It doesn't send an ERROR packet, and the client will hang waiting for one. Fix it. PR: 226005 Notes: svn path=/stable/10/; revision=337250
* MFC r330719:Alan Somers2018-08-032-6/+4
| | | | | | | | | | | | | | | | | | | tftpd: Abort on an WRQ access violation On a WRQ (write request) tftpd checks whether the client has access permission for the file in question. If not, then the write is prevented. However, tftpd doesn't reply with an ERROR packet, nor does it abort. Instead, it tries to receive the packet anyway. The symptom is slightly different depending on the nature of the error. If the target file is nonexistent and tftpd lacks permission to create it, then tftpd will willingly receive the file, but not write it anywhere. If the file exists but is not writable, then tftpd will fail to ACK to WRQ. PR: 225996 Notes: svn path=/stable/10/; revision=337249
* MFC r330718:Alan Somers2018-08-032-6/+17
| | | | | | | | | | | | | | | | | | | tftpd: Verify world-writability for WRQ when using relative paths tftpd(8) says that files may only be written if they already exist and are publicly writable. tftpd.c verifies that a file is publicly writable if it uses an absolute pathname. However, if the pathname is relative, that check is skipped. Fix it. Note that this is not a security vulnerability, because the transfer ultimately doesn't work unless the file already exists and is owned by user nobody. Also, this bug does not affect the default configuration, because the default uses the "-s" option which makes all pathnames absolute. PR: 226004 Notes: svn path=/stable/10/; revision=337248
* MFC r330710:Alan Somers2018-08-033-9/+3
| | | | | | | | | | | | | | | | | | | tftpd: Flush files as soon as they are fully received On an RRQ, tftpd doesn't exit as soon as it's finished receiving a file. Instead, it waits five seconds just in case the client didn't receive the server's last ACK and decides to resend the final DATA packet. Unfortunately, this created a 5 second delay from when the client thinks it's done sending the file, and when the file is available for other processes. Fix this bug by closing the file as soon as receipt is finished. PR: 157700 Reported by: Barry Mishler <barry_mishler@yahoo.com> Notes: svn path=/stable/10/; revision=337247
* MFC r330696, r330709, r330742, r331358Alan Somers2018-08-033-0/+1028
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r330696: Add some functional tests for tftpd(8) tftpd(8) is difficult to test in isolation due to its relationship with inetd. Create a test program that mimics the behavior of tftp(1) and inetd(8) and verifies tftpd's response in several different scenarios. These test cases cover all of the basic TFTP protocol, but not the optional parts. PR: 157700 PR: 225996 PR: 226004 PR: 226005 Differential Revision: https://reviews.freebsd.org/D14310 r330709: Commit missing file from r330696 X-MFC-With: 330696 r330742: tftpd: fix the build of tests on i386 after 330696 It's those darn printf format specifiers again Reported by: cy, kibab X-MFC-With: 330696 r331358: tftpd: misc Coverity cleanup in the tests A bunch of unchecked return values from open(2) and read(2) Reported by: Coverity CID: 1386900, 1386911, 1386926, 1386928, 1386932, 1386942 CID: 1386961, 1386979 X-MFC-With: 330696 Notes: svn path=/stable/10/; revision=337246
* MFC: r328834Marius Strobl2018-03-1910-4/+68
| | | | | | | | | | | | | | | | | | o Let rtld(1) set up psABI user trap handlers prior to executing the objects' init functions instead of doing the setup via a constructor in libc as the init functions may already depend on these handlers to be in place. This gets us rid of: - the undefined order in which libc constructors as __guard_setup() and jemalloc_constructor() are executed WRT __sparc_utrap_setup(), - the requirement to link libc last so __sparc_utrap_setup() gets called prior to constructors in other libraries (see r122883). For static binaries, crt1.o still sets up the user trap handlers. o Move misplaced prototypes for MD functions in to the MD prototype section of rtld.h. o Sprinkle nitems(). Notes: svn path=/stable/10/; revision=331206
* MFC r327289:Pedro F. Giffuni2018-01-102-13/+17
| | | | | | | | | | | | | | | | rpc.sprayd: Bring some changes from NetBSD. Most notable, other than some style issues: CVS 1.11: do not use LOG_CONS. CVS 1.13: consistently use exit instead of return in main(). use LOG_WARNING instead of LOG_ERR for non critical errors. Obtained from: NetBSD Notes: svn path=/stable/10/; revision=327793
* MFC r326562: Use strlcpy().Xin LI2017-12-201-1/+1
| | | | Notes: svn path=/stable/10/; revision=327019
* MFC r324364: ftpd(8): fix user context handlingEugene Grosbein2017-11-061-4/+17
| | | | | | | | | | | | | | | | | Apply authenticated user context after update of wtmp(5) at start of session, so that ftpd process is not killed by kernel with SIGXFSZ when user has "filesize" limit lower than size of system wtmp file. Same applies to session finalization: revert to super-user context before update of wtmp. If ftpd hits limit while writing a file at user request, do not get killed with SIGXFSZ instantly but apparently ignore the signal, process error and report it to the user, and continue with the session. PR: 143570 Approved by: mav (mentor) Notes: svn path=/stable/10/; revision=325472
* MFC 323025: Read max_stack_flags from correct object.John Baldwin2017-09-211-1/+1
| | | | | | | | | 'obj' is not initialized here. Sponsored by: DARPA / AFRL Notes: svn path=/stable/10/; revision=323877
* MFC 321762Sepherosa Ziehau2017-08-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hyperv: Add VF bringup scripts and devd rules. How network VF works with hn(4) on Hyper-V in non-transparent mode: - Each network VF has a cooresponding hn(4). - The network VF and the it's cooresponding hn(4) have the same hardware address. - Once the network VF is up, e.g. ifconfig VF up: o All of the transmission should go through the network VF. o Most of the reception goes through the network VF. o Small amount of reception may go through the cooresponding hn(4). This reception will happen, even if the the cooresponding hn(4) is down. The cooresponding hn(4) will change the reception interface to the network VF, so that network layer and application layer will be tricked into thinking that these packets were received by the network VF. o The cooresponding hn(4) pretends the physical link is down. - Once the network VF is down or detached: o All of the transmission should go through the cooresponding hn(4). o All of the reception goes through the cooresponding hn(4). o The cooresponding hn(4) fallbacks to the original physical link detection logic. All these features are mainly used to help live migration, during which the network VF will be detached, while the network communication to the VM must not be cut off. In order to reach this level of live migration transparency, we use failover mode lagg(4) with the network VF and the cooresponding hn(4) attached to it. To ease user configuration for both network VF and non-network VF, the lagg(4) will be created by the following rules, and the configuration of the cooresponding hn(4) will be applied to the lagg(4) automatically. Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D11635 Notes: svn path=/stable/10/; revision=322129
* MFC r320491:Enji Cooper2017-07-311-0/+1
| | | | | | | | | | atf-sh(3): document atf_init_test_cases(3) fully The function was missing from the NAME/SYNOPSIS sections. Add a manpage link to complete the documentation reference. Notes: svn path=/stable/10/; revision=321755
* MFC r314653:Enji Cooper2017-07-2010-15/+14
| | | | | | | | | libexec: normalize paths using SRCTOP-relative paths or :H when possible This simplifies make logic/output Notes: svn path=/stable/10/; revision=321267
* MFC r316552,r319662:Enji Cooper2017-07-181-1/+23
| | | | | | | | | | | | | | | | | | | r316552: atf-c: fix documentation description for atf_utils_wait(3) atf_utils_wait(3) should be used in combination with atf_utils_fork(3), not itself (atf_utils_wait(3)). r319662: Add MLINKS for atf-sh(3) to each of the functions it implements This hopefully will make atf-sh(3) easier to understand for newcomers, without having to go through the atf-sh(3) level of indirection. Notes: svn path=/stable/10/; revision=321141
* MFC r320433:Xin LI2017-07-171-5/+2
| | | | | | | Use strlcpy() instead of strncpy() and nul-terminating. Notes: svn path=/stable/10/; revision=321069
* MFC r320658:Konstantin Belousov2017-07-111-3/+7
| | | | | | | When reporting undefined symbol, note the version, if specified. Notes: svn path=/stable/10/; revision=320888
* MFC r320644:Allan Jude2017-07-042-2/+20
| | | | | | | Add deprecation notices for all rcmd tools Notes: svn path=/stable/10/; revision=320646
* MFC r313494:Konstantin Belousov2017-02-241-8/+12
| | | | | | | Handle protected symbols in rtld. Notes: svn path=/stable/10/; revision=314199
* MFC r289172,r290254:Enji Cooper2017-02-094-12/+4
| | | | | | | | | | | | | | | | | | | r289172: Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and netbsd-tests.test.mk (r289151) - Eliminate explicit OBJTOP/SRCTOP setting - Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk - Remove unnecessary TESTSDIR setting - Use SRCTOP where possible for clarity r290254: Remove unused variable (SRCDIR) Notes: svn path=/stable/10/; revision=313488
* MFC r311473:Enji Cooper2017-02-042-3/+13
| | | | | | | | | Conditionalize all code that uses tcpd.h behind `LIBWRAP` guard This will allow the code to stand by itself without libwrap Notes: svn path=/stable/10/; revision=313226
* MFC r311886:Konstantin Belousov2017-01-241-24/+29
| | | | | | | | | Fix acquisition of nested write compat rtld locks. PR: 215826 Notes: svn path=/stable/10/; revision=312701
* MFC r310025:Bryan Drewery2017-01-241-2/+2
| | | | | | | Take write lock for rtld_bind before modifying obj_list in dl_iterate_phdr(). Notes: svn path=/stable/10/; revision=312700
* MFC r311984:Konstantin Belousov2017-01-191-8/+20
| | | | | | | | For the main binary, postpone enforcing relro read-only protection until copy relocations are done. Notes: svn path=/stable/10/; revision=312402
* MFC r311879:Konstantin Belousov2017-01-171-4/+4
| | | | | | | Use ANSI C definitions, update comment. Notes: svn path=/stable/10/; revision=312340
* MFC r310609: Don't use high precision clock for expiration as only secondXin LI2017-01-091-7/+7
| | | | | | | portion is used. Notes: svn path=/stable/10/; revision=311751
* MFC r310608: Avoid use after free.Xin LI2017-01-091-4/+6
| | | | Notes: svn path=/stable/10/; revision=311747
* MFC r310155:Konstantin Belousov2016-12-191-1/+1
| | | | | | | Fix typo. Notes: svn path=/stable/10/; revision=310238
* MFC 308456: Pass the correct flag to find_symdef() from _rtld_bind().John Baldwin2016-12-012-3/+3
| | | | | | | | | | | When symbol versioning was added to rtld, the boolean 'in_plt' argument to find_symdef() was converted to a bitmask of flags. The first flag added was 'SYMLOOK_IN_PLT' which replaced the 'in_plt' bool. This happened to still work by accident as SYMLOOK_IN_PLT had the value of 1 which is the same as 'true', so there should be no functional change. Notes: svn path=/stable/10/; revision=309371
* MFC r308689:Konstantin Belousov2016-11-2318-4/+142
| | | | | | | | | | | | | Pass CPUID[1] %edx (cpu_feature), %ecx (cpu_feature2) and CPUID[7].%ebx (cpu_stdext_feature), %ecx (cpu_stdext_feature2) to the ifunc resolvers on x86. MFC r308925: Adjust r308689 to make rtld compilable with either in-tree or (hopefully) stock gcc 4.2.1 on i386 and other arches. Notes: svn path=/stable/10/; revision=309061
* MFC r308688:Konstantin Belousov2016-11-221-1/+1
| | | | | | | Assert that there is no unresolved symbols during rtld linking. Notes: svn path=/stable/10/; revision=308967
* MFC r308687:Konstantin Belousov2016-11-221-1/+1
| | | | | | | Update hint to utilize user variable. Notes: svn path=/stable/10/; revision=308966
* MFstable/11 r307721:Enji Cooper2016-10-212-2/+2
| | | | | | | | | MFC r306029: Use SRCTOP instead of the longhand version for defining the path to contrib/atf Notes: svn path=/stable/10/; revision=307722
* MFC r304012:Konstantin Belousov2016-08-191-0/+4
| | | | | | | Fill phdr and phsize for rtld object. Notes: svn path=/stable/10/; revision=304455
* MFC r304011:Konstantin Belousov2016-08-191-10/+6
| | | | | | | Remove all remaining uses of TAILQ_FOREACH_FROM() from rtld-elf. Notes: svn path=/stable/10/; revision=304454
* MFC r302908:Bryan Drewery2016-07-221-1/+1
| | | | | | | | Fix dlsym(RTLD_NEXT) handling to only return the next library in last library cases. Notes: svn path=/stable/10/; revision=303169
* MFC r300691:Konstantin Belousov2016-06-081-7/+28
| | | | | | | Fix issues found by Coverity in the rtld-elf.c:gethints(). Notes: svn path=/stable/10/; revision=301581
* MFC r299585Don Lewis2016-05-201-3/+3
| | | | | | | | | | | | Declare line[] in the outermost scope of retrieve() instead of declaring it in an inner scope and then using it via a pointer in the outer scope. Reported by: Coverity CID: 605895 Notes: svn path=/stable/10/; revision=300273
* MFC r296319:Konstantin Belousov2016-03-163-19/+42
| | | | | | | | | | Fix handling of DT_TEXTREL for an object with more than one read-only segment. PR: 207631 Notes: svn path=/stable/10/; revision=296939
* MFC r295079:Enji Cooper2016-03-121-1/+2
| | | | | | | | | | Fix the type for hw.ncpu, so sysctlbyname doesn't consistently fail on 64-bit architectures where sizeof(int) != sizeof(size_t). PR: 206758 Notes: svn path=/stable/10/; revision=296756
* MFC r257811 (by markj):Konstantin Belousov2016-03-129-96/+176
| | | | | | | | | | | | | | | | | | Include rtld itself when iterating over loaded ELF objects in dl_iterate_phdr(3). MFC r294373: Do not call callbacks for dl_iterate_phdr(3) with the rtld bind and phdr locks locked. MFC r294470 (by kan): Fix initlist_add_object invocation parameters. MFC r294936 (by kan): Do not unlock rtld_phdr_lock over callback invocations. Notes: svn path=/stable/10/; revision=296727
* MFC r292705: rtld: remove old XXX comment missed in r35529Ed Maste2016-01-071-1/+0
| | | | Notes: svn path=/stable/10/; revision=293317
* MFC r291348:Bryan Drewery2015-12-043-3/+3
| | | | | | | Use LIBEXECDIR for /usr/libexec. Notes: svn path=/stable/10/; revision=291819
* MFC r289324:Konstantin Belousov2015-10-281-3/+21
| | | | | | | | Allow PT_NOTES segments to be located anywhere in the executable image. Notes: svn path=/stable/10/; revision=290099
* Disable SSE in libthrEric van Gyzen2015-10-262-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Clang emits SSE instructions on amd64 in the common path of pthread_mutex_unlock. If the thread does not otherwise use SSE, this usage incurs a context-switch of the FPU/SSE state, which reduces the performance of multiple real-world applications by a non-trivial amount (3-5% in one application). Instead of this change, I experimented with eagerly switching the FPU state at context-switch time. This did not help. Most of the cost seems to be in the read/write of memory--as kib@ stated--and not in the #NM handling. I tested on machines with and without XSAVEOPT. One counter-argument to this change is that most applications already use SIMD, and the number of applications and amount of SIMD usage are only increasing. This is absolutely true. I agree that--in general and in principle--this change is in the wrong direction. However, there are applications that do not use enough SSE to offset the extra context-switch cost. SSE does not provide a clear benefit in the current libthr code with the current compiler, but it does provide a clear loss in some cases. Therefore, disabling SSE in libthr is a non-loss for most, and a gain for some. I refrained from disabling SSE in libc--as was suggested--because I can't make the above argument for libc. It provides a wide variety of code; each case should be analyzed separately. https://lists.freebsd.org/pipermail/freebsd-current/2015-March/055193.html Suggestions from: dim, jmg, rpaulo Sponsored by: Dell Inc. Notes: svn path=/stable/10/; revision=290014
* MFC r287369:Andrew Turner2015-09-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | Ensure we use calculate_first_tls_offset, even if the main program doesn't have TLS program header. This is needed on architectures with Variant I tls, that is arm, arm64, mips, and powerpc. These place the thread control block at the start of the buffer and, without this, this data may be trashed. This appears to not be an issue on mips or powerpc as they include a second adjustment to move the thread local data, however this is on arm64 (with a future change to fix placing this data), and should be on arm. I am unable to trigger this on arm, even after changing the code to move the data around to make it more likely to be hit. This is most likely because my tests didn't use the variable in offset 0. Reviewed by: kib MFC after: 1 week Sponsored by: ABT Systems Ltd Notes: svn path=/stable/10/; revision=287560