3576 Commits
Author SHA1 Message Date
Poul-Henning Kamp c9dbbe382d Mark network_interfaces as deprecated 2026-10-28 09:36:10 +00:00
Poul-Henning Kamp dca2ad4c6f All Jetway NF541 seem to have the same UUID 2026-10-28 08:34:14 +00:00
Konstantin Belousov 175595ba6c dl_iterate_phdr(3): do not return garbage for objects not using TLS
For objects without a TLS segment, tlsindex is zero. tls_get_addr_slow()
then reads dtv_slots[-1], which is dtv_size, and returns it as the TLS
address. Set dlpi_tls_data to NULL for such objects instead.

Fixes:	d36d681615 ("rtld dl_iterate_phdr(): dlpi_tls_data is wrong")
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-10-25 19:33:46 +02:00
Konstantin Belousov e2979f4cbb rtld: some cosmetics in donelist_init()
Add a missing word in the comment.
Make each assignment a separate statement.
Fix formatting.

Fixes:	1e370f0387 ("rtld: stop using unbound alloca()")
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-10-25 19:33:46 +02:00
Konstantin Belousov 91d8163803 rtld: fix leak in get_program_var_addr() on the error path
Fixes:	1e370f0387 ("rtld: stop using unbound alloca()")
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-10-25 19:33:46 +02:00
Wolfram Schneider f7114dc7b7 manpages: Fix unusual Xr order 2026-10-25 12:06:08 +00:00
Piotr Kubaj c4fde87a32 rtld: add .cfi_undefined lr to rtld_start.S on powerpc*
Without it, LLVM libunwind doesn't know where to stop when unwinding the
main thread, so it uses a stale LR as the return address and crashes.
Our libunwind doesn't do that since 5866c369e4 reverted it, but
programs that bundle their own copy, like ClickHouse, are hit by it.

amd64, arm64, i386 and riscv already have the same annotation.

Approved by:	jhibbits
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D60740
2026-10-15 15:59:57 +02:00
Simon J. Gerraty 34e92fb6bd hooks.sh allow running DebugO{n,ff} from hooks_run
We need to watch out for _debugO{n,ff}_hooks.

Also add add_list (hook lists are just lists).

Fix bug in hooks_has() - should look for $2 in list.
2026-10-13 16:59:32 -07:00
Simon J. Gerraty 064edc2ceb debug.sh avoid trouble from set -e
The setting of _TTY ran afoul of set -e.

Also the handling of Myname blew up if debug.sh included by
a login sheel (eg in .profile).

For non-posix shell, leave false alone if it is a builtin.
2026-10-13 16:08:15 -07:00
Simon J. Gerraty 5efc40dd13 safe_eval.sh: safe_set_var add allow list for values
Complete the controls with -v "values":

sh ./safe_eval.sh set_var -a "knob" -v "no yes" knob=yes knob=no knob=ok ok=yes
knob=yes
knob=no
denied value 'ok' for 'knob'
denied variable 'ok'
2026-10-13 16:05:21 -07:00
Simon J. Gerraty 58a8f100a6 safe_eval.sh: safe_set_var use [:space:] if possible
Also use $ssv_extra$ssv_only as the default for $ssv_only has '-'
which must be last in the character class.
2026-10-11 14:55:11 -07:00
Simon J. Gerraty 7c75c96d17 safe_eval.sh: safe_set_var avoid positional args
Use options to set ssv_{allow,only,extra}
Improve the documentation.
Add a test harness for safe_set_var.
2026-10-11 11:12:59 -07:00
Simon J. Gerraty 9f0432041b safe_eval.sh fix description of safe_set_var returns.
The description was out of sync wrt return values.
1. invalid var
2. invalid val
3. var not in allowed list
2026-10-10 23:05:52 -07:00
Simon J. Gerraty 475e3bc18a safe_eval.sh: add safe_set_var
Get the log message right!
Fix default allowed chars (untabify clobbered TAB)
Add a couple more : messages to help debugging.
2026-10-10 22:55:16 -07:00
Simon J. Gerraty 0fa0966b6a safe_eval.sh add safe_var_set
safe_var_set can be used to safely handle var=val args from command line.
eg.

	while :
	do
		case "$1" in
		*=*)	# eval "$1" can be very dangerous
			# safe_var_set will only eval if
			# both var and value are sane.
			if ! safe_var_set "$1"; then
				case "$?" in
				1) echo invalid variable name;;
				2) echo invalide value;;
				3) echo variabel not allowed;;
				esac
			fi
			shift
			;;
		*)	break
			;;
		esac
	done
2026-10-10 21:58:50 -07:00
Konstantin Belousov ef758b59a4 rtld: release rtld_bind_lock around calls to .preinit_array initializers
We unlock the bind lock around .init calls anyway.  Also, the main
object cannot be unloaded.

Reported and reviewed by:	dim
PR:	298943
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D60588
2026-10-10 20:03:01 +03:00
Konstantin Belousov 46399049f8 rtld: fix indent
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-10-10 18:10:18 +03:00
Christos Margiolis 26203cca52 rc.d/mountd: Do not require /etc/exports
mountd exits if it cannot read any exports files. Requiring
/etc/exports, however, unconditionally stops mountd from starting on a
server that exports ZFS datasets only (/etc/zfs/exports).

Let sbin/mountd handle requirements itself, instead of hardcoding
/etc/exports, which is also wrong, because different files can be
specified in mountd_flags.

This patch also works with nfsv4_server_enable="YES", by preserving the
behavior of failing to start if there is no "V4:" line in the exports
file, which is missing by default on ZFS-only exports.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Reviewed by:	rmacklem, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D60044
2026-10-07 18:53:28 +02:00
Konstantin Belousov 274236ed08 rtld.c: avoid double-free on dso load failure in do_load_object()
The obj->path is assigned directly from the path argument, and
load_object() frees the path on do_load_object() failure.  Do not free
it in obj_free() on the error path.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D60402
2026-10-06 20:33:27 +03:00
Konstantin Belousov ea23918b02 rtld-elf/i386: remove no longer true __unused args annotations
Fixes:	d45d7aea61 ("i386 rtld: implement support for TLSDESC relocation")
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-10-06 10:56:59 +03:00
Adam Mizerski de0a279c8b nuageinit: apply meta-data if user-data is a script
Tested by:	[email protected]
Sponsored by:	OVHcloud
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2446
2026-10-04 00:45:22 +02:00
John Baldwin 40ce54ccd9 apm(8): Remove support for APM BIOS
Drop support for queries and commands that are not supported by ACPI's
/dev/apm interface.  This includes dropping support for
enabling/disabling APM BIOS used by /etc/rc.d/apm.

Reviewed by:	ziaee, imp
Differential Revision:	https://reviews.freebsd.org/D59941
2026-09-30 12:21:45 -04:00
John Baldwin 247503fedb apmd: Retire the APM daemon
The original purpose of this daemon was to route power management
requests to userspace, e.g. when the suspend button was pressed, the
APM driver posted an event read by apmd(8) that would invoke zzz(8) to
suspend.  However, on ACPI systems this is handled by devd(8) events
instead and running apmd(8) in addition just adds extra complexity.
This probably should have been axed when the APM BIOS support was
retired in commit 8c576a279e.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D59937
2026-09-30 12:20:02 -04:00
Enji Cooper a4c71d0a20 atf-sh: install kmod_test added as part of the 0.26 release
Fixes:	9522310861 ("contrib/atf: upgrade to 0.26")
2026-09-22 09:36:46 -07:00
Enji Cooper 9522310861 contrib/atf: upgrade to 0.26
This new version gets contrib/atf in line with the published version of
the package up on [GitHub][github].

Please note that this release is a major update: it contains several
bugfixes and feature enhancements. Most were already present in the
FreeBSD src repo, but there were a large number of changes made in
addition to what was already present.

MFC after:      1 month

Merge commit '9c78088348bcf1059d82a62bb57a0746309d4312'

Conflicts:
        contrib/atf/.cirrus.yml
        contrib/atf/Makefile.am
        contrib/atf/Makefile.in
        contrib/atf/aclocal.m4
        contrib/atf/admin/ar-lib
        contrib/atf/admin/check-style-common.awk
        contrib/atf/admin/check-style.sh
        contrib/atf/admin/compile
        contrib/atf/admin/config.guess
        contrib/atf/admin/config.sub
        contrib/atf/admin/depcomp
        contrib/atf/admin/install-sh
        contrib/atf/admin/ltmain.sh
        contrib/atf/admin/missing
        contrib/atf/atf-c++/Makefile.am.inc
        contrib/atf/atf-c++/atf-c++.3
        contrib/atf/atf-c++/atf-c++.pc.in
        contrib/atf/atf-c++/check.cpp
        contrib/atf/atf-c++/check.hpp
        contrib/atf/atf-c++/detail/Makefile.am.inc
        contrib/atf/atf-c++/detail/process_test.cpp
        contrib/atf/atf-c/Makefile.am.inc
        contrib/atf/atf-c/atf-c.3
        contrib/atf/atf-c/atf-c.pc.in
        contrib/atf/atf-c/detail/Makefile.am.inc
        contrib/atf/atf-c/detail/fs.c
        contrib/atf/atf-c/detail/fs_test.c
        contrib/atf/atf-c/detail/process_test.c
        contrib/atf/atf-c/tc.c
        contrib/atf/atf-c/tc.h
        contrib/atf/atf-sh/Makefile.am.inc
        contrib/atf/atf-sh/atf-check.cpp
        contrib/atf/atf-sh/atf-check_test.sh
        contrib/atf/bootstrap/Makefile.am.inc
        contrib/atf/bootstrap/package.m4
        contrib/atf/bootstrap/testsuite
        contrib/atf/config.h
        contrib/atf/configure
        contrib/atf/configure.ac
        contrib/atf/doc/Makefile.am.inc
        contrib/atf/doc/atf-test-case.7
        contrib/atf/m4/developer-mode.m4
        contrib/atf/m4/libtool.m4
        contrib/atf/m4/ltoptions.m4
        contrib/atf/m4/ltsugar.m4
        contrib/atf/m4/ltversion.m4
        contrib/atf/m4/lt~obsolete.m4
        contrib/atf/m4/module-defs.m4
        contrib/atf/test-programs/Makefile.am.inc

[github]: https://github.com/freebsd/atf
2026-09-22 08:23:32 -07:00
Adam Mizerski 13d5f20e5b nuageinit: fix support on OpenStack
Change added in 90a7728cd8 contained a
lot of bugs:
- If all network interfaces correctly respond to DHCP, then pwait was
waiting forever.
- If there was more than 1 interface, then "cat
/tmp/ephemeraldhcp.*.pid" joined pid numbers into one long string.
- "for iface in $left; do kill -15 $left; done" is not using $iface.

Tested by:	[email protected]
Sponsored by:	OVHcloud
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2436
2026-09-17 17:32:37 +02:00
Konstantin Belousov fa848d4d0c rtld: more caution when parsing in digest_notes()
Incorrect ELF might have PT_NOTE slightly larger than the needed to
contain all notes, and the PT_NOTE size could be larger than one page.
Then rtld mmaps just the notes bytes to parse.  After the last note,
we iterate past the mapped region trying to read the Elf_Note header.
This was found in wild.

Require full elf note to fit into the [start_note, end_note) region to
continue the parsing.  Check it in stages, first verifying the Elf_Note
header structure fits, to be able to read the name and data length.
After that, check the whole note against limit.

Reported and tested by:	makc
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59635
2026-09-15 00:55:01 +03:00
Konstantin Belousov 2ef97312d5 rtld.c: fix indent
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2026-09-15 00:55:01 +03:00
Konstantin Belousov 76f5fccc5f amd64 rtld: implement support for TLSDESC relocation
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59269
2026-09-06 01:00:10 +03:00
Konstantin Belousov d45d7aea61 i386 rtld: implement support for TLSDESC relocation
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59269
2026-09-06 01:00:10 +03:00
Konstantin Belousov fb63a60d6e rtld i386: use macro for the 'GNU ABI' calling convention of TLS resolver
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59269
2026-09-06 01:00:09 +03:00
Konstantin Belousov 5d9e5f4964 rtld: explain the use of rtld_bind_lock in rtld_get_addr_slow()
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59269
2026-09-06 01:00:09 +03:00
Konstantin Belousov 6a69d28ee0 rtld: allow arches to initialize/finalize objects
Discussed with:	jrtc27
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D59269
2026-09-06 01:00:09 +03:00
Kyle Evans c45bdb39fe rc: add a backlight service to save/restore backlight levels
The default on my laptop is annoyingly bright, and this is a useful
feature to mitigate that.  The backlight script is largely a copy of the
mixer service which provides the same value for mixers, but this one is
specifically dependant on kld to allow DRM drivers a chance to attach.

Note that it's off by default to avoid interference with DEs, and
document the capability in backlight(8).  Set backlight_enable=YES in
rc.conf(5) to enable save/restore.

Relnotes:	maybe
Reviewed by:	bapt, ivy, manu, ziaee
Differential Revision:	https://reviews.freebsd.org/D59296
2026-09-01 22:51:41 -05:00
Rick Macklem 8ee0a615cb nfsclient: Add a new nfs_client_rdma_enable variable
This patch adds a new nfs_client_rdma_enable variable
to /etc/rc.d/nfsclient to enable the client side of
NFS over RDMA.  The client side of NFS over RDMA
requires the nfsclrdma.ko module, which is still under
test/review.

I wanted to get the "glue" into main so that others
could test the module more easily.  Avaliability of
the module will be announced on freebsd-current@ soon.

It should not affect non-RDMA operation.

I've specified a long MFC, since the module still
requires extensive testing and, hopefully, a review.

MFC after:	3 months
2026-08-30 15:11:08 -07:00
Alexander Leidinger b5dcd8f9d6 rc.subr tests: service jail behaviour of run_rc_command
Twenty cases over where each rc option and each method executes for a
jailed service, the jail's lifetime, and the svcj option handling.  Each
case drives the service inside a chroot built in its ATF work directory.

MFC after:		1 week
MFC to:			stable/15
Assisted-by:	Claude Code (Opus 5)
2026-08-30 19:43:28 +02:00
Alexander Leidinger 9125bc0727 rc.subr: svcj - add a setaudit option
setaudit(8) is prefixed to the command inside the jail when
${name}_audit_user is set, and needs allow.setaudit.

This is not added automatically when ${name}_audit_user is set, this
needs an administrative setting of the options on purpose.

MFC after:	1 week
MFC to:		stable/15
2026-08-30 19:43:17 +02:00
Alexander Leidinger 327dae5081 rc.subr: svcj - run a service's own restart and status methods in its jail
A script that defines non-default restart_cmd or status_cmd should
execute them in the service jail.  Where there is no jail to enter,
restart starts the service instead of failing.

Fixes:			2efbd480f1 rc: add service jails framework
MFC after:		1 week
MFC to:			stable/15
Assisted-by:	Claude Code (Opus 5)
2026-08-30 19:43:11 +02:00
Alexander Leidinger a70ca1ebd8 rc.subr: svcj - remove the service jail when the service is not running
A service whose tracked process had died while another process of its own
kept the jail alive, therefore left svcj-${name} behind, and the next start
would fail.

Fixes:			2efbd480f1 rc: add service jails framework
MFC after:		1 week
MFC to:			stable/15
Assisted-by:	Claude Code (Opus 5)
2026-08-30 19:43:06 +02:00
Alexander Leidinger 21e53eeaff rc.subr: svcj - let svcj_all_enable enable service jails
Fix the logic for svcj_all_enable.

Fixes:		2efbd480f1 rc: add service jails framework
MFC after:	1 week
MFC to:		stable/15
2026-08-30 19:42:55 +02:00
Jochen Neumeister 6155e17019 rc.subr: svcj - send the stop signal from inside the service jail
A service running under ${name}_user was signalled from the host as that
user, which the parent of a jail may no longer do: since 8a5ceebece an
unprivileged process would need allow.unprivileged_parent_tampering.
Stop and reload therefore failed and left both the service and its jail
running.

MFC after:	1 week
MFC to:		stable/15
2026-08-30 19:42:41 +02:00
Colin Percival 5a31987d4c rc+devd: Add growfs_postboot
In VM and cloud environments it is often possible to enlarge virtual
disks; this can be useful, for example, if a system is launched with a
small root disk and it later becomes clear that more space is needed.

On kernels which support run-time resizing of disks (for NVMe, this was
added in November 2025; some other disk types have supported this for
longer) a SIZECHANGE notification is sent to userland via devd.

Add a "nostart" rc.d script (runnable manually but not automatically at
boot time) and a devd script which invokes it when a notification
arrives.  The rc.d script enlarges the "final partition" on partitioned
geoms, or the UFS filesystem or zpool device when triggered on a disk
containing either of those.

Reviewed by:	imp, ziaee
MFC after:	2 weeks
Relnotes:	Disk partitions and filesystems can be enlarged
		automatically when disks grow by setting
		growfs_postboot_enable=YES in /etc/rc.conf.
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D58582
2026-08-23 22:02:16 -07:00
Navdeep Parhar a209aac868 nuageinit: root should be allowed to log in when disable_root is false
PermitRootLogin is "no" by default and that stopped root from logging in
even though disable_root was set to false during initialization.

Reviewed by:	bapt
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D59101
2026-08-21 23:58:28 -07:00
Vinicius Ferrao 3ce28106a8 rc.conf: Fix the default NFS-over-RDMA port number
The default for nfs_server_rdma_listen transposed two digits: 20490
instead of 20049, the IANA-assigned port for NFS-over-RDMA.

Fixes:	471e14267b ("nfsd: Update the rc.d script for RDMA for the nfsd service")
MFC after:	1 month
Sponsored by:	VersatusHPC
Pull Request:	#2371
Signed-off-by:	Vinícius Ferrão <[email protected]>
2026-08-15 14:27:12 -07:00
Rick Macklem 471e14267b nfsd: Update the rc.d script for RDMA for the nfsd service
Commit 7144a1d58c added the hooks for the nfsrdma.ko module.
Once loaded, this module adds RDMA support to the nfsd.

This patch adds a few lines to /etc/rc.d/nfsd, so that
nfs_server_rdma_enable="YES"
in your /etc/rc.conf will load nfsrdma.ko, so that RDMA
service is enabled.
It also supports
nfs_server_rdma_listen="port#"
so that the default of 20490 can be overridden in /etc/rc.conf.

At this available as time, the nfsrdma.ko module is an unofficial port,
since it was developed by Vinicius Ferrao <[email protected]>
using generative AI.
As soon as it is available, it will be announced on
[email protected].

Suggested by:	Vinicius Ferrao <versatushpc.com.br>
MFC after:	1 month
2026-08-14 12:55:54 -07:00
Alexander Leidinger d0f0a3b89b etc/rc.subr: svcj - use the filename for services
We have ports and basesystem services, where the internal name and the
filename differ. While the documentation recommends to keep them in
sync, the reality is different. For service jails use the basename of
the service filename.
Fixes:		2efbd48 rc: add service jails framework
Suggested by:	joneum
MFC after:	1 week
MFC to:		stable/15
2026-08-14 09:49:35 +02:00
Alexander Leidinger 84d8d2878a rc.d/bgfsck: use the correct variable name
The name of the script and the name used internally for rc.conf differ,
as such the hardcoded disabling of service jails for the didn't work.
Fix by using the correct name.
Fixes:		f99f0ee14e rc.d: add a service jails config to all base system services
2026-08-14 09:42:47 +02:00
John Baldwin ec8985a100 rtld: Remove a stale #ifdef PIC
rtld has always been built PIC since commit
7ca8e6a670.  The stale #ifdef might
confuse a reader by thinking rtld can be built as non-PIC.

Reviewed by:	kib
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D58623
2026-08-13 13:02:17 -04:00
Siva Mahadevan 3c33729ce2 rc_subr_test: ignore stderr in no_cycles test
nuageinit_user_data_script references 'firstboot_freebsd_update'
and 'firstboot_pkg_upgrade', which are from Ports. In a default
base system test without sysutils/firstboot-freebsd-update and
sysutils/firstboot-pkg-upgrade, rcorder will warn on "unknown
provisions" to stderr, but is otherwise harmless.

Reviewed by:	arrowd
Fixes:		16e47f317c
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2026-08-13 09:29:43 -04:00
Baptiste Daroussin 8f378c83c6 nuageinit: support allow_public_ssh_keys
Skip importing datasource public keys when set to false.
2026-08-11 13:17:09 +02:00