aboutsummaryrefslogtreecommitdiff
path: root/libexec
Commit message (Collapse)AuthorAgeFilesLines
* rtld: use generated map file to check for some leaks from libc into rtldKonstantin Belousov2024-02-291-0/+19
| | | | | | | Reviewed by: brooks, emaste (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D44136
* rtld: unconditionally generate map file during buildKonstantin Belousov2024-02-291-0/+6
| | | | | | | | | | | It is needed at least to ensure that undesirable code is not linked into rtld from libsys/libc, and adding the map file option each time is not productive. Reviewed by: brooks, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D44136
* rc: Set var_run_enable to enable by defaultEmmanuel Vadot2024-02-282-7/+2
| | | | | | | | | | This will load/save the /var/run directories at boot/shutdown if and only if /var/run/ is a tmpfs mount so it is a win for tmpfs users and a no-op for everyone else. Reviewed by: bapt Differential Revision: https://reviews.freebsd.org/D44097 Sponsored by: Beckhoff Automation GmbH & Co. KG
* rtld-elf: support either byte-order of hints fileStefan Eßer2024-02-261-16/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | Accept either little-endian or big-endian representation of the ELF hints magic number in the header of a hints file and convert the parameters to the native byte-order of the repsective system. This is a pre-requisite for a planned change to always write the byte order in little-endian format on all architectures. The only relvant architecture that uses big-endian data is powerpc64, and it is not likely that new architectures will choose that representation of data in memory. When all supported architectures use little-endian data in the hints file, the byte swap logic can be enabled for big-endian CPUs at compile time. Up to that point, there is a very small run-time penalty that is paid on all systems to check the byte-order of the hints file and to provide the option to byte-swap the parameters read from the hints file header. This commit contains the changes from review D44080 (which had been split off from this patch for easier review), Reviewed by: kib MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D44053
* fdlopen(3): do not create a new object mapping if already loadedKonstantin Belousov2024-02-221-2/+3
| | | | | | | | | | This is expected behavior for both dlopen(3) and fdlopen(3). PR: 277169 Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D44019
* Revert "rc.d/mountlate: discard output from nextboot"Robert Wing2024-02-211-1/+1
| | | | | | This reverts commit 4cea0cbcc9d3a6583e5325ca081c09c8a9423172. Requested by: imp
* rc.d/mountlate: discard output from nextbootRobert Wing2024-02-211-1/+1
| | | | | | | | | | | | | | | silent the warning seen at boot: Mounting late filesystems:. nextboot: unlink /boot/nextboot.conf: No such file or directory Sun Feb 18 23:31:52 AKST 2024 FreeBSD/amd64 (main) (ttyv0) login: Differential Revision: https://reviews.freebsd.org/D43979
* rtld: remove pointless "extern"Konstantin Belousov2024-02-211-1/+1
| | | | | | Reviewed by: brooks, imp Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D43985
* rtld: add some dlopen testsKyle Evans2024-02-132-0/+54
| | | | | | | | | | | | | | | | | dlopen_basic just tests that libthr.so can be dlopen()ed, which will just serve as a sanity check that "libthr.so" is a thing that can be dlopened in case we get a weird failure in dlopen_recursing. dlopen_recursing tests a regression reported after the libsys split, where some dlopen() may cause infinite recursion and a resulting crash. This case is inspired by bdrewery's description of what seemed to be causing his issue. The corresponding fix landed in commit 968a18975ad ("rtld: ignore load_filtees() calls if we already [...]") Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D43859
* rtld: ignore load_filtees() calls if we already loading filtees for the objKonstantin Belousov2024-02-132-1/+4
| | | | | | | | | | | | | | | | in addition to avoiding it for already loaded filtees. Issue is that during load, rtld needs to resolve some special ABI symbols, like executable stack fixer and static TLS initializer, which might trigger recursion. Example is libthr which is filter for libsys, and which exports __pthread_distribute_static_tls. Tested by: kevans, krion Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43858
* rtld load_filtees(): reindent and reduce block nestingKonstantin Belousov2024-02-131-3/+2
| | | | | | | Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43858
* rtld symlook_obj: move common code to check filtees into helperKonstantin Belousov2024-02-131-12/+19
| | | | | | | Revieved by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D43858
* rc.subr add Exists so we can find sedSimon J. Gerraty2024-02-122-6/+36
| | | | | | | | | | SED=`Exists -x /usr/bin/sed /rescue/sed` avoids adding /rescure to $PATH, and allows use of sed before /usr is mounted (if a separate filesystem). Reviewed by: jlduran_gmail.com Differential Revision: https://reviews.freebsd.org/D43826
* rc.subr avoid noise if /usr not mountedSimon J. Gerraty2024-02-101-6/+29
| | | | | | | | | basename, sed and tty are all in /usr/bin and not available until /usr is mounted. basename and tty we can replace with a function, but sed is more important. Fix o_verify to just use shell builtins, and rc_trace should avoid trying to set RC_LEVEL until sed is available.
* /etc/rc add trace debug and verifySimon J. Gerraty2024-02-095-22/+589
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Debugging boot issues can be helped by logging each rc.d script as it is run and being able to selectively enable/disable set -x debug.sh provides an elaborate framework for debugging shell scripts. For secure systems, we want to be paranoid about what we read during boot. dot() simply reads (.) arg file if it exists vdot() if mac_veriexec is active, ignore unverified files otherwise behaves much the same as dot() safe_dot() in safe_eval.sh allows reading an untrusted file; limiting the input to simple variable assignments. In load_rc_config allow caller to provide an option to indicate how to handle its arg: -v use vdot() -s use sdot() which will try to use vdot() and fallback to safe_dot() The default is to read using dot() rc_run_scripts() encapsulate the running of rc.d scripts so that we can easily call it more than twice. We vdot local.rc.subr to pick up extensions (like run_rc_scripts_final) and overrides. We also allow rc.subr.local or rc.conf to set rc_config_xtra eg (rc_config_xtra=XXX for historic compatibility) rc use set -o verify around the reading in of rc.subr This has no effect if mac_veriexec is not active, but if it is; ensures rc.subr has not been tampered with. Reviewed by: imp Sponsored by: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D43671
* leapseconds: Update to the canonical place.Warner Losh2024-02-061-2/+2
| | | | | | | | | | | | | | | | | IERS is the source of truth for leap seconds. Their leapsecond file is updated most quickly and is always right (unlike the IANA one which often lags). IERS operates this public service for the express purpose of random people downloading it. Their terms of service are compatible with open source (we could include this in our release). Rather than fighting with questions around this because the IANA one changed locations or the auto update script broken, just use this. This is in preference to the NIST ftp copy. NIST is in the process of retiring their FTP services. Sponsored by: Netflix Reviewed by: philip, delphij, cy Differential Revision: https://reviews.freebsd.org/D43752
* rtld-elf: Avoid unnecessary lock_restart_for_upgrade() callsMark Johnston2024-02-021-1/+1
| | | | | | | | | | | | | | In order to atomically upgrade the rtld bind lock, load_filtees() may trigger a longjmp back to _rtld_bind() so that the binding can be done with the write lock held. However, the write lock is only needed when filtee objects haven't already been loaded, so move the lock_restart_for_upgrade() call to avoid unnecessary lock upgrades when a filtee is defined. Reviewed by: kib Tested by: brooks MFC after: 1 week Sponsored by: Innovate UK
* bootpd(8): Fix a typo in a source code commentGordon Bergling2024-01-221-1/+1
| | | | | | - s/adddress/address/ MFC after: 3 days
* rc.d/kdc: Support start of MIT krb5kdcCy Schubert2024-01-221-6/+4
| | | | | | | | | | | | | | | | Some users wishing to use the MIT krb5kdc have discovered the kdc script workaround applied to the MIT krb5 ports is insufficient. Let's build into this rc script the smarts to determine whether base or ports Hiemdal kdc is being invoked or the MIT krb5kdc. While at it, remove kdc_start_precmd(). This will simplify a future jail patch. Suggested by: netchild Original patch: netchild Reviewed by: emaste, netchild MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D43523
* rc.d/jail: add legacy compatibility for zfs.datasetAlexander Leidinger2024-01-171-0/+7
| | | | | | | | | | | Evaluate the jail_${jailname}_zfs_dataset variable for legacy jail managers. This variable can take a space separated list of datasets. The singular was used specially to allow unmaintained jail managers like ezjail to use this (simply rename jail_${jailname}_zfs_datasets in the ezjail config to jail_${jailname}_zfs_dataset).
* crashinfo: Print stack traces for all on-CPU threadsMark Johnston2024-01-153-1/+69
| | | | | | | | | | | | | | | | | | | | | Add a python script which implements the bulk of this functionality. Over time, this would ideally evolve into a library of python routines which can be used to inspect kernel data structures and automate some debugging tasks, similar to jhb's out-of-tree scripts, but written in a somewhat nicer language and with better integration into the kgdb command prompt. Note that kgdb currently won't auto-load scripts in this directory. This should perhaps change in the future. It probably also makes more sense to have a crashinfo.py which provides all the kgdb output that we want to include in core.txt, rather than having crashinfo.sh pipe in several commands. Reviewed by: avg, imp Discussed with: jhb MFC after: 3 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33817
* rc.d: Process autobridge_* in vnet jailsMark Johnston2024-01-041-1/+1
| | | | | | Reviewed by: kp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D43316
* rc.initdiskless: Remove bogus plus signJose Luis Duran2023-12-311-1/+1
| | | | | | Reviewed by: imp, dab Fixes: Fixes: 93b7818226cf ("libexec/rc/rc.initdiskless: make tar's path flexible") Differential Revision: https://reviews.freebsd.org/D43241
* libexec/rc/rc.initdiskless: make tar's path flexibleCheng Cui2023-12-151-1/+3
| | | | | | | | Summary: PR: 274977 Reviewed by: rgrimes,imp Approved by: rgrimes MFC after: 1 month
* Stop #defining FREEBSD_ELFJohn Baldwin2023-12-121-1/+1
| | | | | | | | | | | | This was originally used (along with FREEBSD_AOUT) to prefer the use of ELF in various tools instead of a.out as part of the a.out to ELF transition in the 3.x days. The last use of it was removed from <link.h> in commit 66422f5b7a1a6055f0b2358268eb902aab6e2e3e back in 2002, but various files still #define it. Reviewed by: kevans, imp, emaste Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D42964
* rc.conf: correct $ntp_leapfile_sourcesPhilip Paeps2023-12-071-1/+1
| | | | | | | | IETF is no longer serving leap-seconds.list. Point at IANA instead. This fixes "service ntpd fetch". MFC after: 1 day
* rtld: add a test for RTLD_DEEPBINDKyle Evans2023-12-0110-2/+170
| | | | | | | | | | | This tests that with RTLD_DEEPBIND, symbols are looked up in all of the object's needed objects before the global object. PR: 275393 Reviewed by: kib Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D42843
* RTLD_DEEPBIND: make lookup not just symbolic, but walk all refobj' DAGsKonstantin Belousov2023-11-302-2/+7
| | | | | | | | | | | | | before starting the walk over the global list. Effectively we visit needed objects first as well, instead of just the object itself. This seems to better match the semantic offered by the glibc flag. Reported by: kevans PR: 275393 Reviewed by: kevans Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D42841
* libexec: Automated cleanup of cdefs and other formattingWarner Losh2023-11-2733-68/+1
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove copyright strings ifdef'd outWarner Losh2023-11-277-66/+0
| | | | | | | | | | | We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals. These copyright strings are present in the comments and are largely from CSRG's attempt at adding their copyright to every binary file (which modern interpretations of the license doesn't require). Sponsored by: Netflix
* libexec: Remove ancient SCCS tags.Warner Losh2023-11-2757-144/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* rc.d/ldconfig: Remove stray ;;Cy Schubert2023-11-241-1/+0
| | | | | | Stray ";;" causes the ldconfig rc script to fail at boot. Remove it. Fixes: 73902ed85ab7
* ldconfig: only configure compat32 when kernel supports itKonstantin Belousov2023-11-241-5/+2
| | | | | | | | | and eliminate hard-coded arch list. Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D42669
* ldconfig: filter out non-existing directories from default pathKonstantin Belousov2023-11-201-1/+5
| | | | | | | | | | | | | This is done only for ld-elf32.so.1, where /lib32 is kept in the path due to the way STANDARD_LIBRARY_PATH is defined in rtld_paths.h. This change fixes innocent warning appearing after 99132daf6f70cb0cc969c555d3612547fa3cf1db Reviewed by: dim, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D42626
* Spaces to tabs for consistency. No content change.Jens Schweikhardt2023-11-181-2/+2
|
* rc.d/ldconfig: Prepend rtld stdlib paths to ldconfig(32)_pathsJohn W. O'Brien2023-11-131-1/+4
| | | | | | | | | | | Ensure that ldconfig-managed elf and elf32 hints always include the standard library paths that are known independently to rtld. PR: 275031 Reviewed by: kib MFC after: 2 weeks Sponsored by: Saltant Solutions LLC Differential Revision: https://reviews.freebsd.org/D42557
* defaults: oomprotect sshd and local_unboundAlexander Leidinger2023-11-131-0/+2
| | | | | | | | | | | | | | | | | Add sshd and local_unbound to the oom protected services. syslogd is protected by default already, document it. This was discussed on arch@, see https://lists.freebsd.org/archives/freebsd-arch/2023-November/000543.html sshd is protected to be able to investigate and fix oom issues on systems which don't have out-of-band console access. local_unbound is protected as it may be enabled for local use and without DNS a lot grinds to a halt (including sshd). Relnotes: yes MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D42544
* rtld/arm: fix initial-exec (IE) thread-local storage relocationR. Christian McDonald2023-11-031-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | net/frr[89] revealed an interesting edge-case on arm when dynamically linking a shared library that declares more than one static TLS variable with at least one using the "initial-exec" TLS model. In the case of frr[89], this library was libfrr.so which essentially does the following: #include <stdio.h> #include "lib.h" static __thread int *a __attribute__((tls_model("initial-exec"))); void lib_test() { static __thread int b = -1; printf("&a = %p\n", &a); printf(" a = %p\n", a); printf("\n"); printf("&b = %p\n", &b); printf(" b = %d\n", b); } Allocates a file scoped `static __thread` pointer with tls_model("initial-exec") and later a block scoped TLS int. Notice in the above minimal reproducer, `b == -1`. The relocation process does the wrong thing and ends up pointing both `a` and `b` at the same place in memory. The output of the above in the broken state is: &a = 0x4009c018 a = 0xffffffff &b = 0x4009c018 b = -1 With the patch applied, the output becomes: &a = 0x4009c01c a = 0x0 &b = 0x4009c018 b = -1 Reviewed by: kib Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D42415/
* Track upstream project rename in contrib/blocklistdEd Maste2023-11-033-4/+4
| | | | | | | | Upstream is now https://github.com/zoulasc/blocklist/. Rename the contrib directory and update Makefiles to match, in advance of the next vendor branch update. Sponsored by: The FreeBSD Foundation
* ino64: Remove 'forward compat' code for thisWarner Losh2023-10-311-2/+2
| | | | | | | | | | | | | | | Forward compatibility code was added for running newer ino64 binaries on older kernels as a transition aide. Now that ino64 has been in the tree 6 years, this code is no longer useful and should have been removed long ago. Remove it now. Should be no user-visible changes at this point as all the 'upgrade' scenarios it was intended for are long since past. Also need to remove this stuff from rtld since the _foo versions no longer exist. Sponsored by: Netflix Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D42382
* rtld: Teach rtld about the BTI elf noteAndrew Turner2023-10-301-0/+4
| | | | | | | | | | Add the Branch Target Identification (BTI) note to libc assembly sources. As all obect files need the note for rtld to have it we need to insert it in all asm files. Reviewed by: markj, emaste Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D42228
* rtld: introduce STATIC_TLS_EXTRAStephen J. Kiernan2023-10-3010-12/+35
| | | | | | | | | | | | | | | | | | The new STATIC_TLS_EXTRA variable provides a means for applications to increases the size of the extra static TLS space allocated by rtld beyond the default of '128'. This extra static TLS space is used for objects loaded with dlopen. The value specified in the variable must be no less than the default value and no greater than the maximum allowed value for size_t type. If an invalid value is specified, rtld will ignore it and just use the default value. The rtld(1) man page is updated to document this new option. Obtained from: Juniper Networks, Inc. Differential Revision: https://reviews.freebsd.org/D42025
* ttys: bump dateWarner Losh2023-10-261-1/+1
|
* ttys: Document insecure flagWarner Losh2023-10-261-2/+3
| | | | | | | | | Both the secure and insecure flag is documented in init(8). the secure flag is documented here; however, the insecure flag is not. Nor is the nuance that a line missing the 'secure' flag is also considered insecure. Document both here. Sponsored by: Netflix
* flua: add fbsd moduleBaptiste Daroussin2023-09-274-1/+169
| | | | | | | | | | | | This module is bundled into flua, it only provides for now the exec function. The point of the function is to be able to execute a program without actually executing a shell. to use it: fbsd.exec({"id", "bapt"}) Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D41840
* Purge more stray embedded $FreeBSD$ stringsJohn Baldwin2023-09-2529-91/+0
| | | | | | | These do not use __FBSDID but instead use bare char arrays. Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D41957
* jail: avoid a clash with /etc/jail.conf.d between rc and jail(8)Jamie Gritton2023-09-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | Since 13.1, /etc/rc.d/jail has looked for a per-jail config file in /etc/jail.conf.d. For RELENG 14, the ".include" directive was added to jail(8), with a sample line in the jail.conf(5) man page that includes "/etc/jail.conf.d/*.conf". These two use cases don't work together. When the jail.conf.d files are included from a master jail.conf, the files in jail.conf.d are likely to hold only partial configurations, and shouldn't be directly loaded by rc.d/jail. But there are existing configurations that depend on the current rc.d behavior. While users could be advised not to include from /etc/jail.conf.d, it's the natural choice even if not mentioned in jail.conf.5. The workaround is for rc.d/jail to continue to load the individual files, but only when /etc/jail.conf doesn't include from that directory (via a simple grep test), This allows the current use while not breaking the previous use. Reported by: antranigv at freebsd.am Differential Revision: https://reviews.freebsd.org/D41962
* rc.subr: don't require service to be enabled for `status`Daniel Tameling2023-09-211-2/+3
| | | | | | | | | | | | | | For a service that sets an rcvar, there is a check whether it has been enabled before the actual command is executed. If the check fails, one gets a message to enable it and the returned exit status is 0. However, this is usually undesirable for the status command, which is a) supposed to check whether the service is running anyway and b) returns a non-zero exit code if that is not the case. Thus, skip the check for the status command. PR: 272282 Reviewed by: emaste MFC after: 3 days
* save-entropy: Add manual pageFernando Apesteguía2023-09-182-0/+98
| | | | | | | | | | Succinct manual page for save-entropy(8). PR: 223998 Reported by: AJ Jordan <alex+freebsd@strugee.net> Reviewed by: carlavilla@, delphij@, lwhsu@, pauamma_gundo.com Approved by: delphi, lwhsu (src) Differential Revision: https://reviews.freebsd.org/D41768
* rtld: output rtld errors into the dbg channelKonstantin Belousov2023-09-151-0/+1
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 1 week