aboutsummaryrefslogtreecommitdiff
path: root/libexec
Commit message (Collapse)AuthorAgeFilesLines
* libc/gen: split user-visible opendir()-like functions into separate source filesKonstantin Belousov2025-02-251-1/+1
| | | | | | | | | | | | | | | | | | This allows, for instance, to interpose opendir() with an implementation that calls into fdopendir(), without causing multiple symbol definitions when libc is linked in statically. This is aligned with the quality of implementation principle that single object file from a static library should not provide more than one app-visible symbol. [The copyright for fopendir() was copied, it might be refined by the author] Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D49089
* libsys: Don't create or expose __realpathatBrooks Davis2025-02-191-1/+1
| | | | | | | | | | | | | | | | Previously, __realpathat was in libc and libsys (as is currently standard), but not exported from libc which meant the stub in libc was not filtered and thus libc's copy of the syscall was used. This broke an upcoming change to CheriBSD limiting syscalls to libsys. The realpath(3) implementation now uses __sys___realpathat so there are no consumers of __realpathat. Switch it to PSEUDO (only _foo and __sys_foo symbols) and remove __realpathat from Symbol.map. This is a corrected version of 58d43a3cd72a4a85ab8489313672c7eab367495e. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D49049
* var_run: Clean up styleCy Schubert2025-02-191-8/+12
| | | | | | | | | | | | | | | | | | | | | Clean up style and make more consistent. Replace test with if-then-else to make the script more legible. Replace the call to dirname with the shell %/* operator avoiding a fork & exec. Reorder the test for $var_run_autosave before the test for /var/run on tmpfs. This avoids gratuitously scanning the mount table for a tmpfs /var/run. Initial concept by and in discussion with: Harry Schmalzbauer <freebsd@omnilan.de> No functional change intended. MFC after: 2 weeks Differnential revision: https://reviews.freebsd.org/D47773
* ntpd: Use the ntpd -u option in preference to the rc su plumbingCy Schubert2025-02-181-2/+7
| | | | | | | | | | | Using the rc plumbing to setuid(2) is preferred as it allows the user to use the -i option in ntpd_flags to chroot ntpd. Chrooting ntpd by default will be a 2025 project. MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D48191
* src: Use gnu17 as the default C standard for userland instead of gnu99Minsoo Choo2025-02-111-1/+0
| | | | | | | | | | | | | | | | | | | | | | Tracking newer versions of C (and C++) permits assuming newer language features in the base system. Some C11 extensions are already used in the base system but implemented on top of GNU C extensions such as _Alignas and _Static_assert. In some cases the fallback versions in cdefs.h are more limited than the native C11 extensions. Even though C11 is the next major version of C, C17 is chosen instead since C17 does not add new features to C but merely fixes defects in C11. It is also well supported by a wide range of clang (7.0.0+) and GCC (8.1+) versions. Along with changing the default, this change also removes explicit requests for c11 via the CSTD variable in various Makefiles. Libraries and binaries for ZFS continue to use c99. PR: 284039 (exp-run) Reviewed by: imp, arichardson, emaste Differential Revision: https://reviews.freebsd.org/D43237
* rc.subr:rc_trace take advantage of sdotSimon J. Gerraty2025-02-101-10/+5
| | | | | | | | Since we now have sdot, use it to get RC_LEVEL from rc.conf.d/rc_trace also avoid logging execution of ':' when RC_LEVEL > 0 Reviewed by: stevek Differential Revision: https://reviews.freebsd.org/D48856
* rc.d/iovctl: Start the iovctl service after kld.Navdeep Parhar2025-02-071-1/+1
| | | | | | | | | | | Drivers, including those that support SR-IOV, can be loaded via kld_list and it makes sense to process iovctl configuration files afer all drivers have been loaded. MFC after: 1 week Sponsored by: Chelsio Communications Reviewed by: 0mp, jhb Differential Revision: https://reviews.freebsd.org/D47937
* rtld: clear any holes in the struct utrace_rtld passed to kernel loggerKonstantin Belousov2025-02-051-2/+2
| | | | | | | | | | | | This should avoid an (almost) false positive from Valgrind, by filling the padding on LP64. PR: 284563 Reported by: Paul Floyd <pjfloyd@wanadoo.fr> Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D48854
* Revert "rc.d: Add hastd as a prereq for devd"Warner Losh2025-02-051-1/+1
| | | | | | | | This reverts commit 2d17f44a5ae6e948c3a93cac30b8315d127ba900. It hangs the boot. It turns out I installed my test on the wrong machine and rebooted the other one... Sponsored by: Netflix
* rc.d: Add hastd as a prereq for devdWarner Losh2025-02-051-1/+1
| | | | | | | | | Setuping up CARP and HAST described in: https://www.freebsd.org/doc/en/books/handbook/disks-hast.html doesn't work at boot time because devd start before hastd. PR: 199733 Submitted-by: hs_fbsd@on-sky.net (no name given)
* bootptest: Fix a typo in a source code commentGordon Bergling2025-01-261-1/+1
| | | | | | - s/tralier/trailer/ MFC after: 3 days
* Update rc.initdiskless, fix error handling of remount_optionalKeve Müller2025-01-241-1/+4
| | | | | | | | | | | | | | | chkerr() ignores the exit code of a preceding mount command in case a file ```remount_optional``` exists. The check is performed and a subshell is launched to log the informational message and return. The return is executed in the context of the subshell, not the context of the chkerr() function, hence is a NOP. The remount_optional check is hence ineffective. Change the code to if/then/fi, so the return is evaluated in the context of the chkerr function, to make the check effective. Reviewed by: imp, emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/1497
* rtld-elf/i386/reloc.c: apply clang-formatKonstantin Belousov2025-01-211-170/+175
| | | | | | Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D48509
* rtld-elf/amd64/reloc.c: apply clang-formatKonstantin Belousov2025-01-211-156/+169
| | | | | | Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D48509
* rtld-elf/{amd64,i386}/reloc.c: remove unneeded #ifdef dbgKonstantin Belousov2025-01-212-4/+0
| | | | | | | Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D48509
* rtld-elf/map_object.c: apply clang-formatKonstantin Belousov2025-01-211-301/+326
| | | | | | Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D48509
* rtld obj_remap_relro(): unindent the loop bodyKonstantin Belousov2025-01-211-12/+10
| | | | | | Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D48509
* rtld-elf/rtld.c: apply clang-formatKonstantin Belousov2025-01-211-2703/+2775
| | | | | | Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D48509
* rtld-elf/rtld.c: fix typo in commentKonstantin Belousov2025-01-211-1/+1
| | | | | | | Discussed with: emaste, imp Sponsored by: The FreeBSD Foundation MFC after: 3 days Differential revision: https://reviews.freebsd.org/D48509
* tcp_wrappers: Use default C standard versionMinsoo Choo2025-01-091-1/+0
| | | | | Reviewed by: emaste, arichardson, jhb Differential Revision: https://reviews.freebsd.org/D43236
* rc: Document rtadvd_flagsMark Johnston2025-01-061-0/+1
| | | | | PR: 283696 MFC after: 1 week
* Update libexec/rc/debug.sh and hooks.shSimon J. Gerraty2024-12-312-32/+51
| | | | | Use local_works() to test if 'local' actually works for current shell.
* devmatch: do nothing if booted in safe modeKyle Evans2024-12-141-1/+4
| | | | | | | | | Safe mode may be enabled because of some problem discovered with a kmod, thus wanting to avoid devmatch. Honor it and let the user deal with the fallout of not autoloading modules. We've at least made it to userland and the user demonstrably has a local console as they selected safe mode in the first place, so this shouldn't be fatal if we don't, e.g., load a necessary NIC driver.
* rc: ignore InsydeH2O UEFI BIOS UUID placeholder for hostidFranco Fichtner2024-12-111-0/+2
| | | | | | | | This caused MAC addresses (e.g. bridge0) to clash on systems running this particular BIOS. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1544
* rtld: Support multiple PT_GNU_RELRO program headersJohn Baldwin2024-12-063-32/+20
| | | | | | | | | | | | | | Iterate over all the program headers in obj_remap_relro and remove the relro fields from Obj_Entry. Skip the call to obj_enforce_relro() in relocate_object() for the rtld object as well as the main program object. obj_enforce_relro() is called later when it safe to reference globals such as page_size. Reviewed by: kib Obtained from: CheriBSD Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D47884
* rc.d/sendmail: Fix error with some configurationsTijl Coosemans2024-12-031-23/+26
| | | | | | | | | | | | | | | | | | | | | The sendmail startup script can run 4 daemons: sendmail, sendmail_submit, sendmail_outbound, and sendmail_msp_queue. Of the first 3 at most one can be enabled. There's a run_rc_command call for each and the ones for sendmail and sendmail_msp_queue run unconditionally. For some rc commands this triggers warnings or errors when sendmail_enable="NO" or sendmail_msp_queue_enable="NO". Since d2e7bb630b83 these errors are propagated and the whole script fails. Fix this by first determining which daemons are enabled, setting ${name} and ${rcvar} accordingly, and then always calling run_rc_command conditionally. Also replace ${name}.cf with sendmail.cf because ${name} isn't always sendmail. PR: 282585 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D47757
* comsat: move uid/gid setting earlierEd Maste2024-12-021-11/+12
| | | | | | | | | | It's good to reduce privilege as early as possible. Suggested by: jlduran Reviewed by: jlduran Obtained from: NetBSD Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47869
* comsat: Use initgroups and setgid not just setuidEd Maste2024-12-011-4/+5
| | | | | | | | PR: 270404 Reviewed by: jlduran Obtained from: NetBSD Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47828
* comsat: Improve use of setuid()Ed Maste2024-11-281-2/+4
| | | | | | | | | | | | Just return from jkfprintf if either (a) user lookup fails (that is, getpwnam fails) or (b) setuid() to the user's uid fails. If comsat is invoked from inetd using the default of tty:tty we will now return due to setuid() failing rather than fopen() failing. PR: 270404 Reviewed by: kevans Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D47823
* nuageinit: remove redundant mkdirsBaptiste Daroussin2024-11-271-2/+0
|
* nuageinit: implement ssh_keys supportBaptiste Daroussin2024-11-272-5/+93
| | | | | MFC After: 1 week Sponsored by: OVHCloud
* Revert "rc.d/var_run: Fix typo in comment"Cy Schubert2024-11-251-1/+1
| | | | | | | | | svcj is not a typo. Noted by: jlduran MFC after: 3 days This reverts commit bef05a753727fa28032e1b5a895c94b2ffaedd46.
* rc.d/var_run: Add missing $(dirname)Cy Schubert2024-11-251-1/+1
| | | | | | | We intend to create the containing directory here. Fix this typo. PR: 282939 MFC after: 3 days
* rc.d/var_run: Fix typo in commentCy Schubert2024-11-251-1/+1
|
* rc.conf: Update commented examples for lo0 to use CIDRJohn Baldwin2024-11-251-2/+2
| | | | | | | In particular, a bare IP address no longer works. Reviewed by: bz, imp, emaste Differential Revision: https://reviews.freebsd.org/D47716
* nuageinit: add test about encrypted passwordsBaptiste Daroussin2024-11-202-0/+23
| | | | | While here fix fc34a2463c16fd47acbc8e5c3bbbb6b2ce1b1469 where the adduser_passwd.lua file was not added
* nuageinit: use io.popen instead of pipes in shell for passwordBaptiste Daroussin2024-11-201-3/+8
| | | | | using echo in a sh(1) command line, requires many escaping to be done right, using io.popen we don't need to do this escaping anymore.
* nuageinit: add test for the passwordBaptiste Daroussin2024-11-202-0/+22
|
* rtld: drop RTLD_INIT_PAGESIZES_EARLYKonstantin Belousov2024-11-201-7/+0
| | | | | | | | No arch defines it after ia64 decomissioning. Discussed with: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week
* atf: Guard libexec/atf with WITH_TESTS_SUPPORTFranco Fichtner2024-11-181-1/+4
| | | | | | | | | Other atf components are guarded by WITH_TESTS_SUPPORT already. WITH_TESTS is for actual tests. Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47660
* rtld: implement _dl_iterate_phdr_lockedKyle Evans2024-11-142-0/+25
| | | | | | | | | | | | | | Some sanitizers need to be able to use dl_iterate_phdr() after stopping the rest of the process, but it's very hard to do so reliably as a non-participant in the main logic of the program. Introduce _dl_iterate_phdr_locked to bypass the locking that's normally required for dl_iterate_phdr() and slap some scary warning on it. It will remain undocumented and probably shouldn't be used for anything else. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D47558
* rtld.1: cross-reference rtld_get_var.3Konstantin Belousov2024-11-071-0/+10
| | | | | | | | Reviewed by: Alexander Ziaee Discussed with: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47351
* rtld: add rtld_{get,set}_varKonstantin Belousov2024-11-072-8/+59
| | | | | | | | Reviewed by: brooks (previous version) Discussed with: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47351
* rtld: make it easier to add sparce non-default members to ld_env_var_descKonstantin Belousov2024-11-071-2/+5
| | | | | | | | | by making the LD_ENV_DESC() macro variadic. Suggested by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47351
* rtld: 1-bit for bool is enoughKonstantin Belousov2024-11-071-1/+1
| | | | | | | Reviewed by: brooks Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D47351
* debug.sh check for :debug_add:Simon J. Gerraty2024-11-041-11/+73
| | | | | | | | | When we match a tag and turn tracing, see if we have any $DEBUG_ON:debug_add:tag in DEBUG_SH and if so add the new tag. This allows for more focused debugging during boot. Reviewed by: stevek
* rc: Update ipfilter example rules locationJose Luis Duran2024-11-041-1/+1
| | | | | | | | | | | | | It was originally /usr/src/contrib/ipfilter/rules and moved to /usr/src/share/examples/ipfilter/rules in 41edb306f056. Point to users to /usr/src/share/examples/ipfilter instead, as the base directory also contains example rules. Reviewed by: emaste Approved by: emaste (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D47392
* tftpd: Address flaky testsMark Johnston2024-11-033-10/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | The tftpd tests all follow the same pattern: 1. open a UDP socket, 2. fork a child to exec tftpd, which subsequently handles requests on the socket, 3. use a client socket to send some message to the tftpd daemon. However, tftpd's first action is to mark its socket as non-blocking and then read a request from it. If no data is present in the socket, tftpd exits immediately with an error. So, there is a race; we often see tftpd test timeouts when running tests in parallel. These timeouts also arise periodically in CI runs. One solution is to restructure each test to create the server socket, then write the request to the client socket, then fork tftpd. This closes the race. However, this involves a lot of churn. This patch fixes the problem a different way, by adding a new -b flag to tftpd which makes it block to read the initial request. Each test is modified to use -b, closing the race. Reviewed by: imp, asomers MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D47404
* ipfilter: Set ipf -T optionlist at bootCy Schubert2024-11-012-1/+8
| | | | | | | | | | There is no easy way to set ipfilter optionlist variables during boot. Add plumbing to the rc script to support this. PR: 130555 Reviewed by: jlduran MFC 1 week Differential Revision: https://reviews.freebsd.org/D47346
* nuageinit: add support for OpenStack network configBaptiste Daroussin2024-10-291-8/+37
| | | | | | | | | | | | | | | | Add naive support for openstack network config. if no config driver have been found, try to detect that we are running a VM on openstack via the smbios information, use the first iface available and temporary activate dhcp on it, to be able to fetch the necessary informations for cloudinit. While here make the rc script execute after devmatch, some ethernet device might be attached via devmatch and may be needed for cloudinit. Tested on OVHCloud Public Cloud. MFC after: 3 weeks Sponsored by: OVHCloud