aboutsummaryrefslogtreecommitdiff
path: root/libexec
Commit message (Collapse)AuthorAgeFilesLines
* tftpd: tests: raise targeted cstd to c11Kyle Evans2020-03-051-0/+1
| | | | | | | | | | r358556 added alignas() use to the functional tests, which isn't defined until C11. Raise the -std to C11 to fix the build under freebsd-gcc{6,9}. Reported by: mhorne, Jenkins/CI Notes: svn path=/head/; revision=358687
* Add support for the TFTP windowsize option described in RFC 7440.John Baldwin2020-03-029-49/+422
| | | | | | | | | | | | | | The windowsize option permits multiple blocks to be transmitted before the receiver sends an ACK improving throughput for larger files. Reviewed by: asomers MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D23836 Notes: svn path=/head/; revision=358556
* Remove sparc64 source files from rtld-elfWarner Losh2020-02-264-1139/+0
| | | | | | | | | These were missed in the prior sweep. Submitted by: jhb@ Notes: svn path=/head/; revision=358358
* Remove sparc64 specific parts of rtld-elf.Warner Losh2020-02-263-12/+5
| | | | Notes: svn path=/head/; revision=358346
* vfs: add realpathat syscallMateusz Guzik2020-02-201-1/+1
| | | | | | | | | | | | | | | | | | realpath(3) is used a lot e.g., by clang and is a major source of getcwd and fstatat calls. This can be done more efficiently in the kernel. This works by performing a regular lookup while saving the name and found parent directory. If the terminal vnode is a directory we can resolve it using usual means. Otherwise we can use the name saved by lookup and resolve the parent. See the review for sample syscall counts. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23574 Notes: svn path=/head/; revision=358172
* r357895: fix typo in the relocation name for i386 IRELATIVE.Konstantin Belousov2020-02-141-1/+1
| | | | | | | | | Reported by: antoine Sponsored by: The FreeBSD Foundation MFC after: 6 days Notes: svn path=/head/; revision=357910
* Handle non-plt IRELATIVE relocations, at least for x86.Konstantin Belousov2020-02-1311-49/+180
| | | | | | | | | | | | | lld 10.0 seems to generate this relocation for rdtsc_mb() ifunc in our libc. Reported, reviewed, and tested by: dim (amd64, previous version) Discussed with: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D23652 Notes: svn path=/head/; revision=357895
* Fix indent.Konstantin Belousov2020-02-121-20/+24
| | | | | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days Notes: svn path=/head/; revision=357813
* Use sigfastblock(2) in rtld.Konstantin Belousov2020-02-094-43/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | This allows for rtld to not issue two sigprocmask(2) syscalls for each symbol binding operation in single-threaded processes. Rtld needs to block signals as part of locking to ensure signal safety of the bind process, because signal handlers might need to lazily resolve symbol references. As result, number of syscalls issued on startup by simple programs not using libthr, is typically reduced 2x. For instance, for hello world, I see: non-sigfastblock # (truss ./hello > /dev/null) |& wc -l 63 sigfastblock # (truss ./hello > /dev/null) |& wc -l 37 Tested by: pho Disscussed with: cem, emaste, jilles Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D12773 Notes: svn path=/head/; revision=357697
* auditd_stop: wait_for_pids instead of sleepingRyan Libby2020-02-061-1/+3
| | | | | | | | | | | | | | | | It's faster and more reliable to wait_for_pids than to sleep 1. cem@ suggested just to remove auditd_stop() and use the rc.subr default stop action (SIGTERM instead of audit -t), which has a built-in wait_for_pids. That may be a better solution. Discussed with: cem Reviewed by: asomers Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D23223 Notes: svn path=/head/; revision=357611
* Fix the following -Werror warning from clang 10.0.0 in rbootd:Dimitry Andric2020-01-281-1/+2
| | | | | | | | | | | libexec/rbootd/rmpproto.c:335:49: error: multiple unsequenced modifications to 'filename' [-Werror,-Wunsequenced] filename = (filename = strrchr(filepath,'/'))? ++filename: filepath; ~ ^ MFC after: 3 days Notes: svn path=/projects/clang1000-import/; revision=357222
* libexec/rc/rc.d/ipfw: style fix after r356943Eugene Grosbein2020-01-211-2/+3
| | | | | | | | | | Also, make sure it does not break for systems without ipfw code loaded. MFC after: 1 months X-MFC-with: 356943 Notes: svn path=/head/; revision=356944
* Correct "service ipfw status" for INET6-only systems.Eugene Grosbein2020-01-211-0/+3
| | | | | | | MFC after: 1 month Notes: svn path=/head/; revision=356943
* rtld: remove hand rolled memset and bzeroMateusz Guzik2020-01-152-25/+3
| | | | | | | | | | | | | | | They were introduced to take care of ifunc, but right now no architecture provides ifunc'ed variants. Since rtld uses memset extensively this results in a pessmization. Should someone want to use ifunc here they should provide a mandatory symbol (e.g., rtld_memset). See the review for profiling data. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D23176 Notes: svn path=/head/; revision=356741
* rtld: clean up Makefile.Konstantin Belousov2020-01-117-32/+18
| | | | | | | | | | | | | Move all MD statements into $MACHINE_ARCH/Makefile.inc. Unconditionally apply version script to rtld, the interpreter is not functional without it for long time. Reviewed by: brooks, emaste Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D23083 Notes: svn path=/head/; revision=356631
* Stop prepending prefix to the result of realpath(3).Konstantin Belousov2020-01-111-21/+6
| | | | | | | | | | | | The path is already absolute. Noted and reviewed by: rstone Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D23121 Notes: svn path=/head/; revision=356630
* rtld: Return error if $ORIGIN for a dlopen-ed library cannot be resolved ...Konstantin Belousov2020-01-091-14/+25
| | | | | | | | | | | | | | instead of killing the process. The same behaviour of terminating image activation if the $ORIGIN cannot be resolved for the main object, is kept. Reported by: Greg V <greg@unrelenting.technology> Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D23053 Notes: svn path=/head/; revision=356549
* Resolve relative argv0 for direct exec mode to absolute path for AT_EXECPATH.Konstantin Belousov2020-01-091-4/+32
| | | | | | | | | | | | | We know the binary relative name and can reliably calculate cwd path. Because realpath(3) was already linked into ld-elf.so.1, reuse it there to resolve dots and dotdots making the path more canonical. Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D23014 Notes: svn path=/head/; revision=356548
* Run netoptions startup script in vnet jails.Bjoern A. Zeeb2020-01-081-1/+1
| | | | | | | | | | | | | | People use rc.conf inside vnet jails to configure networking setups. Presumably because some sysctl were not virtualised up until r356527 the script was not run for vnet jails leaving the rc.conf options without effect for non-obvious reasons. Run the netoptions startup script also for VNET jails now to make the rc.conf options work. PR: 243193 MFC after: 2 weeks Notes: svn path=/head/; revision=356528
* rtld: fix after r356300Konstantin Belousov2020-01-081-6/+3
| | | | | | | | | | | | | | | binpath local was changed from char array to a char pointer, update strlcpy/strlcat uses. Reported by: Coverity through vangyzen CID: 1412239 and 1412240 Reviewed by: emaste, imp, vangyzen Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D23090 Notes: svn path=/head/; revision=356503
* rtld: Fix segfault in direct exec modeRyan Stone2020-01-071-2/+3
| | | | | | | | | | | | | | | | | | | | When rtld is directly executed with arguments, it has to move the program arguments, environment and elf aux data up a few slots to remove its own arguments before the process being executed sees them. When copying the environment, rtld was incorrectly testing whether the location about to be written to currently contained NULL, when was supposed to check whether it had just copied the NULL terminator of the environment string. This had the result that the ELF aux data was mostly treated as environment variables, and rtld would quickly crash when it tried to access required ELF aux data that it didn't think was present. Differential Revision: https://reviews.freebsd.org/D23008 Reviewed by: kib MFC after: 1 month Notes: svn path=/head/; revision=356444
* Fix AT_EXECPATH for direct exec mode.Konstantin Belousov2020-01-021-6/+27
| | | | | | | | | | | | | | | | | | | When activated in direct exec mode, kernel-provided AT_EXECPATH points to the interpreter. We need to recalculate auxv to point to the string with the path to the executable which is actually executed. The somewhat problematic case is when the executable path is relative and either $PATH use is not enabled or it contains '/' so $PATH search is not performed. In this case resulting AT_EXECPATH is relative, I might fix this later. Reported and reviewed by: rstone Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22894 Notes: svn path=/head/; revision=356300
* rtld(1): Do booleans like C99Conrad Meyer2019-12-311-5/+1
| | | | | | | | Reviewed by: kib, rlibby Differential Revision: https://reviews.freebsd.org/D22964 Notes: svn path=/head/; revision=356220
* Eliminate the last MI difference in AT_* definitions (for powerpc).Justin Hibbits2019-12-271-0/+24
| | | | | | | | | | | | | | | | | | | | | | Summary: As a transition aide, implement an alternative elfN_freebsd_fixup which is called for old powerpc binaries. Similarly, add a translation to rtld to convert old values to new ones (as expected by a new rtld). Translation of old<->new values is incomplete, but sufficient to allow an installworld of a new userspace from an old one when a new kernel is running. Test Plan: Someone needs to see how a new kernel/rtld/libc works with an old binary. If if works we can probalby ship this. If not we probalby need some more compat bits. Submitted by: brooks Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D20799 Notes: svn path=/head/; revision=356113
* [PowerPC] powerpc32 rtld IFUNC handling codeBrandon Bergren2019-12-242-97/+235
| | | | | | | | | | | | | | | | | As PowerPC is moving to clang, we can finally start taking advantage of IFUNC. Implement the MD parts of IFUNC handling for rtld. Currently, it is necessary to look for R_PPC_IRELATIVE in the PLT in addition to RELA. This is an ABI violation, but LLD9 has some .iplt bugs that require this as a workaround. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D22855 Notes: svn path=/head/; revision=356056
* [PowerPC] powerpc64 rtld IFUNC handling codeBrandon Bergren2019-12-242-82/+237
| | | | | | | | | | | | | | | | | As PowerPC is moving to clang, we can finally start taking advantage of IFUNC. Implement the MD parts of IFUNC handling for rtld. Currently, it is necessary to look for R_PPC_IRELATIVE in the PLT in addition to RELA. This is an ABI violation, but LLD9 has some .iplt bugs that require this as a workaround. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D22789 Notes: svn path=/head/; revision=356055
* rtld: make checks for mmap(2) failures compliant with documentation.Konstantin Belousov2019-12-121-3/+3
| | | | | | | | | | | On error, mmap(2) returns MAP_FAILED. There is no need to use its definition or to cast. Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=355676
* rtld: do not try to mmap a zero-sized PT_LOADBrandon Bergren2019-12-121-5/+6
| | | | | | | | | | | | | | | | | | | | When a PT_LOAD segment has a zero p_filesz, skip the data mmap, as mmapping zero bytes from a file is an error. A PT_LOAD with zero p_filesz is legal (but somewhat uncommon due to segment merging in modern linkers, as it is more efficient to merge .data and .bss by just extending p_memsz in the previous segment, assuming compatible page protection.) This was seen on ports/graphics/glew on a powerpc64 ELFv2 experimental build. Submitted by: Alfredo Dal'Ava Junior <alfredo.junior@eldorado.org.br> Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D22634 Notes: svn path=/head/; revision=355657
* Update Makefile.depend filesSimon J. Gerraty2019-12-114-16/+0
| | | | | | | | | | | | | Update a bunch of Makefile.depend files as a result of adding Makefile.depend.options files Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22494 Notes: svn path=/head/; revision=355617
* Add Makefile.depend.optionsSimon J. Gerraty2019-12-114-0/+24
| | | | | | | | | | | | | | | | | | | | Leaf directories that have dependencies impacted by options need a Makefile.depend.options file to avoid churn in Makefile.depend DIRDEPS for cases such as OPENSSL, TCP_WRAPPERS etc can be set in local.dirdeps-options.mk which can add to those set in Makefile.depend.options See share/mk/dirdeps-options.mk Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22469 Notes: svn path=/head/; revision=355616
* Correct the offset of static TLS variables for Initial-Exec on RISC-V.John Baldwin2019-12-101-1/+1
| | | | | | | | | | | | | | | TP points to the start of the TLS block after the tcb, but Obj_Entry.tlsoffset includes the tcb, so subtract the size of the tcb to compute the offset relative to TP. This is identical to the same fixes for powerpc in r339072 and r342671. Reviewed by: James Clarke Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22661 Notes: svn path=/head/; revision=355599
* rc.shutdown: kill shutdown process after logging messageEd Maste2019-12-071-1/+1
| | | | | | | | | | Move the kill -KILL $$ back to the pre-r354446 location at the end of the shutdown timeout handler. MFC with: r354446 Notes: svn path=/head/; revision=355476
* Regularize my copyright noticeWarner Losh2019-12-042-2/+2
| | | | | | | | | | | | o Remove All Rights Reserved from my notices o imp@FreeBSD.org everywhere o regularize punctiation, eliminate date ranges o Make sure that it's clear that I don't claim All Rights reserved by listing All Rights Reserved on same line as other copyright holders (but not me). Other such holders are also listed last where it's clear. Notes: svn path=/head/; revision=355394
* Simplify code with strlcpy/strlcat.Xin LI2019-12-012-7/+4
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=355260
* Reduce disk write load in /usr/libexec/save-entropy.Xin LI2019-11-301-14/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, the save-entropy script rotates entropy files like logs. This involves creating a new file that holds the entropy and renaming of all existing entropy files. However, the entropy data do not really need to be kept in a particular order, and replacing the oldest file is sufficient. This commit replaces the rotation with a scan in the [1..entropy_save_num] space that finds the first empty slot, or the slot of the oldest file, and writes entropy into that slot. This also fixes an issue that prevents save-entropy from saving any entropy when there is one non-regular file in any slot as a side effect. Based on an earlier patch from peterj@. PR: 134225 Reported by: peterj Reviewed by: csprng (cem, markm) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22612 Notes: svn path=/head/; revision=355247
* ldconfig: fetch hw.machine_arch only onceMateusz Guzik2019-11-301-3/+5
| | | | | | | | This happens to be of significance with poudriere which runs the script a lot when installing packages. Notes: svn path=/head/; revision=355232
* Allow opt-out of automatic ntpd leapfile checking/fetching.Ian Lepore2019-11-251-2/+32
| | | | | | | | | | | | | | | | When a system has no internet connection, or when it is configured to obtain ntpd leapfiles from some source other than the internet, or even when the sysadmin has decided for some reason to customize ntp.conf to eliminate use of the leapfile, the rc.d/ntpd script emits various error messages related to the file. This change allows setting the rc var ntp_db_leapfile to NONE to disable all automatic processing related to that file in rc.d/ntpd. Differential Revision: https://reviews.freebsd.org/D22461 Notes: svn path=/head/; revision=355100
* [PowerPC] Fix stack padding issue on ppc32.Brandon Bergren2019-11-241-1/+1
| | | | | | | | | | Four bytes of padding are needed in the regular powerpc case to bring the stack frame size up to a multiple of 16 bytes to meet ABI requirements. Fixes odd hangs I was encountering during testing. Notes: svn path=/head/; revision=355047
* rtld/powerpc: Fix _rtld_bind_start for powerpcspeJustin Hibbits2019-11-241-3/+107
| | | | | | | | | | | | | | Summary: We need to save off the full 64-bit register, not just the low 32 bits, of all registers getting saved off in _rtld_bind_start. Additionally, we need to save off the other SPE registers (SPEFSCR and accumulator), so that their program state is not affected by the PLT resolver. Reviewed by: bdragon Differential Revision: https://reviews.freebsd.org/D22520 Notes: svn path=/head/; revision=355045
* Create /etc/os-release file.Warner Losh2019-11-203-0/+48
| | | | | | | | | | | | | | | | | | | | | | Each boot, regenerate /var/run/os-release based on the currently running system. Create a /etc/os-release symlink pointing to this file (so that this doesn't create a new reason /etc can not be mounted read-only). This is compatible with what other systems do and is what the sysutil/os-release port attempted to do, but in an incomplete way. Linux, Solaris and DragonFly all implement this natively as well. The complete standard can be found at https://www.freedesktop.org/software/systemd/man/os-release.html Moving this to the base solves both the non-standard location problem with the port, as well as the lack of update of this file on system update. Bump __FreeBSD_version to 1300060 PR: 238953 Differential Revision: https://reviews.freebsd.org/D22271 Notes: svn path=/head/; revision=354922
* flua: newer GCC complains about format-nonliteral at WARNS=2Kyle Evans2019-11-191-0/+2
| | | | | | | Disable that one, too. Notes: svn path=/head/; revision=354837
* Add flua to the base system, install to /usr/libexecKyle Evans2019-11-188-0/+1436
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | FreeBSDlua ("flua") is a FreeBSD-private lua, flavored with whatever extensions we need for base system operations. We currently support a subset of lfs and lposix that are used in the rewrite of makesyscall.sh into lua, added in r354786. flua is intentionally written such that one can install standard lua and some set of lua modules from ports and achieve the same effect. linit_flua is a copy of linit.c from contrib/lua with lfs and lposix added in. This is similar to what we do in stand/. linit.c has been renamed to make it clear that this has flua-specific bits. luaconf has been slightly obfuscated to make extensions more difficult. Part of the problem is that flua is already hard enough to use as a bootstrap tool because it's not in PATH- attempting to do extension loading would require a special bootstrap version of flua with paths changed to protect the innocent. src.lua.mk has been added to make it easy for in-tree stuff to find flua, whether it's bootstrap-flua or relying on PATH frobbing by Makefile.inc1. Reviewed by: brooks, emaste (both earlier version), imp Differential Revision: https://reviews.freebsd.org/D21893 Notes: svn path=/head/; revision=354833
* Add 'linux_mounts_enable' rc.conf(5) variable, to make it possibleEdward Tomasz Napierala2019-11-132-6/+10
| | | | | | | | | | | | | to disable mounting Linux-specific filesystems under /compat/linux when 'linux_enable' is set to YES. Reviewed by: netchild, ian (earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22320 Notes: svn path=/head/; revision=354690
* libcompat: Correct rtld MLINKSBrooks Davis2019-11-122-1/+2
| | | | | | | | | | Don't install duplicate ld-elf.so.1.1 and ld.so.1 links in rtld-elf32. Do install lib-elf32.so.1.1 and ldd32.1 links. Reported by: madpilot Notes: svn path=/head/; revision=354663
* libcompat: build 32-bit rtld and ldd as part of "everything"Brooks Davis2019-11-073-8/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included directly so MD paths in Makefiles work. In the process centralize setting them in LIBCOMPATWMAKEENV. Alter .PATH and CFLAGS settings in work when the Makefile is included. While here only support LIB32 on supported platforms rather than always enabling it and requiring users of MK_LIB32 to filter based TARGET/MACHINE_ARCH. The net effect of this change is to make Makefile.libcompat only build compatability libraries. Changes relative to r354449: Correct detection of the compiler type when bsd.compat.mk is used outside Makefile.libcompat. Previously it always matched the clang case. Set LDFLAGS including the linker emulation for mips where -m32 seems to be insufficent. Reviewed by: imp, kib (origional version in r354449) Obtained from: CheriBSD (conceptually) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22251 Notes: svn path=/head/; revision=354491
* Revert r354449: libcompat: build 32-bit rtld and ldd as part of "everything"Brooks Davis2019-11-073-23/+8
| | | | | | | Additional testing is required.. Notes: svn path=/head/; revision=354465
* Extend the linux rc script to mount the neccessary file systems,Edward Tomasz Napierala2019-11-071-1/+20
| | | | | | | | | | | | set ELF fallback brand, and load pty(4). Reviewed by: emaste (earlier version) MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21874 Notes: svn path=/head/; revision=354458
* libcompat: build 32-bit rtld and ldd as part of "everything"Brooks Davis2019-11-073-8/+23
| | | | | | | | | | | | | | | | | | | | | | | Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included directly so MD paths in Makefiles work. In the process centralize setting them in LIBCOMPATWMAKEENV. Alter .PATH and CFLAGS settings in work when the Makefile is included. While here only support LIB32 on supported platforms rather than always enabling it and requiring users of MK_LIB32 to filter based TARGET/MACHINE_ARCH. The net effect of this change is to make Makefile.libcompat only build compatability libraries. Reviewed by: imp, kib Obtained from: CheriBSD (conceptually) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22251 Notes: svn path=/head/; revision=354449
* rc.shutdown: print a newline before watchdog timeout messageEd Maste2019-11-071-1/+2
| | | | | | | | | | | | | | | | | | Previously the watchdog timeout message was appended to the last entry in the "Waiting for PIDS" list, resulting in a message like Waiting for PIDS: 31299 31296 90201 9020090 second watchdog timeout expired. Shutdown terminated. Print a newline to separate the watchdog timeout message. Also perform the kill before logging or echoing the message. PR: 241072 MFC after: 1 month Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=354446
* Remove trailing tab.Cy Schubert2019-10-271-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=354129