Commit graph

20742 commits

Author SHA1 Message Date
Mark Johnston
7efe37333e bsdconfig: Make sure that SSID names are properly escaped
The f_menu_wpa_scan_results() function returns a list of networks
discovered by a scan.  The untrusted network names are evaluated in
f_dialog_menu_wireless_edit.  The quoting applied in
f_menu_wpa_scan_results() protects against evaluation of something like
"$(whoami)" but one can add single quotes to defeat that.

Pass the SSID names through f_shell_escape to work around this.  Escape
single quotes in f_dialog_wireless_edit() and f_menu_wireless_configs()
too for consistency.

I note that this module doesn't seem to actually work, see e.g.,
bugzilla PR 229883.

Approved by:	so
Security:	FreeBSD-SA-26:23.bsdinstall
Security:	CVE-2026-45255
Reported by:	Austin Ralls
Reviewed by:	dteske, des
Differential Revision:	https://reviews.freebsd.org/D56974
2026-05-21 07:32:57 +02:00
Renato Botelho
e13b3978d0 bsdinstall: Avoid invoking eval on the wlan SSID list
The wlanconfig utility is not careful about handling untrusted network
names, which can contain shell metacharacters.  Factor network selection
into a subroutine and use the `set -- "$@"` trick to build up a list of
positional parameters for bsddialog without evaluating them.

Approved by:	so
Security:	FreeBSD-SA-26:23.bsdinstall
Security:	CVE-2026-45255
Reported by:	Austin Ralls
Reviewed by:	dteske, des, asiciliano
Differential Revision:	https://reviews.freebsd.org/D56973
2026-05-21 07:32:56 +02:00
Dag-Erling Smørgrav
19387ebaef freebsd-update: Skip /etc/ssl/cert.pem
We already run `certctl rehash` at the end, there is no point in asking
users upgrading from 15.0 to 15.1 to manually merge the trust store.

Approved by:	so
Security:	FreeBSD-EN-26:13.freebsd-update
MFC after:	3 days
Reviewed by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D57028

(cherry picked from commit 2509ddee9bdb2240ba2f622e3a55a98ebc2aa4ae)
(cherry picked from commit 7d9c1d3895b307085131f922d7e46a4812f04675)
2026-05-21 07:32:45 +02:00
Joseph Mingrone
81f87c4d69 ipfwpcap: Fix build after libpcap 1.10.6 update
pcap-int.h now references SIZEOF_TIME_T from libpcap's config.h, which
is not available to consumers of the internal header outside of the
libpcap build.  Switch to the public <pcap.h> header and replace the
direct FILE* casts and ferror()/fflush() calls with pcap_dump_flush(3),
which is the correct public API for flushing a pcap dump file.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a0b3ef1952603ebf0307ca723b03e5a71598dd5a)
2026-04-30 08:26:37 +02:00
Li-Wen Hsu
04038c19d3 installer: Add download.freebsd.org to mirror list
download.freebsd.org is backed by project mirrors and a CDN, which
should benefit most users.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	delphij (releng)
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D54849

(cherry picked from commit 45079cdf8b517adf803db7dc7aa85e5728cfeb2f)
2026-04-30 07:39:21 +02:00
Ahmad Khalifa
b4ddb3e0f1 bsdinstall: fix EFI boot entry creation
update_uefi_bootentry assumes that the caller sets FREEBSD_BOOTNAME and
mntpt, which isn't the case anymore. The result is that there is no
"FreeBSD" boot entry created/updated after install. Most machines manage
to boot from the removable media path (if the loader is installed there
too), but some don't.

Take the loader's path as an argument and rename the variable used in
the ZFS mirror loop so mntpt can be reused below.

Also mark nentries as a local variable so it doesn't leak out of the
function.

PR:		293385
Fixes:		494de51bc0074472d1b01604f085daea0844f240
MFC after:	2 days
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D55469

(cherry picked from commit 0fd91c489134643ac9e38c0f55ba7464fe892c5e)
2026-02-27 19:22:23 +01:00
Alexander Ziaee
77d00703b2 bsdinstall.8: Minor maintenance
Replace CD-ROMs with "discs, USBs, or network boot environments"
to both modernize aesthetic and also nudge youths to think at scale.
Since I'm disrupting the flow of these lines anyway, expand the VM
acronym because I think this is one of the first manuals people will
be looking at.

Reset list alignment to seven characters. It was at 19 characters,
and that was not enough to align them all, wasting many extra lines
by crunching all the words over. Seven actually bought us some lines
from six due to avg item size. Tag SPDX.

MFC after:	3 days
Discussed with:	ivy, zi

(cherry picked from commit 81d9e08a4df42079d5e163b5991d5d6f3a28d4f0)
2026-02-18 13:13:17 +01:00
John Baldwin
53fff8286e bsdinstall: Mount /dev and /packages after using the shell to partition disks
Normally after partitions are created by the installer, the 'mount'
script is used to mount the target disk partitions under /mnt.  The
tail end of this script also mounts a couple of additional filesystems
under /mnt so that chrooted programs can work such as devfs and
/packages.

When the "Shell" option is used to permit the user to manually mount
the destination filesystem, the "mount" script is not used as the user
is instructed to mount the target filesystems and construct
/mnt/etc/fstab, etc.  However, this means that the user is responsible
for mounting devfs (which is not included in /etc/fstab) and /packages
as well.  The help message for the "Shell" option doesn't mention
these requirements, so users may not know to do so.  This can lead to
confusing errors as chrooted commands can fail to find needed /dev
entries.  For example, running fwget to fetch wireless firmware fails
because /dev/pci doesn't exist.

To make this less painful for users using this option, split out the
bottom half of the 'mount' script that mounts these non-fstab-related
filesystems into a separate 'mount_aux' script.  Invoke 'mount_aux'
after using "Shell" to create the filesystem to ensure that these
filesystems are always present.

PR:		290901
Reported by:	Peter <freebsd@peterk.org>
Tested by:	Peter <freebsd@peterk.org>
Differential Revision:	https://reviews.freebsd.org/D53770

(cherry picked from commit f63a8c0a0915a3eceac179d4d18b2c03b1319fa2)
2026-01-10 08:59:45 +01:00
Franco Fichtner
a051b9a40a rtsold: check RA lifetime before triggering the one-shot always script
Historic context: rtsold is used by *sense to get a router address which
wasn't originally the daemon's purpose.  We only ever get the first address
per interface lifetime so if the RA contains an invalid router with a zero
lifetime and we catch it we cannot get a valid one ever again.

This is suboptimal in a number of ways, but the obvious way to deal with
this is to ignore all RA messages from routers that do not advertise a
default route.

PR: https://github.com/opnsense/core/issues/9551
2025-12-22 22:09:23 +01:00
Mark Johnston
8d1f28706d rtsold: Validate entries in domain search lists
Reported by:	Kevin Day <kevin@your.org>
Approved by:	so
Security:	FreeBSD-SA-25:12.rtsold
Security:	CVE-2025-14558
2025-12-17 08:05:10 +01:00
Ed Maste
e598d7805e partedit: make minimum FreeBSD install size just under 1 GiB
1 GiB is a convenient disk image size for testing.  It is also the
installer's minimum size, but the minimum applies to the partition
rather than the whole disk.  Testing with a 1 GiB image resulted in the
counterintuitive error "There is not enough free space on <disk> to
install FreeBSD (1.0 GB free, 1.0 GB required)."

Reduce the installer's minimum size slightly to support this case.

Reviewed by:	brd
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38881

(cherry picked from commit 57e12d3973)
2025-11-20 12:16:30 -05:00
Ed Maste
2c24992d2a bsdinstall: Use fat32 EFI system partition for ZFS
This is consistent with other operating systems and with bsdinstall's
UFS config and with bsdinstall's ZFS config prior to commit
0b7472b3d8.

PR:		290857
Fixes: 0b7472b3d8 ("Mount the EFI system partition (ESP) on newly-installed systems.")
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53642

(cherry picked from commit 4109cdf0f817162cf3032aa589dd180dfa910025)
(cherry picked from commit 65e347d315)
2025-11-20 12:16:01 -05:00
Ed Maste
9e408269e5 bsdinstall: Fix newfs bsddialog menu
The second and third members of struct bsddialog_menuitem are `bool on`
and `unsigned int depth`. The newfs dialog options in bsdinstall's
partition tool had these two swapped, so the default selection did not
work.

PR: 290857
Reviewed by: asiciliano
Fixes: 50e244964e ("bsdinstall/partedit: Replace libdialog with libbsddialog")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53639

(cherry picked from commit 4e36942420712c2ab6ebc2c646e61d47b2b68e7b)
(cherry picked from commit 980aa8d4cf)
2025-11-20 12:15:27 -05:00
Jose Luis Duran
9776934f55 bsdinstall: Fix typos
Reviewed by:	emaste
MFC after:	2 days
Differential Revision:	https://reviews.freebsd.org/D53170

(cherry picked from commit 4ee348e27143b857445fd261cbe6695d6d57c836)
2025-10-23 08:11:56 +02:00
Ed Maste
85edba454c bsdinstall: Remove support for ZFS + MBR disk layouts
It hasn't worked for some time -- as reported in review D40816
"Installing FreeBSD with Auto ZFS + MBR has been broken ever since the
move to OpenZFS with FreeBSD 13."  It relied on the partition table and
ZFS data overlapping in a very fragile way and is not a good idea.

Reviewed by:	jhb
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51028

(cherry picked from commit ee110941e3)
2025-10-07 12:18:40 +02:00
Siva Mahadevan
545752a725 bsdinstall: fix vfs.zfs.vdev.min_auto_ashift oid
Signed-off-by: Siva Mahadevan <me@svmhdvn.name>
PR: 266374
Pull request: https://github.com/freebsd/freebsd-src/pull/1851
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 87a7b35f04b60956e9aa192680ae80773ec38f14)
(cherry picked from commit 093f3f26e9)
2025-10-07 12:18:08 +02:00
Warner Losh
71586fa78b bsdinstall: Add loader.efi to all ESPs we create
For proper redundancy, add copies of loader.efi to each of the ESPs we
create when we create multi-volume ZFS datasets. zfsboot creates a list
of secondary ESPs, while bootpart doesn't create any (it's the UFS
partitioning tool) because we don't supporg UFS over gmirror. The
primary ESP is mounted and is what we use efibootmgr to boot from. The
redundant copies allow the system to boot if the primary disks fails.

Sponsored by:		Netflix
MFC After:		2 days
PR:			208802
Reviewed by:		cperciva
Differential Revision:	https://reviews.freebsd.org/D52780

(cherry picked from commit 494de51bc0074472d1b01604f085daea0844f240)
2025-10-07 12:17:37 +02:00
Michael Osipov
af1182dbdc bsdinstall: Drop outdated comments about ZFS dataset compression
All datasets on zroot pool are compressed by default since FreeBSD 11.0 [1],
no need to mention that on some specific datasets these days.

[1] 47206692f2

Reviewed by:	jrm (mentor), ziaee
MFC after:	3 days
Differential Revision:	 https://reviews.freebsd.org/D52304

(cherry picked from commit f304c5bb8be65df83b86f8a50e1c7982b266262d)
2025-10-06 17:02:32 +02:00
Colin Percival
eb282231b6 freebsd-update: Library ordering
Upgrading from 14.x to 15.x with freebsd-update broke because libc
depends on the new libsys library; freebsd-update installed the new
libc before creating libsys, and every step after that failed because
all the tools (including gunzip and install) are dynamically linked
and need a working libc.

Enforce ordering when installing shared objects: First libsys, then
libc, then libthr, and then all the rest of the shared object files.

This is a candidate for an Errata Notice since the issue this fixes
breaks upgrades.

PR:		289769
Reported by:	Graham Perrin
Reviewed by:	kib
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D52688
Approved by:	so
Security:	FreeBSD-EN-25:18.freebsd-update

(cherry picked from commit 7ece602e00e85195fc426a2401c49921cd39735e)
(cherry picked from commit e26928669f39c8683aea74040b9e2472e944c43a)
2025-10-06 16:54:51 +02:00
Ed Maste
f74bfeb140 bsdinstall: Improve message for existing FreeBSD EFI entry
When reinstalling FreeBSD bsdinstall reported "There are multiple
FreeBSD EFI boot entries."  This sounds like something went wrong in the
past.  Clarify that there may be only one existing entry, which is not
surprising for a reinstall.

Reviewed by:	manu, ziaee
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51527

(cherry picked from commit ebc6ff8db1)
2025-08-26 10:26:57 +02:00
Lexi Winter
f5c2abac7b bsdinstall: use the canonical name for compression
According to zfsprops(7), the canonical property for the compression
algorithm is "compression", with "compress" accepted as an alternate
name.  Use the canonical name in bsdinstall.

While here, change "lz4" to "on" so we pick up any future changes in
the default compression algorithm.

MFC after:	1 week
Reviewed by:	delphij
Differential Revision:	https://reviews.freebsd.org/D51572

(cherry picked from commit 16045420e7)
2025-08-26 10:26:39 +02:00
Ed Maste
d957797ccc bsdinstall: Emit a warning if the system has too little memory
PR:		251993
Reviewed by:	adrian
Event:		Kitchener-Waterloo Hackathon 202506
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D50944

(cherry picked from commit eb5884c564)
2025-07-31 12:43:30 +02:00
Pierre Pronchery
605df6a3ae bsdinstall: restore the environment when restarting
It is possible to restart the installation process upon errors, when
installing normally through the `auto` script, or when installing a jail
with the `jail` script. However, some values obtained interactively from
the user or guessed by some scripts were kept in the environment when
restarting the process; this made it impossible to re-run some steps as
expected after the restart.

For instance, if a bad choice of mirror was made in the `mirrorselect`
phase, restarting the installer remembered the choice made, and would
never prompt for a different one again. Rebooting was then the only easy
way out of this situation.

This change restores a pre-defined list of environment variables when
restarting the installation process.

PR:		266987
Reviewed by:	emaste
Approved by:	philip (mentor)
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D42281

(cherry picked from commit 9de72af2cc)
2025-07-28 10:15:55 +02:00
Bjoern A. Zeeb
0b2faedaa6 bsdinstall: wlanconfig: ensure the interface is always up for scanning
Sponsored by:	The FreeBSD Foundation
Reviewed by:	thj (earlier), emaste
Differential Revision: https://reviews.freebsd.org/D51312

(cherry picked from commit 153e73d782)
2025-07-28 10:15:22 +02:00
Bjoern A. Zeeb
c09dfb35ef bsdinstall: wlanconfig: properly format regdomain dialog input
Without the extra '\n' the dual-column ('REGD' '') are not properly
separated for dialog which leads to an [misleading] error hidden on
the command line:
	Error: --menu bad arguments items number.
[Writing this I wonder why the dual-column input is needed].

It is still unclear as to where the error message quoted in PR287538
suddenly came from for 14.3-RELEASE given the code was broken since 2016
(or noone ever noticed or reported).

Looking at manual ifconfig output:
    ifconfig wlan0 country GB regdomain Expected
    -> ifconfig: unknown regdomain Expected
and "ifconfig: " gets stripped by the script, which means the regdomain
variable would have to be set to "Expected" or more likely to
"Expected eval: Use: not found" which looks like a concatination of
errors.

Sponsored by:	The FreeBSD Foundation
Fixes:		95ee591e83
PR:		287538
Reviewed by:	emaste, thj
Differential Revision: https://reviews.freebsd.org/D51313

(cherry picked from commit 5a1e2927d6)
2025-07-28 10:15:10 +02:00
Chuck Silvers
772f724391 x86/ucode: add support for early loading of CPU ucode on AMD.
Sponsored by:	Netflix
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D43318
2025-07-09 10:05:48 +02:00
Franco Fichtner
fbd2bda109 bsdinstall: react to WORKAROUND_HYBRID to force UEFI install on BIOS boot
Also add branding name.
2025-07-09 10:05:47 +02:00
Bjoern A. Zeeb
6130192db0 fwget / mt76: update script to extra firmware and update fget(8)
Update the script to support all the sub-drivers we compile now.
Some minor polishing as well.

Update fwget(8) as more IDs were added.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 91f53f4e06)
2025-07-09 10:05:43 +02:00
Lexi Winter
b69907d463 jail: add allow.routing jail permission
if allow.routing is set, the jail can modify the system routing table
even if it's not a VNET jail.

Reviewed by:	kevans, des, adrian
Approved by:	kevans (mentor), des (mentor)
Differential Revision:	https://reviews.freebsd.org/D49843

(cherry picked from commit 3a53fe2cc4)
2025-07-09 10:05:40 +02:00
Graham Perrin
73a6321f7b zfsboot: fix misuse of the phrase zpool
A pool is not a zpool.

Reviewed by:	jbh, ivy
Approved by:	des (mentor)
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1569

(cherry picked from commit f69afe4201)
2025-07-09 10:05:40 +02:00
Dag-Erling Smørgrav
fb33dd91ae certctl: Split certificate bundles before processing.
This allows 'certctl rehash' to do the right thing when ca_root_nss is
installed, instead of linking the entire bundle to the hash of the
first certificate it contains.

MFC after:	3 days
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D42087

(cherry picked from commit a401c8cb26)

certctl: Fix recent regressions.

- If an untrusted certificate is also found in the list of trusted
  certificate, issue a warning and skip it, but don't fail.
- Split on -+BEGIN CERTIFICATE-+ instead of "Certificate:" since
  that's what we're really looking for.

Also fix a long-standing bug: .crl files are not certificates, so we
should not include them when searching for certificates.

Reported by:	madpilot, netchild, tijl
Reviewed by:	netchild, allanjude
Differential Revision:	https://reviews.freebsd.org/D42276

(cherry picked from commit 87945a0829)

certctl: Convert line endings before inspecting files.

This ensures that certificate files or bundles with DOS or Mac line
endings are recognized as such and handled identically to those with
Unix line endings.

PR:		274952
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D42490

(cherry picked from commit f7d16a627e)

certctl: Revert to symlinks.

Unfortunately tar will not be able to extract base.txz to a system where
/etc and /usr are not on the same filesystem if the certificates are
hard links.

PR:		277828
Reviewed by:	mp
Differential Revision:	https://reviews.freebsd.org/D44496

(cherry picked from commit 3fed4f0db5)
(cherry picked from commit 9c34a6876a60dc10fda6ad6a0cbe8f99a372aadc)

Approved by:	re (cperciva)
2025-05-30 17:59:32 +02:00
Colin Percival
a47542f715 pkg.conf: Use kmod repositories
The kmod repositories were added shortly after 14.2-RELEASE.  Point at
them here so that users don't need to manually add the configuration
in order to get e.g. working graphics.

Approved by:	re (cperciva)
MFC after:	1 minute
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D50583

(cherry picked from commit 29f076ae0c)
(cherry picked from commit 8a2ce9f9dd6745e77bdfe78f03e96ddc8ad1b9d7)
2025-05-29 12:58:46 -07:00
Dag-Erling Smørgrav
95223d920a bsdinstall: Use a login shell for final configuration.
If the user accepts our offer of a shell to perform final configuration
tasks before rebooting, start a login shell.  This ensures it will have
the correct PATH and be able to install packages without issues.

Approved by:	re (cperciva)
PR:		286722
MFC after:	3 days
Reviewed by:	jrtc27, allanjude, emaste
Differential Revision:	https://reviews.freebsd.org/D50297

(cherry picked from commit 5870d6a1ef)
(cherry picked from commit 242b52ba3c38108f2c2af4194a031ed495b95dbc)
2025-05-14 20:08:15 +02:00
Rick Macklem
2773c07181 mountd: Fix updating the network/host(s) for an exports line
Mountd reloads the exports(5) file(s) when it receives a SIGHUP
and then compares the old and new exports, updating any ones that
have changed in the kernel.

Without this patch, mountd failed to recognize that a network/host(s)
had changed, if there was no other change to the exports line.
As such, the change of network/hosts(s) did not take effect until
the mountd daemon was (re)started.

This patch fixes the code so that it checks for changes in
the network/host(s) list for an exports line.

PR:	286260
Approved by:	re (cperciva)

(cherry picked from commit 68daa781c1)
(cherry picked from commit 37abcf06f2100eeca41dbd67f8ca8228903ce5e8)
2025-05-04 12:13:49 -07:00
Alan Somers
f8b102d9bb ctld: correctly parse LUN size on 32-bit arches
Disk offset values must always be 64-bit, not size_t.

PR:		214874
Submitted by:	pprocacci@gmail.com
Event:		January 2025 Bug-busting session

(cherry picked from commit f26fe2c666)
2025-04-17 17:39:08 -06:00
Christos Margiolis
84ed51c412 pkg.7: Add example for fetching package for different FreeBSD versions
MFC after:	1 week
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D49580

(cherry picked from commit 8900283fa3)
2025-04-08 03:04:51 +02:00
Mark Johnston
931dec4044 mixer tests: Serialize
These tests modify attributes of a global mixer device, and aren't
prepared to run in parallel.

(cherry picked from commit c6b41ba650)
2025-04-06 18:04:12 +00:00
Kristof Provost
c844e84845 snmp_pf: fix pfInterfacesIfRefsState
pfInterfacesIfRefsState was described as 'Null', which upset bsnmpwalk's attempt
to resolve OIDs to symbolic names:

> bsnmpwalk: Error adding leaf pfInterfacesIfRefsState to list

This was done back in d6d3f01e0a, because we don't return this value any
more. Return it to 'Unsigned32', which fixes things, even if we still don't
actually return this value.

While here update the ORGANIZATION to reflect current ownership.

Reviewed by:	philip
MFC after:	2 weeks
Event:		Tokyo Hackathon 202503
Differential Revision:	https://reviews.freebsd.org/D49413

(cherry picked from commit 712309a645)
2025-04-03 18:41:25 +02:00
Mark Johnston
69c5f7b4ca pkg: Fix Coverity warnings
- Fix allocation size in config_get_repositories().
- Fix a memory leak in read_conf_file().
- Avoid a null pointer dereference in an error path in
  verify_pubsignature().

Fixes:	e3b4a51580 ("pkg(7): expand VERSION_MAJOR, VERSION_MINOR, RELEASE and OSNAME")
Fixes:	dc4581589a ("pkg: clean support for repositories")
(cherry picked from commit c1557708f1)
2025-03-26 08:48:01 -07:00
Ahmad Khalifa
c6d3271fe0 Copy the new ia32 loader
This handles copying in install-boot.sh and bsdinstall's bootconfig.

install-boot.sh:
make_esp_file now optionally takes extra arguments so it can copy
multiple files. This is used by the amd64 release scripts.
make_esp_device also takes an extra optional argument for efibootname.
This is currently unused, but it can be used in the future to do
something like:
make_esp_device loader.efi bootx64
make_esp_device loader_ia32.efi bootia32

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1098

(cherry picked from commit 599273f942)
2025-03-25 19:28:38 -06:00
Rick Macklem
f03c886912 nfsd.8: Note that the -n option is deprecated
PR#284616 reported that --maxthreads did not
obey the 256 thread limit defined as MAXNFSDCNT in nfsd.c.

This is actually a feature and not a bug, since many NFS
servers will now want to run more than 256 threads and
--maxthreads can be used to set the upper bound on the
number of threads. (MAXNFSDCNT was used long ago to
define how many daemons would be forked, before daemons
were replaced by kernel threads.)

However, the nfsd.8 man page was misleading, since it
indicated that "-n" was the equivalent to setting both
--minthreads and --maxthreads to the same value.
This patch fixes the man page.

This is a content change.

PR:	284616

(cherry picked from commit f27afbd850)
2025-03-25 14:35:53 -07:00
Jamie Gritton
0d6ed98ef3 MFC jail: add jexec -d, to specify a working directory
PR:		283170
Submitted by:	DtxdF at disroot.org

(cherry picked from commit d56f3b051f)
2025-03-08 19:43:51 -08:00
Mark Johnston
bec64e75a5 bhyve: Avoid holding /dev/pci open unnecessarily
Some device models, LPC in particular, will call pci_host_read_config()
when probing for devices.  Currently this results in pcifd_init()
opening /dev/pci, and thus bhyve holds the fd open even when it's not
needed.

Modify pci_host_{read,write}_config() to open /dev/pci independent of
the global pcifd.  This means that these routines can only be used
during VM initialization, as capsicum will prevent further opens
afterward.  Introduce internal wrappers which use the global pcifd,
intended for the passthru code.

Reviewed by:	jhb
MFC after:	3 weeks
Fixes:		563fd2240e ("bhyve: export funcs for read/write pci config")
Differential Revision:	https://reviews.freebsd.org/D48908

(cherry picked from commit 649a910e34)
2025-03-07 22:51:49 +00:00
Baptiste Daroussin
0bd3f757f9 pkg(7): expand VERSION_MAJOR, VERSION_MINOR, RELEASE and OSNAME
Catchup with pkg(8) by expanding more variable when parsing repositories
The only missing variable now is ARCH, this will have to wait for
pkg 2.0 to be the lowest supported version.

(cherry picked from commit e3b4a51580)
2025-03-06 16:39:14 +01:00
Baptiste Daroussin
2b8f8ede6e pkg(7): support configuration overwrite like pkg(8)
with pkg(8) it is possible to overwrite a configuration like adding
FreeBSD {
	enabled: false
}

in /usr/local/etc/pkg/repo/overwrite.conf which allows to change any
value which can have been reviously configured in anything in
/etc/pkg/*.conf

now the bootstrap supports the same

MFC After:	3 weeks

(cherry picked from commit 5c341fe512)
2025-03-06 16:38:16 +01:00
Baptiste Daroussin
c7c3f8dbcf pkg: make sure the repositories have at least an url
While here, factorize code to free the repository structure

(cherry picked from commit eccf736c3c)
2025-03-06 16:37:51 +01:00
Baptiste Daroussin
7be3ea2e64 pkg: clean support for repositories
Rework the way the bootstrap fetches pkg, by implementing a full support
for the repositories, the boostrap will now loop over all available repo
and try to fetch the full package from there. It will at the first valid
package found.

Fallback to packagesite (which has been deprecated for a while) if needed, by
transforming it into a repo, if no repo is found.

MFC After:	3 weeks

(cherry picked from commit dc4581589a)
2025-03-06 16:31:35 +01:00
Konstantin Belousov
8ebb0781f5 acpidump: do not use pointer arithmetic to check for overflow
PR:	204945

(cherry picked from commit 8c108dccd7)
2025-03-05 02:51:29 +02:00
Ed Maste
e4bcef6dab makefs: Make cd9660 Rock Ridge inodes reproducible
Rock Ridge extensions include an inode field:

    "POSIX File Serial Number" shall have the same meaning as and may be
    used for the st_ino field of POSIX:5.6.1. This field shall be
    recorded according to ISO 9660:7.3.3. Directory Records which share
    the value of this field are defined as links (see POSIX:2.2.2.17)
    and, by definition, point to the same file or directory.

Previously we'd store the source file's st_ino (except that in metalog
mode we'd record 0 for files with nlink = 1).  This had two issues: the
generated ISO image was nonreproducible due to the arbitrary inode
numbers, and files without hard links would falsely be detected (by
certain tools) as hard links to each other.

Note that the kernel's cd9660(5) file system ignores the Rock Ridge
PX File Serial Number, so this issue isn't observed by mounting such a
file system.

Instead of using the source inode directly, assign target inode numbers
sequentially.  Use a map so that files with the same source inode (hard
links) still receive the same target inode number.

PR:		284795
PR:		285027
Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49141

(cherry picked from commit 518cdd344e)
(cherry picked from commit 337f5e7a44)
(cherry picked from commit a18be39aaf)
2025-03-04 15:57:26 -05:00
Eygene Ryabinkin
666f8246c3 iwmbtfw(8): fix getopt flags, unify usage()/manual page contents
Seems like there was an intention to use command line switches
-m, -p and -v (each with argument), but there is no handling
for them.

Also, some enhancements to the usage()/manpage:

 - use FreeBSD manpage style -- square brackets -- for denoting
   optional arguments in usage();

 - show default directory path in usage();

 - update manual: -f is the optional flag;

 - show descriptions for -I/-D together: they are logically related.

Signed-off-by:	Eygene Ryabinkin <rea@FreeBSD.org>
Reviewed by:	wulf
MFC after:	1 month

(cherry picked from commit 0feaf865ce)
2025-03-01 12:36:39 +03:00