Commit Graph

3494 Commits

Author SHA1 Message Date
Lexi Winter b7daab8be1 apm: Only install rc script on i386
The apm(8) rc script only works on i386, but it's installed on all
platforms.  Only install it on i386, which avoids creating a useless
FreeBSD-apm package on other platforms.

While here, build the acpi package on i386.

MFC after:	2 weeks
Reviewed by:	imp
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D56629
2026-04-26 17:47:27 +01:00
Simon J. Gerraty 566cc00581 safe_set treat ':' and '#' differently
Treat '#' as a comment anywhere,
but ':' only at start of line.
2026-04-22 09:37:35 -07:00
Simon J. Gerraty 69cc351c4c safe_set ignore leading white-space
Also treate ':' at the start of a line as for '#'
ie. a comment.
2026-04-22 09:15:13 -07:00
Konstantin Belousov 9b844b495e rtld: fix processing of preloaded z_initfirst objects
After we found some preloaded z_initfirst object, we must process till
the end of the preload list still, not stopping on the first found
object.

Reported by:	des
Reviewed by:	des, markj, siderop1@netapp.com
Fixes:	78aaab9f1c
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D56466
2026-04-20 20:25:20 +03:00
Jose Luis Duran 8e08080ee5 rc.conf: Fix typo in comment
The correct path is /etc/defaults/rc.conf (defaults in plural).

Reviewed by:	netchild
Fixes:		cc4eb1ea10 ("Add support for a /etc/defaults/vendor.conf override file")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D56456
2026-04-17 13:55:16 +00:00
Christos Margiolis 70e27ecba5 virtual_oss: Introduce virtual_oss_default_control_device rc variable
The -t option gives the user the ability to create a control device for
a given virtual_oss(8) instance, so that the instance's configuration
can be manipulated during runtime with virtual_oss_cmd(8). As is
expected, the control device's name is not known, since it is specified
by the user.

This patch introduces a virtual_oss_default_control_device rc variable,
which defaults to "vdsp.ctl". The goal of this is that third-party
programs and scripts can access the control device of the default
virtual_oss(8) configuration without guessing. This is especially useful
for sbin/devd/snd.conf which deals with hot-swapping sound devices using
virtual_oss(8).

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D55670
2026-04-16 16:51:02 +02:00
Aotian Cao 47a9af4b39 rc.d/NETWORKING: remove the NETWORK alias
NETWORKING is the documented placeholder, while
/etc/rc.d/NETWORKING still provides the legacy alias
NETWORK.

The NETWORKING script was originally introduced to avoid
conflicts with NetBSD's lowercase network script on
case-insensitive file systems.  The NETWORK alias was
retained for compatibility with older scripts.

Following the discussion in PR 293652, remove the legacy
NETWORK alias from 16-CURRENT.  Keeping both names adds
more confusion than value now that NETWORKING is the
documented placeholder and current base system and ports
tree uses are already clean.

Add an UPDATING entry to note that local RC scripts using
REQUIRE: NETWORK should be migrated to REQUIRE: NETWORKING.

PR:		293652
Reviewed by:	michaelo, jlduran
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D56300
2026-04-15 11:06:32 +02:00
Simon J. Gerraty de9fe28ab8 Allow passing xtras to safe_set
This allows safe_set to be leveraged in other contexts
where additional chars like '*' or '!' or even '\[\]' need to
be preserved in the result.
2026-04-10 09:11:21 -07:00
Konstantin Belousov 72252591ac rtld: add test for dlopen("#dirfd/path")
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	 https://reviews.freebsd.org/D56152
2026-04-02 05:41:56 +03:00
Konstantin Belousov ffbf3fecde rtld: allow dlopen("#<number>/<path>")
When a specially formatted path is passed to dlopen(), of the form
  #number/path
and the number is the valid dirfd file descriptor listed in the
LD_LIBRARY_FDS, interpret it as a relative path name against dirfd
number.

This complements the result returned from dladdr() for such objects
in dli_fname.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D56152
2026-04-02 05:41:55 +03:00
Konstantin Belousov 7cfffe25da rtld: check for overflow in parse_integer()
Reviewed by:	dim, emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D56151
2026-03-30 19:56:52 +03:00
Dag-Erling Smørgrav 0a6dbf51d8 pkgbase: Move all of ATF into the atf package
Parts of ATF (including the licence and some of the documentation) were
for some reason part of the tests package instead of the atf package.
Moving them to where they logically belong poses no problem since tests
already depends on atf.

PR:		294129
MFC after:	1 week
Reviewed by:	ivy
Differential Revision:	https://reviews.freebsd.org/D56158
2026-03-30 16:03:29 +02:00
Jose Luis Duran 4f0d0ed5cb libexec: Add pkg-serve directory
Add pkg-serve to the list of subdirectories in the Makefile.

Reviewed by:	bapt
Fixes:		b42e852e89 ("pkg-serve(8): serve pkg repositories over TCP via inetd (8)")
Differential Revision:	https://reviews.freebsd.org/D56009
2026-03-29 16:13:09 +00:00
Alex S 9f16078b5f rtld: add a test for rtld_set_var (with LIBRARY_PATH_FDS)
PR:	294054
Reviewed by:	kib
MFC after:	1 week
2026-03-27 01:41:23 +02:00
Konstantin Belousov b9f046d941 rtld: properly handle update of several vars in rtld_set_var()
Besides setting the value in the array of the values, rtld sometimes
needs to recalculate some internal control variable for the change to
take effect.  Allow the variable description to supply a method called
on the update.  Lock the function with the bind lock for safe operation.

Mark several variables as allowed for update, since the on_update method
is provided for them.  The list is LD_BIND_NOW, LD_BIND_NOT,
LD_LIBMAP_DISABLE, LD_LOADFLTR.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D56055
2026-03-27 01:41:23 +02:00
Baptiste Daroussin b42e852e89 pkg-serve(8): serve pkg repositories over TCP via inetd (8)
Reviewed by:	manu, bdrewery (previous version)
Differential Revision:	https://reviews.freebsd.org/D55895
2026-03-20 13:29:48 +01:00
Jessica Clarke c70f382a8b rtld-elf: Remove stray _exit prototype for aarch64
It's not clear why this is here. It's existed since the very first
version of rtld-elf for aarch64 but has never been used, and anything
actually using exit or _exit should be using rtld_libc.h's #define that
aliases them to __sys_exit.

Fixes:	047c6e3ae6 ("Add the arm64 code to the runtime linker. It's not able to be built as we still need libc_pic for a few things, but this is expected to be ready soon.")
2026-03-13 19:25:04 +00:00
Kyle Evans bc531a96c9 stand: lua: break out a few more dirent types in lfs
These are non-standard and specific to the version used in loader.  We
have some desire to recognize symlinks to avoid filtering out kernel
symlinks in the autodetection bits when they would be perfectly fine to
`load`.

This won't be usable right away, so any impending use will need to be
careful to account for nil.

Reported by:	leres
2026-03-09 16:39:10 -05:00
Samvel Khalatyan 895a97c875 rc.d/zfs: align zfs mount verbosity in host and jail environments
ZFS script runs different startup seqneces depending on where it runs:
on the host (`zfs_start_main()`) or in a jail (`zfs_start_jail()`):

- `zfs_start_main()` mounts ZFS datasets in verbose mode `zfs mount -va`
- `zfs_start_jail()` mounts ZFS datasets silently `zfs mount -a`.

This change aligns the verbose levels.

NO_ISSUE

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/2030
2026-03-07 00:51:16 -07:00
Kalevi Kolttonen d7922c3d23 Fix debug.sh comment typo
Signed-off-by: Kalevi Kolttonen <kalevi@kolttonen.fi>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/2012
2026-03-07 00:51:15 -07:00
Kalevi Kolttonen 3be98a0c86 Fix hooks.sh comment typo
Signed-off-by: Kalevi Kolttonen <kalevi@kolttonen.fi>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/2013
2026-03-07 00:51:15 -07:00
Christos Margiolis e85f221def rc: virtual_oss: Silence potential hw.snd.default_unit error
PR:		293582
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2026-03-06 13:27:03 +01:00
Navdeep Parhar df5014f71c nuageinit.7: Fix a couple of minor errors
Use the correct key name in the chpasswd section.
Remove a stray line to fix the description of 'password'.

MFC after:	1 week
Sponsored by:	Chelsio Communications
Reviewed by:	maxim
Differential Revision:	https://reviews.freebsd.org/D55547
2026-02-28 08:52:40 -08:00
Quentin Thébault 06b466526a virtual_oss: use hw.snd.default_unit by default
Reviewed by:	christos
MFC after:	1 week
Signed-off-by: 	Quentin Thébault <quentin.thebault@defenso.fr>
Sponsored by: 	Defenso
PR:		293130
Pull Request:	https://github.com/freebsd/freebsd-src/pull/2043
2026-02-23 13:33:33 +01:00
Artem Bunichev ab835b3707 debug.sh: Fix a typo
MFC after:		3 days
Reviewed by:		emaste, guest-seuros, sjg, ziaee
Differential Revision:	https://reviews.freebsd.org/D55416
2026-02-23 03:31:34 -05:00
Thibault Payet d3ed0e0ab0 rc.d: Convert more service to Use startmsg
Signed-off-by: Thibault Payet <contact@thibaultpayet.fr>
Reviewed by: imp,mhorne
Pull Request: https://github.com/freebsd/freebsd-src/pull/2001
2026-02-08 13:58:44 -07:00
Jesús Daniel Colmenares Oviedo 436af5715c flua: Fix SIGSEGV in lua_chown when uid/gid doesn't exist
When lua_chown is used to call chown(2) internally, it first resolves
the user and/or group by calling the getpwnam_r(3) and getgrnam_r(3)
functions, respectively. However, although it checks for errors, it does
not check when entries are not found (which is not an error), which
means that the buffer will be set to NULL, and since lua_chown attempts
to access the NULL structure, it will receive a SIGSEGV signal.

Reviewed by:			imp@
Approved by:			imp@
Differential Revision:		https://reviews.freebsd.org/D55172
2026-02-08 16:35:25 -04:00
Jessica Clarke 5beaa1ee75 Revert "Additional icache paranoia: non-PLT relocations can modify the text segment."
reloc_nonplt_object, and thus reloc_non_plt, only ever handles data
relocations, so this paranoia is completely unfounded and only has the
effect of significantly slowing down program startup for binaries with
large amounts of code, like Clang.

If this breaks any systems, that would likely be due to insufficient
flushing in the pmap implementation for executable mappings, as this
existing rtld behaviour would mask any such bugs.

This reverts commit 4b51c69976.

Reviewed by:	adrian
Differential Revision:	https://reviews.freebsd.org/D54221
2026-02-08 16:39:44 +00:00
Enji Cooper fd6217075e tftpd tests: clean trailing whitespace
No functional change intended.

MFC after:	1 week
2026-02-02 21:19:08 -08:00
Kyle Evans d3f21856aa rc: run the zfs rc script before tmp
The tmp rc script has much the same problem that the var does: it wants
to test if /tmp is writable, and mount a tmpfs if it's not.  This means
that we actually want our zfs datasets mounted first, because we might
have a /tmp dataset that changes the story.

The ordering problem is particularly noticable with a r/o zfs root,
since the write test will fail and we'll mount a tmpfs that later gets
covered by our /tmp dataset.  If that /tmp dataset inherited readonly,
then we're still in trouble.

This also fixes `tmpmfs=yes`, which would again get covered by a zfs
dataset with the existing ordering.

Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D54995
2026-02-02 21:21:42 -06:00
Baptiste Daroussin 90a7728cd8 nuageinit: support fetching configuration on multiple iface
On some environement a VM can be connected to multiple ifaces but only
one will respond to dhcp and able to fetch the metadata.

Launch the early dhclient on all available ifaces and as soon as one
dhcp has successfully configured an iface, proceed with fetching the
metadata.

MFC After:	1 week
Reported by:	mateusz.klejn@ovhcloud.com
Tested by:	mateusz.klejn@ovhcloud.com
Sponsored by:	OVHcloud
2026-01-29 11:03:06 +01:00
Eric A. Borisch 1b2d495a24 Set virtual_oss_enable="NO" in /etc/defaults/rc.conf
This prevents 'service -e' from emitting (/var/log/messages):

/usr/sbin/service: WARNING: $virtual_oss_enable is not set properly - see rc.conf(5)

Pull Request:	https://github.com/freebsd/freebsd-src/pull/1987
Reviewed by:	christos
Signed-off-by:	eborisch@gmail.com
MFC after:	1 week
2026-01-29 09:33:59 +02:00
Kyle Evans b41b6fdb3a flua: lposix: fix WARNS=6 issues
lposix is the last holdout of modules built into flua until we can fix
the module design to have the right parts require()able.  Address a
valid bug in lua_read() found at a higher WARNS and drop the override
entirely.  Some of the modules could possibly be re-evaluated.

Fixes:	c2caf3b331 ("flua: lposix: add more useful functions [...]")
Reported by:	des
Reviewed by:	des
Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
2026-01-28 09:43:14 -06:00
John Baldwin 6d6bf4a892 rtld: Use a helper variable to simplify a few lines
Reviewed by:	kib
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D54507
2026-01-15 13:23:42 -05:00
Christos Margiolis 37164224ee libexec/rc/rc.d/Makefile: Remove duplicate mixer entry
Fixes:		f74f891581 ("src.opts: Introduce MK_SOUND")
PR:		292436
Sponsored by:	The FreeBSD Foundation
MFC after:	4 days
Reviewed by:	ivy, emaste
Differential Revision:	https://reviews.freebsd.org/D54706
2026-01-15 19:53:55 +02:00
John Baldwin 3ea97c9de2 rtld: Switch to using <assert.h> for assert
The stock assert() works because rtld-libc includes a custom
implementation of __assert().

Reviewed by:	imp, kib
Obtained from:	CheriBSD
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D54712
2026-01-14 12:10:33 -05:00
John Baldwin e96ec1a1eb rtld: Use uintptr_t instead of Elf_Addr for init/fini function pointers
This is a no-op on non-CHERI architectures, but is required for CHERI
where Elf_Addr is only an address and not a complete pointer.

While here, consistently use `uintptr_t *` for arrays of init/fini
function pointers.

Reviewed by:	imp, kib
Effort:		CHERI upstreaming
Obtained from:	CheriBSD
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D54711
2026-01-14 12:10:33 -05:00
John Baldwin 31a440a0e9 rtld: Simplify walking program headers
Store phnum in Obj_Entry instead of phsize and use that to simplify
the terminate expressions when iterating over program headers.

Reviewed by:	kib
Obtained from:	CheriBSD
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D54710
2026-01-14 12:10:33 -05:00
Sarah Walker a652357fb5 rtld-elf: Pass HWCAP flags to ifunc resolver functions
Function arguments are based on Section 9.4.1 "GNU C Library IFUNC interface"
from "System V ABI for the Arm 64-bit Architecture (AArch64)", 2025Q1.
(https://github.com/ARM-software/abi-aa/releases/download/2025Q1/sysvabi64.pdf)

Reviewed by:	kib, andrew
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D54559
2026-01-13 15:28:04 +00:00
NVSRahul ced7f29dec rc: Add os-release URL rc.conf variables
Add rc.conf defaults for the os-release URL settings introduced in the
os-release rc.d script. This makes it easier for downstream integrators
and appliances to override the URLs via rc.conf instead of patching the
script.

The following variables are added to libexec/rc/rc.conf:
- osrelease_home_url
- osrelease_documentation_url
- osrelease_support_url
- osrelease_bug_report_url

These correspond to HOME_URL, DOCUMENTATION_URL, SUPPORT_URL, and
BUG_REPORT_URL in the generated os-release file.

Signed-off-by: NVSRahul <nvsrahul@hotmail.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1961
2026-01-12 12:43:36 -07:00
NVSRahul babc4d8f70 rc: Improve os-release URLs and add rc.conf overrides
Add DOCUMENTATION_URL and SUPPORT_URL to the generated /var/run/os-release
file, and route the existing URLs through rc.conf-configurable variables:

  - osrelease_home_url
  - osrelease_documentation_url
  - osrelease_support_url
  - osrelease_bug_report_url

This allows downstreams and appliance vendors to customize these URLs
without patching the base script, while providing useful defaults for
stock FreeBSD installations.

Tested:
  - sh -n libexec/rc/rc.d/os-release
  - (No FreeBSD host available; not runtime-tested yet)

Signed-off-by: NVSRahul <nvsrahul@hotmail.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1961
2026-01-12 12:43:34 -07:00
Christos Margiolis f74f891581 src.opts: Introduce MK_SOUND
PR:		291853
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	zarychtam_plan-b.pwste.edu.pl, markj
Differential Revision:	https://reviews.freebsd.org/D54456
2026-01-12 16:16:35 +02:00
Minsoo Choo c5dc38bcc2 Remove all code under __SPE__
Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1957
2026-01-12 00:51:05 -07:00
Minsoo Choo 94d1731e73 Makefile*: remove powerpcspe
As reported on the freebsd-announce mailing list[1] FreeBSD is
continuing to retire 32-bit support.  Remove powerpcspe from build
infrastructure.

[1] https://lists.freebsd.org/archives/freebsd-announce/2024-February/000117.html

Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me>
Reviewed by:	jhibbits, emaste
Pull request:	https://github.com/freebsd/freebsd-src/pull/1914
2026-01-09 11:28:43 -05:00
Baptiste Daroussin 65e77d34fd nuageinit: fix test after recent behaviour change
with recent change nuageinit always create a "freebsd" user, if no
users are specified, which means we do need to get the rootdir in the
testsuite containing a group file otherwise pw complains and the tests
fails.
2026-01-08 10:55:27 +01:00
Gonéri Le Bouder cae280931c nuageinit: set the hostname when user-data is missing
This address the situation reported here
https://github.com/freebsd/freebsd-src/pull/1952#issuecomment-3720210259

The user-data file was missing and the `sethostname` function is never
called. This commit adjusts slightly the logic to avoid the `exit()` call
when the `user-data` file is missing.

MFC After:	1 week
Signed-off-by: Gonéri Le Bouder <goneri@lebouder.net>
Differential Revision:	https://github.com/freebsd/freebsd-src/pull/1953
2026-01-08 10:55:27 +01:00
Gonéri Le Bouder cbc00fcc2b nuageinit: only create the default user when needed
The "default" user should only be created when:

- the `users` key is missing
- or the `default` string is present in the `users` list

Since the `public_keys` is extracted from the meta-data, this patch has
to slightly adjust the way they are loaded.
The change simplify the logic around the default user SSH key injection.
Both `ssh_authorized_keys` and `public_keys` are handled at the same time.

MFC After:	1 week
Signed-off-by: Gonéri Le Bouder <goneri@lebouder.net>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1952
2026-01-07 13:29:58 +01:00
Baptiste Daroussin 9ea30bbb0e nuageinit(7): pert mandoc linter
MFC After: 	1 week
2026-01-06 09:25:14 +01:00
Gonéri Le Bouder 402f135370 nuageinit/man: clarify how to enable sudo and doas
Clarify that both `sudo` and `doas` are not part of the base system and
they need to be listed in the `packages` section if the user wants to
enable them.

MFC After: 	1 week
Signed-off-by: Gonéri Le Bouder <goneri@lebouder.net>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1944
2026-01-06 09:25:14 +01:00
Gonéri Le Bouder 7af8b75201 nuageinit: config2_network support dns service cfg
This change enhances `config2_network()` to honor the DNS
configuration, when it's defined through the `services` section.

The `network_data.json` file can hold DNS configuration at two different
places:
- within a network configuration entry
- or `dns` entry in the `services` section, in this case the configuration is global.

An example of such configuration:

{"links": [{"id": "interface0", "type": "phy",
"ethernet_mac_address": "52:54:00:01:59:03"}], "networks": [{"id": "private-ipv4-0", "type": "ipv4", "link": "interface0",
"ip_address": "192.168.123.5", "netmask": "255.255.255.0", "routes": [{"network": "0.0.0.0", "netmask": "0.0.0.0", "gateway":
"192.168.123.1"}], "network_id": "9e5b1ed9-f5e6-4941-a90f-2e06bab858de", "dns_nameservers": ["192.168.123.1"], "services": [{"type":
 "dns", "address": "192.168.123.1"}]}], "services": [{"type": "dns", "address": "192.168.123.1"}]}

See: https://docs.openstack.org/nova/latest/user/metadata.html

MFC After: 	1 week
Signed-off-by: Gonéri Le Bouder <goneri@lebouder.net>
Pull Request: 	https://github.com/freebsd/freebsd-src/pull/1941
2026-01-06 09:25:14 +01:00