Compare commits

...
989 Commits
Author SHA1 Message Date
Colin Percival 7aedc8de64 Update in preparation for 15.0-RELEASE
- Bump BRANCH to RELEASE
- Add the anticipated RELEASE announcement date
- Set a static __FreeBSD_version

Approved by:	re (implicit)
2025-11-28 00:00:00 +00:00
Colin Percival 463cec10a5 pkg: Move FreeBSD-base to pkg.freebsd.org
Rather than fetching packages directly from the CDN which currently
backs pkgbase.freebsd.org, requests will go to pkg.freebsd.org mirrors
and be 302ed to the correct servers.  This adds ~70 seconds to the
process of installing or upgrading a pkgbase system; it also orphans
systems with 15.0-{PRERELEASE,ALPHA*,BETA*} installed since they are
expecting to see pkgbase files signed with the pkg keys, not the new
pkgbase signing keys.

Approved by:	re (cperciva)
Reviewed by:	dch, philip
MFC after:	immediately (for 15.0-RELEASE)
With hat:	re
Requested by:	clusteradm, core
Differential Revision:	https://reviews.freebsd.org/D53964

(cherry picked from commit a3b0902d73)
(cherry picked from commit 0c87d29a54)
2025-11-27 14:40:59 -08:00
Olivier Certner 20ebb6ec5a mdo.1: Document group-related and fine-grained control functionalities
This is a manual page update describing the functionality that was added
to mdo(1) in commit 3ca1e69028 ("mdo(1): Add support and shortcuts for
fully specifying users and groups").  Please either refer to that commit
or the new manual page's content for more information.

While here:
- Add to the introduction a description of process credentials and some
  specific vocabulary that is used throughout the page, as well as the
  relationship between mdo(1) and mac_do(4).
- Update the HISTORY section.
- Add AUTHORS and SECURITY CONSIDERATIONS sections.

Approved by:	re (cperciva)
Reviewed by:    ziaee
MFC after:      1 minute
Sponsored by:   The FreeBSD Foundation
Sponsored by:   Google LLC (GSoC 2025)
Co-authored-by: Kushagra Srivastava <[email protected]>
Differential Revision:  https://reviews.freebsd.org/D53905

(cherry picked from commit 73dd00f2fd)
(cherry picked from commit dc75034792)
2025-11-26 17:57:24 -08:00
Colin Percival f73d78e3ff bsdinstall: Ignore -p[0-9]+ in determining BRANCH
The patch level is not part of the branch per se and should not be
used in constructing the FreeBSD-base.conf file used by bsdinstall.

Approved by:	re (cperciva)
MFC after:	1 day

(cherry picked from commit d45816f369)
(cherry picked from commit 56275b7b06)
2025-11-26 17:57:20 -08:00
Gordon Tetlow c7ccd5b3f8 Add UPDATING entry and bump version number.
Approved by:	so
Approved by:	re (cperciva)
2025-11-26 08:12:45 -08:00
Gordon Tetlow dabd406d99 Mitigate YXDOMAIN and nodata non-referral answer poisoning.
Add a fix to apply scrubbing of unsolicited NS RRSets (and their
respective address records) for YXDOMAIN and nodata non-referral
answers. This prevents a malicious actor from exploiting a possible
cache poison attack.

Approved by:	so
Approved by:	re (cperciva)
Obtained from:	NLnet Labs
Security:	FreeBSD-SA-25:10.unbound
Security:	CVE-2025-11411
2025-11-26 08:04:39 -08:00
Chuck Silvers 4f2d5bcdbf nda: fix setting of unmappedio flag
The upstream refactoring of ndaregister() to split out ndasetgeom()
accidentally used an uninitialed variable to decide whether or not
to set DISKFLAG_UNMAPPED_BIO.  Fix this by moving that portion of
ndasetgeom() back up to ndaregister().  The check for PIM_UNMAPPED
is not really needed because nvme devices always have that set,
so it cannot change in the other path that ndasetgeom() is now called.

Approved by:	re (cperciva)
Reviewed by:	cperciva, gallatin, imp
Fixes:		dffd882d12
Sponsored by:	Netflix
MFC After:	1 minute
(cherry picked from commit 2b4dbad2db)
(cherry picked from commit e271f9327f)
2025-11-25 15:41:38 -08:00
Minsoo Choo 020e15a901 jemalloc: apply freebsd changes to jemalloc 5.3.0 man page
Approved by:	re (cperciva)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1890

(cherry picked from commit 80ec82aba9)
(cherry picked from commit cbe0ccde66)
2025-11-25 14:58:58 -08:00
Minsoo Choo cda51d06f9 jemalloc: import jemalloc 5.3.0 man page
Approved by:	re (cperciva)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1890

(cherry picked from commit bf4c7487f2)
(cherry picked from commit 6162f863ce)
2025-11-25 14:58:55 -08:00
Colin Percival 91e2d7b9b2 15.0: Update to RC4
This will hopefully be the final RC build before the release.

Approved by:	re (implicit)
2025-11-24 09:42:12 -08:00
Mark Johnston 76883b793d inotify: Work around the vput() bug directly
For 15.0, apply a minimal fix which at least ensures that inotify can't
trigger the latent race described in commit 99cb3dca47 ("vnode: Rework
vput() to avoid holding the vnode lock after decrementing").

Approved by:	re (cperciva)
Reviewed by:	olce, kib
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53774

(cherry picked from commit ebc17879f0)
(cherry picked from commit 1f6e3abf41)
2025-11-24 09:31:16 -08:00
Dag-Erling Smørgrav bada4c39b2 pam_krb5: Fix manual page in MIT case
* Always install the manual page as pam_krb5(8) regardless of which
  version we're using.
* Regenerate it using pod2mdoc instead of pod2man so it doesn't claim
  to be part of “User Contributed Perl Documentation”.
* Put the correct section number in the header and footer.
* Don't cross-reference non-existent pam(7) manual page.

Approved by:	re (cperciva)
Reviewed by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D53885

(cherry picked from commit 961b934407)
(cherry picked from commit 4166181675)
2025-11-23 22:23:11 -08:00
Dag-Erling Smørgrav 8fdafb3966 pam_krb5: Restore allow_kdc_spoof option
Not only does the new pam_krb5 module not have the same allow_kdc_spoof
option that the old one had, its behavior in this matter defaults to
insecure.  Reimplement allow_kdc_spoof and switch the default back.

Approved by:	re (cperciva)
Reviewed by:	cy
Differential Revision:	https://reviews.freebsd.org/D53884

(cherry picked from commit fe5c8baf25)
(cherry picked from commit 2eb030d1c8)
2025-11-23 22:23:08 -08:00
Colin Percival 9f43dc502c release: Ship DVD with only emacs@nox flavour
Contrary to the claim made in a previous commit, removing KDE and
adding all of vim and emacs results in an image which does not fit
into 4.7 GB; to be specific, it lands at 4.722 GB rather than the
claimed 4.689 GB.  (This descrepancy resulted from doing test DVD
image builds using an out-of-date tree, and became visible when the
15.0-RC3 images were built.)

Limit the emacs packages shipped on the DVD to the "nox" flavor;
this brings the disk image down to 4.407 GB, aka under the 4.7 GB
limit for standard DVDs.

Approved by:	re (cperciva)
Fixes:	6cc6beb4c8 ("release: Remove KDE from dvd1.iso")
MFC after:	1 day (for 15.0-RC4)

(cherry picked from commit c8cf5a99f8)
(cherry picked from commit 815f085600)
2025-11-23 22:23:02 -08:00
Gordon Tetlow fb9252e667 Add backup pkgbase signing key held by security-officer.
This key was generated by gordon@ (aka security-officer@) on an offline
system as a backup key should anything happen to the AWS Key
Management Service that is currently in use for signing pkgbase
repositories for FreeBSD 15.x.

Approved by:	re (cperciva)
Reviewed by:	cperciva
With hat:	so

(cherry picked from commit 12ec49d8fa)
(cherry picked from commit 696b0e2209)
2025-11-23 08:38:52 -08:00
Dag-Erling Smørgrav 54808d5041 cp: Fix copying the root directory
When the source of the copy operation is the root directory, we should
neither append it to the destination path on FTS_D nor trim it back off
on FTS_DP.

Approved by:	re (cperciva)
PR:		291132
MFC after:	3 days
Fixes:          82fc0d09e8 ("cp: Partly restore symlink folllowing.")
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D53863

(cherry picked from commit fe836c5012)
(cherry picked from commit c4843e5805)
2025-11-23 08:38:48 -08:00
Alexander Ziaee d84de55c15 loader.8: Document module commands
Begin documenting module loader commands in loader(8), where the reader
would look for them. Segregate them by their availability in individual
loader implementations, like build(7) targets.
These details were graciously donated by kevans.

Approved by:	re (cperciva)
MFC after:		3 days
Reviewed by:		kevans
Co-authored-by:		Kyle Evans <[email protected]>
Differential Revision:	https://reviews.freebsd.org/D50727

(cherry picked from commit 6fb0d67819)
(cherry picked from commit 513b9db1a8)
2025-11-23 08:38:45 -08:00
Alexander Ziaee bba7812141 loader manuals: Clarify console and boot_serial
console=comconsole is for the loader and boot_serial is for the kernel.

I think we should centralize documentation on the loader settings in one
manual, such a loader.8. The current proliferation is not obvious where
to find the documentation. To the user, these are all set in loader.conf
or at the loader prompt.

Approved by:	re (cperciva)
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D53695

(cherry picked from commit 09ffaa4e07)
(cherry picked from commit 3035855815)
2025-11-23 08:38:41 -08:00
Alexander Ziaee f7fd040e3b freebsd-tips: Add a shell function for laptops
Approved by:	re (cperciva)
MFC after:		3 days
Reviewed by:		pauamma_gundo.com
Differential Revision:	https://reviews.freebsd.org/D53748

(cherry picked from commit 42d9ae4945)
(cherry picked from commit f0bb9d28eb)
2025-11-23 08:38:38 -08:00
Alexander Ziaee 56f49dd3a0 vt.4: Document increasing scrollback size
Approved by:	re (cperciva)
MFC:			immediately as 2 llms say this is impossible
Reviewed by:		adrian, emaste
Differential Revision:	https://reviews.freebsd.org/D53860

(cherry picked from commit a8740ba860)
(cherry picked from commit 2da71ee296)
2025-11-23 08:38:34 -08:00
Alexander Ziaee a14c4d0708 dmesg.8: Index kern.msgbuf_show_timestamp
This is the only place this important debugging tunable is documented.
Mark it up with the Va macro according to style.mdoc(5) so that people
can find it via `apropos Va=kern.msg`, the standard syntax to search
the FreeBSD manual for sysctls and tunables.

Approved by:	re (cperciva)
Fixes:	6910fee62e (dmesg: Document kern.msgbuf_show_timestamp)
(cherry picked from commit e13664f6a4)
(cherry picked from commit 1c0668c5b3)
2025-11-23 08:38:28 -08:00
Colin Percival 4579378a95 15.0: Update to RC3
Approved by:	re (implicit)
2025-11-21 00:00:00 +00:00
Colin Percival 07b7bd2311 release: Remove KDE from dvd1.iso
Prior to this commit, we were shipping 2155 MB of packages (from the
ports tree, not counting pkgbase) on dvd1.iso.  Due to the amount of
space required by shipping pkgbase packages *and* distribution sets
on the DVD images, we only have 1696 MB available if we want to fit
into the 4.7 GB limit for DVDs.  Many users have indicated that this
is indeed important.

It is practically impossible to hit this target without removing KDE;
while KDE and its dependencies narrowly fit (1550 MB), we exceed the
limit as soon as we include either of freebsd-doc-all or gnome.  While
we would pick KDE over GNOME (surveys regularly indicate that KDE is
the more widely used of the two), we believe that documentation is the
most important thing to include.

Since removing KDE leaves a bit of extra space, add editors/emacs and
editors/vim.  This takes the 15.0 amd64 dvd1.iso up to 4.689 GB. [1]

Approved by:	re (cperciva)
Requested by:	adamw [1]
MFC after:	immediately (for 15.0-RC3)
Differential Revision:	https://reviews.freebsd.org/D53800

(cherry picked from commit 6cc6beb4c8)
(cherry picked from commit 142df248ac)
2025-11-19 13:37:24 -08:00
Wanpeng Qian e4416d1e95 nvme_sim: signal namespace depature
Signal when the namespace is gone so we can tear down the disk when a
nvme drive is removed.

Approved by:	re (cperciva)
Reviewed by: 		imp
Differential Revision:	https://reviews.freebsd.org/D33032

(cherry picked from commit 4640f50089)
(cherry picked from commit b7ffac0454)
2025-11-19 13:37:21 -08:00
Wanpeng Qian da71efa95d nvd: handle namespace changes
Signal the new media size when the namespace changes size.

Approved by:	re (cperciva)
Reviewed by: 		imp
Differential Revision:	https://reviews.freebsd.org/D33032

(cherry picked from commit bd769e73d8)
(cherry picked from commit 96a7ed1e7f)
2025-11-19 13:37:19 -08:00
Wanpeng Qian ecfb0e51b2 nda: React to namespace change events
Register for AC_GETDEV_CHANGED. When we receive a namespace
notification, we only create a new device if it was unconfigured. If it
was configured, generate this async event. Rely on the fact that we
reconstruct namespace to just get the data from the identify data and
call disk_resised.

Approved by:	re (cperciva)
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D33032

(cherry picked from commit 86d3ec359a)
(cherry picked from commit 9a465b37ea)
2025-11-19 13:37:15 -08:00
Wanpeng Qian 0ccc71de62 nvme: Refactor geom setting to function.
Refactor setting of geometry for the disk to its own function. No
functional changes.

Approved by:	re (cperciva)
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D33032

(cherry picked from commit dffd882d12)
(cherry picked from commit 31412fda9f)
2025-11-19 13:37:12 -08:00
Wanpeng Qian 2c5edd4860 nvme: Notify namespace changes better
When we get a namespace notification, we have to reconstrut the
namespace to get the new identification data from the namespace. For
each namespace in the AEN, we will reconstrict it before we call the
notification. We also flag it as changed for the duration of the change
callback (prior versions of the patch needed to keep track, but we no
longer do, so this bit may be removed). Note when we've seen the
namespace so we can notify when it goes away.

Approved by:	re (cperciva)
Co-authored-by: imp
Differential Revision: https://reviews.freebsd.org/D33032

(cherry picked from commit 20e94950c5)
(cherry picked from commit fe6ee00d17)
2025-11-19 13:37:09 -08:00
Warner Losh 7b31e6a121 nvme: Fix backwards sense of error condition
b21e67875b tested for the good condition, not the error condition, so
we'd never do anything else in this function. This was causing certain
logging not to happen, and also prevented forthcoming namespace size
change code from working as well.

Approved by:	re (cperciva)
Fixes: b21e67875b
Sponsored by: Netflix
(cherry picked from commit 27481c2689)
(cherry picked from commit fd737810a1)
2025-11-19 13:37:05 -08:00
Martin Matuska c30f4ada16 zfs: fix aarch64 build after zfs-2.4.0-rc4
Approved by:	re (cperciva)

(cherry picked from commit fb709935d6)
(cherry picked from commit 484fa40ca7)
2025-11-19 13:37:03 -08:00
Martin Matuska d10ce383bc zfs: update zfs_config.h and zfs_gitrev.h to zfs-2.4.0-rc4
While here, fix compilation be unhiding zfs_tunables hidden in 5714090fb

Approved by:	re (cperciva)

(cherry picked from commit 7128544353)
2025-11-19 13:36:59 -08:00
Martin Matuska 7b5b0f43eb zfs: merge openzfs/zfs@099f69ff5 (zfs-2.4-release) into stable/15
OpenZFS 2.4.0 rc4

Notable upstream pull request merges:
 #17477 1e8c96d7d Add knob to disable slow io notifications
 #17792 5582e8b08 Update dnode_next_offset_level to accept blkid
                  instead of offset
 #17872 584762617 Pass flags to more DMU write/hold functions
 #17875 178a8be21 BRT: Round bv_entcount up to BRT_BLOCKSIZE
 #17875 e3acd0a72 Fix caching of DDT log and BRT
 #17877 67fc49433 Cleanup ZIO_FLAG_IO_RETRY vs TRYHARD usage
 #17824 dda711dbb Fix gang write late_arrival bug
 #17890 41878d57e Add BRT support to zpool prefetch command
 #17903 aaf374bd4 ZIO: Set minimum number of free issue threads to 32
 #17906 ac0bc4cc0 spa_misc: add an API for spa_namespace_lock
 #17908 583db4003 FreeBSD: Add support for _PC_CASE_INSENSITIVE
 #17911 -multiple Update library ABI versions for v2.4.0
 #17915 e305c7d59 BRT: Fix ranges to blocks conversion math
 #17916 002bc3da6 BRT: Increase block size from 4KB to 8KB
 #17921 e895c7619 ZAP: Remove dmu_object_info_from_dnode() call

Approved by:	re (cperciva)
Obtained from:	OpenZFS
OpenZFS commit:	099f69ff5d
OpenZFS tag:	zfs-2.4.0-rc4

(cherry picked from commit 155d5b8a19)
2025-11-19 13:36:55 -08:00
Poul-Henning Kamp d02a08f899 iichid: The IICHID spec defines the response to the RESET command as two bytes of zeros.
Our recent changes to iichid.c has caused us to attempt to read a
full REPORT instead, and at least one keyboard hangs solid when we
do that.

This patch changes us to be spec-compliant.

Approved by:	re (cperciva)
Differential Revision: https://reviews.freebsd.org/D53803
MFC after: 1 day
Approved by: re(ccperciva)

(cherry picked from commit 5d53462af1)
(cherry picked from commit d61be9d994)
2025-11-19 13:36:49 -08:00
Colin Percival 476aca4985 UPDATING: Document FreeBSD-base pkg .conf shuffle
Approved by:	re (cperciva)
Reminded by:	yasu
MFC after:	3 days

(cherry picked from commit 6ccdd2fc23)
(cherry picked from commit fa546e9d18)
2025-11-19 13:36:44 -08:00
Colin Percival 7bd80d8ee0 15.0: Update to RC2
Approved by:	re (implicit)
2025-11-17 18:22:00 -08:00
Colin Percival f66279332f release: Add a MISSING_METALOGS hack to VMs
The packages for 15.0-RELEASE built without the bug fix needed to make
files created via @sample get properly listed in METALOG.  Fix the
cloudware which contain @sample-using packages by adding the necessary
files to METALOG manually.

This should be reverted after the next full package build, and live on
only in releng/15.0.

Approved by:	re (cperciva)
Reviewed by:	markj
MFC after:	immediately (15.0-RC2)
Differential Revision:	https://reviews.freebsd.org/D53797

(cherry picked from commit f6e9474ebd)
(cherry picked from commit 96468730a2)
2025-11-17 18:20:38 -08:00
Colin Percival 0f4c3dcd1e GCE: Add /usr/src and /usr/ports to METALOG
We ship these in order to comply with GCE Marketplace rules about
providing source code and licenses for all the software we ship as
part of images.

Approved by:	re (cperciva)
Reviewed by:	markj
MFC after:	immediately (15.0-RC2)
Differential Revision:	https://reviews.freebsd.org/D53796

(cherry picked from commit 0dbb00733c)
(cherry picked from commit 10ef3bf823)
2025-11-17 18:20:35 -08:00
Colin Percival fb51f37070 release: Add /boot/loader.conf to some cloudware
These were forgotten during the METALOGization process earlier.

Approved by:	re (cperciva)
Reviewed by:	markj
MFC after:	immediately (for 15.0-RC2)
Differential Revision:	https://reviews.freebsd.org/D53795

(cherry picked from commit 86c63597f2)
(cherry picked from commit 0e737642f2)
2025-11-17 18:20:30 -08:00
Colin Percival c87b89d053 vmimage.subr: Log correct paths into METALOG
Paths all need to start with "./" because that's what newfs wants.

Approved by:	re (cperciva)
Fixes:	e0c41af925 ("vmimage.subr: Enable FreeBSD-base repo if pkgbase")
MFC after:	immediately

(cherry picked from commit aa33b6b820)
(cherry picked from commit e1560c8ba6)
2025-11-16 09:14:46 -08:00
Colin Percival da0c913638 15.0: Update to RC1
Approved by:	re (implicit)
2025-11-15 19:37:00 -08:00
Colin Percival acf90099fe 15.0: Switch from "quarterly" to "release" pkgs
Approved by:	re (implicit)
2025-11-15 19:36:43 -08:00
Colin Percival 1ef6b8e068 vmimage.subr: Don't log missing files from pkgs
When installing "extra" packages (aka those built from the ports tree),
we record everything being installed in METALOG.pkg; the contents of
that file is appended to METALOG before we generate the filesystem.

There are two cases when files recorded in METALOG.pkg will no longer
exist by the time we create the final disk image:
1. If a pkg bug results in false dependencies being installed which
are later removed by "pkg autoremove", and
2. If the pkg we build and install from /usr/ports is older than the
pkg on pkg.freebsd.org, and pkg gets upgraded automatically as part of
installing extra packages.

The ultimate issue in both cases is that there's no mechanism for
removing entries from METALOG when we run 'pkg delete'.

Address this build breakage by checking, line by line, if filesystem
objects mentioned in METALOG.pkg exist before appending them to METALOG.

Approved by:	re (cperciva)
Fixes:	6a13aeac3c ("vmimage.subr: pkg autoremove after pkg install")
MFC after:	immediately (needed for 15.0-RC1)

(cherry picked from commit 78fa6965e9)
(cherry picked from commit 0ff7c92517)
2025-11-15 19:11:26 -08:00
Colin Percival 6ac6550a91 vmimage.subr: autoremove -y
Running 'pkg autoremove' without -y results in VM image builds failing
when (bogusly installed) packages are removed.

Approved by:	re (cperciva)
Fixes:	6a13aeac3c ("vmimage.subr: pkg autoremove after pkg install")
MFC after:	immediately (needed for 15.0-RC1)

(cherry picked from commit 509dfd3690)
(cherry picked from commit 9600598a5c)
2025-11-15 19:11:23 -08:00
Colin Percival 93c5db9e9c vmimage.subr: Enable FreeBSD-base repo if pkgbase
When creating a VM image using pkgbase, create a configuration file in
/usr/local/etc/pkg/repos/FreeBSD.conf which enables the FreeBSD-base
repository.  (This repository is defined in /etc/pkg/FreeBSD.conf as
being disabled by default.)

Approved by:	re (cperciva)
Reported by:	Mark Millard
MFC after:	immediately (needed for 15.0-RC1)

(cherry picked from commit e0c41af925)
(cherry picked from commit aade340587)
2025-11-15 19:11:20 -08:00
Colin Percival 9835413fb0 bsdinstall: Enable FreeBSD-base repo when pkgbase
When performing a pkgbase install, create a configuration file in
/usr/local/etc/pkg/repos/FreeBSD.conf which enables the FreeBSD-base
repository.  (This repository is defined in /etc/pkg/FreeBSD.conf as
being disabled by default.)

Approved by:	re (cperciva)
Reported by:	Mark Millard
Reviewed by:	markj
MFC after:	immediately (needed for 15.0-RC1)
Differential Revision:	https://reviews.freebsd.org/D53777

(cherry picked from commit a96230e032)
(cherry picked from commit 5d9062f258)
2025-11-15 19:11:17 -08:00
Colin Percival dbe26fafc6 vmimage.subr: Log pkg/local.sqlite if pkgbase
We were doing this in vm_extra_install_packages but VM images without
any extra packages installed would not get this installed.  This
results in a pkgbase system which thinks it doesn't have any packages
installed (even though all the files are right there).

Add a "metalog_add_data ./var/db/pkg/local.sqlite" call to the pkgbase
install code path, and make the call from vm_extra_install_packages
conditional on !PKGBASE.

Approved by:	re (cperciva)
Reported by:	Michael Dexter
MFC after:	immediately (needed for 15.0-RC1)

(cherry picked from commit 10a4f2d016)
(cherry picked from commit 6b15dc234d)
2025-11-15 19:11:14 -08:00
Colin Percival 567ba10572 GCE: Don't .error on unsupported targets
We ingest Makefile.gce even when we're not trying to create GCE images
so we don't want to .error here.  Instead, set GCE_ARCH to a dummy
value which should make the problem clear to anyone who attempts to
create GCE images on an unsupported architecture.

Approved by:	re (cperciva)
Reported by:	Jenkins
Fixes:		0a8ecca4e3 ("GCE: Specify the architecture of images")

(cherry picked from commit 787d09753f)
(cherry picked from commit 375f8df26b)
2025-11-15 19:11:10 -08:00
Andrew Jorgensen c0a98d7f9d GCE: Specify the architecture of images
Without a specified architecture, a user can attempt to create an
arm64 instance with an amd64 image or vice versa. With the change
the API will prevent that mismatch.

Approved by:	re (cperciva)

(cherry picked from commit 0a8ecca4e3)
(cherry picked from commit 93769d225f)
2025-11-15 19:11:07 -08:00
Andrew Jorgensen 75ee49d2ed GCE: Add TARGET and FS to image family
GCE image family is meant to be unique per set of image characteristics
so that a user can create instances using the image family instead of the
image name to reliably get a similar image with updated software, but no
other changes.

Without this change, the instances create API would select the most recent
non-deprecated image matching the name, regardless of architecture or
filesystem.

Approved by:	re (cperciva)

(cherry picked from commit fc83e6c5e1)
(cherry picked from commit 0005bb76e2)
2025-11-15 19:11:03 -08:00
Colin Percival 5d832135a9 pkg: Add FreeBSD-base to /etc/pkg/FreeBSD.conf
On -CURRENT and -STABLE this gets bits from pkg.freebsd.org; but we get
base system bits from pkgbase.freebsd.org for BETA/RC/RELEASE.

Note that this repository is disabled by default, but can still be used
by explicitly specifying it, e.g. "pkg upgrade -r FreeBSD-base".

Approved by:	re (cperciva)
With hat:	re
MFC after:	8 hours (needed in 15.0-RC1)

(cherry picked from commit 8e0b1a1c03)
(cherry picked from commit 91e1c18012)
2025-11-15 19:11:00 -08:00
Colin Percival 1b859fdfc7 bsdinstall: Don't install FreeBSD-base.conf
When installing e.g. 15.0-RC1, we want to get files from the 15.0-RC1
pkgbase repository; but running 'pkg upgrade' after installation should
get the latest bits build from releng/15.0.

Approved by:	re (cperciva)
With hat:	re
MFC after:	8 hours (needed in 15.0-RC1)

(cherry picked from commit bdfc223c7a)
(cherry picked from commit e4bc038ef8)
2025-11-15 19:10:57 -08:00
Colin Percival f852655889 bsdinstall: Use pkgbase.f.o for BETA/RC/RELEASE
For BETA/RC/RELEASE builds, fetch files from the appropriate repository
on pkgbase.freebsd.org, using the appropriate signing keys.  Note that
there is a separate repository for each BETA and RC; this ensures that
someone installing from e.g. a 15.0-RC1 ISO will get 15.0-RC1 bits and
not whatever happens to be the most recent build from releng/15.0.

Approved by:	re (cperciva)
With hat:	re
MFC after:	8 hours (needed in 15.0-RC1)

(cherry picked from commit 51184e38c9)
(cherry picked from commit 2ce97e8003)
2025-11-15 19:10:54 -08:00
Colin Percival a13564a16f Add pkgbase signing keys for FreeBSD 15
These keys were generated by cperciva@ using the AWS Key Management
Service.  They will not be used for signing anything other than
FreeBSD 15.x pkgbase repositories.

Keys will be generated for FreeBSD 16 at a later date, and likely in
a different way.

Approved by:	re (cperciva)
With hat:	re
MFC after:	8 hours (needed in 15.0-RC1)
Differential Revision:	https://reviews.freebsd.org/D53768

(cherry picked from commit b05f38262b)
(cherry picked from commit 01ba48e113)
2025-11-15 19:10:51 -08:00
Colin Percival d347f4a2ee bsdinstall: Copy in all keys
The keys used for pkgbase signing are going to be placed in
/usr/share/keys/pkgbase-N where N is the FreeBSD major version
number; as such it's not sufficient to copy /usr/share/keys/pkg
into the install chroot, but instead we need /usr/share/keys/*.

Approved by:	re (cperciva)
With hat:	re
MFC after:	8 hours (needed in 15.0-RC1)
Differential Revision:	https://reviews.freebsd.org/D53753

(cherry picked from commit 6b0909f940)
(cherry picked from commit 7c98b725a7)
2025-11-15 19:10:46 -08:00
Mark Johnston 4f0b477080 arm64/vmm: Fix handling of MDCR_EL2.TDE
TDE (make EL2 the target EL for debug exceptions) is set both when
setting guest breakpoints and when single-stepping the guest.  In some
cases we may configure both capabilities, and when subsequently
disabling one of them we need to take care to avoid clearing TDE if the
other is still configured.

Approved by:	re (cperciva)
MFC after:	3 days
Fixes:		75cb949228 ("arm64/vmm: Add breakpoint and single-stepping support")
Sponsored by:	CHERI Research Centre (EPSRC grant UKRI3001)

(cherry picked from commit b6f25aca11)
(cherry picked from commit 295f7255a3)
2025-11-15 18:00:36 -08:00
Mark Johnston a44a95b001 arm64/vmm: Don't set MDSCR_EL1.KDE when enabling single-stepping
When VHE mode is enabled, this results in a hang on the host.  In
particular, when MDSCR_EL2.KDE is set to 1 and the CPU is executing at
EL_D, i.e., EL2, debug exceptions are enabled. In non-VHE mode, we call
into the guest by trapping to EL2, which implicitly masks debug
exceptions by setting PSTATE.D. However, in VHE mode, PSTATE.D remains
clear, so when the guest's MDSCR_EL1 value is loaded, we immediately
begin single-stepping.

In non-VHE mode there is no need to set KDE either, so just stop setting
it.

Approved by:	re (cperciva)
Reviewed by:	andrew
MFC after:	3 days
Sponsored by:	CHERI Research Centre (EPSRC grant UKRI3001)
Differential Revision:	https://reviews.freebsd.org/D48965

(cherry picked from commit ac0032344c)
(cherry picked from commit 47fdacee69)
2025-11-15 18:00:30 -08:00
Olivier Certner b0447186a6 setcred(): Fix 32-bit compatibility copy-in
For 32-bit processes on 64-bit architectures, a difference of 'int'
pointers was wrongly used as a number of bytes to copy in a memcpy()
used to internally construct a 64-bit 'struct setcred' from the 32-bit
variant, leading to copying only part of the 32-bit structure, and thus
to requesting credentials with garbage IDs except for the real and
effective user IDs.

This bug was spotted by jhb@, who produced a slightly more invasive fix
in D53757 (a switch to using CP() on all fields).  In the interest of
minimizing the diff for possible inclusion in 15.0, the commit here just
limits itself to fixing the number of bytes to copy.

Tested successfully on a VM with 32-bit mdo(1) (and in passing also
tested that the same executable on a kernel without this change exhibits
the bug in practice, in the form of setcred() failing with EINVAL).

Reported by:    jhb
Reviewed by:    jhb
Fixes:          ddb3eb4efe ("New setcred() system call and associated MAC hooks")
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D53767

(cherry picked from commit 4872b48b17)

For the insta-MFC to stable/15:
Approved by:    re (cperciva)

(cherry picked from commit 190e6d6795)
2025-11-15 07:05:11 -08:00
Lexi Winter e13fa6418f libpam: Don't put man8 in the dev package
These are user-facing manpages, but were installed in the runtime-dev
package since the PAM modules use bsd.lib.mk.  Use MANNODEV instead of
MAN to put them in the base runtime package instead.

Approved by:	re (cperciva)
Fixes:  031e711647 ("packages: Install development manpages in the -dev package")
MFC after:	3 days
Reviewed by:	bapt
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53601

(cherry picked from commit b1972bd9a0)
2025-11-15 06:43:09 -08:00
Kyle Evans 81f61990b2 lam: fix using stdin more than once
Historically, lam(1) closes stdin once we've hit EOF the first time,
which would stop it from doing anything else on subsequent gatherline()
calls with another openfile.  However, this doesn't seem to be strictly
necessary- the EOF flag on FILEs is quite sticky, so we can assume that
a subsequent fgetc(stdin) will flag EOF properly.

This 'fixes' the below-referenced commit in the sense that it surfaced
this problem as a fatal error, but the issue was pre-existing.  If we
do `lam - -`, then one gatherline() will fclose(stdin) and set `ip->eof`
for *that* openfile, while the next one will then observe that
STDIN_FILENO has been closed and turn it into an EBADF.

Add a few tests that were easy to snipe while I'm here, but I haven't
aimed for anything close to exhaustive because I think re@ would prefer
this fix go in sooner rather than later to land in 15.0.

Minor style adjustment for the previous commit while we're here.

Approved by:	re (cperciva)
Reported by:	cperciva
Discussed with:	jrtc27
Reviewed by:	des, jlduran
Fixes:	4472fd66d0 ("lam: fail on I/O errors")
Sponsored by:	Klara, Inc.

(cherry picked from commit 6a9452c837)
(cherry picked from commit 1d678ba575)
2025-11-15 06:43:05 -08:00
Muhammad Moinur Rahman 279213eb62 Retire pccard(4)
pccard has been declared obsolete for a long time and also the
support has been removed but the man page still exists. It mentions
being scheduled to be removed before 13.0 but it still exists in the
tree.

[Extracted from review D53434]

Approved by:	re (cperciva)
Reviewed by: emaste
Fixes: 31b35400c ("pccard: Remove more of the PC Card infrastructure")

(cherry picked from commit 5b9fba1cb0)
(cherry picked from commit 8bafd2f052)
2025-11-15 06:42:56 -08:00
Jiacong Fang f1d3ed77c9 mpr.4: Add Broadcom LSI 3808 to HARDWARE
The product brief "MegaRAID 9500 PCIe Gen 4.0 Tri-Mode Storage Adapters"
confirms that the LSI 3808 are supported in FreeBSD.

https://docs.broadcom.com/doc/MegaRAID-9500-Tri-Mode-Storage-Adapters

Approved by:	re (cperciva)
MFC after:		3 days (squashed with fixup commit)
Reviewed by:		imp, ziaee
Differential Revision:	https://reviews.freebsd.org/D52760

(cherry picked from commit 744c8d5544)
(cherry picked from commit 8caf467784)
(cherry picked from commit 00008dae20)
2025-11-13 18:35:05 -08:00
Yogesh Bhosale 9ca96ef84f ix.4: Add E610 to HARDWARE section
Approved by:	re (cperciva)
MFC after:		3 days
Reviewed by:		ziaee
Fixes:			dea5f973d0 (new Intel Ethernet E610 family)
Differential Revision:	https://reviews.freebsd.org/D52990

(cherry picked from commit abd53b16c0)
(cherry picked from commit 1a1e30b355)
2025-11-13 18:35:03 -08:00
Alexander Ziaee 9465b903fb sbp.4: Add a hardware section, fix markup nits
+ tag SPDX
+ add sysctl to apropos database
+ fix markup of examples and reflow a overly long line
+ add a hardware section for hw relnotes

Approved by:	re (cperciva)
MFC after:	3 days

(cherry picked from commit dee8e38f52)
(cherry picked from commit ccf4b4fc42)
2025-11-13 18:35:00 -08:00
Alexander Ziaee 1eebc3a372 mx25l.4: Add n25q64 to hardware list
Approved by:	re (cperciva)
MFC after:	3 days
Fixes:		76735c7439 (flash: Add "n25q64" to mx25l driver)

(cherry picked from commit 595fcd71a8)
(cherry picked from commit bf2345bce5)
2025-11-13 18:34:56 -08:00
Alexander Ziaee 480f0a1d0f mx25l.4: Describe better and tag spdx
Approved by:	re (cperciva)
MFC after:	3 days

(cherry picked from commit 6f73950475)
(cherry picked from commit 9b00b95b21)
2025-11-13 18:34:53 -08:00
Muhammad Moinur Rahman 95fcade817 pcic.4: Remove stale manual
Approved by:	re (cperciva)
MFC after:	2 days (squashed with fixup commit)
Reviewed by:	ziaee
Fixes:		31b35400c (pccard: Remove more of the PC Card)
Discussed with:	bsdimp, emaste, jhb
Extracted from:	https://reviews.freebsd.org/D53434

(cherry picked from commit 1d9f2db7c0)
(cherry picked from commit 6aaf184dc4)
(cherry picked from commit feb8971db4)
2025-11-13 18:34:51 -08:00
Alexander Ziaee 893e5b7020 hgame.4: Polish
Explain driver loading and application access in the body of the manual.
Crossreference other game controller driver manuals, and devfs.rules to
hint about how to configure application access. Add a common dongle to
supported hardware. Add evdev a few places to make it really clear how
it works.

Approved by:	re (cperciva)
MFC after:		immediately for inclusion in 15.0R
Reviewed by:		wulf
Differential Revision:	https://reviews.freebsd.org/D53290

(cherry picked from commit c0c8d812b5)
(cherry picked from commit 31e7ee6bd5)
2025-11-13 18:34:48 -08:00
Alexander Ziaee 14ada82543 jail.8: Add creating a jail from package base
Approved by:	re (cperciva)
MFC after:		immediately for inclusion in 15.0R
Reported by:		ivy
Differential Revision:	https://reviews.freebsd.org/D53745

(cherry picked from commit 477799750a)
(cherry picked from commit f467eb078f)
2025-11-13 18:34:46 -08:00
Alexander Ziaee 16d599da7b jail.8: Add creating a jail from distribution set
Approved by:	re (cperciva)
PR:			200803
MFC after:		3 days
Reviewed by:		jamie
Differential Revision:	https://reviews.freebsd.org/D53631

(cherry picked from commit d59903481d)
(cherry picked from commit 5d7cd576d9)
2025-11-13 18:34:41 -08:00
Robert Clausecker cb9075718b aio: fix alignment of struct (o)aiocb32 on non-amd64
Only i386 has a four-byte alignment for uint64_t, others have
eight-byte alignment.  This causes the structure to mismatch
on armv7 binaries running under aarch64, breaking the aio interface.

Approved by:	re (cperciva)
Fixes:		3858a1f4f5
Approved by:	markj (mentor)
Reported by:	Mark Millard <[email protected]>
Discussed with:	jrtc27
PR:		290962
MFC after:	immediately (for 15.0)

(cherry picked from commit ea26fd52a9)
2025-11-13 18:27:28 -08:00
Mark Johnston c70f6e4f4b stand: Teach the zfs loader about dynamic gang headers
There is a pool feature, dynamic_gang_header, that is enabled by default
in new pools.  When this feature is active, gang headers may be larger
than 512 bytes.  The loader needs to be taught to cope with that.

Try using the vdev ashift to pick the gang block header size.  If the
checksum fails, fall back to the old gang block header size.

This is based on a patch by Paul Dagnelie, with testing, bug-fixing and
some simplifications from me.

Approved by:	re (cperciva)
PR:		289690
Co-authored by:	Paul Dagnelie <[email protected]>
Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53578

(cherry picked from commit 4d6801a6b5)
(cherry picked from commit ae17780c71)
2025-11-13 12:12:21 -08:00
Colin Percival bee506b883 Azure: Fix image names
We need to specify the correct image names -- *.vhdf, not *.vhd -- in
order for them to upload.

15.0 candidate

Approved by:	re (cperciva)
Reviewed by:	lwhsu
MFC after:	2 days
Differential Revision:	https://reviews.freebsd.org/D53684

(cherry picked from commit df84867e8a)
(cherry picked from commit eee338692b)
2025-11-12 10:46:18 -08:00
Bjoern A. Zeeb f490eae83f LinuxKPI: 802.11: clear CONF_IDLE earlier
When starting to scan and ending a scan we clear/set the hardware to
idle.  Similarly we set the hw to idle when we remove the channel
context but when starting we only set it to non-idle when we went from
assoc to run.  This apparently was not a problem most of the time
as the switch from a failed hardware scan to a software scan was
racing against net80211.  ad4ddc83eb fixed that specifically for
rtw88 and while we were more consistently scanning, this broke
authentication as the setting of idle at the end of the scan was
now happening reliably.  Move the unsetting of idle from assoc_to_run
to scan_to_auth for when we  create the chanctx to keep it
symmetrical.  This makes authentication work again for rtw88 (though
not for everyone due to other possible problems with net80211).

This likely also fixes the problems in the listed PRs.

iwlwifi(4) mvm and mld driver parts do not use this information at
all and were never affected.

Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation
PR:		290850, 288186, 281979
PR:		272145 (the non skb-mem-limit parts)

(cherry picked from commit b568711f8e)
(cherry picked from commit a77abd53e8)
2025-11-12 10:46:14 -08:00
Ed Maste c5977a934c 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.

Approved by:	re (cperciva)
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 4109cdf0f8)
(cherry picked from commit 65e347d315)
2025-11-12 10:46:12 -08:00
Michael Tuexen c50312b774 vtnet: fix enabling/disabling tso
Transmit segment offloading depends on transmit checksum offloading.
Enforce that constraint. This also fixes a bug, since if_hwassist bits
are from the CSUM_ space, not from the IFCAP_ space.

Approved by:	re (cperciva)
PR:			290773
Reviewed by:		Timo Völker
Tested by:		[email protected]
Differential Revision:	https://reviews.freebsd.org/D53629

(cherry picked from commit 4c50ac6816)
(cherry picked from commit 0fb0ba51d8)
2025-11-12 10:46:09 -08:00
Michael Tuexen b91bf9f0e2 vtnet: don't provide VIRTIO_NET_HDR_F_DATA_VALID
According to section 5.1.6.2.1 of version 1.3 of the virtio
specification, the driver MUST NOT set VIRTIO_NET_HDR_F_DATA_VALID in
the flags. So don't do that.

Approved by:	re (cperciva)
Reviewed by: 		Timo Völker
Differential Revision:	https://reviews.freebsd.org/D53650

(cherry picked from commit 836b3cd9d7)
(cherry picked from commit 0ef06b5bcc)
2025-11-12 10:46:06 -08:00
Michael Tuexen bd4cf77ba2 tcp: drop SYN ACK segment for listening sockets
When a SYN ACK is received for a listening socket, just drop it
instead of killing the SYN-cache entry and send a RST.
This closes the possibility to kill a TCP connection during its
handling in the SYN-cache.

Approved by:	re (cperciva)
Reviewed by:		Nick Banks, Peter Lei
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D53540

(cherry picked from commit 239464e993)
(cherry picked from commit e082156ae1)
2025-11-12 10:46:02 -08:00
Ed Maste e55b2f0321 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.

Approved by:	re (cperciva)
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 4e36942420)
(cherry picked from commit 980aa8d4cf)
2025-11-10 11:00:15 -08:00
Ed Maste dd1ed088f0 openssh: Handle localtime_r() failure by return "UNKNOWN-TIME"
Apply openssh-portable commit 8b6c1f402feb by [email protected]

Approved by:	re (cperciva)
Obtained from:	openssh-portable
PR:		288773
Reported by:	wosch
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ce03706ab2)
(cherry picked from commit 0a45aa9e95)
2025-11-10 11:00:10 -08:00
David E. O'Brien 0339b24f8d random: Have RANDOM_PURE_START be a cross-platform source
and one that will be with us in the long-term future.
(this helps reduce diffs in the future and for down-stream users
that trim entropy sources).  Also, move deprecated (removed in 16.0)
sources to the bottom of the list to reduce changes to 15.x.

Approved by:	re (cperciva)
Reviewed by:	glebius
Obtained from:	Juniper Networks
Differential Revision:	https://reviews.freebsd.org/D53311
(cherry picked from commit 9f3886347c1750cf80a82314470fc7186088eb9a)
(cherry picked from commit e224f2c1b9)
2025-11-10 10:54:37 -08:00
Bruno Silvestre 40056e8abc netlink: plug lock leak in genl_register_family()
Approved by:	re (cperciva)
PR:		290893
(cherry picked from commit 335fc09ab8)
(cherry picked from commit a3cd3a4fd6)
2025-11-10 10:49:11 -08:00
Mark Johnston ee234a8f17 freebsd-update: Swap pkg(8) flags in check_pkgbase()
Unbootstrapped pkg will ignore -N if -r is specified first.  Flip the
order.

Prior to commit 66c75fa63a this worked by accident.

Approved by:	re (cperciva)
PR:		290393
Reported by:	olgeni
MFC after:	3 days
Fixes:		66c75fa63a ("freebsd-update: Fix the pkgbase check")

(cherry picked from commit 645352316b)
(cherry picked from commit addc0556ce)
2025-11-10 10:49:08 -08:00
Colin Percival 854651d47e release: Add WITHOUT_QEMU to IMAKE
We have NO_ROOT here, so we need WITHOUT_QEMU to avoid problems.

15.0 candidate.

Approved by:	re (cperciva)
Reviewed by:	emaste, markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53637

(cherry picked from commit f89aa18848)
(cherry picked from commit 2e2a460f9a)
2025-11-10 10:49:04 -08:00
Mark Johnston 69c726c150 virtio: Fix polling in virtqueue_dequeue()
The access of vq->vq_ring.used->idx needs to be volatile-qualified,
otherwise the compiler may optimize virtqueue_poll() into an infinite
loop if there is no data available upon the first poll.

Prior to commit ad17789a85 this wasn't a problem since an external
function call after each poll inhibited the optimization.

Approved by:	re (cperciva)
PR:		289930
MFC after:	3 days
Sponsored by:	Klara, Inc.
Fixes:		ad17789a85 ("virtio: Remove the unused poll method")

(cherry picked from commit f999ffdce3)
(cherry picked from commit 72c7604754)
2025-11-07 15:12:02 -08:00
Lexi Winter 3447fc070c atf: Move the tests back to the tests package
Commit 9065390ddc moved atf to its own package, but mistakenly moved
the tests as well.  Put the tests back into the test package.

Approved by:	re (cperciva)
Fixes:	9065390ddc ("packages: Remove the tests-dev package")
MFC after:	1 day
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53594

(cherry picked from commit 4b342830ab)
(cherry picked from commit cdfa913977)
2025-11-06 21:46:58 -08:00
Lexi Winter 5bee2fda67 libcrypto: Install tests in the tests package
libcrypto's Makefile.inc used PACKAGE=openssl, which overrides the
PACKAGE=tests in libcrypto/tests/Makefile.  Use PACKAGE?=openssl
instead to avoid this.  This puts the OpenSSL tests in the tests
package where they belong.

Approved by:	re (cperciva)
MFC after:	1 day
Reviewed by:	manu, ngie
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53595

(cherry picked from commit c3b853fe52)
(cherry picked from commit 4e672f6ff0)
2025-11-06 21:46:49 -08:00
Colin Percival db99e6ce3e 15.0: Update to BETA5
Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-11-06 21:16:10 -08:00
Li-Wen Hsu 58f208591b release: Comply with Azure Marketplace requirements for aarch64
Azure requires the first 1 MB (2,048 sectors) of the OS disk to remain
empty for VM images:

  https://learn.microsoft.com/partner-center/marketplace-offers/azure-vm-certification-faq#vm-images-must-have-1-mb-of-free-space

Also append the BOOTPARTSOFFSET suffix for aarch64 images, which only
has an ESP partition for booting.

Co-authored-by:	Brad Davis <[email protected]>
Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53628

(cherry picked from commit 36095c9420)
(cherry picked from commit 72617603a2)
2025-11-06 21:15:59 -08:00
Alexander Ziaee 715cc30d29 sysrc.8: Rewrite examples for mdoc conformance
Tag SPDX while here. This is not a content change, so do not bump date.

Approved by:	re (cperciva)
PR:		274164
MFC after:	3 seconds

(cherry picked from commit 3f0dd77246)
(cherry picked from commit 9a6e6e9edc)
2025-11-06 20:19:35 -08:00
Alexander Ziaee c66b978205 ciss.4: Add p440ar to HARDWARE
Approved by:	re (cperciva)
PR:		290425
MFC after:	3 seconds, this fixes the HW relnotes
Reported by:	jwb

(cherry picked from commit a41ffaa330)
(cherry picked from commit 801f10b8c7)
2025-11-06 20:19:33 -08:00
Felix Johnson 776626f09e dumpon(8): Add a SYSCTL VARIABLES section
Document debug.minidump and machdep.dump_retry_count sysctl variables.

Approved by:	re (cperciva)
PR:			259393
MFC after:		3 seconds
Reviewed by:		gbe (previous), markj, ziaee
Differential Revision:	https://reviews.freebsd.org/D32618

(cherry picked from commit 850841edf6)
(cherry picked from commit 2608020ac8)
2025-11-06 20:19:30 -08:00
Alexander Ziaee 3a63ca9620 ice.4: Add ToC and E835 and editorial pass
This manual is large enough and well structured enough that we can have
a clickable table of contents. Use that to move some subsections which
should not appear in Hardware Release Note to the description section.
Adjust subsection names so this will work, preserving parentheticals
for search by moving them to the bodies just below.

Strip unnecessary copyright symbols and escaped hyphens. Copyright
symbols never appear in the content of manual pages, including other
Intel manual pages, and appear to break the Hardware Release Notes.
Escaped hyphens were necessary decades ago for manual pages written
in man(7), but this page is written in mdoc(7). Also misc touchups.

Add the recently added E835 devices to the supported HARDWARE list.
Add the speed ranges to description like the other ethernet drivers.

Approved by:	re (cperciva)
PR:		290778
MFC after:      1 day
Fixes:		09b48f811b (Add support for E835-XXV-4 adapter)
Fixes:		b202176dc7 (Add PCI IDs for E835 devices)
Reviewed by:	kgalazka (previous version)
Reported by:	kgalazka (additional hardware has been added)
Reported by:	[email protected] (HW Relnote is truncating)

(cherry picked from commit f30335c5cb)
(cherry picked from commit 71bd17b879)
2025-11-06 20:19:26 -08:00
Brad Davis d1ee21dc55 ice.4: Avoid first person language
Approved by:	re (cperciva)
Approved by:	ziaee
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D52896

(cherry picked from commit 85531add28)
(cherry picked from commit 0ee1546565)
2025-11-06 20:19:24 -08:00
Alexander Ziaee 02eabc44ed bhyve.8: Correct description for -c flag, tag spdx
The examples only show the usage of `-c <numcpus>`, as did the flag
description, however the -c flag supports more complex cpu topology
specifiers. These were documented correctly in SYNOPSIS, add them to
the body of the DESCRIPTION as well. Someone could go further and do
and example with using them.

Approved by:	re (cperciva)
MFC after:	3 days (there was a merge conflict with the date)
Event:		OpenZFS Developer Summit '25
Reported by:	Levi Worley <[email protected]>

(cherry picked from commit 205af037e3)
(cherry picked from commit 772837c632)
2025-11-06 20:19:21 -08:00
Alexander Ziaee 5f6d85cb1b gshsec.8: Fix list alignment, tag spdx
Approved by:	re (cperciva)
MFC after:	3 days

(cherry picked from commit 05d4858460)
(cherry picked from commit 6d6132d8ca)
2025-11-06 20:19:18 -08:00
William Carrel 6efc9b0e6a ifconfig.8: Mention max name length
Approved by:	re (cperciva)
PR:		289113
MFC after:	3 days

(cherry picked from commit 832cd05905)
(cherry picked from commit e2a87c0817)
2025-11-06 20:19:16 -08:00
David E. O'Brien 7d106aaa93 random: CTASSERT check sizeof random_source_descr[]
Ensure that the number of elements of random_source_descr[]
and fxrng_ent_char[] matches that of enum random_entropy_source.

Approved by:	re (cperciva)
Reviewed by:	cem
Differential Revision: https://reviews.freebsd.org/D53255
(cherry picked from commit 8bd9a9e9e4)
(cherry picked from commit d53618d582)
2025-11-06 20:19:13 -08:00
David E. O'Brien 08515bdecc random: fenestrasX: Add missing entropy sources
Approved by:	re (cperciva)
Reviewed by: cem
Fixes: 1492c8c0d qcom_rnd: add initial qualcomm prng driver.
Fixes: 9eecef052 Add an Armv8 rndr random number provider
Fixes: b2f8b2dc8 sys: Add an SMCCC Random Number Generator driver
Differential Revision:	https://reviews.freebsd.org/D53292
(cherry picked from commit 93b02f69a6)
(cherry picked from commit 3a9bcf8dee)
2025-11-06 20:19:11 -08:00
David E. O'Brien 3d598826e1 Add FENESTRASX to LINT to avoid breakage
Approved by:	re (cperciva)

(cherry picked from commit c1e7e8f5cb)
(cherry picked from commit a3fcb7bfea)
2025-11-06 19:36:33 -08:00
Lexi Winter 18602717de etc/mtree/BSD.include.dist: Remove libipt-dev
This package only exists on amd64, which means on other platforms we
produce an empty package containing nothing but this directory, and
without a base package (libipt) that package fails to install due to
a missing dependency.

For now, fix this by removing the libipt-dev package tag, which moves
this directory to clibs.

Approved by:	re (cperciva)
Fixes: 436618a427 ("etc/mtree: Add package tags for /usr/include")
Reported by:	cperciva
MFC after:	3 seconds

(cherry picked from commit 2a8a6179eb)
(cherry picked from commit ccd948829c)
2025-11-06 15:11:31 -08:00
Colin Percival 4291f032c4 release: Make fetch happen in GCE images
We want to fetch distfiles, regardless of whether they contain known
vulnerabilities or we're building images for a different version of
FreeBSD.

Approved by:	re (cperciva)
Reviewed by:	ivy
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53569

(cherry picked from commit 8234c1899b)
(cherry picked from commit 3b01c7da327853e9f3347ff0cae9d075460f5a27)
2025-11-06 15:11:28 -08:00
Colin Percival dab5efb726 release: Don't try to fetch distfiles for pkgbase
In order to comply with the require that GCE images must include their
source code, we fetch distfiles for all of the packages installed into
GCE images.  This fails for obvious reasons for packages with an origin
of base/*; filter those out to generate the list to fetch.

Approved by:	re (cperciva)
Reviewed by:	ivy
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53568

(cherry picked from commit 05b3a45cd0)
(cherry picked from commit 92ab9516c8a5d196b60ac8f6df777de745aaa219)
2025-11-06 15:11:26 -08:00
Colin Percival f512ec40bb release: GCE builds depend on ftp
GCE images are required by Google to include their source code; we do
this by extracting {src,ports}.txz into the images, from the (legacy)
distribution sets.

Make sure those distribution sets actually exist.

Approved by:	re (cperciva)
Reviewed by:	ivy
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53567

(cherry picked from commit 7f536b1c11)
(cherry picked from commit a1b00e368926198a163015bfe21171f2d582c703)
2025-11-06 15:11:23 -08:00
Colin Percival f438cf7428 vmimage.subr: pkg autoremove after pkg install
A bug in pkg, which somehow only surfaced as a consequence of pkgbase,
results in pkg install sometimes pulling in false dependencies.  This
problem might be limited to cases when the lib32 pkgbase packages are
not installed.  In the case of EC2 "small" images, installing the
ebsnvme-id package results in binutils, gcc12-devel, gmp, indexinfo,
liblz4, mpc, mpfr, and zstd packages being installed.

These false dependencies are however not recorded as dependencies --
at some level pkg does understand that they're not needed -- so running
pkg autoremove immediately after pkg install cleans them up.

Note: This does not remove lines from METALOG corresponding to these
packages, and makefs emits an error when it attempts to create the
filesystem but cannot find the files listed in METALOG -- but makefs
does seem to complete normally despite the error messages.

This change should be reverted once the pkg issue has been located and
fixed.

Approved by:	re (cperciva)
Reviewed by:	ivy
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D53543

(cherry picked from commit 6a13aeac3c)
(cherry picked from commit a21cff76c57089cd357473128d42410d189ca149)
2025-11-06 15:11:18 -08:00
Colin Percival 299dfb3cec Makefile.incl1: .WAIT before distribute in etc
In order to make sure that man pages are all installed before we run
makewhatis to generate mandoc.db files, we have long placed etc at the
end of the list of subdirectories being recursed into by the build.
In order to support installworld -jN, a .WAIT was more recently added
here.

With the recent adoption by the release engineering team of parallel
*release* builds (aka 'make release -jN') it is now also necessary to
add the same .WAIT before recursing for the 'distribute' target, as we
otherwise end up with distribution sets containing incomplete mandoc.db
files.

Approved by:	re (cperciva)
Reviewed by:	bdrewery
PR:		289683
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D53533

(cherry picked from commit dcb6706ba4)
(cherry picked from commit 48dbf763337aea30e29971e751d3aa1044a555ef)
2025-11-06 15:11:15 -08:00
Colin Percival 0888e32663 release: Spell metalog_add_data conventionally
Approved by:	re (cperciva)
Reviewed by:	markj
MFC after:	3 days
Fixes: f1995d6fc1 ("release: Prepare GCE cloudware images for building as non-root")
Differential Revision:	https://reviews.freebsd.org/D53530

(cherry picked from commit c3a3af1346)
(cherry picked from commit 6e47589eb067e5a22cce9f351ecf12bd2ffa9e4d)
2025-11-06 15:11:13 -08:00
Olivier Certner 76fb5c23dc setcred(): Fix RACCT resource accounting on credentials change
When credentials are changed, we need to adjust the sum of resources
associated to the initial and new process' user IDs (and old and new
login classes and jails, but setcred() does not change them) for them to
stay consistent.

Approved by:	re (cperciva)
PR:             290352
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D53457

(cherry picked from commit 2be5127c4a)
(cherry picked from commit 2e76660cb7)
2025-11-06 15:11:10 -08:00
Olivier Certner c3a27fa066 kern: Fix credentials leaks on RACCT but no RCTL
Affected system calls: setuid(), setreuid(), setresuid(), jail_attach(),
setloginclass().

In these system calls, the crhold() calls that, on RACCT, make the
just-installed process credentials survive a concurrent change of the
same credentials just after PROC_UNLOCK() were not matched by
a corresponding crfree() when RCTL is off.  In fact, in that latter
case, they are simply not necessary, so wrap them with '#ifdef RCTL'
stances.  'kern_rctl.c' causes a compile error if RACCT is not defined
but RCTL is, so ease reading by not nesting '#ifdef's.

Approved by:	re (cperciva)
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D53456

(cherry picked from commit f4315ff8b3)
(cherry picked from commit 4db768b01c)
2025-11-06 15:11:08 -08:00
Kristof Provost 1e5405d6b5 pf: improve DIOCRCLRTABLES validation
Unterminated strings in the anchor or name could cause crashes.
Validate them, and add a test case.

Approved by:	re (cperciva)
Reported by:	Ilja Van Sprundel <[email protected]>
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 1da3c0ca5b)
(cherry picked from commit 909528f8a1)
2025-11-06 15:11:05 -08:00
Kristof Provost 05c3c8c0ab pf: improve add state validation
Both for the DIOCADDSTATE ioctl and for states imported through pfsync packets.
Add a test case to exercise this code path.

Approved by:	re (cperciva)
Reported by:	Ilja Van Sprundel <[email protected]>
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit faacc0d968)
(cherry picked from commit 4891e6f1c0)
2025-11-06 15:11:02 -08:00
Alan Somers 06edf53ab5 fusefs: Fix intermittency in the BadServer.ShortWrite test case
We were using the m_quit bit for two similar but distinct uses:

* To instruct the server to quit
* To cope with the kernel forcibly unmounting the fs

Fix the intermittent test failure by adding a separate bit,
m_expect_unmount, to handle cases like the latter.

Approved by:	re (cperciva)
Reported by:	Siva Mahadevan <[email protected]>
MFC after:	1 week
Revied by:	Siva Mahadevan <[email protected]>
Differential Revision: https://reviews.freebsd.org/D53357

(cherry picked from commit d86025c1d4)
(cherry picked from commit f0cf086c05)
2025-11-06 15:10:59 -08:00
Alan Somers 914064cf19 fusefs: fix intermittency in the BadServer.ShortWrite test
This test implicitly depended on the order in which two threads
completed.  If the test thread finished first, the test would pass.  But
if the mock file system thread did, it would attempt to read from an
unmounted file system, and fail.  As a result, the test would randomly
fail once out of every several thousand executions.  Fix it by telling
the mock file system's event loop to exit without attempting to read any
more events.

Approved by:	re (cperciva)
Reported by:	Siva Mahadevan <[email protected]>
MFC after:	1 week
Reviewed by:	Siva Mahadevan <[email protected]>
Differential Revision: https://reviews.freebsd.org/D53080

(cherry picked from commit d1bd541b38)
(cherry picked from commit a1c3537148)
2025-11-06 15:10:55 -08:00
Alan Somers a711949115 fusefs: respect the server's FUSE_SETXATTR_EXT flag
FUSE protocol 7.33 extended the FUSE_SETXATTR request format.  But the
extension is optional.  The server must opt-in by setting the
FUSE_SETXATTR_IN flag during FUSE_INIT.  We were wrongly using the
extended format for any server using protocol 7.33 or later.

Approved by:	re (cperciva)
PR:		290547
Co-authored-by:	CismonX <[email protected]>
Fixes:		d5e3cf41e8 ("fusefs: Upgrade FUSE protocol to version 7.33")
MFC after:	3 days

(cherry picked from commit e8449c0e0f)
(cherry picked from commit a23bd71dea)
2025-11-06 15:10:51 -08:00
Lexi Winter ba5626d398 etc/mtree: Add package tags for /usr/include
Set the default package to clibs-dev, since that's where the vast
majority of include files comes from.  Add explicit package tags
for the directories which are installed in their own package.

Approved by:	re (cperciva)
MFC after:	1 day
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53577

(cherry picked from commit 436618a427)
(cherry picked from commit 736771f631)
2025-11-06 15:10:49 -08:00
Lexi Winter 011bfe6aae packages: Make set-base-dbg depend on set-optional-dbg
As set-base depends on set-optional, so should set-base-dbg depend on
set-optional-dbg.  Otherwise, people who install set-base-dbg will be
missing a bunch of debug packages.

Approved by:	re (cperciva)
MFC after:	1 day
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53575

(cherry picked from commit 3bcb297770)
(cherry picked from commit 5f1d2ef1f5)
2025-11-06 15:10:46 -08:00
Lexi Winter 190e1cd5a6 libkadm5clnt: Fix library symlink install
libkadm5clnt_mit installs a symlink from libkadm5clnt.so for backward
compatibility, but it neglected to include the package tags, so the
symlink was missing from pkgbase builds.  Add ${DEV_TAG_ARGS} to the
install command.

Approved by:	re (cperciva)
Reported by:	Mark Millard <[email protected]>
MFC after:	1 day
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53574

(cherry picked from commit 707507c27f)
(cherry picked from commit dd9ba3201b)
2025-11-06 15:10:43 -08:00
Lexi Winter 2e2e70bee7 libcasper: Move everything to the libcasper package
The libcasper package exists to contain libcasper, but for some reason
only the libcap_net service was in the package, with libcasper itself
and the rest of the services being in runtime.  Move everything to the
libcasper package, except tests which stay in the tests package.

Approved by:	re (cperciva)
MFC after:	1 day
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53576

(cherry picked from commit b8697ac70e)
(cherry picked from commit 25eb50f68b)
2025-11-06 15:10:36 -08:00
John Baldwin 054da4a6d0 riscv: Treat pointer register as an input in fpe_store
The contents of the memory is an output, but the pointer to that memory
is an input. This was correct in the original version of D45697, but
when adding appropriate clobbers, the pointer operand was incorrectly
switched to an output rather than left an input for fpe_store.

Approved by:	re (cperciva)
Reviewed by:	jrtc27
Obtained from:	CheriBSD
Fixes:		44d4ee7f3d ("riscv: add FPE code.")
MFC after:	1 day
Sponsored by:	AFRL, DARPA
Differential Revision:	https://reviews.freebsd.org/D53441

(cherry picked from commit 91f66f9b37)
(cherry picked from commit 0b5e4af65d)
2025-11-05 12:18:00 -08:00
Enji Cooper f7717bbe13 OpenSSL: install .pc files from the exporters subdir
The .pc files generated in the root directory are used as part of the
build; they should never be installed. Use the versions from the
exporters subdirectory--which should be installed--as the .pc files
which are distributed with FreeBSD. This avoids the need for "fixing up"
these files after the fact (see `crypto/openssl/BSDmakefile` for more
details as part of this change).

Garbage collect `secure/lib/libcrypto/Makefile.version`, et al,
as they're orphaned files. They were technically unused prior to this
change as the vendor process properly embeds the version numbers in
various files, but this commit formalizes the removal.

This correction/clarification on the .pc files will be made in an
upcoming release of OpenSSL [1].

References:
1. https://github.com/openssl/openssl/issues/28803

Approved by:	re (cperciva)
Suggested by:	Richard Levitte (OpenSSL project)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53043

(cherry picked from commit 97388e7215)
(cherry picked from commit 9b84a17c0a)
2025-11-05 11:37:11 -08:00
Enji Cooper 1b0202b4b6 crypto/openssl: remove autogenerated files
These files contain build host paths and other configuration details
that can be regenerated via the standard vendor import process. Don't
clutter up the FreeBSD tree with these files.

Add the paths to .gitignore to prevent them from accidentally being
added in a future update.

Approved by:	re (cperciva)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53044

(cherry picked from commit d271d2ce15)
(cherry picked from commit 0d5ef734e9)
2025-11-05 11:37:07 -08:00
Enji Cooper a7c692e022 openssl: add a simple smoke test for the legacy provider
This change adds a simple smoke test for the legacy provider to ensure
that the provider doesn't break in the future when performing updates.

This is not a functional or system test; the OpenSSL test suite does a
much better job at doing this than we can.

Approved by:	re (cperciva)
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D53045

(cherry picked from commit 3b6442370a)
(cherry picked from commit 9b3c89ce8b)
2025-11-05 11:37:03 -08:00
Enji Cooper af0eda4f33 crypto/openssl: update generated files to match 3.5.4 artifacts
Approved by:	re (cperciva)
MFC with:	046c625e93
Fixes:		046c625e93 ("crypto/openssl: update to 3.5.4")
Reported by:	Herbert J. Skuhra <[email protected]>

(cherry picked from commit d4033e6d37)
(cherry picked from commit 505aec2bf3)
2025-11-05 11:36:59 -08:00
Enji Cooper c0366f908f crypto/openssl: update to 3.5.4
This change includes all necessary changes required to update to OpenSSL
3.5.4.

More information about the 3.5.4 release can be found in the relevant
release notes (see 8e12a5c4eb for more details).

Merge commit '8e12a5c4eb3507846b507d0afe87d115af41df40'

Approved by:	re (cperciva)

(cherry picked from commit 046c625e93)
(cherry picked from commit 57d1d2c497)
2025-11-05 11:36:54 -08:00
Enji Cooper 27ae9da27a crypto/openssl: update build artifacts for the 3.5.3 release
This change updates the build artifacts to match the 3.5.3 release. Much
of the change involves updating version numbers and release dates to
match the release version's metadata.

Approved by:	re (cperciva)
MFC after:	1 week
MFC with:	88b8b7f0c4

(cherry picked from commit d9cc3d558d)
(cherry picked from commit 41955f207f)
2025-11-05 11:36:52 -08:00
Enji Cooper 136987f898 crypto/openssl: update component to 3.5.3
This change updates the sources for crypto/openssl. The subsequent
commit will update the build artifacts to match the 3.5.3 release.

More details about the update can be found in the related vendor branch
commits.

Approved by:	re (cperciva)
MFC after:	1 week
Merge commit 'aed904c48f330dc76da942a8ee2d6eef9d11f572'

(cherry picked from commit 779e075df9)
2025-11-05 11:36:48 -08:00
Enji Cooper 2e31b9635c crypto/openssl: apply polish to new vendor import process
This change does the following 2 things:
- Makes the build more repeatable by isolating the environment. This
  prevents bmake from leaking variables into gmake and makes the overall
  process a bit more robust.
- Add debug printouts to make the process more straightforward to the
  reader and whoever is executing doing the current vendor import.

Approved by:	re (cperciva)
MFC after: 1 month
Differential Revision:	https://reviews.freebsd.org/D52420

(cherry picked from commit d18058b7b8)
(cherry picked from commit 22382d9e70)
2025-11-05 11:36:44 -08:00
Enji Cooper 8b1dd80fd2 Update the installed manpages to match OpenSSL 3.5.1
Approved by:	re (cperciva)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52008

(cherry picked from commit fdb3b695a4)
(cherry picked from commit 3e979746ab)
2025-11-05 11:36:41 -08:00
Kyle Evans 508f9b6837 ipfw: pmod: avoid further rule processing after tcp-mod failures
m_pullup() here will have freed the mbuf chain, but we pass back an
IP_FW_DENY without any signal that the outer loop should finish.  Thus,
rule processing continues without an mbuf and there's a chance that we
conclude that the packet may pass (but there's no mbuf remaining)
depending on the rules that follow it.

Approved by:	re (cperciva)
PR:		284606
Reviewed by:	ae

(cherry picked from commit c0382512bf)
(cherry picked from commit 21d55ae111)
2025-11-05 11:36:38 -08:00
Dag-Erling Smørgrav 290b9b6b26 id: Fix WITHOUT_AUDIT build
Rather than add more ifdefs, trust the compiler to optimize Aflag away.

Approved by:	re (cperciva)
Fixes:		70b72ede98 ("id: Clean up")
PR:		290740
MFC after:	3 days

(cherry picked from commit 92a533ed1d)
(cherry picked from commit 05a3f80efe)
2025-11-05 11:36:35 -08:00
Konrad Witaszczyk 4e80f9f643 dtrace/arm64: properly traverse the symbol table
LINKER_EACH_FUNCTION_NAMEVAL() stops processing the symbol table if a
callback function returns a non-zero value.

The fbt_provide_module_function() callback should not return 1 when
ignoring symbols. Instead, always return 0, as in dtrace/x86.

Approved by:	re (cperciva)
Fixes:		30b68ecda8 ("Changes that improve DTrace FBT reliability on freebsd/arm64:")
Reviewed by:	markj, oshogbo
Approved by:	oshogbo (mentor)
Obtained from:	CheriBSD
Differential Revision: https://reviews.freebsd.org/D53399

(cherry picked from commit 2acdec9e4d)
(cherry picked from commit 76a0a5f91d)
2025-11-05 11:36:32 -08:00
Andrey V. Elsukov 72777e9bf6 mld6: Properly initialize MLD packet options
After commit 530c2c30b0 we need to set flags to ensure that hop-by-hop
and hop limit options are included.

Approved by:	re (cperciva)
PR:		290407
Reviewed by:	zlei, markj
MFC after:	3 days
Fixes:		530c2c30b0 ("ip6_output: Reduce cache misses on pktopts")

(cherry picked from commit 5568fba657)
(cherry picked from commit 5c4144fe1f)
2025-11-05 11:36:29 -08:00
Jose Luis Duran 6e1d4406f1 mtree: Remove stray atm directory
ATM support for netgraph was removed in af0cc0b223 ("NgATM: Remove
netgraph ATM support")

Remove the directory from the mtree specification.

Approved by:	re (cperciva)
Reviewed by:	emaste
Fixes:	21735dfaeb ("include: Remove no longer existing netgraph/atm")
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D53260

(cherry picked from commit 8e8ee8bbe2)
(cherry picked from commit 002ce2c9d0)
2025-11-05 11:36:26 -08:00
Jose Luis Duran eef41b04b3 mtree: Remove stray wi directory
Approved by:	re (cperciva)
Reviewed by:	imp, emaste
Fixes:	a21def4d56 ("pccard: Remove wi(4) driver")
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D53264

(cherry picked from commit f942a74654)
(cherry picked from commit 0b45751456)
2025-11-05 11:36:24 -08:00
Jose Luis Duran 433730c1cb mtree: Remove stray an (Aironet) directory
Approved by:	re (cperciva)
Reviewed by:	imp
Fixes:	663b174b5b ("an: Remove driver")
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D53265

(cherry picked from commit f7ccf05101)
(cherry picked from commit 3281756a24)
2025-11-05 11:36:21 -08:00
Lexi Winter 593f5b29ef static_libpam: Don't install pam.d.5 twice
static_libpam's Makefile includes libpam's Makefile after setting some
variables (like MAN) to empty to avoid installing the manpages twice.
After commit 031e711647, it neglected to do this for MANNODEVLINKS,
causing pam.d.5.gz to be installed twice.  This is harmless for
installworld, but breaks some things that rely on METALOG (NO_ROOT
installs) since it causes two METALOG entries to be generated for
the same file.

Approved by:	re (cperciva)
Fixes:	031e711647 ("packages: Install development manpages in the -dev package")
MFC after:	3 days
PR:		290708
Reported by:	emaste
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53512

(cherry picked from commit a1806e6ff3)
(cherry picked from commit 92a081bc2d)
2025-11-05 11:36:18 -08:00
Lexi Winter 88c5a4996b ifconfig: Fix invalid free() in ifbridge
parse_vlans() does 's = strdup(str)', then calls strsep(&s, ...), then
attempts to free(s) at the end of the function.  For the success case,
this is fine (s is NULL, so it's a trivial memory leak), but in the
error case, we will attempt to free an invalid pointer.

Fix this by storing the original return value from strdup() and freeing
that instead.

Approved by:	re (cperciva)
MFC after:	3 seconds
Reported by:	David Gwynne <[email protected]>
Reviewed by:	zlei, kevans
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53545

(cherry picked from commit 0899f7a3b7)
(cherry picked from commit fe2e534433)
2025-11-05 11:36:12 -08:00
Alfonso S. Siciliano 0595e10ec7 contrib/bsddialog: Import version 1.0.5
Version for change and feature requests.

* Improve documentation for --alternate-screen and --normal-screen.
  Request: https://bugs.freebsd.org/285459. (This PR is not about
  bsddialog itself but is used as an example for an official FreeBSD
  documentation request.)

* Reduce the number of screen refreshes to improve performance over a
  115200 UART connection.
  Request: https://gitlab.com/alfix/bsddialog/-/issues/8.

* Change textbox buttons to return distinct values (previously always
  returned OK).
  Request: https://reviews.freebsd.org/D48668; already committed in
  contrib/ 96a241a359

* Change forms navigation key behavior for ENTER and TAB.
  Request: https://bugs.freebsd.org/287592.

Refer to /usr/src/contrib/bsddialog/CHANGELOG to know more.

PR:		287592
Reported by:	adrian
Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation

Merge commit '653f765f05b8c7e3908ae92e9bf61522a50cefc9' into YYY

(cherry picked from commit 3e42d7194b)
(cherry picked from commit aa2fe36f5e)
2025-11-04 19:30:32 +01:00
Jasper Tran O'Leary 1445291480 nvme: Add handling for bar5
The NVMe spec allows the Table BIR (TBIR) and PBA DIR (PBIR) to
be 0, 4, or 5. The existing NVMe driver basically only has support
for 4, perhaps under the assumption that BAR4 is 64-bit and also
occupies BAR5.

This change adds support for BAR5, covering the case where BAR4
and BAR5 might both be present and 32-bit, where the Table BIR
might be 4 and the PBA BIR might be 5, or vice versa.

The NVMe spec (in the SR-IOV section) also permits VFs to use BIR=2,
so I haven't added stricter checks on which BIR will be permitted
by the driver.

This enables FreeBSD on Google Compute Engine C4 Machines.

Approved by:	re (cperciva)
MFC after:		3 days
Reviewed by:		imp
Sponsored by:		Google
Co-authored-by:		Matt Delco <[email protected]>
Signed-off-by:		Jasper Tran O'Leary <[email protected]>
Differential Revision:	https://reviews.freebsd.org/D53140

(cherry picked from commit 7b32f4f0a7)
(cherry picked from commit 6c321dc15d)
2025-11-03 16:29:52 -08:00
Krzysztof Galazka 83a23ceb40 ice(4): Add support for E835-XXV-4 adapter
Add subdevice ID and branding string for E835-XXV-4
adapter.

Signed-off-by: Krzysztof Galazka <[email protected]>

Approved by:	re (cperciva)
Approved by:	kbowling (mentor), erj (mentor)
Sponsored by:   Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D53319

(cherry picked from commit 09b48f811b)
(cherry picked from commit b59a9230a6)
2025-11-03 12:29:26 -08:00
Krzysztof Galazka 99fdcac549 ice(4): Add PCI IDs for E835 devices
Add device IDs and branding strings for E835 adapters.
This is a follow up for E830 adapters with Security Protocol
and Data Model (SPDM) support and RDMA support available
on 100 and 200Gbps links.

Signed-off-by: Krzysztof Galazka <[email protected]>

Approved by:	re (cperciva)
Approved by:	kbowling (mentor), erj (mentor)
Sponsored by:   Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D52782

(cherry picked from commit b202176dc7)
(cherry picked from commit 16004d2a9e)
2025-11-03 12:29:23 -08:00
Bhosale, Yogesh 97fa2bfeab ixl(4): fix multicast promiscuous mode state tracking and filter management
This change reapplies the improvements from commit 89e7335 and adds
additional fixes and code optimizations on top of it.

The ixl driver supports up to 128 multicast filters in hardware. When this
limit is exceeded, the driver should enable multicast promiscuous mode.
When the count drops below 128, it should disable promiscuous mode and
restore individual filters.

The driver previously had problems that could corrupt multicast filters list.
The main issue was that ixl_dis_multi_promisc() would attempt to disable
promiscuous mode without checking if it was actually enabled, potentially
corrupting existing filters. There was also no state tracking across driver
functions, leading to redundant operations.

This change adds an IXL_FLAGS_MC_PROMISC flag to track the multicast
promiscuous mode state. The flag is set when enabling promiscuous mode and
cleared when disabling it. Early return checks prevent redundant operations
when the mode is already in the desired state, avoiding filter corruption
and unnecessary hardware calls.

Signed-off-by: Yogesh Bhosale [email protected]

Approved by:	re (cperciva)
PR:		283820
Approved by:	kbowling (mentor)
Tested by:	gowtham.kumar.ks_intel.com
Sponsored by:   Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D52549

(cherry picked from commit 46a8a1f08f)
(cherry picked from commit f3c442950d)
2025-11-03 12:29:19 -08:00
Krzysztof Galazka 1d4a3083cf igb(4): Fix out-of-bounds register access on VFs
Virtual Functions have access to a limited number of registers,
and their bus space size is lower. Use KASSERT to detect out-of-bounds
access and eliminate them to avoid kernel panics in production
environment.

Signed-off-by: Krzysztof Galazka <[email protected]>

Approved by:	re (cperciva)
Reviewed by:	jmg
Tested by:	mateusz.moga_intel.com
Approved by:	kbowling (mentor), erj (mentor)
Sponsored by:   Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D52976

(cherry picked from commit 2c02e6ca71)
(cherry picked from commit 9d84e9cba1)
2025-11-03 12:29:15 -08:00
Ed Maste 6bbf1d23e2 bsd.prog.mk: Skip warnings if compiler.mk was not included
We emit a warning if src.conf options WITH_RETPOLINE or INIT_ALL are
in use, and the compiler or linker does not support the feature.

For targets like `cleandir` we skip including bsd.compiler.mk, which
leaves COMPILER_FEATURES unset and spurious warnings were emitted in
early buildworld stages, if these options are in use.

Commit 0837b2ebd5 ("pkg: Die if make -V BRANCH fails") added -W to
usr.sbin/pkg's make flags, causing it to exit on warnings.  As a result
buildworld failed when these src.conf options were in use.

Clean this up by omitting the warning if the magic
_NO_INCLUDE_COMPILERMK flag is set, which indicates that
COMPILER_FEATURES is not set.

Approved by:	re (cperciva)
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53501

(cherry picked from commit e4f2a35095)
(cherry picked from commit 1471af5110)
2025-11-03 12:29:11 -08:00
Ahmad Khalifa 258cc34745 bus_attach_children.9: fix typo
s/DEVICE_ATTACH/DEVICE_DETACH

Approved by:	re (cperciva)
Reviewed by:	ziaee
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53449

(cherry picked from commit 9b9c726df1)
(cherry picked from commit c14f97c16b)
2025-11-03 12:29:07 -08:00
Alan Somers c3f3b96725 fusefs: fix page fault triggered by async notification when unmounted
A FUSE daemon can send asynchronous notification to the kernel in order
to, for example, invalidate an inode's cache.  Fix a page fault that can
happen if the file system isn't yet mounted, or is already unmounted,
when that notification arrives.

Approved by:	re (cperciva)
PR:		290519
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D53356

(cherry picked from commit 5d42c88139)
(cherry picked from commit 25e368c4da)
2025-11-03 12:29:04 -08:00
Martin Matuska 8a0b57ba54 libarchive: merge from vendor branch
libarchive 3.8.2

Important bugfixes:
 #2477 tar writer: fix replacing a regular file with a dir for
       ARCHIVE_EXTRACT_SAFE_WRITES
 #2659 lib: improve filter process handling
 #2664 zip writer: fix a memory leak if write callback error early
 #2665 lib: archive_read_data: handle sparse holes at end of file correctly
 #2668 7zip: Fix out of boundary access
 #2670 zip writer: fix writing with ZSTD compression
 #2672 lib: fix error checking in writing files
 #2678 zstd write filter: enable Zstandard's checksum feature
 #2679 lib: handle possible errors from system calls
 #2707 lib: avoid leaking file descriptors into subprocesses
 #2713 RAR5 reader: fix multiple issues in extra field parsing function
 #2716 RAR5 reader: early fail when file declares data for a dir entry
 #2717 bsdtar: Allow filename to have CRLF endings
 #2719 tar reader: fix checking the result of the strftime (CVE-2025-25724)
 #2737 tar reader: fix an infinite loop when parsing V headers
 #2742 lib: parse_date: handle dates in 2038 and beyond if time_t is big
       enough

Approved by:	re (cperciva)
Obtained from:	libarchive
Vendor commit:	7f53fce04e4e672230f4eb80b219af17975e4f83
Security:	CVE-2025-25724
PR:		290303 (exp-run)
MFC after:	1 week

(cherry picked from commit 401026e482)
(cherry picked from commit f55001cc9f)
2025-11-03 12:29:00 -08:00
Rick Macklem e5fc5bc53f nfs_commonsubs.c: Add a sanity check for nid_ngroup
The nfsuserd(8) daemon passes user credentials
(uid + gids) into the kernel for users and groups
identified by name (received from a NFSv4 server).

This patch add a sanity check for the number of
groups (nid_ngroup) passed in.

It's only purpose is to protect against a bogus
nfsuserd(8) running in a jail.

Approved by:	re (cperciva)

(cherry picked from commit 4672adcea4)
(cherry picked from commit 83a0732a4c)
2025-11-03 12:28:56 -08:00
Rick Macklem 5d37e6975e nfs_clrpcops.c: Check for too large a write reply
The "rlen" reply length for a Write operation/RPC
could cause trouble if a broken server replies with
too large a value.

Improve the sanity check for "rlen" to avoid this.

Approved by:	re (cperciva)

(cherry picked from commit 2c82cdd2e2)
(cherry picked from commit b5b6ddfc99)
2025-11-03 12:28:53 -08:00
Rick Macklem 82579ee1f0 nfs_clrpcops.c: Fix two possible large NFSM_DISSECT()s
There are two cases in nfs_clrpcops.c where it was possible
for the code to attempt to NFSM_DISSECT() a large size,
which is not allowed by nfsm_dissct().

This patch fixes them.

Reducing the maximum stripecnt should be no problem,
since there in no extant NFSv4.n server that does striped
File Layout pNFS and current development is centered
around the Flex File layout.

Approved by:	re (cperciva)

(cherry picked from commit b9e6206f59)
(cherry picked from commit 609c4eb70a)
2025-11-03 12:28:49 -08:00
Rick Macklem 9c47506fc7 nfs_clrpcops.c: Add sanity checks for the slot cnts
The reply to CreateSession includes the slot cnt for
both fore and back slots. It should never be larger
than the argument specified and the fore slot cnt
should always be at least 1.

Without this patch, the replied slot cnts were not
being sanity checked.

While here, replace 64 with NFSV4_SLOTS (which is 64).

Approved by:	re (cperciva)

(cherry picked from commit 3053b2a3dc)
(cherry picked from commit 14148591b9)
2025-11-03 12:28:45 -08:00
Rick Macklem f38a2cfd5f nfs_nfsdserv.c: Add a sanity check for layout commit cnt
If a client were to send a LayoutCommit (seldom
used and only for a pNFS server) with a bogus
cnt, there could be problems with a malloc() call
that uses it.

This patch adds a sanity check for the cnt. Note
that RFC8881 does not specify any upper bound
on the cnt.

Approved by:	re (cperciva)

(cherry picked from commit 1a679fb907)
(cherry picked from commit c69e0be70f)
2025-11-03 12:28:41 -08:00
Christos Margiolis 10858b0162 snd_dummy: Round channel pointer after each write
Otherwise we go out of bounds and keep incrementing endlessly.

Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation
MFC after:	4 days
Differential Revision:	https://reviews.freebsd.org/D53337

(cherry picked from commit 364864ea91)
(cherry picked from commit 4eac02b29f)
2025-11-03 12:28:38 -08:00
David E. O'Brien 4002a34e68 random: garbage collect the RANDOM_PURE_OCTEON entropy source
It was used for Octeon MIPS and all producers have been removed
from the source tree.

Approved by:	re (cperciva)
Reviewed by: emaste
Differential Revision:	https://reviews.freebsd.org/D53146
(cherry picked from commit 283699338c)
(cherry picked from commit b3bf22d70e)
2025-11-03 12:28:35 -08:00
David E. O'Brien 1b7bd82b6d random: add RDSEED as a provably unique entropy source
NIST SP800-90B allows for only a single entropy source to be claimed
in a FIPS-140-3 certificate.  In addition, only hardware sources that
have a NIST Entropy Source Validation (ESV) certificate, backed by
a SP800-90B Entropy Assessment Report, are usable.  Intel has obtained
ESV certificates for several of their processors, so RDSEED is a
FIPS-140-3 suitable entropy source.

However, even though RDRAND is seeded by RDSEED internally, RDRAND
would need a RBG certificate and CAVP testing run on the DRBG in order
to use it for FIPS-140-3 (SP800-90B) purposes.  So we need to know
down in the CSPRNG-subsystem which source the entropy came from.

In light of the potential issues surrounding AMD Zen 5 CPU's RDSEED
implementation[*], allow RDSEED to be disabled in loader.conf.
[*] https://www.phoronix.com/news/AMD-EPYC-Turin-RDSEED-Bug

Approved by:	re (cperciva)
Reviewed by:	cem
MFC after:	3 days
Sponsored by:	Juniper Networks
Differential Revision:	https://reviews.freebsd.org/D53150
Differential Revision:	https://reviews.freebsd.org/D53291
(cherry picked from commit 3a12982962)
(cherry picked from commit 38e9d282cd)
(cherry picked from commit 9ca8e09abb)
2025-11-03 12:28:29 -08:00
Colin Percival a7707f2a3b Revert "Merge commit e24f90190c77 from llvm git (by Brad Smith):"
The BETA4 builds failed on aarch64 with errors which look
suspiciously like this commit is involved.

This reverts commit 4ae6078a60.

Direct commit to releng/15.0.

Approved by:	re (cperciva)
2025-10-30 23:40:00 -07:00
Colin Percival f0b1ca546e 15.0: Update to BETA4
Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-10-30 17:00:17 -07:00
Dag-Erling Smørgrav 8c478bbfeb realpath: Belatedly document POSIX conformance
We've been mostly POSIX-conforming since r236400 and fully since r240410,
which fixed a corner case where a missing non-leaf directory would be
reported as ENOTDIR instead of ENOENT.

Approved by:	re (cperciva)
Sponsored by:	Klara, Inc.
Fixes:		7877ed7ce3 ("Avoid mapping ENOENT to ENOTDIR for non-existent path components.")
Reviewed by:	ziaee, markj
Differential Revision:	https://reviews.freebsd.org/D53027

(cherry picked from commit 7c66667d45)
(cherry picked from commit 50d6a56a19)
2025-10-30 16:49:52 -07:00
Dag-Erling Smørgrav 38c42ca57b realpath: Report correct path on failure
If lstat() fails with EACCES or ENOTDIR, the path we need to return in
the caller-provided buffer is that of the parent directory (which is
either unreadable or not a directory; the latter can only happen in the
case of a race) rather than that of the child we attempted to stat.

Approved by:	re (cperciva)
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D53025

(cherry picked from commit 1406de21e1)
(cherry picked from commit 6c9b25246d)
2025-10-30 16:49:49 -07:00
Dag-Erling Smørgrav 4dc6fd2b9b realpath: Additional test cases
* Passing NULL should result in EINVAL
* Passing an empty path should result in ENOENT
* Failure with a non-null buffer should leave a partial result.  As
  pointed out in a comment in the test case, this reveals a discrepancy
  between the documentation and reality.

Approved by:	re (cperciva)
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D53024

(cherry picked from commit f3386dfeb4)
(cherry picked from commit 5debbcb6b7)
2025-10-30 16:49:46 -07:00
Dag-Erling Smørgrav 201038a01b quot: Make nusers unsigned
Approved by:	re (cperciva)
Fixes:		195b00ec45 ("quot: Clean up")
Reviewed by:	rlibby
Differential Revision:	https://reviews.freebsd.org/D53224

(cherry picked from commit fa347930f8)
(cherry picked from commit 2427ae41b7)
2025-10-30 16:49:43 -07:00
Dag-Erling Smørgrav 1825be32d0 quot: Add tests
To facilitate the task, we change the comparison function so that users
with equal filesystem usage are sorted by UID, and add an undocumented
option that prevents quot from replacing numerical UIDs with names.  We
also switch from getfsfile(3) to getmntpoint(3) so the first line is
identical regardless of whether we pass quot a mountpoint or a device.

Approved by:	re (cperciva)
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D53133

(cherry picked from commit aa870a1935)
(cherry picked from commit b5f3f1a661)
2025-10-30 16:48:55 -07:00
Dag-Erling Smørgrav 08dda8c969 quot: Drop the -h option
There was probably a time, more than 30 years ago, when the actual
size of a file had to be calculated and this option saved time, but
all it does today is give incorrect results for no benefit.

Approved by:	re (cperciva)
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D53132

(cherry picked from commit 8209311c51)
(cherry picked from commit c0d4bbcb80)
2025-10-30 16:48:41 -07:00
Dag-Erling Smørgrav dedf7401bd quot: Drop the COMPAT version
We've had this code for 30 years, but there has never been a way to
build it.  We have no idea if it still works, or if it ever worked.

Approved by:	re (cperciva)
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D53131

(cherry picked from commit 0eaca4a24b)
(cherry picked from commit 9a7b48fef1)
2025-10-30 16:48:38 -07:00
Dag-Erling Smørgrav b0fdefbf31 quot: Clean up
* Fix numerous style violations.
* Modernize somewhat.
* Don't bother examining errno after calling get_inode(), as it always
  exits on error.
* Fix confusing wording in the manual page.

The code remains somewhat idiosyncratic, e.g. in its insistance on
counting down rather than up in simple for loops, but in the absence
of comprehensive automated tests, the risk of introducing bugs exceeds
the benefit of rewriting these into more idiomatic forms.

Approved by:	re (cperciva)
Reviewed by:	obiwac
Differential Revision:	https://reviews.freebsd.org/D53130

(cherry picked from commit 195b00ec45)
(cherry picked from commit 68911bf64e)
2025-10-30 16:48:34 -07:00
Dag-Erling Smørgrav 60384327a8 quot: Fix benign buffer overflow
If it encounters an inode whose owner does not have a pw entry, quot
allocates a 7-byte buffer (8 in practice, since that is the minimum
allocation size) and uses it to store the numeric uid preceded by a
hash character.  This will overflow the allocated buffer if the UID
exceeds 6 decimal digits.  Avoid this by using asprintf() instead.

While here, simplify the common case as well using strdup().

Approved by:	re (cperciva)
Reported by:	Igor Gabriel Sousa e Souza <[email protected]>
MFC after:	3 days
Reviewed by:	obiwac, emaste
Differential Revision:	https://reviews.freebsd.org/D53129

(cherry picked from commit 5854d1cbab)
(cherry picked from commit 3d680881f6)
2025-10-30 16:48:31 -07:00
Dag-Erling Smørgrav 8cf76cbac8 w: Trim whitespace and commas from time and uptime
When producing formatted output, trim leading whitespace and trailing
commas from the human-readable time and uptime before emitting them.
The text output remains unchanged.

Approved by:	re (cperciva)
PR:		290089
Fixes:          6e6febb54d ("w: Fix idle time in json output, add login/idle times to json output")
Reviewed by:	marius.h_lden.org
Differential Revision:	https://reviews.freebsd.org/D53167

(cherry picked from commit 4d5789532a)
(cherry picked from commit ca16a115a0)
2025-10-30 16:48:28 -07:00
Dag-Erling Smørgrav b763c111ad pwait: Add an option to print remaining processes
* On startup, insert all valid PIDs into a tree.
* In our main loop, whenever a process terminates, remove its PID
  from the tree.
* On exit, if the -p flag was specified, print the remaining PIDs.

Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	bcr, markj
Differential Revision:	https://reviews.freebsd.org/D53293

(cherry picked from commit 3d73146bae)
(cherry picked from commit 955650f181)
2025-10-30 16:48:25 -07:00
Bryan Drewery 936ef70cea pwait: Avoid calling getpid(2) for each proc.
Approved by:	re (cperciva)

(cherry picked from commit ab4abce6c2)
(cherry picked from commit 54d1d527c8)
2025-10-30 16:48:22 -07:00
Dag-Erling Smørgrav ac84e695eb rc.subr: Fix slow shutdown issue
Instead of sleeping after pwait returns, use its new -p option to
obtain the list of processes that still have not terminated.

Approved by:	re (cperciva)
MFC after:	3 days
PR:		290357
Fixes:		5953e7c984 ("rc.subr: Move the sleep in wait_for_pids")
Reviewed by:	0mp, markj
Differential Revision:	https://reviews.freebsd.org/D53294

(cherry picked from commit 22cff1f3e9)
(cherry picked from commit 7b375832c2)
2025-10-30 16:48:19 -07:00
Dag-Erling Smørgrav 02de2f3b49 id: Add -d and -s options
These options may not be combined with any other options and print the
current or specified user's home directory and shell respectively.

Approved by:	re (cperciva)
Reviewed by:	imp, bcr
Differential Revision:	https://reviews.freebsd.org/D53301

(cherry picked from commit f41b1eb637)
(cherry picked from commit eff786f236)
2025-10-30 16:48:15 -07:00
Dag-Erling Smørgrav e392a6d78d id: Clean up
No functional change intended.

Approved by:	re (cperciva)
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D53300

(cherry picked from commit 70b72ede98)
(cherry picked from commit 758e4565a9)
2025-10-30 16:48:03 -07:00
Colin Percival 65a3f9cf30 pkg: Die if make -V BRANCH fails
If build logic breaks such that we can't figure out which branch we're
on, we should error out rather than shipping a default (and probably
wrong) /etc/pkg/FreeBSD.conf

Approved by:	re (cperciva)
Reviewed by:	ivy
MFC after:	5 minutes
Suggested by:	ivy
Differential Revision:	https://reviews.freebsd.org/D53487

(cherry picked from commit 0837b2ebd5)
(cherry picked from commit 1f528e32f5)
2025-10-30 13:53:30 -07:00
Colin Percival c824a13191 release: Only check no-root/no-qemu when building
Building VMs as non-root requires no-QEMU code paths (installing
packages from outside the VM image rather than inside it) and vice
versa; we have a check for broken combinations.

Unfortunately that check was breaking
make -C src/usr.sbin/pkg NO_ROOT=YES -V PKGCONFBRANCH
because that code reaches into src/release to determine the branch
name (which is then used to determine which /etc/pkg/FreeBSD.conf to
install).

Wrap the no-root/no-qemu check in an .if to only run when we've
asked for VM and/or CLOUD building to be enabled.

Approved by:	re (cperciva)
Reviewed by:	ivy
MFC after:	5 minutes
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D53486

(cherry picked from commit b485322d6b)
(cherry picked from commit 6b2f2e03f1)
2025-10-30 13:53:26 -07:00
Ed Maste 660255be1e ipfw: Retire obsolete compat code
The current IPFW version 3 dates to 2010 (commit cc4d3c30ea, "Bring in
the most recent version of ipfw and dummynet, developed").

The compat code for FreeBSD 8 and earlier has a number of issues and is
no longer needed, so remove it.

Approved by:	re (cperciva)
Reported by:	Ilja Van Sprundel <[email protected]>
Reviewed by:	ae, glebius
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53343

(cherry picked from commit c59aab9a5b)
(cherry picked from commit 9657c50cdd)
2025-10-30 13:53:23 -07:00
Ed Maste 443258a77a pmcstat: Remove no-op -k option
Commit 53d0b9e438 ("pmc: Provide full path to modules from kernel
linker") made pmcstat's -k option have no effect, but the option was
retained for backwards compatibility (while emitting a warning that
-k is not in FreeBSD 15).

Approved by:	re (cperciva)
Reviewed by:	jrtc27
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53397

(cherry picked from commit c6b156e360)
(cherry picked from commit 958659dc94)
2025-10-30 13:53:20 -07:00
Ed Maste fcf8720e9f bsdlabel: Bump removal to FreeBSD 16.0.
It is deprecated but was not removed prior to 15.0.

Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9447a40781)
(cherry picked from commit be24d85ec7)
2025-10-30 13:53:13 -07:00
Lexi Winter a3cf750ba4 packages: Remove the /boot hack from mtree-to-plist.awk
Currently, files in /boot (other than /boot/kernel) are assigned to the
bootloader package using a filename match in mtree-to-plist.awk.  This
causes some problems, most notably that debug info for userboot ends up
in the utilities-dbg package instead of bootloader-dbg.

Remove the path handling from mtree-to-plist and instead set PACKAGE
in the appropriate Makefiles to put these in the correct package.

While here, move userboot*.so from bootloader-dev to bootloader.

Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	cperciva
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53179

(cherry picked from commit 842942be28)
(cherry picked from commit a182020edf)
2025-10-30 09:15:15 -07:00
Lexi Winter ac849c0a1e flua: Move to a new flua package
flua is a standalone third-party component that deserves its own
package.  In particular, this means things can use flua without
having to depend on FreeBSD-utilities, which will be useful as
more base utilities use flua.

This saves ~500kB in FreeBSD-utilities for systems which don't
need flua.

Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	kevans
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53161

(cherry picked from commit 957715f877)
(cherry picked from commit e4ef333917)
2025-10-30 09:15:09 -07:00
Lexi Winter bcb4095b36 packages: Put dhclient in the minimal-jail set
This is somewhat widely used in VNET jails, it's fairly small (150kB on
amd64) and it's enough of a core system component that it's reasonable
to include, even if many jails don't require it.

Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	dch
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53154

(cherry picked from commit 8a9d29beda)
(cherry picked from commit c392cdae9b)
2025-10-30 09:15:06 -07:00
Lexi Winter a3fde3ac56 share/man/man5: Use MANGROUPS.yes
Simplify the Makefile logic by using MANGROUPS.yes for optional
packages.  Also, move bluetooth manpages to the correct package,
add the correct conditional for OpenSSH (MK_OPENSSH), and properly
alphabetise the file.

Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53127

(cherry picked from commit 82f96b2bc9)
(cherry picked from commit 7a572fd52e)
2025-10-30 09:15:03 -07:00
Ed Maste 325663f0c0 man: Conditionally install ar.5 in toolchain package
Previously if WITHOUT_TOOLCHAIN was set we'd create a FreeBSD-clang
package that contained only ar.5.  As ar.5 describes the ar format
and doesn't come from Clang/LLVM move it to the FreeBSD-toolchain
package and make it conditional on MK_TOOLCHAIN.

Approved by:	re (cperciva)
Reviewed by:	ivy
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52886

(cherry picked from commit a8d774d970)
(cherry picked from commit 4574a86c52)
2025-10-30 09:15:00 -07:00
Lexi Winter 2b0a1e6a93 packages: dhclient, local-unbound require resolvconf
Both of these packages use resolvconf for various things.  Add a
dependency to make this work.

Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	des
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53115

(cherry picked from commit bf28c98f14)
(cherry picked from commit 01f1896527)
2025-10-30 09:14:57 -07:00
Lexi Winter 873f0864db mandoc: Also run makewhatis for /usr/share/openssl/man
We use a pkg(8) trigger to run makewhatis for /usr/share/man when
manpages are updated, but this doesn't cover /usr/share/openssl/man.

Rewrite the trigger to process a list of directories instead of a
single directory, and include /usr/share/openssl/man in the list.

Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53064

(cherry picked from commit 450fb637f4)
(cherry picked from commit 37effd917e)
2025-10-30 09:14:53 -07:00
Lexi Winter 84e42ef510 packages: Install development manpages in the -dev package
Add a new per-group SUBPACKAGE option to bsd.man.mk.  When MANSPLITPKG
is enabled, this is forced to "-man", otherwise it defaults to empty
but can be overridden by the caller.

Use this in bsd.lib.mk to install library manpages in the -dev package
instead of the base package.  This is nearly always preferable, since
library manpages are usually in section 2 or 3 and are only relevant
to people with development packages installed.

For manpages which should be installed in the base package even for
libraries, add a new MANNODEV group in bsd.lib.mk.  Update existing
Makefiles to use this where appropriate.

Approved by:	re (cperciva)
MFC after:	3 days
Discussed with:	olce
Reviewed by:	olce
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52832

(cherry picked from commit 031e711647)
(cherry picked from commit e1a6189f96)
2025-10-30 09:14:47 -07:00
Lexi Winter 32b6de9082 zlib: Move to a new zlib package
zlib is a standalone third-party component, and deserves its own
package rather than living in runtime.  For example, this will make
future security updates less invasive.  This also means there's no
dependency on runtime for ports that just require zlib, which is
useful for service jails.

Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	bapt, emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53058

(cherry picked from commit 924c0c60d4)
(cherry picked from commit a02e78a2c9)
2025-10-30 09:14:43 -07:00
Dimitry Andric 4ae6078a60 Merge commit e24f90190c77 from llvm git (by Brad Smith):
[Driver] Enable outline atomics for FreeBSD/aarch64 (#156089)

The compiler_rt helper functions have been built since 12.4, 13.1, 14
and anything newer.

Approved by:	re (cperciva)
MFC after:	3 days

(cherry picked from commit 51e8e8b0f3)
(cherry picked from commit 7778507bf9)
2025-10-30 09:14:38 -07:00
Jose Luis Duran bc59efc45c blocklist: blacklist: Chase recent upstream changes
Upstream introduced a fix that avoids blocklistd(8) from running into an
endless loop when it tries to delete an address from the database which
has been added multiple times.

Apply the same fix to blacklistd(8).

Approved by:	re (cperciva)
Upstream PR:	https://gnats.netbsd.org/cgi-bin/query-pr-single.pl?number=57193
MFC after:	2 days

(cherry picked from commit b502a451cb)
(cherry picked from commit 528e1d1403)
2025-10-29 21:36:41 -07:00
Jose Luis Duran 4afb96fdd2 MFV: Import blocklist 2025-10-26 (ff13526)
Merge commit 'df549a80425635d98419f7f742309d66d367e65f'

Changes:

https://github.com/zoulasc/blocklist/compare/156df4f...ff13526

Approved by:	re (cperciva)
MFC after:	2 days

(cherry picked from commit 34ffc7073f)
(cherry picked from commit dfc4a7c10c)
2025-10-29 21:36:37 -07:00
Jose Luis Duran c4f2ac409c blocklist: blacklist: Chase recent upstream changes
Upstream introduced an extra column in blocklistctl(8) to display the
name of the rule associated in the database entry.

It is intended to avoid confusion when seemingly duplicate locations
appear in the output of the blocklistctl dump command.  Especially when
users are transitioning from the old nomenclature to the new one.

The latest patches will not be fully backported to blacklistctl(8), to
avoid breaking current scripts that may be parsing its output.  Also we
are slowly preparing to feature-freeze everything related to blacklist.

Approved by:	re (cperciva)
MFC:	2 days

(cherry picked from commit eae98e28a0)
(cherry picked from commit cd284c1e17)
2025-10-29 21:36:32 -07:00
Jose Luis Duran 8ea3c27a03 MFV: Import blocklist 2025-10-25 (156df4f)
Merge commit '1ae0b2f3a242a48af2deef1e88649bf4a3a74e2f'

Changes:

https://github.com/zoulasc/blocklist/compare/8aa81bf...156df4f

Approved by:	re (cperciva)
MFC after:	2 days

(cherry picked from commit bcbe0a3c92)
(cherry picked from commit cbd8e3a004)
2025-10-29 21:36:28 -07:00
Jose Luis Duran b39a387442 libpfctl: Fix displaying deeply nested anchors
Set the number of rulesets (i.e., anchors) directly attached to the
anchor and its path in pfctl_get_ruleset().

While here, add a test to document this behavior.

Approved by:	re (cperciva)
PR:		290478
Reviewed by:	kp
Fixes:		041ce1d690 ("pfctl: recursively flush rules and tables")
MFC after:	2 days
Differential Revision:	https://reviews.freebsd.org/D53358

(cherry picked from commit a943a96a50)
(cherry picked from commit 1c8a554f75)
2025-10-29 21:36:20 -07:00
Jamie Gritton c37d95826a jail: fix a regression that creates zombies when removing dying jails
When adding jail descriptors, I split sys_jail remove in two, and
didn't properly track jail held between them when a jail was dying.
This fixes that as well as cleaning up the logic behind it.

Approved by:	re (cperciva)
PR:		290217
Reported by:	David 'equinox' Lamparter <equinox at diac24.net>
Reviewed by:	markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53200

(cherry picked from commit 78f70d4ff9)
(cherry picked from commit 2d3c6a06ed)
2025-10-29 21:23:18 -07:00
Jamie Gritton 9620ee8816 jail: fix an error condition that was returned without setting errno.
Approved by:	re (cperciva)
MFC after:	3 days

(cherry picked from commit 5f7d5709e0)
(cherry picked from commit c6bf733736)
2025-10-29 21:23:15 -07:00
Ed Maste 87b73c2684 ipfw: Remove more unused IP_FW_* cases
All of the do_cmd() calls are in dummynet.c and specify the socket
option at compile time; none of these removed cases are used in ipfw
after the v3 work.

Approved by:	re (cperciva)
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53378

(cherry picked from commit 0e2e0fb955)
(cherry picked from commit 6b1e5d4d20)
2025-10-29 21:23:12 -07:00
Ed Maste 37580e661b ipfw: Remove IP_DUMMYNET_GET case
IP_DUMMYNET_GET is no longer used in ipfw(1).

Approved by:	re (cperciva)
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53348

(cherry picked from commit 28e52dea96)
(cherry picked from commit 73c105268c)
2025-10-29 21:23:10 -07:00
Ed Maste a986bf1f4a ipfw: Correct error message
The failed allocation in the error pertains to IP_FW_XADD, not
IP_FW_ADD.

Approved by:	re (cperciva)
Reviewed by:	ae
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53359

(cherry picked from commit 498e561426)
(cherry picked from commit c22437c8b5)
2025-10-29 21:23:07 -07:00
Ed Maste 883230a190 ipfw: Update warning/error setsockopt references
Dummynet v3 switched to IP_DUMMYNET3 but did not update these
warnings/errors.

Approved by:	re (cperciva)
Fixes: cc4d3c30ea ("Bring in the most recent version of ipfw and dummynet, developed")
Sponsored by:	The FreeBSD Foundation
Differential Revision: sbin/ipfw/ipfw2.c

(cherry picked from commit 1f95a51788)
(cherry picked from commit a5dd21c7dd)
2025-10-29 21:23:04 -07:00
Ed Maste 6652930aaa closefrom.2: Add introduction of close_range to HISTORY
Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53240

(cherry picked from commit 514fff24b1)
(cherry picked from commit 243a886019)
2025-10-29 21:23:02 -07:00
Ed Maste a085b67453 getrlimitusage.2: Update HISTORY section
Add 14.2, as this was cherry-picked prior to release.

Approved by:	re (cperciva)
Reported by:	Harald Eilertsen
Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53320

(cherry picked from commit 2387a51af2)
(cherry picked from commit 87795ea454)
2025-10-29 21:22:59 -07:00
Ed Maste b17920af75 upgt.4: bump removal to 16.0
It was not actually removed prior to FreeBSD 15.0.

Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 0cd8754ad5)
(cherry picked from commit 453766184d)
2025-10-29 21:22:57 -07:00
Ed Maste 392061b369 agp.4: Bump deprecation to 16.0
It was not actually removed prior to FreeBSD 15.0.

Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit cadadd1a03)
(cherry picked from commit 92f169fe0f)
2025-10-29 21:22:53 -07:00
Ed Maste 901603ae6b cam: Bump deprecated sysctl removal to 16
The descriptions for these unmapped_io and rotating sysctls indicated
that they're deprecated and being removed for FreeBSD 15.0.  That did
not happen, so update to FreeBSD 16 instead.

Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit e93db9abc9)
(cherry picked from commit 469ab88d10)
2025-10-29 21:22:50 -07:00
Ed Maste c2c8f9d321 sys: Bump non-ISA PNP removal to 16.0
This may include atkbdc, which is not being removed in 15.0.

Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 46f982122c)
(cherry picked from commit db84583a93)
2025-10-29 21:22:47 -07:00
Ed Maste 1dc5e059da sys: Bump GIANT device removal to 16.0
It did not happen prior to FreeBSD 15.0.

Approved by:	re (cperciva)
Reported by:	zlei
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 24adb135c5)
(cherry picked from commit 8e276f22bd)
2025-10-29 21:22:44 -07:00
Ed Maste d67ed83c51 le(4): Update depreciation notice
This driver was in fact not removed prior to FreeBSD 15.0.

Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit e4d6433e9c)
(cherry picked from commit 59ba727849)
2025-10-29 21:22:34 -07:00
Ed Maste 61d4640720 fdisk: Bump removal to FreeBSD 16.0
Removal did not happen prior to 15.0.

Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f817f6e7f4)
(cherry picked from commit 739750ae7c)
(cherry picked from commit 2be4c64a0d)
2025-10-29 21:22:31 -07:00
Mark Johnston 81a98c3a12 netmap: Fix error handling in nm_os_extmem_create()
We bump the object reference count prior to mapping it into the kernel
map, at which point the vm_map_entry owns the reference.  Then, if
vm_map_wire() fails, vm_map_remove() will release the reference, so we
should avoid decrementing it in the error path.

Approved by:	re (cperciva)
Reported by:	Ilja van Sprundel <[email protected]>
Reviewed by:	vmaffione
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53066

(cherry picked from commit dfc1041c08)
(cherry picked from commit 6e1f47765d)
2025-10-29 21:22:28 -07:00
Mark Johnston c40e634e6a release: Use PKG_CMD when installing pkgbase packages in vmimage.subr
This defaults to plain "pkg", but being able to override it is useful
when testing pkg itself.

Approved by:	re (cperciva)
Reviewed by:	cperciva
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53307

(cherry picked from commit bbe65c5e8c)
(cherry picked from commit 79fbc4ccb6)
2025-10-29 21:22:23 -07:00
Bojan Novković a91a62c42d pt: Switch to swi(9)
The pt hwt(4) backend uses NMIs to receive updates about the latest t
racing buffer offsets from the tracing hardware. However, it uses
taskqueue(9) to schedule the bottom-half handler. This can lead to
a panic since the taskqueue(9) code isn't aware it's being called
from an NMI context and uses the regular scheduling interfaces.

Fix this by scheduling the bottom-half handler using swi(9) and the
SWI_FROMNMI flag.

Approved by:	re (cperciva)
Fixes:	310162ea21
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D52491

(cherry picked from commit 96d82d2d13)
(cherry picked from commit 56b4719076)
2025-10-29 21:22:19 -07:00
Robert Clausecker 3c8ae8b1c9 sys/arm: add fp[gs]et* prototypes to <ieeefp.h>
We have provided implementations for hard float of these for
a while now.  Add them to the header to make things official.
This is required for a bunch of legacy programs in ports.

Approved by:	re (cperciva)
Approved by:	markj (mentor)
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D53156

(cherry picked from commit a8079d40ae)
(cherry picked from commit af39e511ee)
2025-10-29 21:22:16 -07:00
Robert Clausecker 245d95ce16 sys/arm64: fix COMPAT_FREEBSD32 __syscall()
It seems like _QUAD_LOWWORD was incorrectly expanded into 1,
which is correct for big endian but not little endian.  This
means we always grab the padding word for the syscall number,
which is usually 0, causing SIGSYS to be delivered to the caller.
Reintroduce _QUAD_LOWWORD to fix the syscall.

Approved by:	re (cperciva)
PR:		290411
MFC after:	1 week
Discussed with:	jrtc27
Reviewed by:	cognet, emaste
Approved by:	markj (mentor)
Fixes:		8c9c3144cc
Differential Revision:	https://reviews.freebsd.org/D53250

(cherry picked from commit 1ca09538d9)
(cherry picked from commit c824960b89)
2025-10-29 21:22:09 -07:00
Michael Tuexen 71f94c1e2c tcp: improve credential handling in syncache
When adding a syncache entry, take a reference count of the
credentials while the inp is still locked.
Thanks to markj@ for providing a hint regarding the root cause.

Approved by:	re (cperciva)
Reported by:		David Marker
Reviewed by:		glebius
Tested by:		David Marker
Fixes:			cbc9438f05 ("tcp: improve ref count handling when processing SYN")
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D53380

(cherry picked from commit 44cb1e857f)
(cherry picked from commit 9611bf2fed)
2025-10-29 21:22:06 -07:00
Michael Tuexen 54da44487a udp: honor IPV6_TCLASS cmsg for UDP/IPv4 packets
Honor the IPPROTO_IPV6-level cmsg of type IPV6_TCLASS when sending
an UDP/IPv4 packet on an AF_INET6 socket.

Approved by:	re (cperciva)
Reviewed by:		bz
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D53347

(cherry picked from commit d3a3854fdc)
(cherry picked from commit e31ff080e5)
2025-10-29 21:22:03 -07:00
Michael Tuexen bdbb23567f udp: honor IPV6_TCLASS socket option for UDP/IPv4 packets
Honor the IPPROTO_IPV6-level socket option IPV6_TCLASS when sending
an UDP/IPv4 packet on an AF_INET6 socket.

Approved by:	re (cperciva)
Reviewed by:		bz, glebius
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D53346

(cherry picked from commit 3535546a86)
(cherry picked from commit 8f5162f6fc)
2025-10-29 21:21:53 -07:00
Cy Schubert a988846174 unbound: Vendor import 1.24.1
Release notes at
	https://nlnetlabs.nl/news/2025/Oct/22/unbound-1.24.1-released/

Approved by:	re (cperciva)
Security:	CVE-2025-11411

Merge commit '73dd92916f532cb3fe353220103babe576d30a15'

(cherry picked from commit 8b29c373e6)
(cherry picked from commit fc3c317b05)
2025-10-28 14:23:22 -07:00
Dag-Erling Smørgrav fef4de6547 local-unbound-setup: Set so-sndbuf to 0
Without this setting, Unbound 1.24.0 and newer will attempt to set the
socket buffer size to 4 MB to mitigate issues that mostly affect servers
with large numbers of clients on local networks, which is not a scenario
local-unbound is intended for.  This is not only a waste of resources,
it can also fail, resulting in a warning message on daemon startup.

Approved by:	re (cperciva)
Fixes:		b2efd602ae ("unbound: Vendor import 1.24.0")
Reviewed by:	jlduran, cy
Differential Revision:	https://reviews.freebsd.org/D52977
(cherry picked from commit de3faa85d8)
(cherry picked from commit 65629acb4a)
2025-10-28 14:23:12 -07:00
Cy Schubert 4db0093fa0 unbound: Vendor import 1.24.0
Release notes at
	https://nlnetlabs.nl/news/2025/Sep/18/unbound-1.24.0-released/

Approved by:	re (cperciva)
MFC after:	1 week

Merge commit '0064eb9cf1c8d526e87d3149249445d4bc8d0248'

(cherry picked from commit b2efd602ae)
(cherry picked from commit 0143f06b45)
2025-10-28 14:23:08 -07:00
Jonathan T. Looney 8376d05279 x86: Reduce amount of time the MCA lock is held while emitting records
The MCA spin lock is acquired in the hardware interrupt context to
record MCA messages. It is also acquired by a task handler to emit
those messages.

Reduce the amount of time the task handler holds the lock to reduce
the maximum amount of time the hardware interrupt handler may need to
spin on the lock.

Approved by:	re (cperciva)
Reviewed by:	glebius, markj
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D52938

(cherry picked from commit e770e32aa3)
(cherry picked from commit d83dee356d)
2025-10-28 14:23:05 -07:00
Peter Lei df023b0275 tcp: save progress timeout cause in connection end status
TCP stats are currently incremented for the persist and progress
timeout conditions, but only the persist cause was saved in the
connection end info status, which in turn is logged in the
blackbox "connection end" event.

Approved by:	re (cperciva)
Reviewed by:	tuexen
Sponsored by:	Netflix, Inc.

(cherry picked from commit 1a61a673a3)
(cherry picked from commit 6b81787240)
2025-10-28 14:23:02 -07:00
Peter Lei f30ddc76d2 tcp rack: cleanup
The TCP_SAD_DETECTION code was removed. Remove the remaining
sysctl-variables and counters.

Approved by:	re (cperciva)
Reviewed by:	tuexen
Sponsored by:	Netflix, Inc.

(cherry picked from commit 04c2642406)
(cherry picked from commit 8856e55b47)
2025-10-28 14:22:59 -07:00
Martin Matuska ed0083d081 zfs: update zfs_config.h and zfs_gitrev.h after ce7e1f86a (zfs-2.4.0-rc3)
Approved by:	re (cperciva)

(cherry picked from commit 51d5e8c8ca)
2025-10-28 14:22:53 -07:00
Martin Matuska 6bf158defb zfs: merge openzfs/zfs@814f9afba (zfs-2.4-release) into stable/15
OpenZFS 2.4.0 rc3

Notable upstream pull request merges:
 #17750 964dfc317 FreeBSD: Correct _PC_MIN_HOLE_SIZE
 #17793 b9d1e28a7 ddt prune: Add SCL_ZIO deadlock workaround
 #17799 1585a10a8 Make mount/share errors non-fatal for zfs create/clone
 #17801 073b34b3e Fix display of default xattr to show 'sa'
 #17803 e09c86cb1 zvol: verify IO type is supported
 #17807 -multiple zpool iostat: fix regressions in "all pools" mode
                  after #17786
 #17826 b9356f06e Explicit set ashift for non-leaf vdevs
 #17830 f0bff230f Suppress some ashift warnings
 #17833 c1f55bff8 Fix the type of the raidz_outlier_check_interval_ms
                  parameter
 #17836 799bda73e Fix return value for setting zvol threading
 #17834 f0c76f8a7 libzpool/cmn_err: remove suppression, add stop option,
                  cleanup
 #17843 1956417b5 mmap_seek: print error code and text on failure
 #17847 7987d4deb Update device removal documentation
 #17851 6f6e1c90a FreeBSD: zfs_getpages: Don't zero freshly allocated pages

Approved by:	re (cperciva)
Obtained from:	OpenZFS
OpenZFS commit:	814f9afba7
OpenZFS tag:	zfs-2.4.0-rc3

(cherry picked from commit ce7e1f86a1)
2025-10-28 14:22:49 -07:00
Christos Margiolis 470fae965f sndctl(8): Modify vchans only on supported directions
Currently mod_play_vchans() and mod_rec_vchans() run unconditionally,
even if the direction (playback, recording) is not supported by the
device. This results in the "autoconv" (see mod_autoconv()) control
failing when run on simplex devices, because we'll be trying to modify
vchans on an unsupported direction.

Test whether the direction is supported and silently move on if it
isn't.

Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation
MFC after:	4 days
Differential Revision:	https://reviews.freebsd.org/D53233

(cherry picked from commit 70b34fbdbe)
(cherry picked from commit e015e079f9)
2025-10-28 14:22:43 -07:00
Poul-Henning Kamp 74a6de9f96 deadfs: Return ENXIO instead of EIO when the device is gone.
One some systems, under some conditions, pulling a USB stick would
read(2) returning EIO and not ENXIO, like it should and used to.

Recoverdisk(1), which does not give up on EIO, like most programs
would, spins furiously.

Arguably, deadfs was always wrong in returning EIO, because once you
get to deadfs no operation will ever work again, but we used to
take a different path through devfs_vnops.c which got us the ENXIO.

Something changed recently, and while testing this fix, I noticed
that drm-kmod-66/i915kms may be the condition which trigger
the different code-path.

Approved by:	re (cperciva)
MFC to: stable/15
Fixes: 289785
Thanks to: imp, kib

(cherry picked from commit 2612f1b864)
(cherry picked from commit 44e214f824)
2025-10-27 19:58:00 -07:00
Bjoern A. Zeeb 3dc891b8a5 LinuxKPI: 802.11: additions for Linux v6.17 based wireless drivers
This includes the conflicting changes from previous driver versions
(v6.11/v6.14), mostly being function pointer or function arguments.

Approved by:	re (cperciva)

(cherry picked from commit 76aed633b5)
(cherry picked from commit 22eb6e43d0)
2025-10-27 18:58:43 -07:00
Bjoern A. Zeeb dd5a80ba09 rtw89: update Realtek's rtw89 driver
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
e5f0a698b34ed76002dc5cff3804a61c80233a7a ( tag: v6.17 ).

Approved by:	re (cperciva)

(cherry picked from commit 354a030185)
(cherry picked from commit a13158f451)
2025-10-27 18:58:40 -07:00
Bjoern A. Zeeb 8bf92b4a45 rtw88: update Realtek's rtw88 driver
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
e5f0a698b34ed76002dc5cff3804a61c80233a7a ( tag: v6.17 ).

Approved by:	re (cperciva)

(cherry picked from commit eb15fdb1b7)
(cherry picked from commit 0272ecf586)
2025-10-27 18:58:33 -07:00
Bjoern A. Zeeb 30459f58e8 iwlwifi: update Intel's mvm/mld drivers
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
e5f0a698b34ed76002dc5cff3804a61c80233a7a ( tag: v6.17 ).

Some of the changes we reported upstream got incorporated in this
(or the v6.16) release.

This also includes a change from iwlwifi-next.git::next for missing symbols

iwl_mvm_v3_rate_from_fw() and iwl_mvm_v3_rate_to_fw() were originally
comitted to mvm/rs.[ch] which we do not have.  That left us with
unresolved symbols.  For the never comitted v6.16 driver update I had
started to piece these together but they have been migrated out to
utils.c so take them from there until the next release hopefully ships
this change.

Approved by:	re (cperciva)
Obtained from:	git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next.git
	branch next, 1b49af228594452206d5c50a33b6a341428edb63

(cherry picked from commit 6b627f8858)
(cherry picked from commit e89beeee25)
2025-10-27 18:58:29 -07:00
Alan Somers 52245427a5 find: fix pathnames printed by the SIGINFO handler
Don't duplicate the last component.

Approved by:	re (cperciva)
PR:		290362
Reported by:	John F. Carr <[email protected]>
Fixes:		d06a00963b
Reviewed by:	jilles, Goran Mekić <[email protected]>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1878

(cherry picked from commit f6d767fe86)
(cherry picked from commit be122b46be)
2025-10-27 18:58:26 -07:00
Michael Tuexen d9f8e8aa11 tcp over udp: don't copy more bytes than avaiable
When copying the data in the first mbuf to get rid of the UDP
header, use the correct length. It was copying too much (8 bytes,
the length of the UDP header).
This only applies to handling TCP over UDP packets. The support for
TCP over UDP is disabled by default.

Approved by:	re (cperciva)
Reported by:		jtl
Reviewed by:		Peter Lei
Sponsored by:		Netflix, Inc.

(cherry picked from commit bfda98a420)
(cherry picked from commit c566953da8)
2025-10-27 18:58:23 -07:00
Michael Tuexen 978615d7bf sockstat: add support for UDP-Lite endpoints
With this patch UDP-Lite endpoints are also show per default.

Approved by:	re (cperciva)
Reviewed by:		Peter Lei, Nick Banks
Relnotes:		yes
Differential Revision:	https://reviews.freebsd.org/D53230

(cherry picked from commit f48c6390dd)
(cherry picked from commit c10317b0c4)
2025-10-27 18:58:20 -07:00
Michael Tuexen 72016759da netstat: add support for UDP-Lite endpoints
With this patch UDP-Lite endpoints are also shown per default.

Approved by:	re (cperciva)
Reviewed by:		Nick Banks
Differential Revision:	https://reviews.freebsd.org/D53252

(cherry picked from commit c2b08c13c2)
(cherry picked from commit 372b604226)
2025-10-27 18:58:18 -07:00
Michael Tuexen 573270bf34 UDP-Lite: export pcblist via sysctl interface
Export the list of pcbs for UDP-Lite to be consumed by sockstat and
netstat.

Approved by:	re (cperciva)
Reviewed by:		Peter Lei, Nick Banks
Differential Revision:	https://reviews.freebsd.org/D53229

(cherry picked from commit be93b27483)
(cherry picked from commit da7a90f097)
2025-10-27 18:58:15 -07:00
Michael Tuexen 9c148488a0 UDP: let udp_pcblist() support UDP and UDP-Lite
Provide the IPPROTO_UDP in the arg2 parameter of udp_pcblist() and use
this to determine the inpcbinfo. This allows the same function to be
used in an upcoming commit to provide the list of pcbs for UDP-Lite
just by providing IPPROTO_UDPLITE in the arg2 parameter.

Approved by:	re (cperciva)
Reviewed by:		rrs
Differential Revision:	https://reviews.freebsd.org/D53218

(cherry picked from commit be3c59ff50)
(cherry picked from commit 365378184a)
2025-10-27 18:58:05 -07:00
John Baldwin 42cf7ea8dc inet_net_test: Use int to hold expected return values from inet_net_pton
GCC warns about the sign mismatch in comparisons:

lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_inet4::body() const':
lib/libc/tests/net/inet_net_test.cc:86:17: error: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Werror=sign-compare]
   86 |                 ATF_REQUIRE_EQ(bits, addr.bits);
      |                 ^~~~~~~~~~~~~~
lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_inet6::body() const':
lib/libc/tests/net/inet_net_test.cc:205:17: error: comparison of integer expressions of different signedness: 'int' and 'const unsigned int' [-Werror=sign-compare]
  205 |                 ATF_REQUIRE_EQ(bits, addr.bits);
      |                 ^~~~~~~~~~~~~~

Approved by:	re (cperciva)
Fixes:		8f4a0d2f7b ("libc: Import OpenBSD's inet_net_{ntop,pton}")
(cherry picked from commit e1aeb58cbb)
(cherry picked from commit 7ffd190ae9)
2025-10-25 21:13:26 -07:00
John Baldwin 595ddf009a inet_net_test: Compare pointers against nullptr
GCC does not like passing NULL (__null) to std::ostringstream::operator<<
inside of ATF_REQUIRE_EQ:

lib/libc/tests/net/inet_net_test.cc: In member function 'virtual void {anonymous}::atfu_tc_inet_net_ntop_invalid::body() const':
lib/libc/tests/net/inet_net_test.cc:306:9: error: passing NULL to non-pointer argument 1 of 'std::__1::basic_ostream<_CharT, _Traits>& std::__1::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::__1::char_traits<char>]' [-Werror=conversion-null]
  306 |         ATF_REQUIRE_EQ(ret, NULL);
      |         ^~~~~~~~~~~~~~
In file included from /usr/obj/.../amd64.amd64/tmp/usr/include/c++/v1/sstream:317,
                 from /usr/obj/.../amd64.amd64/tmp/usr/include/atf-c++/macros.hpp:29,
                 from /usr/obj/.../amd64.amd64/tmp/usr/include/atf-c++.hpp:29,
                 from lib/libc/tests/net/inet_net_test.cc:33:
/usr/obj/.../amd64.amd64/tmp/usr/include/c++/v1/__ostream/basic_ostream.h:338:81: note:   declared here
  338 | basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>::operator<<(long __n) {
      |                                                                            ~~~~~^~~
...

Approved by:	re (cperciva)
Fixes:		8f4a0d2f7b ("libc: Import OpenBSD's inet_net_{ntop,pton}")
(cherry picked from commit aa358ce3ca)
(cherry picked from commit 848ca53d3a)
2025-10-25 21:13:20 -07:00
Konstantin Belousov 9c31c1a823 include/stdckdint.h: make the header compatible with C++
Approved by:	re (cperciva)
PR:	290299

(cherry picked from commit 3c052bec12)
(cherry picked from commit e54e24bcc7)
2025-10-25 15:10:19 -07:00
Colin Percival 0fc5b401bd 15.0: Update to BETA3
Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-10-23 16:59:30 -07:00
Mark Johnston a653824079 packages: Update the METALOG when (un)installing the caroot package
There may be other issues here but this change certainly seems to
be necessary.

Approved by:	re (cperciva)
PR:	290394
Reviewed by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D53263

(cherry picked from commit fa240b7ff0)
(cherry picked from commit 8b45854447)
2025-10-23 16:36:32 -07:00
Mitchell Horne a4eedfccbe riscv: build starfive JH7110 DTBs
These are known to work if loaded manually by loader(8) (for VF2 at
least). If nothing else, it is useful to provide a DTB closely tied to
the kernel version.

Approved by:	re (cperciva)
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D53117

(cherry picked from commit 96b137c044)
(cherry picked from commit 2257adb848)
2025-10-23 16:32:44 -07:00
Mitchell Horne f2c15ac7c4 riscv: build allwinner DTBs
These are known to work if loaded manually by loader(8) (for the Nezha
board at least). If nothing else, it is useful to provide a DTB closely
tied to the kernel version.

Approved by:	re (cperciva)
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D53118

(cherry picked from commit 3ed48eb085)
(cherry picked from commit 9a44b56907)
2025-10-23 16:32:41 -07:00
Mitchell Horne 24718d1db0 dtb: sort by vendor on riscv
Just like arm64, our DTS comes from Linux and is correctly sorted into
subdirectories by vendor. Enable the logic to preserve these directories
in the installation, for example:

  /boot/dtb/sifive/hifive-unmatched-a00.dtb

Approved by:	re (cperciva)
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D53116

(cherry picked from commit cf202819af)
(cherry picked from commit 0cc2448fc2)
2025-10-23 16:32:37 -07:00
Michael Tuexen 369ef36d08 sockstat: fix column length for PROTO
The computation of the length was not taking into account that IPv6
endpoints, which are not IPv6 only, have a suffix of 46.
For UDP and TCP this bug was not relevant, since tcp46 and udp46
has the same length as PROTO, but sctp46 is longer. Upcoming
udplite support will also be affected.

Approved by:	re (cperciva)
Reviewed by:		asomers
Differential Revision:	https://reviews.freebsd.org/D53212

(cherry picked from commit 4ee0ddae1d)
(cherry picked from commit 8c197879bf)
2025-10-23 16:32:34 -07:00
Bjoern A. Zeeb 2c40d6e95f UPDATING: bump __FreeBSD_version for LinuxKPI changes
The size of an embedded struct has changed and might possibly be a
problem.  Allow this change to be detected by bumping __FreeBSD_version.

Approved by:	re (cperciva)

(cherry picked from commit 37ad1beaf5)
(cherry picked from commit a4ee95e54a)
2025-10-23 16:32:31 -07:00
Bjoern A. Zeeb 34353881ef LinuxKPI: 802.11: additions for Linux v6.17 based wireless drivers
This includes some type cleanups as well as some shuffling of structs
and functions to sort dependencies out.  Few new functions and defines
as well as new struct members.  Minor fixes to style and debug logging.

This is the majority of changes.  None of these should conflict with
current in-tree drivers.  The final bit of changes will come along with
the driver updates adding an extra argument to function pointers.

Approved by:	re (cperciva)

(cherry picked from commit 0567484734)
(cherry picked from commit f2b2d6c18a)
2025-10-23 16:32:27 -07:00
Bjoern A. Zeeb 70d9247e3a LinuxKPI: netdevice add attach/detach skeleton functions
For the moment add skeleton functions for netif_device_attach/detach()
needed by rtw8[89] v6.17.

Approved by:	re (cperciva)

(cherry picked from commit 5ea941a4fb)
(cherry picked from commit 4bdd0e51d7)
2025-10-23 16:32:24 -07:00
Bjoern A. Zeeb f6fe2cf64f LinuxKPI: skbuff: add a misplaced socket operation to skbuff.h for now
This likely belongs in socket code which we do not have in LinuxKPI.
Needed by a wirless driver at v6.17.

Approved by:	re (cperciva)

(cherry picked from commit 88dbf83345)
(cherry picked from commit 3ad05fa24a)
2025-10-23 16:32:21 -07:00
Bjoern A. Zeeb 645785359b LinuxKPI: soc/mediatek add pr_debug calls
We do not support Wireless Ethernet Dispatch (wed) on the mt76 (yet).
Add pr_debug calls with TODO in case we run into the calls anyway so
we could deal with them.

Approved by:	re (cperciva)

(cherry picked from commit 224ac9d2a0)
(cherry picked from commit b9b571e614)
2025-10-23 16:32:19 -07:00
Bjoern A. Zeeb 4a2f77958f LinuxKPI: page_pool headers moved; add netmem.h
page_pool headers were not used yet;  they were created for mt76 but
are without functionality.  Upstream has migrated them for v6.17 and
split them up into multiple files.  Also add netmem.h which the little
needed is directly related to page pools.

Approved by:	re (cperciva)

(cherry picked from commit 7c31cdfa40)
(cherry picked from commit d388ff8016)
2025-10-23 16:32:15 -07:00
Bjoern A. Zeeb 18bb10c59f LinuxKPI: add skeleton pci_enable_wake()
Given we do not yet support "wake" bits in device there is little need
doing it in PCI if we cannot check if we are supposed to do the
operation in first place.  Once we would implement this, we would need
to also do the appropriate PCI (pme) checks before enabling (disabling)
it.

Approved by:	re (cperciva)
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D53208

(cherry picked from commit 885e8f272f)
(cherry picked from commit be52a81be0)
2025-10-23 16:32:12 -07:00
Bjoern A. Zeeb 5440f67a31 LinuxKPI: add fips.h
We do not currently aim to support crypto FIPS compliance in LinuxKPI
so keep this turned off.

Approved by:	re (cperciva)
Reviewed by:	emaste, dumbbell
Differential Revision: https://reviews.freebsd.org/D53207

(cherry picked from commit 98609f4fec)
(cherry picked from commit 3aaaba2078)
2025-10-23 16:32:10 -07:00
Bjoern A. Zeeb 1a71288abc LinuxKPI: device_driver add (*coredump)()
Needed by multiple wireless driver for the v6.17 update (likely earlier
versions already).

Approved by:	re (cperciva)
Reviewed by:	dumbbell
Differential Revision: https://reviews.freebsd.org/D53206

(cherry picked from commit 8ea366f400)
(cherry picked from commit 0741aa3c72)
2025-10-23 16:32:07 -07:00
Bjoern A. Zeeb b691171a06 LinuxKPI: platform_device return type change
The return type now is void;  I believe no one ever used this
so we can just chnage it.  The only active platform_driver_register()
calls seems to be in ath1[01]k and mt76 and there in unsupported code.

Approved by:	re (cperciva)
Reviewed by:	dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D53205

(cherry picked from commit 0ae4998423)
(cherry picked from commit 5434a1635e)
2025-10-23 16:32:03 -07:00
Bjoern A. Zeeb 8c34b2e7fa LinuxKPI: add three skeleton functions to etherdevice.h
We will see how much we will need them and how to fill them at that
point.  They are left with a pr_debug("TODO") for now.

Approved by:	re (cperciva)
Differential Revision: https://reviews.freebsd.org/D53204

(cherry picked from commit cc792250ac)
(cherry picked from commit 805038b70a)
2025-10-23 16:32:00 -07:00
Bjoern A. Zeeb 257376b32b LinuxKPI: add __counted_by_le() and __counted_by_be()
The former is needed by a wireless driver at v6.17.

Approved by:	re (cperciva)
Reviewed by:	dumbbell, emaste
Differential Revision: https://reviews.freebsd.org/D53203

(cherry picked from commit 0a4b11ddb2)
(cherry picked from commit 0e30cab0f3)
2025-10-23 16:31:50 -07:00
Lexi Winter 7bdd04a687 libc: Import OpenBSD's inet_net_{ntop,pton}
Our versions of these functions (originally taken from BIND) simply
don't work correctly for AF_INET6.  These were removed from BIND itself
quite a while ago, but OpenBSD has made several fixes in the mean time,
so import their code.

Add tests for both functions.

Approved by:	re (cperciva)
PR:		289198
Reported by:	Nico Sonack <[email protected]>
MFC after:	1 week
Reviewed by:	des
Obtained from:	OpenBSD (lib/libc/net)
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52629

(cherry picked from commit 8f4a0d2f7b)
(cherry picked from commit ff7a10d0e1)
2025-10-22 21:26:07 -07:00
Lexi Winter 1998d706df Makefile: Don't allow install{world,kernel} with pkgbase
Using these targets on a pkgbase system will cause the installed system
to become out of sync with the package database, which is almost certain
to cause issues the next time pkg(8) is used.

To prevent users doing this accidentally, disallow install* if we detect
that FreeBSD-runtime is installed in the target.  The check can be
overridden with DESTDIR=/ for users who are sure they want to do this.

Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52879

(cherry picked from commit 74a6bb524e)
(cherry picked from commit ef82bdc864)
2025-10-22 21:26:03 -07:00
Lexi Winter 72fbd38716 ncurses: Move utilities to the ncurses package
Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	manu, kevans
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53163

(cherry picked from commit 09a49cd49b)
(cherry picked from commit 68897925ca)
2025-10-22 21:26:00 -07:00
Lexi Winter ecaa234c68 tar: Move to the utilities package
tar(1) is not a core runtime utility; in particular, nothing in
/etc/rc.d/* requires it.  Move it to utilities, which is also
where cpio(1) lives.

This removes the dependency from runtime to libarchive.

Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	manu, emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53059

(cherry picked from commit c0f17d637a)
(cherry picked from commit c6a19aed69)
2025-10-22 21:25:57 -07:00
Lexi Winter e01c7d02ba bsd.man.mk: Support MANGROUPS.yes
Similar to SUBDIR and CONFGROUPS, this allows the use of
MANGROUPS.${MK_FOO}, simplifying Makefile logic for optional
manpages.

Approved by:	re (cperciva)
MFC after:	3 seconds
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53126

(cherry picked from commit e757a92282)
(cherry picked from commit da0e0f755e)
2025-10-22 21:25:49 -07:00
Kristof Provost f138688ea4 pf: fix 'no rdr'
Ensure we always have a non-NULL rule pointer (ctx.rm).
It might have gotten set to NULL by pf_get_translation().

While here also restore the previous rdr behaviour be re-adding the incorrectly
removed 'break' in pf_match_translation_rule.

Approved by:	re (cperciva)
PR:		290177
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D53191

(cherry picked from commit cb36bfee25)
(cherry picked from commit 536b07512c)
2025-10-22 13:12:34 -07:00
Gordon Tetlow 0948c4d4a3 libc: Add "Z" as TZ designator for strptime.
ISO 8601 allows use of "Z" as the time zone designator. Update the
strptime parser to allow this usage.

While we are at it, update the manpage to reflect that both UTC and Z
are now valid options.

Approved by:	re (cperciva)
Reviewed by:	des
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53083

(cherry picked from commit 79e57ea662)
(cherry picked from commit 3d368c699b)
2025-10-22 13:12:30 -07:00
Mark Johnston b1faa50c18 imgact_elf: Check note body sizes
In parse_notes we validate that the note name fits within the note
buffer, but we do not do the same for the note data, so there is some
potential for an OOB read in the note handler.  Add a bounds check.

Approved by:	re (cperciva)
Reported by:	Ilja Van Sprundel <[email protected]>
Reviewed by:	kib, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53063

(cherry picked from commit c86af2cc4c)
(cherry picked from commit 09ae918e1f)
2025-10-22 13:12:27 -07:00
Mark Johnston 95f60a34dd libnv: Fix a length check in nvpair_unpack_string_array()
A string array is represented by a set of nul-terminated strings
concatenated together.  For each string, we check to see if there's a
nul terminator at the end, taking care to avoid going past the end of
the buffer.  However, the code fails to handle the possibility that
size == 0 at the end of an iteration, leading to underflow.

Fix the length check.

Approved by:	re (cperciva)
Reported by:	Ilja van Sprundel <[email protected]>
Reviewed by:	emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53069

(cherry picked from commit 937693fc9e)
(cherry picked from commit c47f9af477)
2025-10-22 13:12:23 -07:00
Mark Johnston eaafcf841c ipfw: Check for errors from sooptcopyin() and sooptcopyout()
Note, it looks like this code may be unused since commit 4a77657cbc
("ipfw: migrate ipfw to 32-bit size rule numbers").  In particular, it
looks like the ipfw_nat_*_ptr pointers are unused now.

Approved by:	re (cperciva)
Reviewed by:	ae
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D53068

(cherry picked from commit 2df39ce5d4)
(cherry picked from commit 302c4c540e)
2025-10-22 13:12:21 -07:00
Mark Johnston 945500c6dd exec: Check for errors when mapping the shared object
In the non-ASLR case, there is no check for an error from
vm_map_fixed().  Restore it, it was dropped in commit 939f0b6323.
This bug could result in a refcount leak of the object used to map the
VDSO page.

Approved by:	re (cperciva)
Reviewed by:	kib
Reported by:	Ilja Van Sprundel <[email protected]>
MFC after:	1 week
Fixes:	939f0b6323 ("Implement shared page address randomization")
Differential Revision:	https://reviews.freebsd.org/D53065

(cherry picked from commit 7117c86fcb)
(cherry picked from commit 6a5f0dc705)
2025-10-22 13:12:18 -07:00
Ed Maste 90cbdfa9dd bsdinstall: Use pkgbase release URL for BETA/RC
Approved by:	re (cperciva)
PR:		290238
Reviewed by:	ivy
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53214

(cherry picked from commit 604b6458f3)
2025-10-22 13:12:15 -07:00
Colin Percival 74cd979bcb release: Add pkg .conf to METALOG on dvd
We're correctly recording all of the packages in the dvd METALOG file,
but if we don't record ./packages/repos/FreeBSD_install_cdrom.conf then
users won't be able to install them very easily.

Approved by:	re (cperciva)
Reviewed by:	markj
Reported by:	Lars Tunkrans
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D53199

(cherry picked from commit 2b5c62494d)
(cherry picked from commit 52ea1ca18a)
2025-10-22 11:32:29 -07:00
Colin Percival 6f1622df13 Revert "release: Switch back to latest packages for now"
We now have 15.x quarterly package sets for both amd64 and arm64.

This reverts commit dc5aae134a.

Approved by:	re (cperciva)
2025-10-22 11:32:26 -07:00
Colin Percival 06e48a8d7a vmimage.subr: Fix when/where we fix up METALOG
We only need to check for unMETALOGed directories and sort the METALOG
file if we're using it, i.e. if we're doing a NO_ROOT build.  This
non-NO_ROOT builds by no longer bogusly writing to /METALOG*.

We only need to add databases (spwd.db etc) to METALOG if we're doing
a pkgbase-enabled NO_ROOT build; but we should always do this before
creating the filesystem, not only if we installed extra packages (in
vm_extra_install_packages, where that code was erroneously placed).
This fixes non-cloud VM images, which in 15.0-BETA2 shipped without
password databases.

Approved by:	re (cperciva)
Reviewed by:	ivy
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D53194

(cherry picked from commit 012014403b)
(cherry picked from commit 962194df83)
2025-10-22 11:32:18 -07:00
Mark Johnston c43777cd71 Add UPDATING entries and bump version
Approved by:	so
Approved by:	re (cperciva)
2025-10-22 15:50:12 +00:00
Mark Johnston aaf04147bd so_reuseport_lb_test: Add a test case for connected UDP sockets
Approved by:	so
Approved by:	re (cperciva)

(cherry picked from commit 1dd66c6ac2)
(cherry picked from commit 25e0657743)
2025-10-22 15:50:01 +00:00
Mark Johnston 98c5396678 inpcb: Ignore SO_REUSEPORT_LB on connected sockets
While TCP disallows connect()ing a socket with SO_REUSEPORT_LB, UDP does
not.  As a result, a connected UDP socket can be placed in the lbgroup
hash and thus receive datagrams from sources other than the connected
host.

Reported by:	Amit Klein <[email protected]>
Reported by:	Omer Ben Simhon <[email protected]>
Reviewed by:	glebius
Approved by:	so
Approved by:	re (cperciva)
Security:	FreeBSD-SA-25:09.netinet
Security:	CVE-2025-24934

(cherry picked from commit 320ad3dec5)
(cherry picked from commit ef159100ec)
2025-10-22 15:49:44 +00:00
Dave Cottlehuber e27e5b6b01 release: split up Oracle Cloudware tools
Sometimes one or the other but not both tools are present; this ensures
that all cases are correctly handled.

Reported by:	cperciva
Approved by:	cperciva (re)
Sponsored by:	SkunkWerks, GmbH

Reviewed by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D53186

MFC after:	2 days

(cherry picked from commit 81d807a906)
2025-10-22 08:17:01 +00:00
Bjoern A. Zeeb cafb77e9e0 pci: add quirk to disable Function-Level Reset (FLR)
MediaTek mt76 WiFi cards are advertising FLR support but after issuing
a FLR the chipset is gone.  Add a quirk so we can disable FLR.  The
current reset code will automatically fall back to a power reset.

This makes the card show up under bhyve where before it would just not
be discovered at all. That should make wifibox work for it and will help
development for a LinuxKPI based mt76 driver as found in framework laptops
as no dedicated machine and constant reboots are needed anymore.
We will likely need to add more PCI vendor/device IDs once we can test
the other device IDs.

Approved by:	re (cperciva)
After a lot of help from: jhb
Really implemented by:	jhb (I just typed and tested)
GH issue:		github.com/pgj/freebsd-wifibox/issues/73
Reviewed by:		imp, emaste
Differential Revision: https://reviews.freebsd.org/D52728

(cherry picked from commit 4c0e53aced)
(cherry picked from commit 3bd015a1a9)
2025-10-20 22:45:11 -07:00
Chris Johns 71f065aab5 dc(4): fix argument to if_foreach_llmaddr() for 21143.
As found on RTEMS the argument to if_foreach_llmaddr() was wrong
causing crashes.

Approved by:	re (cperciva)
Fixes:		51e8082055
PR:		290314

(cherry picked from commit 33afdf0e35)
(cherry picked from commit 10c71151ad)
2025-10-20 22:45:08 -07:00
Bjoern A. Zeeb 07d7f0e07b fwget: pci: mediatek: correct package name
The port is called wifi-firmware-mt76-kmod not "mediatek" in the
moddle.

Approved by:	re (cperciva)
Reported by:	Lars Tunkrans (drsnx60 gmail.com)
Reviewed by:	emaste, jrm, imp
Differential Revision: https://reviews.freebsd.org/D53067

(cherry picked from commit 10d88a7aa6)
(cherry picked from commit e048748627)
2025-10-20 22:45:01 -07:00
Olivier Certner b15ff72140 vm_domainset: Ensure round-robin works properly
All iterators that rely on an object's 'struct domainset_ref' (field
'domain' on 'struct vm_object'), which is the case for page allocations
with objects, are used with the corresponding object locked for writing,
so cannot lose concurrent iterator index's increases even if those are
made without atomic operations.  The only offender was thread stack
allocation, which has just been fixed in commit 3b9b644576 ("vm: Fix
iterator usage in vm_thread_stack_create()").

However, the interleaved policy would still reset the iterator index
when restarting, losing track of the next domain to allocate from when
applying round-robin, which all allocation policies do if allocation
from the first domain fails.

Fix this last round-robin problem by not resetting the shared index at
iterator's phase init on DOMAINSET_POLICY_INTERLEAVE.

Add an assertion to check that, when passed, an object is write-locked
in order to prevent the problem mentioned in the first paragraph from
reappearing.

Approved by:	re (cperciva)
Reviewed by:    markj
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52733

(cherry picked from commit 7b0fe2d405)
(cherry picked from commit d7226d1858)
2025-10-20 11:02:37 -07:00
Mark Johnston 9554bb1249 vm: Fix iterator usage in vm_thread_stack_create()
After commit 7a79d06697 we no longer hold the VM object lock when
initializing or advancing the domainset iterator in
vm_thread_stack_create().

We could lift the lock out of vm_thread_stack_back() but that poses
complications since we cannot allocate KVA with a VM object lock held.

Instead of overridding the object's iterator, just borrow that of the
current thread.  Kernel stacks are basically always allocated with a
DOMAINSET_POLICY_PREFER policy, so it's not very important to maintain a
global iterator for round-robin allocation.

As a part of this, fix up flag handling: make sure we handle
M_NOWAIT/M_WAITOK from the caller.  Delete a comment in vm_thread_new()
which refers to a non-existent consideration (stack swapping has been
removed).  I suspect vm_thread_new() can use M_WAITOK but opted not to
make that change here.

Approved by:	re (cperciva)
Reported by:	olce
Reviewed by:	olce, alc, kib
Fixes:		7a79d06697 ("vm: improve kstack_object pindex calculation to avoid pindex holes")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52982

(cherry picked from commit 3b9b644576)
(cherry picked from commit 511311e4f7)
2025-10-20 11:02:26 -07:00
Mark Johnston 30b015e2cf linprocfs: Add nodes for inotify
These map directly onto sysctls under vfs.inotify of the same name.

Approved by:	re (cperciva)
Reviewed by:	olce, des
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53142

(cherry picked from commit 28c0ef7684)
2025-10-20 10:48:16 -07:00
Michael Osipov 5773d056fb manpages: Use canonical names for Linux filesystems
The manpages of linprocfs(5) and linsysfs(5) document incomplete names without
"fs" suffix. Make them identical to other filesystems.

Approved by:	re (cperciva)
PR:		283079
MFC after:	3 days
Reviewed by:	ziaee, markj
Differential Revision:	https://reviews.freebsd.org/D53155

(cherry picked from commit 88b9ca860e)
(cherry picked from commit 6ec0fbd8ff)
2025-10-20 10:48:13 -07:00
Paul Armstrong e3bd658fad login.conf: Remove never used ignoretime/ignoretime@
Approved by:	re (cperciva)
PR:		240378
Reviewed by:	otis (mentor), glebius (src committer)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52991

(cherry picked from commit 4835fc45ef)
(cherry picked from commit 34710b2c08)
2025-10-20 10:48:09 -07:00
Mark Johnston 7cd9d3fe83 vmrun.sh: Don't require firmware on amd64 unless -E was specified
Approved by:	re (cperciva)
PR:		290232
Reported by:	David Marker <[email protected]>
Fixes:		aa34b1d20e ("vmrun.sh: Add arm64 support")
MFC after:	3 days

(cherry picked from commit f19f17b3af)
(cherry picked from commit 6c5540eebc)
2025-10-19 16:50:44 -07:00
Michael Tuexen aa2f726e9f socket: bump socket buffer limit to 8MB
Bump the socket buffer limit from 2 MB to 8MB.
In particular, this allows to use larger values for TCP sockets,
which may result in higher throughput values with default settings.
In the review I was proposing using 16 MB, but in the transport
call today we settled on a more conservative value of 8.
Bumping it further will be done in combination with mitigations
for mbuf exhaustion attacks.

Approved by:	re (cperciva)
Reviewed by:		rscheff, Peter Lei, jtl, thj
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52873

(cherry picked from commit 1fe6497b48)
(cherry picked from commit 167b9fac60)
2025-10-19 16:50:41 -07:00
Michael Tuexen a95febd393 tcp: bump max rcv buffer size for autoscaling
This allows in higher throughput values with default settings.
In the review I was proposing using 16 MB, but in the transport
call today we settled on a more conservative value of 8.
Bumping it further will be done in combination with mitigations
for mbuf exhaustion attacks.

Approved by:	re (cperciva)
Reviewed by:		rscheff, Peter Lei, jtl, thj
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52871

(cherry picked from commit baeff75122)
(cherry picked from commit c3cc8223dd)
2025-10-19 16:50:38 -07:00
Michael Tuexen a4198ef496 tcp: bump max snd buffer size for autoscaling
This allows in higher throughput values with default settings.
In the review I was proposing using 16 MB, but in the transport
call today we settled on a more conservative value of 8.
Bumping it further will be done in combination with mitigations
for mbuf exhaustion attacks.

Approved by:	re (cperciva)
Reviewed by:		rscheff, cc, glebius, Nick Banks, Peter Lei, jtl, thj, rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52872

(cherry picked from commit 9dd4742ee5)
(cherry picked from commit 7d29554b36)
2025-10-19 16:50:30 -07:00
Alexander Ziaee 0798de75ab nvd.4: Add a HARDWARE section for HW Relnotes
Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	dab
Differential Revision:	https://reviews.freebsd.org/D52867

(cherry picked from commit 7f5267a998)
(cherry picked from commit 795f4eef2c)
2025-10-18 17:40:28 -07:00
Alexander Ziaee a441f8ef16 release.7: Update RPI example + CHROOTDIR + SPDX
+ arm/RPI-B.conf no longer exists, adjust for arm64/RPI.conf
+ document default CHROOTDIR, also add to FILES list
+ tag SPDX

Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D53078

(cherry picked from commit 8a9f1a2286)
(cherry picked from commit be9b7d8dd0)
2025-10-18 17:40:22 -07:00
Colin Percival 3edefa72bc 15.0: Update to BETA2
Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-10-17 11:16:15 -07:00
Mark Johnston 1ae34f2dd8 linker: Make it easier to find the VNET section layout
When trying to find the address of a VNET variable from a debugger, it
helps to have the original address of the VNET section.  In particular,
given the address of a vnet_entry_foo symbol, one wants to easily find
the linker file that the symbol belongs to.

In link_elf_obj.c, the section address for VNET and DPCPU sections is
overwritten in link_elf_link_preload() and link_elf_load_file().  Add an
"origaddr" field to store the original absolute address of the section
base.

In link_elf.c the elf_file_t already has the fields we want, but they
were not getting filled out for the kernel itself.  Fix that too, since
that simplifies things for debuggers and improves consistency.

Approved by:	re (cperciva)
Reviewed by:	kib
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D52730

(cherry picked from commit 07747afd51)
(cherry picked from commit 5a926b3cd5)
2025-10-17 10:59:15 -07:00
Mark Johnston bdb41ce607 certctl.8: Update documentation of BUNDLE
- Fix a typo.
- Provide the default path.

Approved by:	re (cperciva)
Reviewed by:	des
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53001

(cherry picked from commit ec8e07e8fa)
(cherry picked from commit 1de06221cc)
2025-10-17 10:59:12 -07:00
Mark Johnston ecce77b7c9 vmstat: Print the number of wired pages in each object
Approved by:	re (cperciva)
Reviewed by:	alc, kib
MFC after:	1 week
Sponsored by:	Modirum MDPay
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D53008

(cherry picked from commit f66bb825f5)
(cherry picked from commit 5bc5ce6e61)
2025-10-17 10:59:08 -07:00
Mark Johnston cb752719c7 vm_object: Export the number of wired pages in vm_object_list_handler()
Approved by:	re (cperciva)
Reviewed by:	alc, kib
MFC after:	1 week
Sponsored by:	Modirum MDPay
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D53008

(cherry picked from commit ffca0c44ff)
(cherry picked from commit 2eaee0dbc2)
2025-10-17 10:59:04 -07:00
Mark Johnston 7060c79d24 vm_object: Reset kvo_path on each iteration in vm_object_list_handler()
Otherwise we print a bogus path for anonymous objects.

Approved by:	re (cperciva)
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	Modirum MDPay
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52997

(cherry picked from commit 13d866b314)
(cherry picked from commit 55ad7c573e)
2025-10-17 10:59:00 -07:00
Michael Tuexen 25d7786e32 sockstat: improve handling of path state
Only suppress the path state column when producing traditional text
output. When generating html output, always include the column.
Please note that when generating json or xml output, optional fields
like the path state are only generated if they is applicable. This
has not been changed.
The changes in this patch were suggested by asomers.

Approved by:	re (cperciva)
Reviewed by:		asomers
Fixes:			746eadecaa ("sockstat: show path state column only when useful")
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D53005

(cherry picked from commit 97e858f5b3)
(cherry picked from commit f6923c0a68)
2025-10-17 10:58:57 -07:00
Michael Tuexen 46d39e9f09 sockstat: show path state column only when useful
Showing the path state column is only useful, if there is at least one
SCTP endpoint shown, which is not in the state CLOSED or LISTEN.
Don't show it when it is not useful.

Approved by:	re (cperciva)
Reviewed by:		rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52986

(cherry picked from commit 746eadecaa)
(cherry picked from commit 9a0a114b7f)
2025-10-17 10:58:52 -07:00
Gleb Smirnoff 4940dc8c35 socket(2): refactor the manual page
Create a chapter on every important socket type: stream, datagram,
seqpacket.  Always list what protocol families do support what kinds of
sockets.  Improve some statements possessing language from the
specification [1].  Reduce some statements that are mostly specific to
TCP.  Provide more external links and references to various important
syscalls that can be used on sockets.

Add a paragrph on non-blocking mode.

The big factual change is documentation of SOCK_SEQPACKET.  In FreeBSD 15
this socket now fully follows the specification and is a stream socket
with record boundaries.

[1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/V2_chap02.html#tag_16_10_06

Approved by:	re (cperciva)
Differential Revision:	https://reviews.freebsd.org/D52771

(cherry picked from commit 86d1723923)
(cherry picked from commit ad13fd5a8f)
(cherry picked from commit a091d6919c)
2025-10-17 10:58:47 -07:00
Gleb Smirnoff b05f153cd2 unix/stream: repair SO_SNDTIMEO
The send operations are waiting on the peer's socket buffer, but we shall
use our timeout value.  Provide a test for that.

Approved by:	re (cperciva)
Reported by:		phk
Reviewed by:		asomers
Differential Revision:	https://reviews.freebsd.org/D53081
Fixes:			d157927807

(cherry picked from commit ead7219352)
(cherry picked from commit bbfaff26bf)
2025-10-17 10:58:38 -07:00
Colin Percival 8d2dcf925d vmimage.subr: Add missing directories to METALOG
Theoretically METALOG should include everything which needs to go
into disk images; unfortunately there are still a few bugs which
are resulting in directories not being listed -- and if METALOG
has files in unrecorded directories, the directories end up being
created with 000 permissions.

Oddly enough, systems where / has 000 permissions are not very
usable.

As a temporary hack, compare the staging tree against METALOG and
add entries for any unrecorded directories.  This will hopefully
be reverted before 15.0-RELEASE.

Approved by:	re (cperciva)
Reviewed by:	bapt, emaste, ivy
Sponsored by:	https://www.patreon.com/cperciva
MFC after:	5 minutes
Differential Revision:	https://reviews.freebsd.org/D53153

(cherry picked from commit 71b2f98535)
(cherry picked from commit 7ce5d908fd)
2025-10-17 09:53:40 -07:00
Ed Maste b5d5181d74 pkg-stage: Correct /packages permissions
Include /packages in the METALOG used to create dvd1.iso.  Previously
we used an expression ^./packages/ (with a trailing /) which did not
match /packages itself, and then with no METALOG entry /packages on
dvd1.iso ended up with mode d---------.

Approved by:	re (cperciva)
PR:		290222
Reviewed by:	cperciva
MFC after:	1 minute
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2db11dda84)
(cherry picked from commit ecd943a5af)
2025-10-16 18:33:12 -07:00
Colin Percival dc5aae134a release: Switch back to latest packages for now
Normally in BETAs the DVD images get packages from the latest
quarterly package build; but aarch64 does not yet have a quarterly
package set built for 15.x, and this made the BETA1 aarch64 builds
fail.  Switch back to using packages from the "latest" package set.

Direct commit to releng/15.0; will be reverted before the release.

Approved by:	re (cperciva)
Sponsored by:	https://www.patreon.com/cperciva
2025-10-16 18:15:15 -07:00
Colin Percival 6fc227a68b Ping: Make build reproducible
As recently fixed in sockstat (9934558460), having tests/Makefile
include files from the parent directory with SRCS= ../foo.c results
in a race condition as the parent build and the tests build try to
produce the same object file but contain different paths.

Use .PATH to tell make to find sockstat.c in the parent directory
but place the object file in the current object directory.

Approved by:	re (cperciva)
Reviewed by:	emaste, jrtc27, kevans
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D53075

(cherry picked from commit 3c9a2f383f)
(cherry picked from commit a7c1d6b72a)
2025-10-16 13:08:09 -07:00
Colin Percival 8f5eb720e2 packages: Compress in parallel
The FreeBSD-base pkg repository is currrently dominated by a handful of
large packages: Out of a compressed repository size of ~960 MB, about
160 MB is taken up by the FreeBSD-src package, 128 MB (on amd64) is
used by the FreeBSD-kernel-generic-dbg package, and 91 MB is used by
the FreeBSD-src-sys package.  Consequently, running 'make packages -jN'
provides less benefit than one might hope, as most of the packages
finish building quickly, ultimately leaving the FreeBSD-src package
building by itself for a couple minutes while all the other CPUs are
idle.

Pass -T${PKG_CTHREADS} to the 'pkg create' commands (with a default
of -T0) in order to instruct pkg's zstd compression to use multiple
threads.

Testing on an EC2 r7i.48xlarge instance with -j192, this reduces the
time taken by 'make packages' from 6m17s to 1m39s; package creation
time itself (excluding the initial process of installing into world
and kernel staging directories) dropped from 5m37s to 59s.

Approved by:	re (cperciva)
Reviewed by:	ivy
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D53053

(cherry picked from commit 16155cccc4)
(cherry picked from commit 3d8ec3273d)
2025-10-16 13:08:05 -07:00
Olivier Certner 77a00e86d6 sys/rpc: UNIX auth: Do not log on bogus AUTH_SYS messages
Remove the printf() stances added in commit d4cc791f3b ("sys/rpc: UNIX
auth: Fix OOB reads on too short message").

Even if it can be helpful to know why an authentication message is
rejected, printing explanatory messages on each request attempt is
a remote log filler that could be triggered by accident, and the generic
RPC code generally does not do that.  These printf() calls should be
restored only after some limiting or configuration mechanism is devised.

Approved by:	re (cperciva)
MFC with:       d4cc791f3b ("sys/rpc: UNIX auth: Fix OOB reads on too short message")
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 2110ae0ef9)
(cherry picked from commit fb8a978ebf)
2025-10-16 11:48:24 -07:00
Olivier Certner 2dda215652 sys/rpc: UNIX auth: Style: Remove unnecessary headers, minor changes
Approved by:	re (cperciva)
MFC after:      2 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit a4105a5d4e)
(cherry picked from commit d06658b806)
2025-10-16 11:48:21 -07:00
Olivier Certner 082e48e81b sys/rpc: UNIX auth: Support XDR_FREE
xdr_authunix_parms() does not allocate any auxiliary memory, so we can
simply support XDR_FREE by just returning TRUE.

Although there are currently no callers passing XDR_FREE, this makes us
immune to such a change in a way that doesn't cost more but is more
constructive than a mere KASSERT().

Approved by:	re (cperciva)
Suggested by:   rmacklem
MFC after:      2 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 4ae70c3ea4)
(cherry picked from commit b27688a8b5)
2025-10-16 11:48:17 -07:00
Olivier Certner f96df7ef17 sys/rpc: UNIX auth: Fix OOB reads on too short message
In the inline version (_svcauth_unix()), fix multiple possible OOB reads
when the credentials part of a request is too short to contain mandatory
fields or with respect to the hostname length or number of groups it
advertises.  The previously existing check was arriving too late and
relied on possibly wrong data coming from earlier OOB reads.

While here, use 'uint32_t' as the length/size type, as it is more than
enough and removes the need for conversions, explicit or implicit.
While here, factor out setting 'stat' to AUTH_BADCRED and then jumping
to 'done' on error, through the new 'badcred' label.  While here,
through comments, refer to what the non-inline version is doing
(xdr_authunix_parms() in 'authunix_prot.c') and the reasons.

Approved by:	re (cperciva)
Reviewed by:    rmacklem
Fixes:          dfdcada31e ("Add the new kernel-mode NFS Lock Manager.")
MFC after:      2 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52964

(cherry picked from commit d4cc791f3b)
(cherry picked from commit 45e671c9cd)
2025-10-16 11:48:14 -07:00
Olivier Certner d14f6f1704 sys/rpc: UNIX auth: Use AUTH_SYS_MAX_{GROUPS,HOSTNAME} as limits (2/2)
Remove local defines from 'svc_auth_unix.c' and use the new limit
macros instead.

Approved by:	re (cperciva)
Reviewed by:    rmacklem
MFC after:      2 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52963

(cherry picked from commit e665c0f6f7)
(cherry picked from commit 9763e76ccc)
2025-10-16 11:48:11 -07:00
Olivier Certner fc3b621afd sys/rpc: UNIX auth: Use AUTH_SYS_MAX_{GROUPS,HOSTNAME} as limits (1/2)
Consistently with the XDR_INLINE() variant of xdr_authunix_parms()
(_svcauth_unix() in 'svc_auth_unix.c'), reject messages with credentials
having a machine name length in excess of AUTH_SYS_MAX_HOSTNAME or more
than AUTH_SYS_MAX_GROUPS supplementary groups, which do not conform to
RFC 5531.  This is done mainly because we cannot store excess groups
anyway, even if at odds with the robustness principle ("be liberal in
what you accept").

While here, make sure the current code is immune to AUTH_SYS_MAX_GROUPS
changing value (in future RFCs?) even if that seems improbable.

Approved by:	re (cperciva)
Reviewed by:    rmacklem
Fixes:          dfdcada31e ("Add the new kernel-mode NFS Lock Manager.")
MFC after:      2 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52962

(cherry picked from commit b119ef0f6a)
(cherry picked from commit 34fc20503f)
2025-10-16 11:48:07 -07:00
Olivier Certner ed62b31e30 sys/rpc: Define AUTH_SYS_MAX_{GROUPS,HOSTNAME}
As, respectively, the maximum number of "supplementary" groups and the
maximum hostname size allowed in the credentials structure for AUTH_SYS
(aka, AUTH_UNIX).

Will be used in subsequent commits.

Approved by:	re (cperciva)
Reviewed by:    rmacklem
MFC after:      2 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52961

(cherry picked from commit f7c4f800cc)
(cherry picked from commit 37aeac4464)
2025-10-16 11:48:04 -07:00
Olivier Certner f647564f3f sys/rpc: UNIX auth: Fix OOB accesses, notably writes on decode
When the received authentication message had more than XU_NGROUPS, we
would write group IDs beyond the end of cr_groups[] in the 'struct
xucred' being filled (as 'ngroups_max' is always greater than
XU_NGROUPS).

For robustness, prevent various OOB accesses that would result from
a change of value of XU_NGROUPS or a 'struct xucred' with an invalid
'cr_ngroups' field, even if these cases are unlikely.

Approved by:	re (cperciva)
Reviewed by:    rmacklem
Fixes:          dfdcada31e ("Add the new kernel-mode NFS Lock Manager.")
MFC after:      2 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52960

(cherry picked from commit 47e9c81d4f)
(cherry picked from commit 9492a1e27f)
2025-10-16 11:48:00 -07:00
Olivier Certner 330b918549 sys/rpc: UNIX auth: Rename 'ngroups' => 'supp_ngroups' for clarity
Approved by:	re (cperciva)
MFC after:      2 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit bda3b61512)
(cherry picked from commit 5e482104ec)
2025-10-16 11:47:57 -07:00
Ed Maste 53eda63d6d zfs: Emit warning upon use of legacy sysctls
The introduction of OpenZFS moved some sysctls, and legacy compat shims
were added.  For example:

Old (legacy) name: vfs.zfs.min_auto_ashift
New name:          vfs.zfs.vdev.min_auto_ashift

Upstream OpenZFS removed these, but we've temporarily restored them in
FreeBSD.

Note that l2arc sysctls use generic sysctl functions (e.g. SYSCTL_UQUAD)
and thus cannot trivially have warnings added, so they are not handled.

Approved by:	re (cperciva)
PR:		266374
Reviewed by:	jlduran
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53033

(cherry picked from commit 654a3aa9a1)
(cherry picked from commit f0033878b9)
2025-10-16 11:15:49 -07:00
Ahmad Khalifa 4c87cff1c8 libm: remainder: make sure x is zero
Make sure the entirety of x is zero before flipping the sign bit.
Otherwise the sign would be wrong for small values of x when x is
negative and |n*y| > |x|

Approved by:	re (cperciva)
Reported by:	alfredo
PR:		251091
Reviewed by:	kargl
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D53023

(cherry picked from commit 25cca51ed2)
(cherry picked from commit 583e976d6d)
2025-10-16 10:37:22 -07:00
Jose Luis Duran 2b4d38a475 openssh: blocklist: Remove non async-signal safe probe
BLOCKLIST_NOTIFY() is called within a signal handler for the alarm after
the grace period has expired that may only take async-signal safe
actions.

Approved by:	re (cperciva)
Reviewed by:	emaste
Fixes:		e02003bce7 ("openssh: blocklist: Use NetBSD probes")
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D53109

(cherry picked from commit 9c82c17c2a)
(cherry picked from commit 7161c525ab)
2025-10-15 20:47:33 -07:00
Mark Johnston 24546cb506 rc: Update dependencies for zpool scripts
After commit 900bc02063, zpool depends on mountcritlocal.  zpoolreguid
and zpoolupgrade depend on zpool and want to run before mountcritcycle,
so we have a pair of cycles.

Update zpoolreguid and zpoolupgrade to avoid this.

Approved by:	re (cperciva)
Reviewed by:	des
MFC after:	3 days
Fixes:	900bc02063 ("rc.d/zpool: change mountcritlocal dep from BEFORE to REQUIRE")
Differential Revision:	https://reviews.freebsd.org/D52953

(cherry picked from commit ae6db60ff5)
(cherry picked from commit 8e957b78e6)
2025-10-15 12:23:44 -07:00
Hareshx Sankar Raj 138e36514f qat: enable qat driver for 402xx device
Enabled qat driver support for 402xx device with
ID 0x4944/0x4945. This is an additional device supported
under the existing qat_4xxx driver. Firmwares specific to
the 402xx device are added.

Signed-off-by: Hareshx Sankar Raj <[email protected]>

Approved by:	re (cperciva)
Relnotes:	yes
Sponsored by:	Intel Corporation
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D52488

(cherry picked from commit 7fbd362c09)
(cherry picked from commit 88c0ce38bc)
2025-10-15 12:23:40 -07:00
Lexi Winter d8897097ed packages: Rename unbound to local-unbound
This more accurately reflects its purpose, and its contents, since
everything in the package is prefixed with "local-".

While here, add a message on upgrade about regenerating the config.

Approved by:	re (cperciva)
MFC after:	3 seconds
Requested by:	des
Reviewed by:	des
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53056

(cherry picked from commit bf84861460)
(cherry picked from commit f1b0e00d56)
2025-10-15 12:23:36 -07:00
Lexi Winter 14d97bd64a ncurses: Add an ncurses-lib package
Set LIB_PACKAGE= in lib/ncurses/Makefile.inc so the ncurses libraries
go into the ncurses-lib subpackage rather than the base package. This
means applications that depend on ncurses can be installed without
needing to install the various utilities and manpages.

This removes a dependency from runtime to ncurses (it now depends on
ncurses-lib instead).

Approved by:	re (cperciva)
MFC after:	3 seconds
Reviewed by:	kevans
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53060

(cherry picked from commit bde703e8b6)
(cherry picked from commit 9dab0e61a9)
2025-10-15 12:23:32 -07:00
Ed Maste 7ae8ea82d7 Cirrus-CI: Bump to FreeBSD 14.3 image
Approved by:	re (cperciva)
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit cca9295dd6)
(cherry picked from commit 608043e6d0)
2025-10-15 12:23:29 -07:00
Ed Maste c307343246 bsdinstall: Tweak pkgbase/dist set labels
Have the button labels refer to the artifact type directly (distribution
sets / packages), and use "Tech Preview" as packaged base is no longer
experimental.

Approved by:	re (cperciva)
Reviewed by:	ivy, cperciva
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52999

(cherry picked from commit abd9424590)
(cherry picked from commit dbd1e32296)
2025-10-15 12:23:19 -07:00
Colin Percival f6751f1fc5 vmimage.subr: Sort METALOG before running makefs
When creating VM images from pkgbase, the METALOG may not be in order;
in particular, files may be listed before the directories which contain
them.  This causes makefs to create directories with 000 permissions.

Interestingly, such VM images boot just fine, since root ignores those
permissions; the first sign of trouble was sshd refusing logins with an
error message which said absolutely nothing about /etc/ having
incorrect permissions or being unable to read files inside it.

Immediately prior to running makefs, sort the METALOG file.  While
we're here, uniquify as well; this does not guarantee that we do not
have duplicate paths, but if there are duplicate paths with different
settings something else has gone wrong and we don't really have any
good way of solving the problem anyway.

Approved by:	re (cperciva)
Reviewed by:	ivy
Hint from:	imp
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D53046

(cherry picked from commit 0cc81b375e)
(cherry picked from commit ad2ca1c5c1)
2025-10-14 23:08:12 -07:00
Michael Tuexen a9ffe497c8 sockstat: improve output formatting
Fix the format when the output for a socket spans multiple lines.

Approved by:	re (cperciva)
Reviewed by:		rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52984

(cherry picked from commit 98b2a2265f)
(cherry picked from commit 7e567f51ff)
2025-10-14 23:08:09 -07:00
Michael Tuexen 72e948cff1 sockstat: improve indentation
No functional changes intended.

Approved by:	re (cperciva)
Sponsored by:	Netflix, Inc.

(cherry picked from commit ab837a2eed)
(cherry picked from commit 3dac4b92ec)
2025-10-14 23:08:05 -07:00
Mateusz Guzik 9bea2657c4 vfs offset: fix assertion failure in face of racing ffofset and setfl locking
Both use the same 16 bit var to store their locked and waiters bits,
then this in file_v_unlock:

        state = atomic_load_16(flagsp);
        if ((state & lock_wait_bit) == 0 &&
            atomic_cmpset_rel_16(flagsp, state, state & ~lock_bit))
                return;

can fail if for example foffset is being unlocked while setfl is getting
locked.

Afterwards the code assumes there are blocked waiters on foffset.

Approved by:	re (cperciva)
Reviewed by: kib, markj
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D52915

(cherry picked from commit f43e19db6c)
2025-10-14 23:08:01 -07:00
Jose Luis Duran bf591ddc87 blocklist: Add an UPDATING entry
Add an UPDATING entry about the renaming of blocklist.

Approved by:	re (cperciva)
Approved by:	emaste (mentor)
Fixes:	7238317403 ("blocklist: Rename blacklist to blocklist")
MFC after:	1 day

(cherry picked from commit ffa8165009)
(cherry picked from commit f22ca25404)
2025-10-13 21:36:45 -07:00
Jose Luis Duran 621d4b1d01 blacklist: Avoid duplicate manual pages in METALOG
Previously, blacklist man pages were just a symlink to their blocklist
counterpart, this in turn installed blocklist man pages twice, and
resulted in a duplicate error when running metalog_reader.lua -c.

Take advantage of the duplication to document nuances in blacklist, such
as the fact that it uses the new database and socket name (blocklist).
Also, note that it has been renamed to blocklist.  In the future, it
will help to document its deprecation.

Approved by:	re (cperciva)
Approved by:	emaste (mentor)
Fixes:	7238317403 ("blocklist: Rename blacklist to blocklist")
MFC after:	2 days

(cherry picked from commit c624004553)
(cherry picked from commit f935c0f66f)
2025-10-13 21:36:42 -07:00
Jose Luis Duran f315a3512c blocklist-helper: Silence a bogus pf warning
Silence a bogus warning about (an ethernet) anchor not being found.

It has been reported as PR 280516.  In the meantime, just sweep under
the carpet.

Approved by:	re (cperciva)
Approved by:	emaste (mentor)
MFC after:	2 days

(cherry picked from commit 2347ca21d6)
(cherry picked from commit ba5768504b)
2025-10-13 21:36:39 -07:00
Jose Luis Duran 2b6eb65612 blocklist: Rename blacklist to blocklist
Follow up upstream rename from blacklist to blocklist.

- Old names and rc scripts are still valid, but emitting an ugly warning
- Old firewall rules and anchor names should work, but emitting an ugly
  warning
- Old MK_BLACKLIST* knobs are wired to the new ones

Although care has been taken not to break current configurations, this
is a large patch containing mostly duplicated code.  If issues arise, it
will be swiftly reverted.

Approved by:	re (cperciva)
Reviewed by:	ivy (pkgbase)
Approved by:	emaste (mentor)
MFC after:	2 days
Relnotes:	yes

(cherry picked from commit 7238317403)
(cherry picked from commit 7f6f2139ee)
2025-10-13 21:36:35 -07:00
Jose Luis Duran 803c373304 blocklist: Revert upstream commit ddf6d71
Upstream commit ddf6d71 ("implement BLOCKLIST_BAD_USER as a "one-count"
failure") introduced BLOCKLIST_BAD_USER with a one-count failure
mechanism.  BLOCKLIST_AUTH_FAIL was implemented with a two-count failure
mechanism.  Since we have been utilizing BLOCKLIST_AUTH_FAIL, the number
of failed attempts now doubles towards the maximum limit (nfails),
giving system administrators the impression that the number of failed
authentication attempts is inaccurate.

Revert this commit until a consensus has been reached.  We do not want
to introduce yet another breaking change with the renaming of the
library.

Approved by:	re (cperciva)
Approved by:	emaste (mentor)
MFC after:	2 days

(cherry picked from commit 4d56eb007b)
(cherry picked from commit a719ef67e8)
2025-10-13 21:36:31 -07:00
Jose Luis Duran e2dcc9fc4d MFV: Import blocklist 2025-04-28 (8aa81bf)
Merge commit '70f30afd4e9af5a51ee324d97e4d8c5f2124ec15'

Breaking changes:

- Upstream commit 24932b6 ("blocklistd: log the conf file line number
  with bad protocol errors") breaks backward database compatibility.
  An error will be displayed:
      Key size mismatch 296 != 288
  A new and compatible database, with the new name, will be created when the
  service starts (committed separately).

- Upstream commit ddf6d71 ("implement BLOCKLIST_BAD_USER as a
  "one-count" failure") introduced BLOCKLIST_BAD_USER with a one-count
  failure mechanism.  BLOCKLIST_AUTH_FAIL was implemented with a
  two-count failure mechanism.  Since we utilize BLOCKLIST_AUTH_FAIL, the
  number of failed attempts now doubles towards the maximum limit
  (nfails).  This commit will be reverted separately.

Changes:

https://github.com/zoulasc/blocklist/compare/7093cd9...8aa81bf

Approved by:	re (cperciva)
Approved by:    emaste (mentor)
MFC after:      2 days
Differential Revision:  https://reviews.freebsd.org/D52869

(cherry picked from commit 48e64ca13d)
(cherry picked from commit 1a08326c6f)
2025-10-13 21:36:12 -07:00
Colin Percival 6908a35807 EC2: Fix additional files on small+builder AMIs
The file /usr/local/etc/ssl/cert.pem is not present on "small" and
"builder" AMIs, so we don't need to add it to METALOG.

Approved by:	re (cperciva)
Fixes:	2b0ffc0ee4 ("EC2: metalog_add missing files from packages")
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 8a7ac88aa3)
(cherry picked from commit e9010214e9)
2025-10-13 19:54:24 -07:00
Lexi Winter f01adba1e2 Makefile.inc1: Build source packages before sets
To build set-src, we first need to build the source packages.  Add a
.ORDER to ensure this happens.  Otherwise, in a parallel build, sets
might be built before the src-* packages have finished building, and
set-src will be mysteriously missing.

Approved by:	re (cperciva)
MFC after:	3 seconds
Reported by:	cperciva
Actually diagnosed by:	jrtc27
One-line fix by:	ivy
Reviewed by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D53076

(cherry picked from commit ea5685ba79)
(cherry picked from commit 3b5ec539be)
2025-10-13 19:47:36 -07:00
Igor Ostapenko e01a58798f mit-krb5.pc: Add missing -lkrb5profile
Fixes the ports that prefer static linking:
https://reviews.freebsd.org/D49277

Approved by:	re (cperciva)
Reviewed by:	ivy, dch, cy
Sponsored by:	SkunkWerks, GmbH
Differential Revision:	https://reviews.freebsd.org/D52910

(cherry picked from commit 2d9fd2c573)
(cherry picked from commit 771ee17c88)
2025-10-13 19:47:32 -07:00
Xin LI 573cb59c35 MFC: libbz2: add pkg-config file (bzip2.pc)
Add generation of a bzip2.pc file for use with pkg-config and create
a basic template as bzip2.pc.in.

This allows other software to easily locate and link against libbz2
using standard pkg-config mechanisms instead of manual compiler and
linker flags.

The version number is extracted automatically from bzlib.h to keep
it consistent with the library sources.

Approved by:	re (cperciva)
Tested:	pkg-config --exists --print-errors "bzip2 >= 1.0.9" (fail, expected)
	pkg-config --exists --print-errors "bzip2 >= 1.0" (succeeded)
	pkg-config --libs bzip2 (-lbz2)
	pkg-config --cflags bzip2 ()

(cherry picked from commit 5863197933)
(cherry picked from commit f139a644d3)
2025-10-13 08:28:24 -07:00
Lexi Winter ab0d79d537 libbluetooth: Move to the bluetooth-lib package
Move the library, but not any of the runtime.  This allows executables
to link against libbluetooth without having to pull in the entire BT
stack.

Approved by:	re (cperciva)
MFC after:	3 days
Reviewed by:	dch, emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53016

(cherry picked from commit 426891e0f8)
(cherry picked from commit dced18c770)
2025-10-13 00:06:47 -07:00
Lexi Winter e74f3a9494 virtual_oss: Move plugins to the sound package
This is the correct place for them, and also issues an incorrect
dependency from utilities to sound.

Approved by:	re (cperciva)
Fixes:	1b806e607f ("packages: Add a sound package")
MFC after:	3 days
Reviewed by:	christos, dch
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53015

(cherry picked from commit 419dcdc2c9)
(cherry picked from commit 861225fbe3)
2025-10-13 00:06:44 -07:00
Lexi Winter fde09c8300 release/packages/ucl: Fix typos
Approved by:	re (cperciva)
MFC after:	3 days
Sponsored by:	https://www.patreon.com/bsdivy

(cherry picked from commit 039eba16f9)
(cherry picked from commit 663a53d8e7)
2025-10-13 00:06:29 -07:00
Lexi Winter 0fa9385d10 bridge.4: Fix the synopsis for -ifuntagged
This command doesn't accept a vlan-id.

Approved by:	re (cperciva)
PR:	290141
MFC after:	3 days
Reported by:	Paul Procacci <[email protected]>
Reviewed by:	ziaee (manpages)
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D53049

(cherry picked from commit dc978c5cb5)
(cherry picked from commit 53fcc7f9b0)
2025-10-13 00:06:21 -07:00
Rick Macklem c904188d35 rpc.tlsservd.c: Pin max threads at 1 for now
PR#289734 reports a crash in tcp_use_close() when the rpc.tlsservd
daemon is being used.  Although I have no, as yet, had time to track
down/fix the race, it turns out setting rpctls_maxthreads to 1
avoids the problem.

This patch pins rpctls_maxthreads to 1 to avoid the problem,
until there is a proper fix.

Approved by:	re (cperciva)
PR:	289734

(cherry picked from commit 7a289fe3cd)
(cherry picked from commit a7fc4e326c)
2025-10-12 18:25:42 -07:00
Colin Percival 36a923a476 release: Remove errant .endfor
This didn't show up in testing on main or stable/15 because it only
applies for "release" (BETA and onwards) builds.

Approved by:	re (cperciva)
Fixes:	afdc022deb ("release: Publish pkgbase-repo.tar")
MFC after:	30 seconds
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 474ae083b1)
(cherry picked from commit 5de7bdab32)
2025-10-10 21:17:48 -07:00
Colin Percival 7849d8d239 EC2: metalog_add missing files from packages
The files
	/usr/local/etc/dhclient.conf
	/usr/local/etc/ssl/cert.pem
are created in EC2 images by installed packages, but are not being
registered in METALOG.  The reason for this is not immediately clear,
but may be related to the handling of "sample" files.

Approved by:	re (cperciva)
Reviewed by:	dch
MFC after:	5 minutes
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D53035

(cherry picked from commit 2b0ffc0ee4)
(cherry picked from commit 63da8d2639)
2025-10-10 17:05:24 -07:00
Colin Percival b1303ed636 vmimage.subr: metalog_add generated databases
The files /etc/login.conf.db, /etc/passwd, /etc/pwd.db, /etc/spwd.db,
and /var/db/services.db are generated at install time.  When VM images
are built using installworld, there is Makefile code which emits the
necessary METALOG lines; but the pkgbase triggers do not do this.  This
resulted in VM images which lacked these essential database files.

VM images are currently the only place where this matters, since this
issue is specific to non-root image builds uusing pkgbase.  (In some
point in the future we will start building release ISO iamges from
pkgbase, at which point it will be a problem there as well.)

The long-term solution for this is probably to teach the relevant
database-creating tools to emit METALOG lines; but for now, just log
the necessary files from vmimage.subr.

Approved by:	re (cperciva)
Reviewed by:	dch
MFC after:	5 minutes
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D53034

(cherry picked from commit 6081365c27)
(cherry picked from commit b3c5c7d6f1)
2025-10-10 17:05:16 -07:00
Colin Percival a2829ff9d1 15.0: create releng/15.0 branch
Update from ALPHA5 to BETA1
Switch pkg(8) configuration to use the quarterly repository
Bump __FreeBSD_version

Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-10-09 23:59:00 +00:00
Christos Margiolis 2a6c17544e virtual_oss: Clean up rcorder
sndiod is part of audio/sndio, so we should avoid referencing a port
utility from base.

We should also require NETWORKING for the service to start, since
virtual_oss can be configured to send audio through the network.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	des, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D53019

(cherry picked from commit 188ddc15e5)
2025-10-10 23:23:31 +02:00
John Baldwin fb939e88ba ahci: Don't fail attach if the MSI-X BARs cannot be allocated
If the MSI-X table and/or PBA live in separate BAR(s) and those BAR(s)
cannot be allocated, fall back to using MSI or INTx instead of failing
attach.

PR:		289748
Reported by:	Vitalij Satanivskij <[email protected]>
Reviewed by:	avg, imp
Differential Revision:	https://reviews.freebsd.org/D52889

(cherry picked from commit b658158e93)
2025-10-10 17:04:31 -04:00
John Baldwin ec598fa915 ahci: Use pci_msix_*_bar instead of reading config registers directly
Reported by:	avg
Reviewed by:	avg, imp
Differential Revision:	https://reviews.freebsd.org/D52888

(cherry picked from commit 762f1c7c6c)
2025-10-10 17:04:02 -04:00
Zhongqi Zhao 64b51d35ce Fix possible out of bounds read in armv8_crc32c
Reviewed by:	andrew
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D52401

(cherry picked from commit f48b1a34ef)
2025-10-10 17:00:10 -04:00
Colin Percival 0abc052966 sockstat: Fix build reproducibility
Both usr.bin/sockstat and usr.bin/sockstat/tests build the file
src/usr.bin/sockstat/sockstat.c.  Unfortunately, they place the
resulting object file in the same place, but produce different
files due to paths appearing in the .debug files; this results
in different binaries depending on how the race between the two
builds ends.

Use .PATH to tell make to find sockstat.c in the parent directory
but place the object file in the current object directory, rather
than placing '..' into the name of the source file.

Suggested by:	bdrewery, emaste, jrtc27
MFC after:	5 minutes (15.0 build fix)
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D53032

(cherry picked from commit 9934558460)
2025-10-10 13:51:44 -07:00
Dave Cottlehuber b84e5059db release: switch OCI containers to use pkg sets
use minimal-jail in no-toolchain

MFC after:	1 hour

Reviewed by:	ivy
Sponsored by:	SkunkWerks, GmbH
Differential Revision:	https://reviews.freebsd.org/D53014

(cherry picked from commit a5b19a0cb9)
2025-10-10 19:50:24 +00:00
Kyle Evans 8a0cdfc5a5 build: fix ordering of pkgbase targets to get a dtb package reliably
dtb.plist is generated by mtree-to-plist when it processes the kernel
metalog, so we shouldn't try to create dtb packages until that's been
done.  Add another level of indirection to the create-kernel-packages
target to organize all of the kernel flavors under a single target that
is ordered before the create-dtb-packages target.

Note that we may later refine these targets after further pkgbase
review; this is simply a maybe-final stop-gap that's been tested to
fix a known problem.

Reviewed and tested by:	cperciva

(cherry picked from commit a29cf898b0)
2025-10-10 12:38:25 -05:00
Olivier Certner 59f602e2f2 getgroups.2: Simplifications; Be clearer on programs to be modified
In the STANDARDS section, stop mentioning behavior that is not
prescribed by POSIX and make sure to specify which alternative we
implement (as POSIX allows to return or not the effective group ID).

Say more clearly that programs treating specially the first slot of the
returned array must be modified.

Consistently use "group ID" instead of "GID".

These changes are going to be MFCed into stable/14 as part of MFCing
commit 4be38acc82 ("getgroups.2: Clarify, mention ascending order, add
SECURITY CONSIDERATIONS"), so the current commit will be MFCed to
stable/15 only.

MFC after:      1 hour
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit c363dcbe75)
2025-10-10 19:03:16 +02:00
Alexander Ziaee c637cd700e cli.lua.8: Reflow literal comments
Reflow comments in literal text blocks
so this manual is legible at MANWIDTH 78.

MFC after:	1 day

(cherry picked from commit de36d0dbae)
2025-10-10 12:15:06 -04:00
Alexander Ziaee 7c837513a4 umass.4: Modernize driver loading instructions
+ consolidate kernel configuration in SYNOPSIS
+ explain driver autoloading in DESCRIPTION
+ s/port/interface/ because of internal USBs
+ fix flow of remaining example

MFC after:	1 day

(cherry picked from commit d8a4843cb7)
2025-10-10 12:15:06 -04:00
Alexander Ziaee 27663f352a aacraid.4: Fix document description + tag SPDX
The document description previously just stated the name of the driver.
Replace this with the name of the controller families and specs that
it supports, in a similar fashion to other RAID drivers.

MFC after:	3 days

(cherry picked from commit d5d1e05efb)
2025-10-10 12:15:05 -04:00
Alexander Ziaee 1eae8fe5eb aacraid.4: Improve HARDWARE introductory sentance
To improve HW relnotes

MFC after:	3 days

(cherry picked from commit 20a8d06034)
2025-10-10 12:15:05 -04:00
Yoshiro MIHIRA 89cee021a7 release/RPI: Add RPI Zero 2W device tree blob dtb
Enable Pi 02W support on the release SD card images by including the
device tree.

PR:		278816
MFC after:	3 days
Approved by:	cperciva (re)

(cherry picked from commit e41e099ef1)
2025-10-10 12:15:01 -04:00
Lexi Winter 4e74ee7820 etc/mtree: Add package tags for Kerberos directories
Fixes:		e7e7bf757a ("krb5: create the KDC database directory")
MFC after:	3 seconds
Reviewed by:	cy
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52975

(cherry picked from commit 6235ee2848)
2025-10-10 14:35:35 +01:00
Gleb Smirnoff 4e5964d6e2 krb5: create the KDC database directory
Reviewed by:		rmacklem, cy
Differential Revision:	https://reviews.freebsd.org/D52970

(cherry picked from commit e7e7bf757a)
2025-10-10 14:35:35 +01:00
Michael Tuexen d46d4628f6 sockstat: support reporting of BBLog state
Add a -b option to print the BBLog state for TCP sockets.

Reviewed by:		jtl, rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52944

(cherry picked from commit d801cc2d85)
2025-10-09 21:52:35 +02:00
Kristof Provost 8638af3b22 pf.conf.5: 'address' is mandatory with route-to
Adjust the BNF, and don't claim it is optional in the text.

PR:		290059
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 306f29475f)
2025-10-10 10:11:37 +02:00
Colin Percival c779f56c70 release: Don't install missing lib32 into VMs
There is no FreeBSD-set-lib32 on riscv64 or powerpc64le.

Reviewed by:	ivy, emaste
Fixes: 2d184465e8 ("release: Rework VM package selection using sets")
MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D52987

(cherry picked from commit 0dc634d48f)
2025-10-09 21:46:43 -07:00
Colin Percival a1d3c0257a release: Fix pkgbase tarball names on FTP site
These need to have names like
  FreeBSD-15.0-ALPHA5-amd64-pkgbase-repo.tar
not just "pkgbase-repo.tar".

Fixes: d0ff67db29 ("release: Publish pkgbase-repo.tar")
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit c943e6ff9a)
2025-10-09 21:46:43 -07:00
Colin Percival 4f00e2f965 release: Fix dependency ordering
The 'make release' command triggers some sub-builds, in particular
'real-release' (which builds install images) and 'vm-release' (which
builds VM images).  These both now depend on pkgbase-repo.

Unfortunately for historical reasons 'make real-release' has used a
recursive make instead of proper make dependencies; this results in
the pkgbase-repo target being invoked twice since the recursive make
does not have any awareness of the targets being run by the parent
make command.  Since the pkgbase-repo target starts by creating the
pkgbase-repo directory, the second make command incorrectly assumes
that target has already been built; this showed up in 15.0-ALPHA5
builds with pkgbase-repo.tar being empty as it was created after the
pkgbase-repo directory was created by before that directory had been
populated.

Change
real-release:
	make obj
	make ${RELEASE_TARGETS}
to a single line
real-release: obj .WAIT ${RELEASE_TARGETS}
in order to handle dependency deduplication properly while keeping
the intended behaviour that "obj" completes before ${RELEASE_TARGETS}.

Diagnosed by:	jrtc27, emaste
Reviewed by:	emaste
MFC after:	1 day
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D52972

(cherry picked from commit b6f69c3999)
2025-10-09 21:46:43 -07:00
Colin Percival 2b4630e43f release: Rework VM package selection using sets
Filtering the list of packages broke with the introduction of package
sets, since we excluded FreeBSD-src.* but still included
FreeBSD-set-src, which transitively included the FreeBSD-src and
FreeBSD-src-sys packages.  This could be fixed by excluding package
sets, but that would be fragile, potentially breaking upgrades if
new packages are introduced.

Instead, start with an explicit set of package sets:
	base, base-dbg
	lib32, lib32-dbg
	kernels, kernels-dbg
	tests
and filter the package sets; the EC2 "small" and "builder" AMIs
filter out everything except "base" and "kernels".

Note that using FreeBSD-set-kernels may pose a problem in the future
if we start shipping packages for multiple differently-configured
kernels.  That will be addressed if and when that problem arises.

Reviewed by:	ivy
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D52922

(cherry picked from commit 2d184465e8)
2025-10-09 21:46:43 -07:00
Colin Percival eba80e6577 EC2: Include LLDB in small and builder AMIs
I excluded lldb from the "small" and "builder" flavours of EC2 AMIs
because on FreeBSD 14.x the lldb binary was 100 MB, as a result of
statically linking in lots of LLVM code; but we now have libprivatellvm
as a shared library and lldb is much smaller so there's no significant
benefit to excluding it.

Reviewed by:	ivy
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D52921

(cherry picked from commit 2b6c5f041f)
2025-10-09 21:46:43 -07:00
Lexi Winter 42b2a874b1 bsdinstall.8: Fix '---jail' option in manpage
The .Fl macro implicitly adds a '-', so only use a single '-' in the
--jail option.

Fixes:	8d0a90512e ("bsdinstall: Improve pkgbase handling for jails")
MFC after:	1 day
Reported by:	Mark Millard <[email protected]>
Sponsored by:	https://www.patreon.com/bsdivy

(cherry picked from commit ed5023c96c)
2025-10-10 05:33:40 +01:00
Lexi Winter f94b650805 generate-set-ucl.lua: Add missing copyright header
This file was derived from generate-ucl.lua, so copy the existing
header.

MFC after:	3 days

(cherry picked from commit c8f9a9abd8)
2025-10-10 05:33:31 +01:00
Lexi Winter 8a703d0988 libexec/rc/rc.d/Makefile: Use CONFGROUPS.yes
Replace .if statements with CONFGROUPS.${MK_FOO} where possible,
and also sort and re-indent the file for readability.

A couple of more complicated sections don't work with CONFGROUPS.yes
yet, so leave those as they are for now.

MFC after:	1 week
Reviewed by:	imp
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52974

(cherry picked from commit 56f9879c3d)
2025-10-10 05:32:52 +01:00
Lexi Winter cad4ddf201 bsd.confs.mk: Support CONFGROUPS.yes
Align CONFGROUPS with other options like SUBDIRS and FILESGROUPS by
supporting the CONFGROUPS.yes option.  This means logic like this:

.if ${MK_FOO} != "no"
CONFGROUPS+= FOO
.endif

can be replaced by:

CONFGROUPS.${MK_FOO}+= FOO

MFC after:	1 week
Reviewed by:	imp
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52923

(cherry picked from commit 0f5ed3c427)
2025-10-10 05:30:23 +01:00
Lexi Winter 2fe5ced1a8 BSD.root.dist: Add package tag for all directories
This fixes some missing directories, notably /boot/modules.  Other
directories are not missing because they contain other files, but
they should still have their own METALOG entries and be placed in
the correct package.

MFC after:	3 days
Reported by:	bdrewery
Reviewed by:	cperciva, imp
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52958

(cherry picked from commit fa6d67cd16)
2025-10-10 05:30:11 +01:00
Lexi Winter 250557a74a generate-ucl.lua: Add missing copyright header
Add a standard BSD license with a copyright claim for everyone who has
modified this file since it was added, excluding users who explicitly
declined attribution.

MFC after:	3 days
Reviewed by:	ifreund_freebsdfoundation.org, imp, bapt, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D52881

(cherry picked from commit a6ac2c98c9)
2025-10-10 05:30:02 +01:00
Lexi Winter 77f609aa6e packages: Set dependency origin in generate-ucl.lua
Commit 822fd56067 changed the origin of packages from "base"
to "base/<package name>", but the old origin was still used for
dependencies.

Aside from being wrong, this confuses pkg <= 2.3.1 and causes
"pkg info -d" to show the dependencies as "<pkgname>-(null)"
instead of the correct version string.

Remove the explicit origin from dependencies in the UCL files,
and instead populate this during the build in generate-ucl.lua.
In the (very unlikely) case that an explicit origin is still
needed, don't overwrite one if it's already present.

MFC after:	1 day
Fixes: 822fd56067 ("pkgbase: set origin for each packages as base/FreeBSD-*")
Reported by:	bapt
Reviewed by:	cperciva, bapt
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52892

(cherry picked from commit a507a7026c)
2025-10-10 05:29:52 +01:00
Lexi Winter 33becdef1f libpkgecc: Remove -ffreestanding
This incorporates pkg(8) commit a31c8c3682a3 for consistency.

https://github.com/freebsd/pkg/commit/a31c8c3682a3

MFC after:	1 day
Reviewed by:	kevans
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52920

(cherry picked from commit 349f4fd382)
2025-10-10 05:29:43 +01:00
Lexi Winter 3e25b34d01 Makefile: Force DISTDIR=/ for (update-)packages
The make(1) variable DISTDIR is used by both ports and src with a
different meaning.  Some users may set DISTDIR in /etc/make.conf
for ports, which previously worked fine when building src since
the src targets which used this variable were not very commonly
used (mainly, make distributeworld).

Unfortunately, with pkgbase becoming the default, this is no longer
true since make (update-)packages invokes make stageworld, which is
sensitive to DISTDIR, and these users find that their build now fails.

A correct fix for this probably requires renaming one or both of
the DISTDIR variables, but for now, work around the problem by
setting DISTDIR=/ for the user-facing pkgbase targets, packages
and update-package.  Since setting DISTDIR doesn't work for these
targets anyway, this should not break any existing configurations.

MFC after:	1 week
PR:		290010
Reported by:	Oleh Vinichenko <[email protected]>
Reviewed by:	imp, bapt
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52929

(cherry picked from commit f7dc7d7af3)
2025-10-10 05:29:35 +01:00
Lexi Winter 659b3175ed ncurses: Move to the minimal set
MFC after:	1 day
Reviewed by:	bapt
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52950

(cherry picked from commit ecaf90ee03)
2025-10-10 05:29:21 +01:00
Gregory Neil Shapiro e504946ee1 MFC: Merge commit '1fdae2e33fdc751bc2ec74c81fcde14323e4e965'
Be explicit that newaliases for sendmail
(Upstream sendmail.org commit 3084151d898)

PR:	289259

(cherry picked from commit e9f7c3de11)
2025-10-09 20:56:22 +00:00
Olivier Certner 94f08f6a84 nfsuserd: Fix OOB access on membership of too many groups, take 2
Forgot to reset 'ngroup' after one of the calls to getgrouplist() in the
previous commit with same title (referenced also below).

MFC after:      1 hour
Fixes:          e6c623c86a ("Add support for the "-manage-gids" option to the nfsuserd daemon.")
Fixes:          bb339adfb2 ("nfsuserd: Fix OOB access on membership of too many groups")
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 75eb684626)
2025-10-09 22:40:43 +02:00
Olivier Certner ef40e02a8d nfsuserd: Fix OOB access on membership of too many groups
getgrouplist() sets the variable containing the allocated length in
input to the full effective group list length, not the number of slots
that were actually filled in case the passed array is too small to
contain it.

While here, on this condition, improve the error message by outputting
the corresponding user name.

MFC after:      1 hour
Fixes:          e6c623c86a ("Add support for the "-manage-gids" option to the nfsuserd daemon.")
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit bb339adfb2)
2025-10-09 22:40:43 +02:00
Olivier Certner baf1210fa2 initgroups.3: Clarify that ENOMEM is a possible value for 'errno'
The current phrasing could be interpreted as meaning that initgroups(3)
could return ENOMEM instead of -1, which it actually did until I fixed
it in commit 0b018cfd81 ("initgroups(3): Fix return value on
allocation failure").

While here, mention setgroups(2) as a system call rather than a library
function.

MFC with:       0b018cfd81 ("initgroups(3): Fix return value on allocation failure")
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit c36a44e1cd)
2025-10-09 22:40:43 +02:00
Olivier Certner 23494c4987 getgrouplist.3: Insist on the value returned in 'ngroups'; Minor changes
Emphasize the peculiar treatment of 'ngroups', through which the
effective group list's size is returned, even if the passed allocated
size is not big enough, in which case the output 'groups' array is
completely filled with the effective group list's first elements.

Use the precise POSIX term for the group associated to the user in the
password database ("initial numerical group ID"), consistently with what
was done in initgroups.3.

Use "length" instead of "size" to refer to the number of elements of an
array (in contrast with its actual size in bytes).

Perform some minor simplifications on top of the last rework.

MFC after:      1 hour
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit f554455675)
2025-10-09 22:40:37 +02:00
Jonathan T. Looney 3f0df559cb x86: Defer non-fatal MCA message output from the HW interrupt context
When processing recoverable MCA events in a hardware interrupt context,
defer logging the messages to a task queue.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D12275

(cherry picked from commit 5e1611a37a)
2025-10-09 17:16:41 +00:00
Jonathan T. Looney 8d0f269989 x86: Close race condition on MCA task queues at startup
Currently, the CMCI handler checks the cold variable to determine
whether it can schedule a task. The task queue is setup as part of the
mca_startup() function, which is run well after the configure_final()
function sets the cold variable to 0. Therefore, if an MCA arrives
in the window between configure_final() and mca_startup() running,
the code could try to schedule a task on an unintitalized task queue.

Close the race by specifically checking whether the mca_startup()
function has run.

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D12276

(cherry picked from commit 4a5d8670a7)
2025-10-09 17:15:21 +00:00
Jonathan T. Looney be85c5d657 x86: Keep cumulative MCA statistics in the kernel
Keeping cumulative MCA statistics in the kernel provides a way for
users to get an accurate count of various kinds of errors reported
by the CPU.

After ca8929d2a3, it is possible that
the kernel will drop the record of some MCA interrupts. Moreover, this
provides a cheaper interface to obtain statistics if that is the only
reason a user is processing MCA logs.

Reviewed by:	markj
Sponsored by:	Netflix
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D52709

(cherry picked from commit 5f1f7d8457)
2025-10-09 17:13:56 +00:00
Andrew Turner f579cc4498 arm64/vmm: Add missing debug traps
These are features we don't support or advertise to the guest so can
safely be trapped.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52806

(cherry picked from commit c67ea2707d)
2025-10-09 17:31:50 +01:00
Andrew Turner 9f85826c88 arm64/vmm: Handle debug exits
This is enough to boot FreeBSD again.

PR:		290044
Reported by:	Siva Mahadevan <[email protected]>
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52931

(cherry picked from commit 534aec0097)
2025-10-09 17:31:50 +01:00
Andrew Turner ddd5ff0f77 arm64: Add Debug OS Lock fields
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52930

(cherry picked from commit fa975e2a5b)
2025-10-09 17:31:50 +01:00
Andrew Turner 54ee094d9a arm64: Sort hypervisor.h
Move the MDCR_EL2 macros into the correct alphabetical location.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52805

(cherry picked from commit 4aa762f3cb)
2025-10-09 17:31:50 +01:00
Andrew Turner cb004ced63 arm64: Rename the MDCR_EL2 macros
To be consistent within the register prefix all fields with MDCR_EL2_.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52804

(cherry picked from commit d552556b7e)
2025-10-09 17:31:50 +01:00
Andrew Turner e14f3edc16 arm64/vmm: Save dbgclaimset_el1
It may be used by the guest.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52803

(cherry picked from commit 4954ec00c4)
2025-10-09 17:31:49 +01:00
Andrew Turner dcfe2e687e arm64/vmm: Save more PMU registers
These were missed in the initial vmm.ko change.

While here keep the order the same in all locations we handle these.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52802

(cherry picked from commit 35d0c9efb1)
2025-10-09 17:31:49 +01:00
Andrew Turner 3e9e19e967 arm64/vmm: Clear all pmc fields
When clearing pmcntenclr_el0, pmintenclr_el1, and pmovsclr_el0 clear
all bits as new fields may be added in the upper 32-bits.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52801

(cherry picked from commit c1723bbe2a)
2025-10-09 17:31:49 +01:00
Alexander Ziaee 0fac38bdaf ice.4: Improve SYNOPSIS
Remove prose from synopsis, adding sysctls and tunables.

MFC after:		3 days
Reviewed by:		kbowling
Differential Revision:	https://reviews.freebsd.org/D52913

(cherry picked from commit 45f8336f3a)
2025-10-09 10:25:55 -04:00
Alexander Ziaee 8b5f5fed89 iovctl.8: Fix missing xref section number
MFC after:	3 days

(cherry picked from commit 17085d8eb1)
2025-10-09 10:25:41 -04:00
Alexander Ziaee eea978b588 ice.4: Zap registered mark from document descr
Document descriptions for device drivers always contain registered
trademarks of the manufacturers, but this is not a place for the
registered mark symbol. While here, remove another useless symbol,
the hyphen in the first line comment.

MFC after:	3 days

(cherry picked from commit 6720975ba0)
2025-10-09 10:25:28 -04:00
Alexander Ziaee 4e2526fc99 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 81d9e08a4d)
2025-10-09 10:25:08 -04:00
Michael Tuexen 4774687d40 tcp lro: use the flowid only when it has hash properties
When a packet is provided to LRO using tcp_lro_queue_mbuf(), a
sequence number is computed based on the m_pkthdr.flowid provided
by he driver. The implicit assumption is that the m_pkthdr.flowid
has hash properties.
The recent use of tcp_lro_queue_mbuf() in iflib exposed a bug in at
least one driver (igc) , which
* reports always that is uses M_HASHTYPE_OPAQUE.
* sets in some cases m_pkthdr.flowid not consistently for packets
  belonging to the same TCP connection.
This results in severe performance problems for the base TCP stack,
since it handles the packets in the wrong sequence, although they were
received in the correct sequence.
To protect against such misbehaving drivers, just take the
m_pkthdr.flowid only into account, if it has hash properties.
The performance problems were observed by gallatin@ and analyzed
together with rrs@.

Reviewed by:		gallatin
Tested by:		gallatin
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52989

(cherry picked from commit 73f56fa542)
2025-10-09 14:53:09 +02:00
Cy Schubert 756a5282b3 ipfilter/ippool: Dump a copy of ippool dstlist data in "new" format
As with 7531c434a5, which dumped ippool table data in the "new"
format, print dstlist data in the "new" format.

(cherry picked from commit eee36ffa0d)
2025-10-09 05:36:20 -07:00
Cy Schubert 26e0bf6015 ipfilter/ippool: Dump a copy of ippool hash data in "new" format
As with 7531c434a5, which dumped ippool table data in the "new"
format, print hash data in the "new" format.

(cherry picked from commit 2f30b43fa2)
2025-10-09 05:36:20 -07:00
Cy Schubert c50efdbe4a ipfilter ippool: Prefix deleted entries with "#"
To maintain consistency with ippool list functions, prefix deleted
entries with "#".

(cherry picked from commit f3ff6abb9d)
2025-10-09 05:36:20 -07:00
Cy Schubert 5176142732 ipfilter ippool: Flag deleted entries with "#"
List deleted entries prefixed by "#". This is consistent with other
ippool list functions.

Fixes:		7531c434a5

(cherry picked from commit 94758e72fd)
2025-10-09 05:36:19 -07:00
Dag-Erling Smørgrav 2961562640 nvme: Tweak completion timeout loop
* Rename delta_t to avoid misleading simplistic syntax highlighters
* Simplify the increment calculation

Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D52973

(cherry picked from commit 4070ae0e9a)
2025-10-09 12:16:05 +00:00
Dag-Erling Smørgrav 86eecff20d rcorder: Fix grammar in warning about loops
MFC after:	1 week
Reviewed by:	ae
Differential Revision:	https://reviews.freebsd.org/D52951

(cherry picked from commit d96f9a4688)
2025-10-09 12:16:05 +00:00
Dag-Erling Smørgrav 6a9e0fdf37 tarfs: Simplify sameness checks
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52928

(cherry picked from commit 1b0fce2944)
2025-10-09 12:16:05 +00:00
Dag-Erling Smørgrav 23b82b5b44 ln: Simplify sameness checks
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52927

(cherry picked from commit 18997fb9ec)
2025-10-09 12:16:04 +00:00
Dag-Erling Smørgrav ef8420744e cp: Simplify sameness checks
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52926

(cherry picked from commit 95de78614a)
2025-10-09 12:16:04 +00:00
Dag-Erling Smørgrav 12304ec662 fts: Remove a few stray blank lines
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52924

(cherry picked from commit 31db1582c8)
2025-10-09 12:16:04 +00:00
Dag-Erling Smørgrav 835f8ac7d0 tail: Tweak follow_rename test case
Add a brief sleep to give tail time to start following the file before
we rename it.

PR:		289902
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52887

(cherry picked from commit a9c72543d2)
2025-10-09 12:16:04 +00:00
Dag-Erling Smørgrav b2f1fa13e9 fts: Document thread (un)safety
MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52828

(cherry picked from commit 64f8416afd)

fts: Further improve the manual page

* Add subsections for the three functions that didn't already have one.
* Add a RETURN VALUES section.
* Improve the grammar somewhat.
* Clarify that fts_read() will not set errno to 0 if called again after
  having already returned NULL.

Sponsored by:	Klara, Inc.
Reviewed by:	bcr, markj
Differential Revision:	https://reviews.freebsd.org/D52925

(cherry picked from commit a802334d86)
2025-10-09 12:16:04 +00:00
Dag-Erling Smørgrav df70662f47 rc: Teach netwait to wait for DAD
In some configurations, especially in jails, it is possible for the
system to boot so fast that we end up launching daemons while duplicate
address detection is still ongoing.  If that happens, said daemons may
fail to bind to IPv6 addresses, as they are still tentative.  Teach the
netwait service to wait (up to 10 seconds, by default) for the tentative
flag to vanish.

MFC after:	1 week
Reviewed by:	olce
Differential Revision:	https://reviews.freebsd.org/D51889

(cherry picked from commit 5ead817c3b)

rc: Improve netwait DAD logic

Disable if IPv6 is not supported, and instead of 10 seconds, default to
one more than the value of net.inet6.ip6.dad_count.

Fixes:		5ead817c3b ("rc: Teach netwait to wait for DAD")
Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D52905

(cherry picked from commit ec6ad605ec)
2025-10-09 12:16:04 +00:00
Doug Rabson e5c0b4f036 release: Avoid generating .pkgsave files in OCI images
This also installs the pkg key from the current source tree instead of
using the one currently installed on the host.

Reviewed by:		dch
MFC after:		1 day
Differential Revision:	https://reviews.freebsd.org/D52615

(cherry picked from commit e21e6e96b6)
2025-10-09 11:47:07 +01:00
Michael Tuexen 3ca54c736b tcp: remove stray ;
Sponsored by:	Netflix, Inc.

(cherry picked from commit 0faa9ca827)
2025-10-09 10:00:29 +02:00
Michael Tuexen 41e9c68d9a tcp: improve SEG.ACK validation in SYN-RECEIVED
According to the fifth step in SEGMENT ARRIVES, send a RST segment in
response to an ACK segment which fails the SEG.ACK check, but leave
the endpoint state unchanged.
FreeBSD handles this correctly when entering the SYN-RECEIVED state via
the SYN-SENT state, but not in the SYN-cache code, which handles the
SYN-RECEIVED state via the LISTEN state.

This also fixes a panic reported by Alexander Leidinger.

Reviewed by:		jtl, glebius
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52934

(cherry picked from commit 8af2f06a99)
2025-10-09 09:59:49 +02:00
Michael Tuexen 3b6fb75bde tcp: remove stray ;
No functional change intended.

Sponsored by:		Netflix, Inc.

(cherry picked from commit 941b8ecdc0)
2025-10-09 09:59:21 +02:00
Christos Margiolis 44114a581f libsamplerate: Define as PRIVATELIB
Fixes the following warnings:

ld: error: relocation R_X86_64_32S cannot be used against local symbol; recompile with -fPIC

>>> defined in /usr/obj/usr/src/amd64.amd64/lib/libsamplerate/libsamplerate.a(samplerate.o)
>>> referenced by samplerate.c:498 (/usr/src/contrib/libsamplerate/samplerate.c:498)
>>>
>>>   samplerate.o:(src_new) in archive /usr/obj/usr/src/amd64.amd64/lib/libsamplerate/libsamplerate.a

Related discussion: https://reviews.freebsd.org/D52306

Sponsored by:	The FreeBSD Foundation
Reviewed by:	fuz
Differential Revision:	https://reviews.freebsd.org/D52307

(cherry picked from commit dafd960a3d)
2025-10-08 14:54:56 +02:00
Mark Johnston e15e7a5c0b zfs: Use the correct type for raidz_outlier_check_interval_ms
raidz_outlier_check_interval_ms has type hrtime_t, which is a long long,
which is 64 bits wide on all supported platforms.

(cherry picked from commit 081f0e38e3)
2025-10-08 11:23:39 +02:00
Martin Matuska a111519108 zfs: install missing openzfs-2.4 files in /usr/share/zfs/compatibility.d
MFC after: 3 days

(cherry picked from commit 4dc4a512e0)
2025-10-08 09:52:05 +02:00
Rick Macklem 23fbea8cf2 kadmin.8: Document the new dump -f flag
Commit 5000d023a4 added a new flag to the dump option.

This patch documents this new flag.

This is a content change.

Fixes:	5000d023a4 ("heimdal-kadmin: Add support for the -f dump option")

(cherry picked from commit 03da141d59)
2025-10-07 18:51:08 -07:00
Rick Macklem 9fd3b28d4e heimdal-kadmin: Add support for the -f dump option
The "-f" dump option allows a dump of the Heimdal
KDC in a format that the MIT kdb5_util command can
load into a MIT KDC's database.
This makes transitioning from the Heimdal KDC to
the current MIT one feasible without having to
re-create the KDC database from scratch.

glebius@ did the initial work, cherry picking these
commits from the Heimdal sources on github and then doing
extensive merge conflict resolution and other fixes so
that it would build.
Heimdal commit fca5399 authored by Nico Williams:
Initial commit for second approach for multiple kvno.  NOT TESTED!

Heimdal commit 57f1545 authored by Nico Williams:
Add support for writing to KDB and dumping HDB to MIT KDB dump format
    Before this change Heimdal could read KDBs.  Now it can write to
    them too.

    Heimdal can now also dump HDBs (including KDBs) in MIT format,
    which can then be imported with kdb5_util load.

    This is intended to help in migrations from MIT to Heimdal by
    allowing migrations from Heimdal to MIT so that it is possible
    to rollback from Heimdal to MIT should there be any issues.  The
    idea is to allow a) running Heimdal kdc/kadmind with a KDB, or
    b) running Heimdal with an HDB converted from a KDB and then
    rollback by dumping the HDB and loading a KDB.

    Note that not all TL data types are supported, only two: last
    password change and modify-by.  This is the minimum necessary.
    PKINIT users may need to add support for KRB5_TL_USER_CERTIFICATE,
    and for databases with K/M history we may need to add KRB5_TL_MKVNO
    support.

This resulted in a Heimdal kadmin that would dump
the KDC database in MIT format.  However, there
were issues when this dump was loaded into the
current MIT KDC in FreeBSD current/15.0.

The changes I did to make the dump more useful are listed below:
When "-f MIT" is used for "kadmin -l dump" it writes
the dump out in MIT format.  This dump format is understood
by the MIT kdb5_util command.  The patch modifies the above
so that the MIT KDC's master key keytab file can be provided
as the argument to "-f" so that the principals are re-encrypted in
it. This allows any principal with at least one strong encryption
type key to work without needing a change_password.
The strong encryption types supported by the Heimdal KDC are:
aes256-cts-hmac-sha1-96
aes128-cts-hmac-sha1-96

The issues my changes address are:
- If there are weak encryption keys in a principal's entry,
  MIT's kadmin.local will report that the principcal's entry
  is incomplete or corrupted.
- The keys are encrypted in Heimdal's master key.  The
  "-d" option can be used on the "kadmin -l dump" to
  de-encrypt them, but the passwords will not work on the
  current MIT KDC.

To try and deal with the above issues, this patch modied the above to:
- Does not dump the weak keys.
- Re-encrypts the strong keys in MIT's master key if the argument
  to "-f" is actually a filename which holds the MIT KDC's
  master key keytab and not "MIT".
- For principals that only have weak keys, it generates
  a fake strong key. This key will not work on the MIT
  KDC, but the principal entry will work once a
  change_password is done to it.
- It always generates a "modified_by" entry, faking one if
  not already present in the Heimdal KDC database.
  This was necessary, since the MIT kadmin will
  report that the principal entry is "incomplete or
  corrupted" without one.

It also fixed a problem where "get principal" no longer
worked after the initial patch was applied.

A man page update will be done as a separate commit.

I believe this commit is acceptable since the Heimdal
sources are now essentially deprecated in favor of the
MIT sources and that this new "-f" patch simplifies
the transition to the MIT KDC.

(cherry picked from commit 5000d023a4)
2025-10-07 18:47:21 -07:00
Jesús Daniel Colmenares Oviedo 6c6b157a9f nuageinit: Ignore non-existent groups
In cloud-init, when a group specified in the 'users.{index}.groups' parameter
does not exist, it is ignored, but the user is created anyway. In the case of
nuageinit, it exits with an exception, since pw(8) expects each group to exist.

Reviewed by:		bapt@
Approved by:		bapt@
Differential Revision:	https://reviews.freebsd.org/D52718

(cherry picked from commit 68691160f4)
2025-10-07 08:51:18 +02:00
Colin Percival fc601f0ba8 release: Check for empty NODISTSETS
Treat an empty NODISTSETS the same as if it is not defined; this avoids
problems if a script calls 'make release NODISTSETS=${NODISTSETS}'.

MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 4b8b4c7dbf)
2025-10-06 20:15:58 -07:00
Colin Percival 224d3a6576 release: Don't publish pkgbase.repo for embedded
The embedded "SD card" images build very differently from regular
releases, and don't use pkgbase yet.

MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 026707768f)
2025-10-06 20:15:46 -07:00
Colin Percival 4a62dbb245 release: Respect NODISTSETS
In addition to not putting distribution sets onto ISO images, if
NODISTSETS is set then we should not build the distribution sets
or put them onto the "FTP" site (aka download.freebsd.org).

MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit e64eb9ea0f)
2025-10-06 20:15:38 -07:00
Mark Johnston f459a2ef73 release: Set INSTALL_AS_USER=yes when running pkg clean in NO_ROOT mode
Otherwise pkg complains about unexpected ownership of the root
directory.

MFC after:	1 day
Fixes:		86221f965c ("vmimage.subr: Fix NO_ROOT build in ..._rmcache")

(cherry picked from commit 5fda4690b4)
2025-10-07 00:56:17 +00:00
Mark Johnston 9bb0282097 release: Complete NO_ROOTification of Vagrant builds
- Don't clean pkg files, they won't be recorded in the manifest anyway.
- Use pw's new metalog mode to create the vagrant user.  Note that we do
  not need to manually create the home directory, pw will do it, so just
  remove that.
- Write metalog entries for the vagrant user's ssh key dir and
  authorized keys file

Note, this depends on an updated pw being installed on the host.

Reviewed by:	emaste
MFC after:	1 day
Sponsored by:	Klara, Inc.
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D52631

(cherry picked from commit 02dfca2458)
2025-10-07 00:56:14 +00:00
Jose Luis Duran 8435c4112a nss_tacplus: Fix typo MK_INSTALLIB -> MK_INSTALLLIB
Reviewed by:	des
Approved by:	emaste (mentor)
Fixes:	6c5cdba1ba ("Add nss_tacplus, a TACACS+ NSS module.")
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D52882

(cherry picked from commit 75f7e003b7)
2025-10-07 00:30:36 +00:00
Jonathan T. Looney a1f20ce894 tcp: close two minor races with debug messages
The syncache entry is locked by the hash bucket lock. After running
SCH_UNLOCK(), we have no guarantee that the syncache entry still
exists.

Resolve the race by moving SCH_UNLOCK() after the log() call which
reads variables from the syncache entry.

Reviewed by:	rrs, tuexen, Nick Banks
Sponsored by:	Netflix
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D52868

(cherry picked from commit ad38f6a0b4)
2025-10-06 16:20:33 +00:00
Jose Luis Duran e4e196585c release: packages: Fix grammar in pkg description
Reported by:	ivy
Approved by:	emaste (mentor)
MFC after:	1 hour
Differential Revision:	https://reviews.freebsd.org/D52917

(cherry picked from commit 893c3b857e)
2025-10-06 14:04:43 +00:00
Jose Luis Duran ff7700b4d5 release: packages: Fix typos
Reviewed by:	cperciva
Approved by:	emaste (mentor)
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D52917

(cherry picked from commit 9e6cea12ab)
2025-10-06 02:51:53 +00:00
Kristof Provost 3e79ec993d pf tests: fix intermittent mld test failures
We can't reliably check for the absence of replies to our MLD queries (because
a host may announce its multicast subscriptions), so enable pf logging and check
for the relevant error message instead.

PR:		289821
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D52762

(cherry picked from commit a57f6ce479)
2025-10-05 22:47:35 +02:00
Kristof Provost 4c7dba0c93 atf_python: allow test scripts to pass jail options
Test scripts based on atf_python can now pass jail command options via the
'opts' key in the 'vnetX' key of TOPOLOGY.

Reviewed by:	melifaro
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D52761

(cherry picked from commit 2213e15888)
2025-10-05 22:47:34 +02:00
Kristof Provost ff566e6b9b pf: fix 'natpass'
If an rdr (or nat) rule specifies 'pass' we don't run the filter rules, we just
pass the traffic. Or at least, we did until that got unintentionally broken.
Restore that behaviour and add a test case.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D52838

(cherry picked from commit b93394a38b)
2025-10-05 22:47:34 +02:00
Kristof Provost dd4095f11b pf: return PF_PASS/PF_DROP from pf_setup_pdesc()
We returned 'PF_DROP' instead of '-1' in one case, which would lead to us
continuing the processing for an invalid packet.
This also aligns us closer to OpenBSD, and reduces the odds of future similar
mixups.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 5d210f396e)
2025-10-05 22:47:34 +02:00
Kristof Provost 48cbd5698d pf: fix possibe SCTP panic
While processing SCTP packets we can enqueue work for later, in the
sctp_multihome_jobs queue. This deferred job includes a copy of the current
struct pf_pdesc, which must contain a valid pcksum pointer (in case of NAT).

However, jobs could be enqueued before we'd actually set this pointer in
pf_setup_pdesc(). Set this pointer before we scan the SCTP chunk headers (and
could enqueue deferred jobs.)

While here sprinkle in a few more assertions to ensure we got this right.

Reported-by: [email protected]
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit dd2fc08d85)
2025-10-05 22:47:34 +02:00
Martin Matuska 0cafc294bf zfs: merge openzfs/zfs@2f50d6740 (zfs-2.4-release) into stable/15
OpenZFS 2.4.0 rc2

Notable upstream pull request merges:
 #15869 8604e67dc Add description of default sorting behavior to zfs_list.8
 #16025 460858dfd dnode_next_offset: backtrack if lower level does not match
 #17019 c755aa486 Fix wrong dedup_table_size for legacy dedup
 #17543 -multiple zfs allow send:raw
 #17576 -multiple Add allocation profile export and zhack subcommand for
                  import
 #17600 04d991dbc Update pam_zfs_key.c defaultt path for FreeBSD
 #17632 774a34f3f Synchronize the update of feature refcount
 #17645 b727163db zfs_vnops_os.c: Add support for the _PC_CLONE_BLKSIZE name
 #17665 2fc6bf82b zdb: Fix format strings on 32-bit systems
 #17673 5846a8515 Update compatibility.d files
 #17690 56e8ab4a3 zvol: reject suspend attempts when zvol is shutting down
 #17704 cfd640c3e Fix warnings about sha2_is_supported on FreeBSD/i386
 #17705 ef9b7dde9 Fix a printf format specifier on FreeBSD/i386
 #17706 b23eae62b Fix the build on 32-bit FreeBSD with GCC
 #17227 -multiple Detect a slow raidz child during reads
 #17708 9c6f72021 Fix atomic-alignment warnings in libspl on FreeBSD/i386
 #17712 -multiple cmd: rename to zarcstat / zarcsummary
 #17717 3dc345851 Prevent scrubbing a read-only pool
 #17719 da33cfd43 vdev_disk_close: take disk write lock before destroying it
 #17722 b5d41deca FreeBSD: Satisfy ASSERT_VOP_IN_SEQC()
 #17729 efdb4bf07 Fix two infinite loops if dmu_prefetch_max set to zero
 #17730 95d677efd Fix ddle memleak in ddt_log_load
 #17732 5f7253ca1 Refactor `zhack label repair` and fix `-c` regression
                  on nonzero TXG
 #17733 41c6eaac8 Fix type in dbrrd_closest()
 #17735 cac483dbd Fix time database update calculations
 #17742 8b548776f zfsprops(7): attempt to clarify the keylocation
                  description
 #17748 1ca4cd8a3 Fix txg_log_time ZAP key typo
 #17755 9bcda0b5f Use "vdev" instead of "devices" when referring to vdevs
 #17758 954fe5e1b Add interface to interface spa_get_worst_case_min_alloc()
                  function
 #17764 61a68554d zdb: Fix asize overflow in verify_livelist_allocs()
 #17765 9079f986a zvol: Fix blk-mq sync
 #17786 35ec4b14a zpool iostat: refresh pool list every interval
 #17780 d33d0cac5 Fix 'zpool add' safety check corner cases
 #17783 e1a6ec42d zdb: add ZFS_KEYFORMAT_RAW support for -K option
 #17800 f3295ec76 range_tree: drop duplicate zfs_ prefix from
                  rs_set_fill_raw

Obtained from:	OpenZFS
OpenZFS commit:	2f50d67409
OpenZFS tag:	zfs-2.4.0-rc2
2025-10-05 21:48:10 +02:00
Michael Tuexen f846f0cc60 tcp: improve segment validation in SYN-RECEIVED
The validation of SEG.SEQ (first step in SEGMENT ARRIVES of RFC 9293)
should be done before the validation of SEG.ACK (fifth step in
SEGMENT ARRIVES in RFC 9293).
Furthermore, when the SEG.SEQ validation fails, a challenge ACK
should be sent instead of sending a RST-segment and moving the
endpoint to CLOSED.

Reported by:		Tilnel on freebsd-net
Reviewed by:		Nick Banks
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52849

(cherry picked from commit b7118461f9)
2025-10-05 15:31:21 +02:00
Michael Tuexen 81ea2bdab1 tcp: keep SYN-cache entry when sending of challenge ACK fails
Don't drop a SYN-cache entry just because a challenge ACK couldn't
be sent. This might only be a temporary failure.

Reviewed by:		Nick Banks, glebius, jtl
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52840

(cherry picked from commit 7841b44f84)
2025-10-05 15:30:34 +02:00
Michael Tuexen 0ca910a682 tcp: cleanup syncache_expand()
Only validate SEG.SEQ and SEG.ACK when processing a real SYN-cache
entry. In the SYN-cookie case, these conditions are always true, since
the SYN-cache entry on the stack is constructed from the incoming
TCP segment.
While there, fix the logging messages.

Reviewed by:		Nick Banks
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52816

(cherry picked from commit 3034fa3d43)
2025-10-05 15:29:55 +02:00
Lexi Winter e42935e587 Makefile.inc1: Fix package-pkg with CROSS_TOOLCHAIN
CROSS_TOOLCHAIN is used to build src with a different toolchain than
the bundled one.  Ports also has a CROSS_TOOLCHAIN option, but it has
a different meaning.  When building ports-mgmt/pkg from ports for the
package-pkg target, unset CROSS_TOOLCHAIN to prevent ports from being
confused.

This fixes 'make CROSS_TOOLCHAIN=llvm19 package-pkg' for the native
target, but cross-building (e.g., targetting powerpc from amd64) is
still broken due to an issue in pkg itself.

MFC after:	3 seconds
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52902

(cherry picked from commit b09dd58651)
2025-10-05 06:25:04 +01:00
Lexi Winter 830684a523 Makefile: Fix ordering for (update-)packages
The (update-)packages targets require buildworld and buildkernel to
run first.  Add some .ORDER statements to ensure this happens.

This fixes 'make -j8 buildworld buildkernel packages'.

PR:		289969
Reported by:	yasu
MFC after:	3 days
Reviewed by:	yasu, emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52877

(cherry picked from commit dfc9da6248)
2025-10-05 06:24:54 +01:00
Lexi Winter cfcd89e6cc libc: Move NLS catalogues to the locales packages
We don't want to put these in clibs (where libc is) since they are not
critical to system operation.  Move them to locales, since anyone who
is interested in translated versions of strerror() is going to have
that installed anyway.

While here, add some more documentation to bsd.nls.mk, particularly
the NLSPACKAGE option.

MFC after:	3 seconds
Reviewed by:	manu, kib
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52898

(cherry picked from commit 0242d4c3ae)
2025-10-05 06:14:15 +01:00
Mark Johnston 1efb9810ba pw: Add a metalog output mode
When creating OS images as a non-root user, it may be useful to
pre-create users in the staged tree.  The useradd operation adds files
to the new user's home directory, copied from the skeleton directory
(/usr/share/skel), which makes it inconvient for use in this scenario
since the added files are not recorded in the mtree metalog.

To cover this gap, this change adds a new -M <metalog> option to pw's
useradd operation, causing pw to add mtree entries for newly added
files.

Extend an existing regression test to validate this mode.

Reviewed by:	bapt, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52590

(cherry picked from commit 182ed3c075)
2025-10-04 19:34:57 +00:00
Mark Johnston d114dc0e22 pw: Use copy_file_range() when copying skeleton files
As a bonus, check for I/O errors and print them to standard error.

Reviewed by:	bapt, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52588

(cherry picked from commit a03d150a3d)
2025-10-04 19:34:57 +00:00
Mark Johnston 350784b01c pw: Add a missing chown() when creating dirs in mkdir_home_parents()
mkdir_home_parents() effectively performs a mkdir -p of the root home
directory.  It chowns the home directory to 0, 0, but doesn't do so for
the intermediate directories.  Add an explicit chown() call for those
too.  Fix a long line while here.

Reviewed by:	bapt
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52587

(cherry picked from commit 41b2a80353)
2025-10-04 19:34:57 +00:00
Mark Johnston a288670287 pw: Style
No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.

(cherry picked from commit 42dc71a544)
2025-10-04 19:34:57 +00:00
Mark Johnston 240acee902 pw: Clean up a couple of errx() calls
- Remove a stray backslash.
- Make an error message fit on one line.

No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.

(cherry picked from commit bc69d5dffa)
2025-10-04 19:34:57 +00:00
Mark Johnston 8b6d7e8fe3 pw: Print warnings when metadata updates fail
We do this in most places already, but not consistently.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.

(cherry picked from commit daa63c9417)
2025-10-04 19:34:57 +00:00
Mark Johnston 1809c29d8d pw: Remove duplicate lines from the pw useradd usage message
No functional change intended.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.

(cherry picked from commit 4784ca8744)
2025-10-04 19:34:57 +00:00
Mark Johnston 92a00264b7 sanitizers: Provide wrappers for atomic_testandset_acq_long
Noticed when building a kernel with options RANDOM_FENESTRASX.

MFC after:	1 week

(cherry picked from commit 7ea59a0704)
2025-10-04 19:34:57 +00:00
Mark Johnston e309119ae1 OptionalObsoleteFiles.inc: Add more ATF libraries
PR:		289653
Reported by:	Trond Endrestøl <[email protected]>
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52676

(cherry picked from commit ceb5792d1e)
2025-10-04 19:34:57 +00:00
Mark Johnston 33b5c3d97a dtrace: Deduplicate dtrace_sync() and dtrace_xcall() implementations
dtrace_xcall() is just a thin wrapper around smp_rendezvous_cpus().
There's no need for six identical implementations to live in MD layers.

No functional change intended.

MFC after:	2 weeks

(cherry picked from commit bf115203bb)
2025-10-04 19:34:57 +00:00
Brad Davis e991ca922a vnet.9: Remove references to non-existant macros and update how to virtualize sysctls
Approved by:	bcr, ziaee
MFC after:	1 week
MFC to:		stable/14, stable/15
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D52620

(cherry picked from commit 22886d3af0)
2025-10-04 12:17:17 -06:00
Ed Maste a7931987d6 usbhid.4: Note that it was enabled by default for 15.0
Also add cross-references to hkbd.4 and hms.4.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7b18bf2a22)
2025-10-04 09:38:06 -04:00
Konstantin Belousov 5f0155e497 kern/vfs_vnops.c: generalize the lock primitive for file foffset
(cherry picked from commit 94a0f9f63e)
2025-10-04 12:09:16 +03:00
Colin Percival 1c0898edf2 15.0: Update to ALPHA5
Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-10-03 22:23:02 -07:00
Eugene Grosbein 5f20a4333b trim.8: update the manual with references to zpool-trim and fsck_ffs -E
(cherry picked from commit 5d8fde8507)
2025-10-04 10:48:10 +07:00
Colin Percival afdc022deb release: Publish pkgbase-repo.tar
This is a tarball containing the pkgbase repository for the release.

Note: This is an uncompressed tarball, because all of its constituent
.pkg files are already compressed; there's no point adding another
layer of compression.

Reviewed by:	ivy
MFC after:	1 minute
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D52899

(cherry picked from commit d0ff67db29)
2025-10-03 17:36:51 -07:00
Warner Losh 4b734c4774 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 494de51bc0)
2025-10-03 18:27:07 -06:00
Lexi Winter aff08d3191 bsdinstall: Improve pkgbase handling for jails
Add a new --jail option to the pkgbase script which installs
jail-specific set variants if they exist:

* "minimal" is replaced with "minimal-jail"

* A kernel is not installed.

* For sets shown in the component selection dialogue, only show the
  appropriate variant (jail or non-jail) for the target.

Modify the jail script to pass --jail to the pkgbase script.

Remove the redundant --no-kernel option, which was added in 15.0 and
was only used to install jails.

MFC after:	3000ms
Reviewed by:	ifreund_freebsdfoundation.org
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52829

(cherry picked from commit 8d0a90512e)
2025-10-03 22:54:14 +01:00
Lexi Winter 15d367160d bsdinstall/pkgbase: Restore the kernel-dbg component
Commit 561dc357c2 changed the way we handle components in the prompt,
and accidentally resulted in the kernel-dbg component not being listed
since we now hide all components ending in "-dbg".

Add an exception for kernel-dbg to bring it back.

Fixes:	561dc357c2 ("bsdinstall: Use package sets for pkgbase install")
MFC after:	3 seconds
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52826

(cherry picked from commit ed6716207d)
2025-10-03 20:21:59 +01:00
Lexi Winter d63d221507 libexec: Move blacklistd-helper to the blocklist package
Reviewed by:	emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52830

(cherry picked from commit 63ce00f5d0)
2025-10-03 20:21:50 +01:00
Lexi Winter f4f0b7c340 etc, ypserv: Fix symlink creation for pkgbase
The Makefile logic for /etc/aliases, /var/yp/Makefile and /etc/unbound
tries to avoid creating the symlink if it already exists in the target,
but this breaks with pkgbase since the symlink won't be installed (and
therefore won't be added to METALOG) if building with an existing
worldstage, meaning it's missing from the generated package.

Change the logic to forcibly install the symlink if NO_ROOT is defined,
but keep the existing logic for non-package builds to avoid trashing
the user's custom symlinks on non-pkgbase installworld.

MFC after:	3 seconds
Reported by:	cperciva
Reviewed by:	cperciva, emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52834

(cherry picked from commit 09cd3decf0)
2025-10-03 20:21:38 +01:00
Warner Losh 3b7da838aa sdhci.4: Improve HARDWARE for HW Relnotes + SPDX
MFC after:		1 hr
Discussed with:		ivy, olce
Co-authored-by:		ziaee (typed up imps suggestion, tagged spdx)
Differential Revision:	https://reviews.freebsd.org/D52860

(cherry picked from commit bc433a0b7b)
2025-10-03 13:48:20 -04:00
Warner Losh 0a9fa94c0b nda.4: Add a HARDWARE section, tag SPDX
The description likely also needs some love.

MFC after:		1 hour
Co-authored-by:		ziaee (typed up imps suggestion, tagged spdx)
Differential Revision:	https://reviews.freebsd.org/D52866

(cherry picked from commit f19aea89ab)
2025-10-03 13:47:50 -04:00
Ed Maste 77bec6e492 diff3: Move to own package
diff3 is the last remaining GPL-licensed userland component.  Move it
to its own package, so that it may be excluded if desired.

Reviewed by:	ivy
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52810

(cherry picked from commit e7258c4252)
2025-10-03 09:52:43 -07:00
Ed Maste 2d997bf6b5 release: Use standard Azure disk image extension
Azure images are Microsoft VHD files which use the .vhd extension.
We use the mkimg format arg "vhdf" to specify the fixed vhd format, but
the extension should remain .vhd.

Reviewed by:	lwhsu, whu
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38761

(cherry picked from commit fb77d8e546)
2025-10-03 09:51:53 -07:00
Ed Maste 2730e35e14 release: Consolidate pkgbase-repo dependency
Use the same approach for pkgbase-repo-dir as for the packagesystem
dependency.

Reviewed by:	Isaac Freund <[email protected]>
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52884

(cherry picked from commit ac1408bd1d)
2025-10-03 09:50:47 -07:00
Siva Mahadevan eb90941ee5 vmimage.subr: fix typo in checking NO_ROOT var
Reviewed by: imp
Fixes: 08b497dc6c ("vmimage.subr: Support NO_ROOT pkgbase")
Signed-off-by: Siva Mahadevan <[email protected]>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1867
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 65e2ce55b6)
2025-10-03 09:50:41 -07:00
Colin Percival 627511cb1e vmimage.subr: Support NO_ROOT pkgbase
We need to tell pkg to record files in METALOG; otherwise when we
create the VM image it's almost empty.

MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 08b497dc6c)
2025-10-03 09:50:37 -07:00
Lexi Winter 06221931cf create-sets.sh: Add missing copyright header
I wrote this file and am the only person who has modified it since
it was added.

MFC after:	3 days

(cherry picked from commit a22f8bd457)
2025-10-03 09:50:33 -07:00
Colin Percival eec0cbd268 vmimage.subr: Fix NO_ROOT build in ..._rmcache
When doing a NO_ROOT build we can't run pkg inside a chroot, for
multiple reasons including not having /dev mounted.

MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 86221f965c)
2025-10-03 09:50:29 -07:00
Ed Maste cef8f3aca9 release: Fix NO_ROOT cross-building VM images
Pass PKG_ABI to virtual machine image builds.

Reviewed by:	cperciva
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52874

(cherry picked from commit 5c5c0571c2)
2025-10-03 09:50:20 -07:00
Lexi Winter 779b8a20e4 release: Install pkg(8) from the release repo on bootonly
Although bootonly doesn't contain an offline package repository, we
still want pkg installed so the user can use it to repair an existing
system.  Installing it from the release repository ensures it's always
available without depending on pkg.freebsd.org.

While here, fix a typo in PKGBASE_REPO_ARGS.

MFC after:	3 seconds
Reviewed by:	cperciva
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52848

(cherry picked from commit 3b9d89e1c9)
2025-10-03 09:50:11 -07:00
Lexi Winter 085b0eb3eb packages: Add a sound package
Put virtual_oss, /etc/devd/snd.conf and the other audio-related tools
into a new "sound" package.  Don't create a separate -lib package,
since it's unlikely someone will want mixer(3) without mixer(8).

Put the sound package in the optional set rather than minimal, since
it's not actually required for audio hardware support, and many systems
(including nearly all servers) won't want it installed.

MFC after:	3 seconds
Reviewed by:	christos
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52823

(cherry picked from commit 1b806e607f)
2025-10-03 09:50:05 -07:00
Isaac Freund 6e93fa6a6c release: create pkgbase repo config from Makefile
This will allow the VM image build scripts to use the same repository
config file for installing base system packages at build time.

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51482

(cherry picked from commit f4f0308440)
2025-10-03 09:49:34 -07:00
Colin Percival a9c551dc5c release: Build all cloudware regardless of noroot
There are still some minor breakage with NO_ROOT (aka WITHOUT_QEMU)
builds but turning all the cloudware on unconditionally will allow
for more testing of the build process concurrently with the final
bug fixes landing.

Discussed with:	markj
MFC after:	1 week
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 86114bae09)
2025-10-03 09:46:08 -07:00
Colin Percival 67c560b184 release.sh: Pass through NO_ROOT
To be specific, set NO_ROOT=1 WITHOUT_QEMU=1 (those options go
together and it is an error to specify one without the other) if
NO_ROOT is defined in release.conf.

MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 723445fdee)
2025-10-03 09:46:01 -07:00
Baptiste Daroussin 822fd56067 pkgbase: set origin for each packages as base/FreeBSD-*
MFC After:		3 day
Reviewed by:		ivy
Differential Revision:	https://reviews.freebsd.org/D52689

(cherry picked from commit 23e69b5497)
2025-10-03 09:45:47 -07:00
Mark Johnston b9a0e12f6e release: Create /firstboot in common VM image creation code
Some services, such as growfs, only run upon the first boot of an image.
The first boot is indicated by the presence of the file /firstboot,
which is unlinked after boot.

Individual cloudware types shouldn't be responsible for creating it.  Do
so in a centralized place.  Aside from simplifying things, this ensures
that we create a metalog entry for the firstboot file.

Reviewed by:	cperciva, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52450

(cherry picked from commit 1d6b6ea2d0)
2025-10-03 09:42:21 -07:00
Mark Johnston e9f564a47e release: Made it possible to specify more attributes in metalog entries
Verify that the target file or directory exists, and add support for an
optional mode.  This is required to enable NO_ROOT builds of some
cloudware image types.  No functional change intended.

Reviewed by:	cperciva, emaste
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52449

(cherry picked from commit 6207325f3a)
2025-10-03 09:41:57 -07:00
Unicorn9x 4c04d125ed Update vmimage.subr
This "noatime" tweak, reduced the OPNsense constant 50kb - 80kb disk writes that wear down the SSD / NVME.

Signed-off-by: Unicorn9x
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1834
(cherry picked from commit 3ed0cdf7de)
2025-10-03 09:40:57 -07:00
Michael Tuexen 0cd2297001 tcp: apply rate limits to challenge ACKs
When sending challenge ACKs from the SYN-cache, apply the same rate
limiting as in other states.

Reviewed by:		cc, rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52754

(cherry picked from commit c2900b6e82)
2025-10-03 10:38:05 +02:00
Michael Tuexen e1a7840dd9 vtnet: disable hardware TCP LRO by default
Hardware TCP LRO results in problems in settings with IP forwarding
being enabled. In case of nodes without IP forwarding, using
software LRO is also beneficial in general, since it can provide better
information about what was received on the wire.
Therefore, disable hardware TCP LRO by default.
By tuning the loader tunable, this can be changed.

PR:			263229
Reviewed by:		Timo Völker
Differential Revision:	https://reviews.freebsd.org/D52684

(cherry picked from commit 6e4b811009)
2025-10-03 10:34:08 +02:00
John Baldwin 6f0160bf8c cxgbe: Use partial GCM mode for partial TLS records on T7
T7's crypto co-processor adds a new partial GCM mode.  This permits an
AES-GCM operation to be split into multiple requests.  After each
request, the partial GHASH state is returned to the host and must be
included in the subsequent request to continue the GHASH computation.

Make use of this when sending a TLS record that spans multiple TCP
"request" (where a request can use TSO to span multiple segments).
This permits computing the final GHASH value across multiple requests
without having to re-send the entire TLS record for the final request.

To ensure that intermediate GHASH results are available when needed,
mbuf chains are queued in the TLS pcb and only dispatched one at a
time to the NIC TXQ.  Packets which do not request a GHASH result
queue the next mbuf from the connection as soon as they are written
into the TXQ.  Packets which do request a GHASH result queue the next
mbuf after the the GHASH result is returned by a message on a NIC RXQ.

Note that partial GCM mode is only used for the in-order data at the
"tip" of a connection and not for retransmits of earlier data.
Retransmits will not request a GHASH result so will enqueue the next
mbuf from the connection to the NIC TXQ after being written.

Partial GCM mode is also not TLS-aware and only supports "plain"
AES-GCM.  Thus, TLS AAD must be explicitly constructed and sent as
part of the work request in the TXQ at the start of each TLS record.
However, by avoiding the need to retransmit the entire TLS record's
contents for the last mbuf spanning a TLS record, the overall amount
of "wasted" DMA is reduced by a factor of about 30.

Sponsored by:	Chelsio Communications

(cherry picked from commit 9e269eafeb)
2025-10-02 15:09:09 -07:00
John Baldwin 1e062655dc cxgbe: Permit multiple handlers for CPL6_FW_PLD
Currently this CPL is only used to handle replies from lookaside
crypto requests submitted by ccr(4).  However, in the future this
request will be returned for other requests.  Use the low bit in the
cookie field as a way to identify replies to ccr(4) vs other use
cases.  This should be safe as 'struct cryptop' pointers should be
word-aligned.

Sponsored by:	Chelsio Communications

(cherry picked from commit 96469647bc)
2025-10-02 15:09:09 -07:00
John Baldwin 48656dc9c5 cxgbe mp_ring: Add mp_ring_enqueue_only
Unlike mp_ring_enqueue, this function is meant to be called from
within a drain routine to enqueue more packets to the queue currently
being drained.  To avoid recursion, it only enqueues additional items
without becoming a consumer.

Sponsored by:	Chelsio Communications

(cherry picked from commit 96054b97b4)
2025-10-02 15:09:08 -07:00
John Baldwin f83f48e622 cxgbe TOE TLS: Support for TLS 1.3 for receive
Sponsored by:	Chelsio Communications

(cherry picked from commit e2fae07e09)
2025-10-02 15:09:08 -07:00
John Baldwin 97c6187bdc cxgbe TOE TLS: Support for TLS 1.3 for transmit.
Sponsored by:	Chelsio Communications

(cherry picked from commit 7de77bea2a)
2025-10-02 15:09:08 -07:00
John Baldwin f184ef0797 cxgbe TOE TLS: Better support for partial records for T7.
T7 is able to start TOE TLS receive offload more cleanly if a partial
TLS record containing a full header and at least one other byte has
been received.  In that case it is able to request the remaining bytes
for the current TLS record from the NIC.  Once those bytes has been
received TLS receive offload can then be received starting with the
subsequent record.

Sponsored by:	Chelsio Communications

(cherry picked from commit 1e9849415f)
2025-10-02 15:09:08 -07:00
John Baldwin e36647988f cxgbe: Extend NIC TLS to support TLS 1.3.
One unusual quirk is that the crypto engine requires the driver to
provide an 8 byte placeholder as input before the AAD that is replaced
with the middle 8 bytes of the nonce generated from the sequence
number and key context.

Sponsored by:	Chelsio Communications

(cherry picked from commit 5b9dc22c91)
2025-10-02 15:09:08 -07:00
John Baldwin e35760a50b cxgbe: Support for TLS 1.3 in key contexts.
For TLS 1.3 the 4 byte salt field has been extended to hold the 12
byte nonce.

Sponsored by:	Chelsio Communications

(cherry picked from commit 6154961e2e)
2025-10-02 15:09:08 -07:00
John Baldwin d28c4d0ec6 cxgbe: Support for NIC KTLS transmit on T7 adapters.
Unlike NIC KTLS support on T6, T7 is able to reuse the existing TSO
functionality directly, including trimming the output of the crypto
engine before it is passed on to TSO.  This is much simpler and does
not require the use of bypass pseudo-connections in the TOE engine.
Among other things this permits arbitrary TCP options (including the
full range of possible TCP timestamp values) while also avoiding
various edge cases where parts of a requested TCP packet could not
always be transmitted (e.g. partial trailers).  This implementation
also permits NIC KTLS to be used in parallel with TOE.

This version does not yet support connections over a VF (specifically
the ktls_tunnel_packet function needs to handle the VF work request),
nor does it support VxLAN offload.

Sponsored by:	Chelsio Communications

(cherry picked from commit 4f272a5ef3)
2025-10-02 15:09:07 -07:00
John Baldwin 16763e046a ccr: Support T7.
- Use expanded channel ID fields (2 bits vs 1 bits), even on T6 as on
  T6 the extra bits were previously reserved and the channel IDs should
  only be 0 or 1 on T6.

- Set CMDMORE in ULP_TX_PKT on T7.

Sponsored by:	Chelsio Communications

(cherry picked from commit 8bc9d30893)
2025-10-02 15:09:07 -07:00
John Baldwin 853d1343ac cxgbe: Move the STAG and PBL memory pool arenas to the base driver
Both RDMA (iw_cxgbe) and NVMe offloads use TPT table entries to map
transaction tags in incoming PDUs to buffers in host memory permitting
direct placement of received data into host memory buffers avoiding
copies (iSCSI offload uses a different scheme for mapping tags to host
memory).  Move the vmem arenas for the supporting card memory regions
from iw_cxgbe to the main driver so they can be shared with the NVMe
offload driver.  In addition, add some helper routines for
constructing work requests to update TPT table entries.

Sponsored by:	Chelsio Communications

(cherry picked from commit 19d9a9b151)
2025-10-02 15:09:07 -07:00
John Baldwin daceb19407 cxgbe: Move send_iscsi_flowc_wr to t4_tom.ko
Rename the function to send_txdataplen_max_flowc_wr to match the
parameter it sets.  This function will be reused by other ULP modules.

Sponsored by:	Chelsio Communications

(cherry picked from commit 35b883ccf3)
2025-10-02 15:09:07 -07:00
John Baldwin ab2da6915f cxgbe: Refactor find_offload_adapter and move to t4_tom from cxgbei
This allows it to be used for other offload drivers.

Sponsored by:	Chelsio Communications

(cherry picked from commit c341048373)
2025-10-02 15:09:07 -07:00
Navdeep Parhar 9fb993778d cxgbe(4): Add support for port types SFP56 and QSFP56 and speed 200Gbps
This enables the 2x200/100/40Gbps and 4x50/25/10/1Gbps boards.

Sponsored by:	Chelsio Communications

(cherry picked from commit a02f38cced)
2025-10-02 15:09:06 -07:00
Navdeep Parhar 9d5e555fc2 cxgbe(4): Support for T7 tracing filters
These are the filters that can be used to sniff wire traffic after all
hw offloads.

Sponsored by:	Chelsio Communications

(cherry picked from commit 3203b1a110)
2025-10-02 15:09:06 -07:00
Navdeep Parhar 9d66e94f4e cxgbe(4): T7 ULPTX supports larger data length with MEMIO commands
Sponsored by:	Chelsio Communications

(cherry picked from commit 77098268dc)
2025-10-02 15:09:06 -07:00
Navdeep Parhar c42d37ec21 cxgbe(4): T7 TCB CPLs have queue and channel in different location
Sponsored by:	Chelsio Communications

(cherry picked from commit 721033a7d9)
2025-10-02 15:09:06 -07:00
Navdeep Parhar eee6854c33 cxgbe(4): Update the filtering code for T7
There are new fields available and the width of the optional part has
changed.  This affects the ntuples used by TOE/filters/hashfilters.

Sponsored by:	Chelsio Communications

(cherry picked from commit c231e86ce3)
2025-10-02 15:09:06 -07:00
Navdeep Parhar 8e73528872 cxgbe(4): Updates for T7 CIM multicore operation
T7 has a multicore microprocessor and each core has its own queue
configuration, inbound/outbound queues, and logic analyzer.  A work
request involving a tid can only be handled on queues where
(tid & tid_qid_sel_mask) == (eq->cntxt_id & tid_qid_sel_mask).

Sponsored by:	Chelsio Communications

(cherry picked from commit 3d76a4feee)
2025-10-02 15:09:06 -07:00
Navdeep Parhar cac2046f1e cxgbe(4): T7 LB mode support
This is the new mode where multiple internal channels are used to
service 1 port.  LB = Load Balancing.

* Ask for tx_tpchmap from the firmware and update sc->chan_map.
* Statistics for a port should include all its channels.

Sponsored by:	Chelsio Communications

(cherry picked from commit a16423b7a4)
2025-10-02 15:09:05 -07:00
Navdeep Parhar 5d7656a4db cxgbe(4): Recognize the new capabilities reported by T7 firmwares
Sponsored by:	Chelsio Communications

(cherry picked from commit cfcf1394ef)
2025-10-02 15:09:05 -07:00
Navdeep Parhar c99a025159 cxgbe(4): Congestion manager context settings for T7
Sponsored by:	Chelsio Communications

(cherry picked from commit c392b5a9e4)
2025-10-02 15:09:05 -07:00
Navdeep Parhar ddc8cd4053 cxgbe(4): T7's SGE context has 4 more bytes
Sponsored by:	Chelsio Communications

(cherry picked from commit d4fb12583a)
2025-10-02 15:09:05 -07:00
Navdeep Parhar bc81546ebb cxgbe(4): Include T7 PMRX cache stats in the sysctl that shows PM stats
Sponsored by:	Chelsio Communications

(cherry picked from commit fc7f27c31e)
2025-10-02 15:09:05 -07:00
Navdeep Parhar bf23542a79 cxgbe(4): Support for displaying T7 MPS TCAM entries
Sponsored by:	Chelsio Communications

(cherry picked from commit 6fa85bf122)
2025-10-02 15:09:05 -07:00
Navdeep Parhar 14e524cd2e cxgbe(4): Update meminfo for T7
There are new regions in the T7 and internal addresses are not limited
to 32b.

Sponsored by:	Chelsio Communications

(cherry picked from commit f487e4778b)
2025-10-02 15:09:04 -07:00
Navdeep Parhar 3a5c5aabdf cxgbe(4): Add T7 support to routines that deal with memory windows
Sponsored by:	Chelsio Communications

(cherry picked from commit 87d3ee5d14)
2025-10-02 15:09:04 -07:00
Navdeep Parhar 39ef0c3880 cxgbe(4): Claim T7 based devices
The nexus/ifnet names are chnex/che respectively.

Sponsored by:	Chelsio Communications

(cherry picked from commit 1ba1c78329)
2025-10-02 15:09:04 -07:00
Navdeep Parhar 1a4dfc97c4 cxgbe(4): hw/fw headers and shared code for the Terminator 7 ASIC
This is the first of a series of commits that will add T7 support to
cxgbe.  The ASIC is gen5x16 on the PCIe side and has a 400Gbps MAC on
the Ethernet side.  NICs using the T7 will come in the following
variants:

* 1 x 400Gbps with QSFP-DD connector
* 2 x 200/100/40Gbps with QSFP56/QSFP28/QSFP+ connectors
* 4 x 50/25/10/1Gbps with SFP28/SFP+/SFP connectors

There are 8 general purpose ARM A72 cores available on select
SmartNIC/DPU boards.

Obtained from:	Chelsio Communications
Sponsored by:	Chelsio Communications

(cherry picked from commit c7b2e390de)
2025-10-02 15:09:04 -07:00
Navdeep Parhar a51b2733c7 cxgbe(4): Use hw_port and tx_chan correctly all over the driver
The port's tx channel and its hardware index are different things that
happen to have the same value on NICs using T4 through T6.  This is
going to change so use the correct spelling all over the driver.
Specifically, the firmware expects the hw port index in all of these:

* PCIe channel for queues
* TX interface for TX CPLs
* PORTID in FW_PORT commands
* PORTID in t4_alloc_vi
* flowid in all the firmware flowc WRs
* mbox commands that deal with the tx scheduler

Also, create a port_id lookup table for hw_port, just like the one for
tx_chan.  Use it to lookup the port softc in the port_info handler.

Sponsored by:	Chelsio Communications

(cherry picked from commit 6d29d22a9e)
2025-10-02 15:09:03 -07:00
Navdeep Parhar d99e74711b cxgbe(4): Rename lport to hw_port.
No functional change intended.

Sponsored by:	Chelsio Communications

(cherry picked from commit 499ff78fb1)
2025-10-02 15:09:03 -07:00
John Baldwin f69054d536 cxgbe tom: Send auxiliary TLS work requests as raw WR mbufs
In particular, the work request to update the TCB state when switching
from plain TCP to TLS is now queued on the connection's offload
transmit queue rather than over the per-port control queue.

This also handles an unlikely edge case that a connection does not
have sufficient credits to transmit other work requests synchronously
such as programming the key in on-card memory or altering TCB fields.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D47763

(cherry picked from commit d869395ac4)
2025-10-02 15:09:03 -07:00
John Baldwin 846df8bc79 cxgbe tom: Export alloc_raw_mbuf for use in other TOE drivers
Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D47762

(cherry picked from commit a7aab22d2b)
2025-10-02 15:09:03 -07:00
John Baldwin 340c4db702 cxgbe tom: Support sending "raw" WR mbufs on plain TCP and TLS sockets
This is intended to support control work requests that manipulate
connection state but do not transmit data.  Raw WRs are transmitted
immediately if possible, otherwise they are queued to an mbufq in the
toe pcb until sufficient credits are available.  Raw WRs take
precendence over transmitting socket data.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D47761

(cherry picked from commit e2a2a7581c)
2025-10-02 15:09:03 -07:00
John Baldwin e27bb92b6f cxgbe tom: Halve the size of offload transmit software descriptors
Use bitfields to pack tx_credits and plen into a single 32-bit word.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D47759

(cherry picked from commit 5a38857684)
2025-10-02 15:09:03 -07:00
Alexander Ziaee b7418581f4 umass.4: Remove some extra lines which snuck in
Fixes:		70993c2fbe (umass.4: Add HISTORY, HARDWARE, and SPDX)
MFC with:	70993c2fbe (umass.4: Add HISTORY, HARDWARE, and SPDX)
2025-10-02 14:55:51 -04:00
Alexander Ziaee 70e9133d54 umass.4: Add HISTORY, HARDWARE, and SPDX
While here, break a long line that agitates the linter.

Fixes:		cc16f1b9d9 (Add umass.c)
MFC after:	1 hour
Discussed with:	imp, ivy

diff --git a/sys/dev/usb/FILES b/sys/dev/usb/FILES
2025-10-02 14:55:51 -04:00
Alexander Ziaee 14f4bc64b0 thunderbolt.4: Remove
emaste reported that this driver did not make it into FreeBSD 15.

Fixes:	3ae6c97350 (thunderbolt.4: Initial manual)
Fixes:	5ba4a93f91 (thunderbolt.4: Mention Thunderbolt 3)
2025-10-02 14:12:48 -04:00
Li-Wen Hsu cd790b9ca8 wlanstat(8): Follow-ups after moving to /usr/sbin and renaming
- Update related comments
- Remove from tools/tools/net80211

Reviewed by:	imp, adrian
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52726

(cherry picked from commit 6952bb321c)
2025-10-03 01:19:06 +08:00
Li-Wen Hsu cb714aa76b wlanstat(8): Rename from wlanstats(8) to keep consistency
All the status and statistics utilties in base are ending with "stat",
the only exception is mailstats(8) but that's from sendmail.

Reviewed by:	imp, adrian
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52724

(cherry picked from commit 89eee8ee2c)
2025-10-03 01:19:06 +08:00
Yogesh Bhosale 772b37053b ixgbe: Remove unused function ixgbe_is_media_cage_present
Remove the unused function ixgbe_is_media_cage_present that
generates a compiler warning.

Signed-off-by: Yogesh Bhosale [email protected]

Reported by:	markj
Differential Revision:	https://reviews.freebsd.org/D52467

(cherry picked from commit 275f7d72ff)
2025-10-02 19:14:35 +02:00
Olivier Certner 6fcfb244e3 namei.9: Remove duplicate WANTPARENT description
Fixes:          5673462af5 ("namei.9: sort operational modifiers in numerical order")
MFC after:      2 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit f456081242)
2025-10-02 18:57:20 +02:00
Olivier Certner 4ffcb1a4a9 mdo(1): Add support and shortcuts for fully specifying users and groups
While preserving compatibility ('root' implied if no user is specified,
option '-i' not setting groups), introduce options to control finely
which user and group IDs are set in the launched process.

To minimize the risks of user error, mdo(1) by default enforces that all
user and group IDs are specified, either with explicit values from the
command-line or, if a known user name is passed with '-u', from the
corresponding content of the password and group databases.  The other
main type of use cases is to start from the current process'
credentials, only amending part of them.  It is now also possible to
blend both approaches, where some parts must be specified and the others
can just be amended or left as is.

Options:

* As before:
-u: Specifies a user name or ID to change all user IDs to.  If a known
    name is passed, also automatically sets all groups as per the
    password and group databases.
-i: Starts from the current groups, instead of having to specify them
    by using '-u' with a known user name or explicitly.

* New:
-k: Starts from the current users (incompatible with '-u').  Implies '-i'.
-g: Sets/overrides the primary group IDs with the passed group name or ID.
-G: Sets/overrides the supplementary groups set with the passed list of
    comma-separated names or IDs.
-s: Amend the supplementary groups set according to the list of
    comma-separated directives from the following:
    - @: Empties the set.  Must be the first directive.  Incompatible with '-G'.
    - +<group>: Add a group to the set.
    - -<group>: Remove a group from the set.  Takes precedence over +<group>.
--euid: Overrides the effective user ID.
--ruid: Overrides the real user ID.
--svuid: Overrides the saved user ID.
--egid: Overrides the effective group ID.
--rgid: Overrides the real group ID.
--svgid: Overrides the saved group ID.

Option '-k' was introduced as a requirement to be explicit when one
wants to keep the current user(s) instead of specifying new ones.  This
is both for the purpose of avoiding foot-shooting and preserving the
possibility to omit '-u' to switch to 'root'.  In order to avoid
confusion, if any user or group overrides are specified, mdo(1) however
enforces that either '-u' or '-k' has been specified (so, in practice,
'-u root' is implied only in the absence of any other options except
'-i').

Some base supplementary groups set is needed when '-s' is used without
directive '@'.  It can be an explicit one specified with '-G',
effectively meaning that '-G' is processed before '-s'.  Else, it is
determined from the password/group database (see initgroups(3)) if '-u'
with a user name was passed, or is simply the current set if '-i' (or
'-k') was specified.  Other cases require specifying the full set (using
'-G' or '-s' with '@'), and will fail otherwise.

As the release process for 15.0 is progressing, this is committed in
advance of the still-in-progress tests and manual page updates.

Note for MFC to stable/14: As initgroups() has its old behavior,
consistently with it, remove the effective GID from being passed also as
a supplementary group.

Reviewed by:    bapt
MFC after:      3 days
Relnotes:       yes
Event:          EuroBSDCon 2025
Sponsored by:   The FreeBSD Foundation
Sponsored by:   Google LLC (GSoC 2025)
Co-authored-by: Kushagra Srivastava <[email protected]>
Differential Revision:  https://reviews.freebsd.org/D52613

(cherry picked from commit 3ca1e69028)
2025-10-02 18:57:20 +02:00
Olivier Certner 51a336aca7 vn_fullpath.9: Add missing links for described functions
To reflect all the functions that are now described in the manual page.

Fixes:          9f269a0a77 ("MAC/do: Check executable path ...")
MFC after:      3 days
Event:          EuroBSDCon 2025
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 05e5de00b9)
(cherry picked from commit c87a9f51a0)

(Compilation fix MFCed in the same commit.)
2025-10-02 18:57:20 +02:00
Olivier Certner 89958992b6 MAC/do: Check executable path from the current jail's root
Contrary to my initial belief, vn_fullpath() does return a vnode's path
from the current chroot, and not from the global root (which would have
been a bug also, but without security consequences).  This enables
a "confused deputy"-like scenario where a chroot(2) can change which
executable can be authorized by MAC/do, which is even more problematic
for unprivileged chroot(2).

This was found by re-examining the code following two close events:
1. Shawn Webb sent a mail to freebsd-hackers@ on 08/05 saying that in
   HardenedBSD they had added a check on P2_NO_NEW_PRIVS (in
   mac_do_priv_grant()), which I responded to on 08/20 saying that
   P2_NO_NEW_PRIVS was not necessary for mac_do(4), with a correct
   reasoning but based on the wrong above-mentioned assumption about
   vn_fullpath().
2. I reviewed some code by Kushagra Srivastava (GSoC 2025 student
   working on mac_do(4)/mdo(1)) adding the ability to specify which
   executables can spawn processes that mac_do(4) may decide to
   authorize (others are simply ignored), which currently is hardcoded
   to '/usr/bin/mdo'.

MFC after:      3 days
Event:          EuroBSDCon 2025
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52758

(cherry picked from commit 9f269a0a77)
2025-10-02 18:57:19 +02:00
Olivier Certner 09ae06b1b2 vfs cache: Add vn_fullpath_jail(), factor out common code
Introduce vn_fullpath_jail(), which returns a path to the passed vnode
relative to the current jail's root.  It will be used by mac_do(4) in
a subsequent commit.

Factor out common code between the new variant and vn_fullpath().  While
here, rework the comments a bit.

Add vn_fullpath_jail() to the vn_fullpath.9 manual page.  While here,
document all the existing public vn_fullpath*() functions.

Reviewed by:    kib (except latest manual page changes)
MFC after:      3 days
Event:          EuroBSDCon 2025
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52757

(cherry picked from commit c5a813c9f4)
2025-10-02 18:57:19 +02:00
Olivier Certner 907fbfd7e4 mac_do.4: Mention "from" part's GID can also match supplementary groups
MFC after:      3 days
Event:          EuroBSDCon 2025
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit c1d5fc4e0c)
2025-10-02 18:57:14 +02:00
Alexander Ziaee 5ba4a93f91 thunderbolt.4: Mention Thunderbolt 3
MFC after:	1 hr
Reported by:	emaste
Fixes:		2f7a796b59 (thunderbolt.4: Initial manual)

(cherry picked from commit e4e412e45a)
2025-10-02 12:45:49 -04:00
Xin LI 860583c83e MFC: MFV: expat 2.7.3.
(cherry picked from commit 8d485a8490)
2025-10-02 09:37:58 -07:00
Alexander Ziaee 3ae6c97350 thunderbolt.4: Initial manual for HW Relnotes
This manual contains nothing and is only suitable for the HW Relnotes,
but lets get it in so we have something and then can iterate on it.

MFC after:		3 minutes
Fixes:			2ed9833791 (thunderbolt: Import USB4 code)
Discussed with:		obiwac
Differential Revision:	https://reviews.freebsd.org/D52847

(cherry picked from commit 2f7a796b59)
2025-10-02 11:15:19 -04:00
Alexander Ziaee b81bc40741 mmcsd.4: s/DESCRIPTION/HARDWARE + HISTORY + SPDX
This manual only describes a tiny amount suitable for the HW Relnotes.
Remove the description section and replace it with a hardware section
which will appear there.

MFC after:	3 minutes
Reported by:	ivy
History Ref:	5bcb64f20a (Add mmc and mmcsd)

(cherry picked from commit 0c1c81c479)
2025-10-02 11:15:19 -04:00
Kyle Evans 4ca234b87a pkgbase: move libedit into the -runtime package
libedit isn't as foundational as the rest of -clibs, but various bits
of -runtime do need it.  Give it a new home over in -runtime.

This also fixes the libedit build to group the readline bits into the
same package as the libedit that implements them.

Reviewed by:	ivy

(cherry picked from commit 5e4e12ae64)
2025-10-02 08:32:53 -05:00
Kyle Evans 61a7d5d9bf pkgbase: move ncurses into its own package
Pushing ncurses into clibs adds extra upgrade risk to a package that
otherwise consists of integral libs with non-trivial interdependencies.

Adding it to -runtime was considered, but the move was historically
motivated to some extent by allowing a much smaller set of base libs to
be installed for smaller VM images that don't really need all of the
runtime package.

This also fixes the ncurses build to ensure that libmenuw is grouped
with the rest of the ncurses libraries, which doesn't seem to have been
an intentional omission.

Reviewed by:	ivy

(cherry picked from commit 06afa0a55e)
(cherry picked from commit df74ea7f41)
2025-10-02 08:32:32 -05:00
Dag-Erling Smørgrav cb06890f79 nss_tacplus: Fix typo in Makefile
Reported by:	ivy@
MFC after:	3 days

(cherry picked from commit e98d341691)
2025-10-02 08:19:25 +00:00
Dag-Erling Smørgrav 073895078e libucl: Fix bugs in C-style comment parser
When an asterisk is encountered inside a C-style comment, we first check
if there is at least one more character left in the buffer, and if that
character is a slash, which would terminate the comment.  If that is not
the case, the next two characters are consumed without being inspected.
If one of those is a double quote, or the initial asterisk of an
asterisk-slash pair, we end up misparsing the comment.

MFC after:	3 days
Reviewed by:	kevans, bofh
Differential Revision:	https://reviews.freebsd.org/D52808

(cherry picked from commit b5e2bd5ef3)
2025-10-02 08:19:24 +00:00
Dag-Erling Smørgrav 52ae229c92 libc: Add missing MLINK for tzname(3)
While here, fix manlint warnings and a typo in tzset(3).

MFC after:	3 days

(cherry picked from commit be88306123)
2025-10-02 08:19:24 +00:00
Dag-Erling Smørgrav cbb155ce4e tzcode: Test escape from TZDIR
Test a value of TZ that temporarily escapes from TZDIR (which is not
permitted when setugid) then reenters it.

MFC after:	3 days

(cherry picked from commit cf76bfbb23)
2025-10-02 08:19:24 +00:00
Dag-Erling Smørgrav 4048c39cfa tzcode: Fix issues when TZ is an absolute path
* If TZ starts with TZDIR, strip any additional slashes so relname
  does not end up looking like an absolute path.  For instance,
  TZ=/usr/share/zoneinfo//UTC should result in UTC, not /UTC.

* In the setugid case, we were incorrectly passing name rather than
  relname to fstatat().

* Modify the tz_env and tz_env_setugid test cases to exercise both
  of these scenarios.

* Also add test cases for invalid values of TZ, which I wrote
  earlier but forgot to include in a5f14e4f90.

Reported by:	Paul Eggert <[email protected]>
MFC after:	3 days
Fixes:		967a49a21a ("Update tzcode to 2025b")
Fixes:		a5f14e4f90 ("tzcode: Use -00 only for invalid time zones")
Reviewed by:	philip
Differential Revision:	https://reviews.freebsd.org/D52753

(cherry picked from commit df8bc705eb)

tzcode: Really fix issues when TZ is an absolute path

This was accidentally left out of the previous commit.

Fixes:		df8bc705eb ("tzcode: Fix issues when TZ is an absolute path")
(cherry picked from commit 202b59c35e)

tzcode: Tweak open flags.

Upstream uses a set of flags that reduces to O_RDONLY | O_CLOEXEC when
you ignore flags that either don't exist in FreeBSD or have no effect.
We were using O_RDONLY | O_BINARY, which reduces to O_RDONLY.  Add
O_CLOEXEC.  Also replace O_RDONLY with the more accurate O_SEARCH when
opening TZDIR.

MFC after:	3 days
Fixes:		967a49a21a ("Update tzcode to 2025b")

(cherry picked from commit d28e4ce6cb)
2025-10-02 08:19:24 +00:00
Dag-Erling Smørgrav a46136a8be tzcode: Drop libc namespace
This hasn't been needed in years and is a maintenance headache.

MFC after:	1 week
Reviewed by:	philip
Differential Revision:	https://reviews.freebsd.org/D52694

(cherry picked from commit d58339f398)
2025-10-02 08:19:23 +00:00
Dag-Erling Smørgrav b28b044287 tzcode: Expose and document offtime() and offtime_r()
Includes diff reduction to upstream version of this patch.

MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	philip
Differential Revision:	https://reviews.freebsd.org/D39715

(cherry picked from commit 155290b23f)
2025-10-02 08:19:23 +00:00
Dag-Erling Smørgrav 89e460f6c0 tzcode: Use -00 only for invalid time zones
As of tzcode 2025a, if we are unable to load a time zone, we set tzname
to "-00" to indicate an error.  This penalizes users who simply don't
set TZ or create /etc/localtime as a faster way of setting the time zone
to UTC (pointing /etc/localtime at /usr/share/zoneinfo/UTC forces us to
parse it every time for no real benefit).  To rectify this, use "-00"
only if TZ was set or zoneinit() returned something else than ENOENT.

MFC after:	3 days
Fixes:		967a49a21a ("Update tzcode to 2025b")
Reviewed by:	philip
Differential Revision:	https://reviews.freebsd.org/D52680

(cherry picked from commit a5f14e4f90)
2025-10-02 08:19:23 +00:00
Dag-Erling Smørgrav 76fd9309e5 pwait: Fix timeout unit parser
The timeout parser would check the first character after the number and
ignore any subsequent ones.

While here, switch to bool for booleans and fix some style nits.

MFC after:	1 week
Reviewed by:	0mp, markj
Differential Revision:	https://reviews.freebsd.org/D52612

(cherry picked from commit 3aac05f566)
2025-10-02 08:19:23 +00:00
Dag-Erling Smørgrav 384006a4c5 rc.subr: Move the sleep in wait_for_pids
Instead of sleeping while constructing the list of PIDs to wait for,
sleep briefly after pwait to give init a chance to reap the processes
that just terminated before we loop around and start probing them.

PR:		289630
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D52619

(cherry picked from commit 5953e7c984)
2025-10-02 08:19:22 +00:00
Christos Margiolis 57327328f1 snd_hda: Implement automatic redirection between associations
For audio to be redirected to the headphones/headset after plugging the
jack, or back to the speaker/internal mic when unplugging it, the
speaker and headphone pins need to be part of the same association
(i.e., the same PCM device). This patch makes it possible to redirect
audio even between different associations, which can reduce the need for
manual pin patching.

The idea is that we issue a devctl_notify() from within the jack
detection callback whenever a jack is (un-)plugged to redirect audio to
the appropriate device. Then the snd.conf devd script is responsible for
using virtual_oss to change the playback/recording device to whatever
snd_hda(4) selected. The reason for requiring virtual_oss is that it has
hot-swapping support, which is necessary for jack redirection.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Differential Revision:	https://reviews.freebsd.org/D50070

(cherry picked from commit 2ffaca551e)
(cherry picked from commit 5cc36854ee)
2025-10-02 09:31:29 +02:00
Christos Margiolis 1cde8b0a25 mixer(8): Update virtual_oss path
virtual_oss is part of base as of 9cab9fde5e ("virtual_oss: Port to
base").

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52322

(cherry picked from commit 5c8835e5c0)
2025-10-02 09:31:28 +02:00
Christos Margiolis 5a31c62314 virtual_oss: Port to base
This patch diverges quite a bit from the current upstream [1] in a few
ways:

1. virtual_oss(8), virtual_bt_speaker(8) and virtual_oss_cmd(8) are
   actually separate programs.
2. Backends (lib/virtual_oss) are built as separate shared libraries and
   we dlopen() them in virtual_oss(8) and virtual_bt_speaker(8) on
   demand.
3. virtual_equalizer(8) and the sndio and bluetooth backends are built
   as ports, because they depend on third-party libraries.
4. Use newer libav API in bluetooth backend (see HAVE_LIBAV ifdefs) to
   address compiler errors.

[1] https://github.com/freebsd/virtual_oss

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D52308

(cherry picked from commit 9cab9fde5e)
(cherry picked from commit 86a7787e32)
(cherry picked from commit 69ede18b95)
(cherry picked from commit 0532cd2d77)
(cherry picked from commit 25d551b5fb)
(cherry picked from commit 8af6aee96e)
(cherry picked from commit f040ee6e40)
(cherry picked from commit bce8cdaf4c)
2025-10-02 09:31:27 +02:00
Alexander Ziaee 955d9b0a10 mandoc: Vendor import of upstream at 2025-09-26
Interesting changes:
+ mandoc db: Improve case sorting, found by our very own markj
+ history: Add macros for version 8 and 10 AT&T Unix
+ linter: Warn on blank lines in man(7) like mdoc(7)
+ manuals: Improve precision, man(7) syntax table, and roff(7) specifics
+ manuals: Fix PDF/PS footer regression detailed in our PR: 289786

PR:		289786
MFC after:	3 days

(cherry picked from commit 59fc2b0166)
2025-10-01 22:52:57 -04:00
Alexander Ziaee 1b3408e301 ahc.4,ahd.4: Improve HARDWARE + tag SPDX
Add some context for the Hardware Relnotes, and tag SPDX while here.

MFC after:	3 days

(cherry picked from commit 2c2a2b8281)
2025-10-01 22:52:57 -04:00
Alexander Ziaee da26590f1c aac.4: Improve HARDWARE introductory sentance
For the improvement of the hardware release notes. While here, tag SPDX.

MFC after:	3 days

(cherry picked from commit 17be686a39)
2025-10-01 22:52:56 -04:00
Alexander Ziaee fba07ae01a mpr.4: Improve HARDWARE introductory sentance
Add context for inclusion in Hardware Release Notes.

MFC after:	3 days

(cherry picked from commit c856f327fa)
2025-10-01 22:52:56 -04:00
Gleb Smirnoff b8975e052e ucode: use wrmsr_early_safe() for early CPU microcode update
Use the new method for wrmsr that is able to set up fault handler even at
the very early stage of kernel boot.  This prevents panic with new
microcode for some new AMD EPYCs, that requires certain patchlevel of
microcode to be already present in the CPU.  If BSP patching failed, we
print the message and we don't try to patch APs.

This has been tested only on AMD booted in EFI mode.

Reviewed by:		stas, kib
Differential Revision:	https://reviews.freebsd.org/D52643

(cherry picked from commit d9f03a43f2)
2025-10-01 17:00:13 -07:00
Isaac Freund ecfdb6df48 release: create pkgbase VM and cloud images
VM and cloud images are now built as packaged base systems by default,
matching the default for installation media.

Setting -DNOPKGBASE allows building as non-pkgbase systems.

Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51483

(cherry picked from commit 4227d51b6e)
2025-10-01 17:19:16 -04:00
Alexander Ziaee 224d270f6c mrsas.4: Cleaning
+ Rewrite SYNOPSIS for consistency
+ Rewrite HARDWARE for HW Relnotes, and add some stragglers
+ Correct mdoc grammar, making sysctls aproposable and linking xrefs
+ Clean up TODO, cannonicalize to CAVEATS, a standard section
+ Editorial pass, tag SPDX

MFC after:		3 days
Reviewed by:		imp
Differential Revision:	https://reviews.freebsd.org/D52125

(cherry picked from commit 52eb7e394a)
2025-10-01 12:52:30 -04:00
Mateusz Piotrowski e3a9e2f029 mktemp.1: Document TMPDIR in ENVIRONMENT
While here, use Ev for TMPDIR consistently.

MFC after:	3 days
Event:		EuroBSDCon 2025

(cherry picked from commit 6b164f1811)
2025-10-01 18:32:17 +02:00
Kajetan Staszkiewicz ad428a318b pf: Fix interface counters for af-to rules
An inbound af-to rule creates a state bypassing outbound pf_test().
In such case increase counters of the outbound interface directly in
pf_route() for post-af-to address family.

For outbound af-to rules ensure that post-af-to address family is used
to increase interface counters.

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D52448

(cherry picked from commit 7cd3854f82)
2025-10-01 18:00:47 +02:00
Kajetan Staszkiewicz 013708fd31 pf: Fix rule and state counters
Increasing counters on "match" rules causes the 1st packet making a
connection to be double-counted, but only for rule counters, not rules'
tables, because those are not increased at all during rule parsing.
Remove "match" rule counter handling during rule parsing, do it only in
pf_counters_inc().

NAT can be performed either by "nat" rules in the  NAT ruleset or by "match"
rules. Rules before the NAT rule, and the NAT rule itself match on pre-NAT
addresses, and later rules match on post-NAT addresses. When increasing
counters go over rules in the same order as a packet would and use
source and destination addresses for updating table counters from
appropriate state key, taking into consideration on which rule NAT
happens.

Use AF from state key, so that table counters can be properly updated for
af-to rules.

Synchronize match rule updating behaviour to that of OpenBSD: if rules
match, but state is not created, don't update counters.

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D52447

(cherry picked from commit 6353f5d9a5)
2025-10-01 18:00:31 +02:00
Kajetan Staszkiewicz 048b8123ee pf: Always skip outbound filtering for inbound af-to rules
The af-to rules on inbound direction create a single state spanning both
the inbound and the outbound interface. Calling pf_test() for the
outbound direction in pf_route() makes the packet pass through state
search, match the existing state, never evaluate the ruleset, and increase
state counters.

Check that the state comes from an af-to rule in inbound direction, and
if yes, skip outbound testing.

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D52446

(cherry picked from commit 938ae26ffd)
2025-10-01 18:00:20 +02:00
Kajetan Staszkiewicz f12dba5d17 pf: Fix interface binding for af-to with route-to
States created by inbound af-to rules bypass outbound filtering and span
both the inbound and outbound interfaces. When the first packet for such rule
creates a state, this state has st->orig_kif set the original inbound interface
and kif set to V_pfi_all. When the outbound interface is eventually
known st->kif is updated to that interface. When not using route-to,
the outbound route and its interface are determined for the new address family
and st->kif is set to that interface. However when using route-to, ifp
is explicitely given and the code for updating st->kif is not run for
the first packet. When the returning packet matches the state, the code is
run but updates st->kif to the original inbound interface, which is now
the outbound interface. The state ends up with st->kif == st->orig_kif
and won't forward any more returning packets.

There is another block of code performing such update, but only for reply-to.

Perform the update of st->kif in a single place no matter if ifp was
explicitely given or found by routing lookup. For checks using pings
check if really all pings have been replied to, because a single reply
is enough to have ping exit with a successful exit code.

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D52445

(cherry picked from commit 42441d3420)
2025-10-01 17:59:45 +02:00
Kajetan Staszkiewicz e345fb2e91 pf: Add pfsync protocol for FreeBSD 15
A new version of pfsync packet is introduced: 1500. This version solves
the issues with data alignment introduced in version 1400 and adds syncing
of information needed to sync states created by rules with af-to (original
interface, af and proto separate for wire and stack keys), of rt_af
needed for prefer-ipv6-nexthop, and of tag names.

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D52176

(cherry picked from commit 99475087d6)
2025-10-01 17:59:44 +02:00
Mateusz Piotrowski 2b58ab6ce5 sysctl.9: Fix grammar in *TUN descriptions
Reported by:	bcr
Reviewed by:	bcr
MFC after:	3 days
Event:		EuroBSDCon 2025
Fixes:	5eb1caa8c8 Updated SYSCTL manual pages
Differential Revision:	https://reviews.freebsd.org/D52768

(cherry picked from commit f34e1c76ad)
2025-10-01 17:51:50 +02:00
Lexi Winter 1bd7477460 package: Use correct license for clang
LLVM was relicensed under Apache 2.0 with LLVM exception a while ago.

MFC after:	1 day
Reviewed by:	bapt, imp (previous version)
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D51769

(cherry picked from commit 3cbd1f8168)
2025-10-01 11:37:08 +01:00
Lexi Winter 50dc8aa375 packages: Move ctf-tools to ctf
Remove the ctf-tools package.  Add a new package which contains the
previous contents of ctf-tools along with libctf.  This removes
CDDL-licensed code from the utilities package.

Set LIB_PACKAGE for libctf so that DTrace runtime doesn't need to
install the tools.

MFC after:	1 day
Reviewed by:	bapt
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52776

(cherry picked from commit 24e4dcf4ba)
2025-10-01 11:36:58 +01:00
Lexi Winter 0e17e80093 libstdbuf: Move to the utilities package
This is a niche tool which is only useful in a small number of
specific situations.  It's very small (8kB), and the executable
component /usr/bin/stdbuf is already in -utilities, so move the
shlib to -utilities as well.

MFC after:	1 day
Reviewed by:	bapt
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52788

(cherry picked from commit 4c8bbf5897)
2025-10-01 11:36:49 +01:00
Lexi Winter 9655d4f5e1 libbsm: Rename package to audit-lib
This is part of audit, so use the new LIB_PACKAGE feature to name the
package audit-lib, rather than libbsm.

MFC after:	1 day
Reviewed by:	bapt
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52789

(cherry picked from commit a053f948ad)
2025-10-01 11:36:37 +01:00
Lexi Winter 4305db21bb libsdp: Move to bluetooth-lib package
Instead of creating a separate libsdp package, use LIB_PACKAGE to
ship this in bluetooth-lib.

MFC after:	1 day
Reviewed by:	bapt
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52790

(cherry picked from commit 41ee4321cc)
2025-10-01 11:36:25 +01:00
Lexi Winter b580906afa packages: Rename liblzma package to xz
Rename liblzma to xz, and use LIB_PACKAGE to create an xz-lib package
for runtime libraries.

MFC after:	1 day
Reviewed by:	bapt
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52791

(cherry picked from commit 9124ace751)
2025-10-01 11:36:15 +01:00
Lexi Winter b2249ee627 libstdthreads: Move to the runtime package
This library is required for C11 conformance, and is tiny (11kB), so
instead of creating a bunch of packages for it, put it in runtime.

Although this is a core C library and might be expected to live in
clibs, kib objected to this on the basis that almost nothing actually
uses libstdthreads and putting it in clibs would be wasteful.

MFC after:	1 day
Reviewed by:	kib
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52792

(cherry picked from commit 11709058bf)
2025-10-01 11:36:07 +01:00
Lexi Winter 1757898edd liby: Move to toolchain package
We don't need an entire package for this trivial library.  Move it to
toolchain, which in practice means it's installed in toolchain-dev as
it only contains a static library.

MFC after:	1 day
Reviewed by:	bapt
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52793

(cherry picked from commit b0f25a38d7)
2025-10-01 11:35:57 +01:00
Lexi Winter 693aa6bea2 bsdinstall: Only offer to enable services which are installed
With pkgbase, users may decide to install a minimal set of packages
that's missing some daemons.  Check which services are installed, and
only include the ones which are present in the dialogue.

MFC after:	1 day
Reviewed by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D52646

(cherry picked from commit 2507698b63)
2025-10-01 11:35:23 +01:00
Lexi Winter b4b91207ab sh: Remove /.profile
root's home directory was moved to /root many years ago, so there's no
reason to keep this old link.  This brings sh in line with csh, where
/.cshrc was removed in dcb65c5a94.

Relnotes:	yes
Approved by:	re (cperciva)
MFC after:	1 day
PR:		289097
Reviewed by:	cperciva, jilles, bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D52161

(cherry picked from commit d31e342bcc)

bin/sh: Fix the build

Removing <bsd.prog.mk> was unintentional; put it back.

Fixes:		d31e342bcc ("sh: Remove /.profile")
MFC after:	1 day

(cherry picked from commit bb0955ee4d)
2025-10-01 11:35:10 +01:00
Lexi Winter 259bb93b80 Remove ftpd(8)
This was previously deprecated and is slated for removal in 15.0.
Users who still need ftpd(8) can install the ftp/freebsd-ftpd port.

Retain the ftp(d) PAM services since other FTP daemons use them.

Update /etc/inetd.conf to point to /usr/local.

Add ftpd to ObsoleteFiles, but do not list configuration files since
users may want to preserve these to use with the freebsd-ftpd port.

There is still some language in the manual referring to ftpd(8)
which is relevant to the port, which has been retained but updated
to reference the port.

MFC after:	3 days
Relnotes:	yes
Reviewed by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D52739

(cherry picked from commit 614c8750ce)
2025-10-01 11:28:40 +01:00
Lexi Winter 3ded79804e create-sets.sh: Always build the base sets
Since all packages were moved to the optional set, no packages are
directly in the base sets, which means nothing caused the base sets
to be built.  Add the base sets to create-sets.sh so they're always
built.

Fixes:		eaecc9551a ("packages: Add an "optional" set")
MFC after:	1 day

(cherry picked from commit a087b4aec3)
2025-10-01 11:26:53 +01:00
Lexi Winter 7082b85f03 packages: Add an "optional" set
This is everything in "base" but without compilers.  This means we
have sets to support four basic workloads:

- "minimal" for a small installation where the user intends to add
  other packages by hand.

- "optional" for a complete installation on a production system which
  does not need to compile software.

- "devel", which can be added to either minimal or optional when
  compilers are required.

- "base" for a complete installation, including compilers, for users
  who don't want to interact with pkgbase and just want the complete
  system installed like it was before.

This is probably the last set want to add; any further metapackages
would be better treated as "task" packages intended to target one
specific workload.

MFC after:	3 days
Reviewed by:	cperciva, bapt
Differential Revision:	https://reviews.freebsd.org/D52777

(cherry picked from commit eaecc9551a)
2025-10-01 11:26:43 +01:00
Lexi Winter 4b220047f1 packages: Add kernel-man to minimal-jail
These manpages are broadly applicable to all systems, even jails,
since they describe kernel facilities which are available in jails.

MFC after:	3 days
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52743

(cherry picked from commit 29a4fe3dbd)
2025-10-01 11:26:21 +01:00
Lexi Winter 478a4535a0 packages: Add efi-tools to set-minimal
This is required to manage the firmware on amd64 and aarch64 systems.

MFC after:	3 days
Reviewed by:	imp, emaste
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52742

(cherry picked from commit fc726c4ec4)
2025-10-01 11:26:10 +01:00
Lexi Winter e1632b827b freebsd-base.7: New manpage describing pkgbase
This covers the basic structure of pkgbase, how packages are
distributed, how package sets work, and provides a few example
of actually using pkgbase.

MFC after:	6 hours
Approved by:	re (cperciva)
Reviewed by:	ziaee, cperciva
Differential Revision:	https://reviews.freebsd.org/D52644

(cherry picked from commit 72bf56e273)
2025-10-01 11:25:25 +01:00
Lexi Winter 32e75ec585 packages: Add a base-jail set
This is base, but without packages which are not generally useful
in jails.  The following packages are excluded:

* Support for hardware not present in a jail:
  acpi, apm, bluetooth, ccdconfig, console-tools, cxgbe-tools,
  efi-tools, fd, hostapd, mlx-tools, nvme-tools, wpa

* Kernel facilities that don't work in a jail:
  dtrace, dwatch, ggate, hast, iscsi, libcuse, smbutils

All library packages are included in base-jail, even if they might not
work, because the user may have executables linked with them.

While here, remove the set-minimal dependency from set-devel, since
this will cause unnecessary packages to be installed in jails.  This
means users will need to install set-devel in addition to their base
set (minimal or base), which bsdinstall already handles correctly.

Add a license to all the set UCL files, so people can redistribute them.

MFC after:	6 hours
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D52719

(cherry picked from commit 31d00ac6c9)
2025-10-01 11:25:15 +01:00
Lexi Winter fc4881dd9a packages: Remove inetd from the minimal set
Although inetd is widely used, none of the base daemons which require
or support inetd (e.g. fingerd, tftpd, sshd) are in the minimal set,
and it's fairly uncommon to enable inetd's built-in servers nowadays.

MFC after:	6 hours
Reviewed by:	manu, bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D52715

(cherry picked from commit 791fc275db)
2025-10-01 11:24:47 +01:00
Ahmad Khalifa 3c4b41a93a gpioc: allocate new fifo size
This slipped through after I resolved some merge conflicts.

Fixes:		d000adfe
MFC after:	1 day

(cherry picked from commit 2679636b44)
2025-10-01 12:37:36 +03:00
Ahmad Khalifa 8fef0ee894 gpioc: fix race in ioctl(GPIOCONFIGEVENTS)
A race can occur in gpioc_ioctl when it is called with GPIOCONFIGEVENTS
closely followed by GPIOSETCONFIG. GPIOSETCONFIG can alter the
priv->pins list, making it no longer empty and opening the door for
access to priv->events while we are reallocating it. Fix this by holding
priv->mtx while handling GPIOCONFIGEVENTS.

Reported by:	Qiu-ji Chen
PR:		289120
Reviewed by:	mmel
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D52783

(cherry picked from commit d000adfe41)
2025-10-01 12:37:36 +03:00
Ahmad Khalifa 0f92b40499 gpioc: allocate priv->events with the correct size
MFC after:	1 day

(cherry picked from commit fa26e44554)
2025-10-01 12:37:36 +03:00
Ahmad Khalifa 7432a95653 gpio: implement bus_setup_intr and bus_teardown_intr
Implement bus_setup_intr and bus_teardown_intr as bus_generic_setup_intr
and bus_generic_teardown_intr respectively for GPIO drivers that support
interrupts. This allows children to setup interrupts.

Reported by:	Evgenii Ivanov <[email protected]>
Reviewed by:	imp
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D52197

(cherry picked from commit f1a372ed88)
2025-10-01 12:37:36 +03:00
Evgenii Ivanov cddbc26251 rk_gpio: Enable gpio allocation via fdt
The code is based on bcm2835_gpio.c. This enables allocating gpio
interrupts via interrupts property in fdt.

Reviewed by:	vexeduxr
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D52513

(cherry picked from commit ace98a8fb8)
2025-10-01 12:37:36 +03:00
Evgenii Ivanov 9fd527140a rk_gpio: Fix register read/write on rk3568
Not all registers have a write mask with high/low register on rk3568.

Reviewed by:	vexeduxr
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D52512

(cherry picked from commit 34ec8c9cca)
2025-10-01 12:37:35 +03:00
Ahmad Khalifa 2ae71a5e9f ng_tty: copy to the correct mbuf
memcpy should copy to the current mbuf, otherwise we're copying to the
first mbuf in the chain over and over.

Reported by:	kevans
Reviewed by:	glebius
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D52713

(cherry picked from commit e05521121f)
2025-10-01 12:37:35 +03:00
Ahmad Khalifa e73cc0abe1 ng_tty: don't increment m_data
Stop incrementing m_data so the callee can read the mbuf.

MFC after:	3 days
Reviewed by:	glebius
Differential Revision:	https://reviews.freebsd.org/D52702

(cherry picked from commit 57d5a8feda)
2025-10-01 12:37:35 +03:00
Aymeric Wibo dc77c451f7 Revert "acpi_powerres: Fix turning off power resources on first D-state switch"
This reverts commit a13f28d57e.

Reported by:    phk
Tested by:      phk
Sponsored by:   The FreeBSD Foundation
2025-10-01 11:28:35 +02:00
Aymeric Wibo 929a887b32 Revert "acpi_powerres: acpi_pwr_get_state and getting initial D-state for device"
Setting ACPI D-states is generally broken on FreeBSD and this change
surfaced an issue. So reverting for the time being whilst I write a
proper fix for this.

This reverts commit 02a8fadd2c.

Reported by:	glebius, phk
Tested by:	glebius
Sponsored by:	The FreeBSD Foundation
2025-10-01 11:28:20 +02:00
Michael Tuexen bd7f55a1d8 vtnet: improve control of transmit offloading
Keep the hwassist flags for transmit checksum offload and transmit
segment offload in sync with the enabled capabilities.

Reported by:		Timo Völker
Reviewed by:		Timo Völker
Differential Revision:	https://reviews.freebsd.org/D52765

(cherry picked from commit f2575d56c8)
2025-09-30 23:49:23 +02:00
Konstantin Belousov 799fae57ca libsys: drop private exports no longer needed
(cherry picked from commit 495813bfd7)
2025-10-01 06:00:08 +03:00
Konstantin Belousov 47f5f89dbd libc: properly forward the compat syscall references to libsys
(cherry picked from commit e194103bd3)
2025-10-01 06:00:08 +03:00
Konstantin Belousov 8a8d6e1861 libc: un-namespace gen-compat.h
(cherry picked from commit f15d3694db)
2025-10-01 06:00:08 +03:00
Ariel Ehrenberg 45f786241c mlx5 ipsec: Add VLAN tag to IPSec rules to prevent duplicates
(cherry picked from commit 84d688af4e)
2025-10-01 06:00:08 +03:00
Konstantin Belousov d4f91b6d25 amd64: add wrmsr_early_safe(9)
(cherry picked from commit a319696875)
2025-10-01 06:00:08 +03:00
Zhenlei Huang 3dc9f96a48 witness: Record the first acquired file and line for recursable locks
and the last acquired file and line to witness object.

For recursable locks, unfortunately current implementation records only
the recurse count and the last acquired file and line, but does not
restore the previous acquired file and line on unlock. Hence it is
possible to report false acquired file and line, and that may mislead
developers and make the report by users a little harder to analyse.

Since subsequent recurse locks do not affect how witness order check,
record the first acquired file and line so that the logic is much clear.

Reported by:	bz
Reviewed by:	kib (previous version), markj
See also:	https://lists.freebsd.org/archives/freebsd-current/2025-June/007944.html
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D52496

(cherry picked from commit 2d85bc8929)
2025-10-01 10:13:54 +08:00
Rick Macklem 4771b65fde rpc_generic.c: Fix a rpcbind core dump when rpcinfo is done
Commit c5d671b added netlink support to
server side rpcbind. However it did not add
a case for AF_NETLINK to __rpc_taddr2uaddr_af().
(Reported as PR#289625.)

As such, without this patch the r_addr field of the
netlink rbllist is NULL, which causes a crash in
svc_sendreply() for a Dump query (what rpcinfo
does).

PR:	289625

(cherry picked from commit 70730cd21c)
2025-09-30 17:52:46 -07:00
Jose Luis Duran 53dc967db7 openssh: blocklist: Use NetBSD probes
Use NetBSD probe locations for consistency.  We have submitted all
improved or missing probes, keeping them synchronized with NetBSD (our
blocklist upstream) should simplify upgrades and maintenance, as the
locations of these probes are a moving target, depending on upstream
OpenSSH changes.

Additionally, use BLACKLIST_AUTH_FAIL exclusively for now.  At the time
of this commit BLACKLIST_BAD_USER, is a no-op.  However, it will change
in a future upgrade.

Also, enhance blacklist notification messages for better debugging by
making them more descriptive.

Reviewed by:	emaste
Approved by:	emaste (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52749

(cherry picked from commit e02003bce7)
2025-09-30 23:17:21 +00:00
Jose Luis Duran ec4771b17b ftpd: blocklist: Add a permission denied probe
Reviewed by:	emaste
Approved by:	emaste (mentor)
Obtained from:	NetBSD
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52746

(cherry picked from commit 1060684b04)
2025-09-30 23:17:02 +00:00
Jose Luis Duran 268e74d149 ftpd: blocklist: Add an extra probe
Add a blocklist probe when user access is denied.

Reviewed by:	emaste
Approved by:	emaste (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52747

(cherry picked from commit 307929b211)
2025-09-30 23:16:45 +00:00
Jose Luis Duran 8f4e196e7e rc.d: Fix ftpd flags
After f99f0ee14e ("rc.d: add a service jails config to all base system
services"), the FTP service ignores the flags configured in ftpd_flags:

    # sysrc ftpd_flags=-B
    ftpd_flags:  -> -B
    # service ftpd enable
    ftpd enabled in /etc/rc.conf
    # service ftpd start
    Starting ftpd.
    # pgrep -fl ftpd
    1234 /usr/libexec/ftpd -D

Notice the absence of the "-B" flag.

PR:		285600
Reviewed by:	0mp, emaste
Approved by:	emaste (mentor)
Fixes:	f99f0ee14e ("rc.d: add a service jails config to all base system services")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52745

(cherry picked from commit 2872ced187)
2025-09-30 23:15:42 +00:00
Bjoern A. Zeeb a38672e64a UPDATING: bump __FreeBSD_version for drm-kmod/nvidia-drm vs. LinuxKPI
Both drm-kmod and nvidia-drm were updated to keep compiling and/or
working after the latest LinuxKPI PCI changes.  Some of what should
have worked for a long time but did not or conflicted was hidden
behind native PCI calls instead of using LinuxKPI.  We cleaned this
up.  Bump __FreeBSD_version so that users will get the updated packages.

PR:		289647

(cherry picked from commit 52ce810302)
2025-09-30 22:20:36 +00:00
Bjoern A. Zeeb 62c3b77d1d LinuxKPI: pci: implementation of [lkpi_]pci_get_slot()
Like lkpi_pci_get_domain_bus_and_slot() implement lkpi_pci_get_slot()
using pci_find_bsf() instead of pci_find_dbsf() (no domain).
This is needed for a wireless driver.

Unfortunately the name [pci_get_slot()] collides with the native PCI
function.  Add a guard around it and disable the use when the native
version is required (in lkpifill_pci_dev() and in bnxt/bnxt_en; if the
latter gets fixed we can probably also fix work around it in the former;
further conflicts in drm-kmod 6.1-lts, 6.6-lts, and master were resolved).

Sponsored by:	The FreeBSD Foundation (initially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52065

(cherry picked from commit 4179e6b782)
2025-09-30 21:45:29 +00:00
Bjoern A. Zeeb d8972ad2f6 LinuxKPI: pci: allocate entire pci_dev hiereachy up to root port on attach
In linux_pci_attach_device() allocate a LinuxKPI pci_dev for each device in
the hierarchy up to the root port[1] as we cannot do that later on demand
as we may be in a context where we may not sleep.

Take special care of DRM as there is a non-PCI device in the chain which
needs to be skipped.

iwlwifi(4) can hit this case called from a callout.

While here leave a comment as the cleanup order of
linux_pci_attach_device() needs correction seperately.

Sponsored by:	The FreeBSD Foundation (initially)
PR:		283027
PR:		289647
Suggested by:	jhb [1]
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52069

(cherry picked from commit bbeeb58531)
(cherry picked from commit 3860afe99e)
(cherry picked from commit 123c2dc6e1)
2025-09-30 21:45:28 +00:00
Brian Behlendorf 2f50d67409 Tag 2.4.0-rc2
Signed-off-by: Brian Behlendorf <[email protected]>
2025-09-30 12:49:15 -07:00
Ed Maste fd07941961 linuxkpi: Move string_helpers.h to string_choices.h
Chace Linux change fca76071bab2 ("lib/string_helpers: Split out
string_choices.h") from v6.5.  Everything that we implemented from
string_helpers.h has moved, so rename the file, update the include
guards, and add a new dummy string_helpers.h that just #includes it.
This matches Linux for the functionality that we have.

Reviewed by:	bz
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52606

(cherry picked from commit 4d6d5f5a21)
2025-09-30 18:58:15 +02:00
Siva Mahadevan 6f0d113e7e atf_pytest: fix xfail detection from pytest report
The location of the 'wasxfail' attribute was moved from
the 'reason' attribute back to the parent 'report'. This
fixes an issue where xfails are wrongly reported to ATF
as skipped tests.

Signed-off-by: Siva Mahadevan <[email protected]>
Pull-request: https://github.com/freebsd/freebsd-src/pull/1849
Sponsored by: The FreeBSD Foundation
(cherry picked from commit df997faca8)
2025-09-30 18:58:15 +02:00
Gordon Tetlow 4d6fd774b5 Fix multiple security issues in OpenSSL.
Out-of-bounds read & write in RFC 3211 KEK Unwrap (CVE-2025-9230)
Timing side-channel in SM2 algorithm on 64 bit ARM (CVE-2025-9231)
Out-of-bounds read in HTTP client no_proxy handling (CVE-2025-9232)

Obtained from:	OpenSSL
Approved by:	so
Security:	FreeBSD-SA-25:08.openssl
Security:	CVE-2025-9230
Security:	CVE-2025-9231
Security:	CVE-2025-9232

(cherry picked from commit aa1afb69dc)
2025-09-30 08:26:09 -07:00
Mark Johnston 053b8cb760 dtrace: Use a size_t to represent a buffer size in the printm action
printm is specific to the FreeBSD dtrace port.  I believe it's
effectively the same as tracemem(), though printm apparently predates
it.  It stores the size of the buffer of traced data inline.  Currently
it represents that size using a uintptr_t, which isn't really right and
poses challenges when porting to CHERI because
`DTRACE_STORE(uintptr_t, ...`  requires the destination to be suitably
aligned, but this isn't necessary since we're just storing a size.

Convert to using a size_t.  This should be a no-op since
sizeof(uintptr_t) == sizeof(size_t) on non-CHERI platforms (and besides
that I don't see a reason to use printm() when tracemem() is available
and is simpler to use.)

Reviewed by:	Domagoj Stolfa, avg
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D52055

(cherry picked from commit 3877025f52)
2025-09-30 09:43:08 +00:00
Mark Johnston f7bce8e182 vmm: Suspend the VM before destroying it
Otherwise we don't do anything to kick vcpu threads out of a sleep
state when destroying a VM.  For instance, suppose a guest executes hlt
on amd64 or wfi on arm64 with interrupts disabled.  Then,
bhyvectl --destroy will hang until the vcpu thread somehow comes out of
vm_handle_hlt()/vm_handle_wfi() since destroy_dev() is waiting for vCPU
threads to drain.

Note that on amd64, if hw.vmm.halt_detection is set to 1 (the default),
the guest will automatically exit in this case since it's treated as a
shutdown.  But, the above should not hang if halt_detection is set to 0.

Here, vm_suspend() wakes up vcpu threads, and a subsequent attempt to
run the vCPU will result in an error which gets propagated to userspace,
allowing destroy_dev() to proceed.

Add a new suspend code for this purpose.  Modify bhyve to exit with
status 4 ("exited due to an error") when it's received, since that's
what'll happen generally when the VM is destroyed asynchronously.

Reported by:	def
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D51761

(cherry picked from commit 3d39856d4d)
2025-09-30 09:43:08 +00:00
Mark Johnston 0ab811d893 re: Make sure re_rxeof() is called in net epoch context
It may pass packets up the stack and so needs to be called in a network
epoch.  When a watchdog timeout happens, we need to enter a section
explicitly.

Reviewed by:	zlei, glebius, adrian
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D51885

(cherry picked from commit b653a281f5)
2025-09-30 09:43:08 +00:00
Mark Johnston cffe51ff98 libnv: Fix handling of nvlist_dump() and nvlist_send() for child nvlists
Suppose an nvlist nvl belongs to a parent nvlist or nvlist array.  In
this case, nvl contains a pointer to its container.  This trips up
nvlist_send(nvl) and nvlist_dump(nvl), which intuitively should only
operate on nvl and its nvpairs.  In particular, both of these functions
will traverse to nvl's parent and start sending/dumping the parent's
nvpairs, which results in assertion failures or nonsensical output,
respectively.

Reviewed by:	oshogbo
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D52360

(cherry picked from commit 0b68e3ce6e)
2025-09-30 09:43:08 +00:00
Mark Johnston a33ab3001a random: Exclude the timestamp from healthtest for pure sources
So-called pure sources provide entropy at regular intervals, so the
timestamp counter provides little entropy.  Exclude it from health
testing for such sources.

Reviewed by:	cem, emaste
MFC after:	2 weeks
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52233

(cherry picked from commit 480928ae65)
2025-09-30 09:43:08 +00:00
Mark Johnston b466df5ae9 random: Allow pure entropy sources to provide a min-entropy estimate
The current implementation of the NIST health tests assumes a
min-entropy estimate of one bit per sample, which is quite conservative.
For so-called "pure" sources (e.g., virtio-random, TPM) it might be nice
to support larger estimates so that the tests catch failed devices more
quickly.

Thus:
- let each pure random source provide an estimate, so that downstreams
  or driver implementors can override defaults if they want to;
- increase the default estimate for pure sources;
- for pure sources initialize the state machine at source registration
  time.

Reviewed by:	cem
MFC after:	2 weeks
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52232

(cherry picked from commit f865264f6a)
2025-09-30 09:43:08 +00:00
Mark Johnston e5cb6859e2 random.4: Document the kern.random.nist_healthtest_enabled tunable
Reviewed by:	cem, emaste
MFC after:	2 weeks
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52231

(cherry picked from commit 27e2afa4f2)
2025-09-30 09:43:08 +00:00
Mark Johnston 730b6d166b random: Fix synchronization of hc_source_mask
This variable provides a mask of all registered entropy sources and is
updated when drivers attach and detach (or by sysctl).  However, nothing
was synchronizing accesses to it.  Use the harvest lock to provide
mutual exclusion for updates, and use atomic_load_int() to mark unlocked
reads.

Reviewed by:	cem
MFC after:	2 weeks
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52230

(cherry picked from commit c942d9e83e)
2025-09-30 09:43:08 +00:00
Mark Johnston 97792a5870 random: Make the entropy source registration interface more uniform
Most pure sources work under a "pull" model wherein a dedicated thread
polls the source at regular intervals (every 100ms).  A couple of
sources, however, will instead call random_harvest_direct() to provide
entropy samples.  Such sources were not calling random_source_register()
and thus weren't in the global random source list.

Modify "push" sources to use random_source_register() like other sources
do.  Such sources omit an implementation of rs_read and are thus skipped
by the above-mentioned thread.  This makes it easier to allow pure
sources to provide a min-entropy estimate in a uniform way.

Reviewed by:	cem
MFC after:	2 weeks
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52229

(cherry picked from commit 8635f86977)
2025-09-30 09:43:08 +00:00
Mark Johnston 56965bbf7f random: Make the min-entropy estimate configurable
Right now the cutoff values for the RCT and APT tests are computed with
a fixed min-entropy estimate of 1.  In preparation for permitting
alternative estimates for "pure" sources (i.e., hardware noise sources),
extend the code to handle alternative estimates of an integer number of
bits.

For the RCT test, the cutoff is simply the formula from section 4.4.1 of
NIST SP 800-90B.  For the APT test, I used Excel to compute a lookup
table using the formula provided in section 4.4.2.

Reviewed by:	cem
MFC after:	2 weeks
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52228

(cherry picked from commit 228302e630)
2025-09-30 09:43:08 +00:00
Mark Johnston ae2c350540 jail: Optionally allow audit session state to be configured in a jail
Currently it is impossible for a privileged, jailed process to set audit
session state.  This can result in suprising audit event misattribution.
For example, suppose a user ssh'es into a jail and restarts a service;
normally, sshd sets audit state such that events generated by the SSH
session are attributed to the newly authenticated user, but in a jail,
the corresponding setaudit(2) call fails, so events are attributed to
the user who had started sshd in the jail (typically the user who had
started the jail itself by some means).

While this behaviour is reasonable, administrators might want to trust
the jailed sshd to reset audit state, such that the authenticated user
appears in audit logs.  Add a jail knob to enable this.  Add a simple
regression test.

This is a reapplication of commit 246d7e9fc2 following a revert.
The audit system calls must preserve the old behaviour of returning
ENOSYS if the system call is disallowed within a jail, as some
applications depend on that behaviour.

Reviewed by:	kevans, jamie (previous version)
MFC after:	1 week
Sponsored by:	Modirum MDPay
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D51719
Differential Revision:	https://reviews.freebsd.org/D52572

(cherry picked from commit 4be491e1b9)
2025-09-30 09:43:08 +00:00
Mark Johnston 597b606207 random: fxrng: Add an entry for RANDOM_RANDOMDEV to the source table
Otherwise we get a NULL pointer dereference when writing to /dev/random.

PR:		288826
Reviewed by:	cem
MFC after:	1 week
Fixes:		fa8db724ae ("random: Treat writes to /dev/random as separate from /entropy")
Differential Revision:	https://reviews.freebsd.org/D52633

(cherry picked from commit 174d5d9397)
2025-09-30 09:43:08 +00:00
Mark Johnston e338aab613 share/mk: Fix a heuristic in bsd.cpu.mk
When cross-building from MacOS we have MACHINE=arm64 MACHINE_ARCH=arm,
so bsd.cpu.mk infers that sizeof(long) == 4, but of course it isn't.
This breaks the bootstrap build of openssl, which tests
MACHINE_ABI:Mlong64 to decide whether to build ecp_nistp224.c.  It
doesn't, and crypto/openssl/freebsd/include/openssl/configuration.h
undefines OPENSSL_NO_EC_NISTP_64_GCC_128, so we end up with a link
error.

Reviewed by:	ngie, emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D52340

(cherry picked from commit 4341f92251)
2025-09-30 09:43:08 +00:00
Mark Johnston 96cd2eb699 release: Prepare Vagrant cloudware images for building as non-root
Add metalog entries for various files.  This is a bit incomplete as
pw(8) doesn't yet have support for emitting metalog entries, which we
need since it's used here to create an interactive user.

Reviewed by:	emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52456

(cherry picked from commit 135cb071e0)
2025-09-30 09:43:08 +00:00
Mark Johnston 1deb72ac2d release: Prepare GCE cloudware images for building as non-root
- Avoid mounting devfs just to list packages and fetch distfiles.
- Add metalog entries.

Reviewed by:	cperciva, emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52455

(cherry picked from commit f1995d6fc1)
2025-09-30 09:43:08 +00:00
Mark Johnston afe49951b8 release: Prepare oracle cloudware images for non-root builds
- Add metalog entries.
- Remove a stray entry in the package list.

Reviewed by:	cperciva, emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52454

(cherry picked from commit 8f5791873a)
2025-09-30 09:43:07 +00:00
Mark Johnston 43a765bded release: Prepare EC2 cloudware images to be buildable as non-root
- Avoid chrooting to uninstall pkg, as it will not be installed in the
  first place when in non-root mode.
- Add metalog entries.

Reviewed by:	cperciva
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52452

(cherry picked from commit 8027de008d)
2025-09-30 09:43:07 +00:00
Mark Johnston 59a0361e5f release: Make azure cloudware images buildable as non-root
- Don't chroot to uninstall pkg since we don't install pkg in the first
  place.
- Use pw -R instead of chrooting.
- Add metalog entries.

Reviewed by:	cperciva, emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52451

(cherry picked from commit bab6b01bcf)
2025-09-30 09:43:07 +00:00
Mark Johnston de79f47a40 release: Enable installing packages as a non-root user
Provide variables, PKG_REPOS_DIR and PKG_REPO_NAME, to allow the user to
configure the source package repository.  Configure pkg to emit added
files to a metalog which gets concatenated with the main metalog
immediately before we build the root filesystem.

Reviewed by:	cperciva, emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D52453

(cherry picked from commit 5eb917426e)
2025-09-30 09:43:07 +00:00
Mark Johnston 87691082d8 bnxt: Fix the request length in bnxt_hwrm_func_backing_store_cfg()
PR:		286720
Reviewed by:	zlei
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D50491

(cherry picked from commit 5ca390f03b)
2025-09-30 09:43:07 +00:00
Mark Johnston 65de7110a6 release: Remove a duplicate package listing in oracle.conf
sysutils/panicmail is specified again several lines down.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.

(cherry picked from commit cc6e21cb94)
2025-09-30 09:43:07 +00:00
Mark Johnston ee99cb45ea certctl: Include sys/types.h
This is needed to fix bootstrapping on FreeBSD versions before commit
56ee5c551f ("sysctl: make sys/sysctl.h self contained").  Moreover,
certctl should really be including sys/types.h directly since it uses
size_t.

MFC after:	1 week

(cherry picked from commit 2024887abc)
2025-09-30 09:43:07 +00:00
Damjan Jovanovic 782a376911 sound: Implement COMPAT_FREEBSD32 shims
PR:		216568
MFC after:	1 week
Reviewed by:	christos, kib
Differential Revision:	https://reviews.freebsd.org/D52509

(cherry picked from commit 749a926698)
2025-09-30 11:17:26 +02:00
Christos Margiolis abdd81f0a5 dtraceall: Enable kinst for aarch64 and riscv as well
aarch64 and riscv are supported since 2023 so it should be safe to
enable it by default.

MFC after:	2 weeks
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52575

(cherry picked from commit 67f3c0d6a5)
2025-09-30 11:17:26 +02:00
nav1s 0939787e83 manuals: fix typos in zpool-upgrade man page
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: George Melikov <[email protected]>
Signed-off-by: nav1s <[email protected]>
Closes #17797
2025-09-29 16:50:57 -07:00
hoshinomori f3295ec763 range_tree: drop duplicate zfs_ prefix from rs_set_fill_raw
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: hoshinomori <[email protected]>
Closes #17800
2025-09-29 16:50:53 -07:00
Rob Norris 35ec4b14ab zpool iostat: refresh pool list every interval
When running zpool iostat in interval mode, it would not notice any new
pools created or imported, and would forget any destroyed or exported,
so would not notice if they came back. This leads to outputting "no
pools available" every interval until killed.

It looks like this was at least intended to work; the comment above
zpool_do_iostat() indicates that it is expected to "deal with pool
creation/destruction" and that pool_list_update() would detect new
pools. That call however was removed in 3e43edd2c5, though its unclear
if that broke this behaviour and it wasn't noticed, or if it never
worked, or if something later broke it. That said, the lack of
pool_list_update() is only part of the reason it doesn't work properly.

The fundamental problem is that the various things involved in
refreshing or updating the list of pools would aggressively ignore,
remove, skip or fail on pools that stop existing, or that already exist.
Mostly this meant that once a pool is removed from the list, it will
never be seen again. Restoring pool_list_update() to the
zpool_do_iostat() loop only partially fixes this - it would find "new"
pools again, but only in the "all pools" (no args) mode, and because its
iterator callback add_pool() would abort the iterator if it already has
a pool listed, it would only add pools if there weren't any already.

So, this commit reworks the structure somewhat. pool_list_update()
becomes pool_list_refresh(), and will ensure the state of all pools in
the list are updated. In the "all pools" mode, it will also add new
pools and remove pools that disappear, but when a fixed list of pools is
used, the list doesn't change, only the state of the pools within it.

The rest of the commit is adjusting things for this much simpler
structure. Regardless of the mode in use, pool_list_refresh() will
always do the right thing, so the driver code can just get on with the
display.

Now that pools can appear and disappear, I've made it so the header (if
enabled) is re-printed when the list changes, so that its easier to see
what's happening if the column widths change.

Since this is all rather complicated, I've included tests for the "all
pools" and "set of pools" modes.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Igor Kozhukhov <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #17786
2025-09-29 16:50:49 -07:00
Tony Hutter abda34b1c0 CI: Add ZTS -O option, log Setup Testing Machines step
Add a -O option to zfs-test.sh to dump debug information on test
timeout.  The debug info includes:

- 30 lines from 'top'
- /proc/<PID>/stack output of process with highest CPU usage
- Last lines strace-ing process with highest CPU usage
- /proc/sysrq-trigger kernel stack traces

All debug information gets dumped to /dev/kmsg (Linux only).

In addition, print out the VM console lines from the "Setup Testing
Machines" step.  We have often see VMs timeout at this step and don't
know why.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #17753
2025-09-29 16:50:46 -07:00
Tony Hutter 9079f986ae zvol: Fix blk-mq sync
The zvol blk-mq codepaths would erroneously send FLUSH and TRIM
commands down the read codepath, rather than write.  This fixes
the issue, and updates the zvol_misc_fua test to verify that
sync writes are actually happening.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Ameer Hamza <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #17761
Closes #17765
2025-09-29 16:50:43 -07:00
Brian Behlendorf a9bcf4faf3 CI: Switch FreeBSD 15 to 15.0-ALPHA3
Signed-off-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Closes #17795
2025-09-29 16:50:39 -07:00
Brian Behlendorf ca9b89bd2d CI: Remove Buildbot references
The Buildbot CI infrastructure has been fully replaced by GitHub
Actions.  Remove any lingering references from the repository.

Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #17794
2025-09-29 16:50:35 -07:00
Vladimir Kondratyev ee46f649cb ietp(4): Always overload HID report descriptor
It is required since "iichid(4): Always use wMaxInputLength bytes
as input report length" commit.

MFC after:	1 week

(cherry picked from commit a9227954b0)
2025-09-30 00:51:36 +03:00
Vladimir Kondratyev 9c61c3f7e4 iichid(4): Do not add 2 leading "length" bytes to input report length
MFC after:	1 week
fixes:          36027361f9 ("iichid: Stop using split I²C bus transactions")

(cherry picked from commit 1e74951b6c)
2025-09-30 00:51:07 +03:00
Vladimir Kondratyev c18032ba31 iichid(4): Always use wMaxInputLength bytes as input report length
Lower values may result in non-acknowledged interrupts. E.g. ITE5570 device
found in ASUS TUF. Greater values may result in read failures. E.g. GXTP7863
device found on MateBookPro 2023.

Investigated by:	[email protected]
PR:		289353
MFC after:	1 week
fixes:		36027361f9 ("iichid: Stop using split I²C bus transactions")

(cherry picked from commit 8f496952e3)
2025-09-30 00:50:43 +03:00
Michael Tuexen fed8dbe794 vtnet: improve interface capability handling
Enable the handling of the IFCAP_RXCSUM_IPV6 handling by handling
IFCAP_RXCSUM and IFCAP_RXCSUM_IPV6 as a pair. Also make clear, that
software and hardware LRO require receive checksum offload.

Reviewed by:		Timo Völker
Differential Revision:	https://reviews.freebsd.org/D52682

(cherry picked from commit eaf619fddc)
2025-09-29 21:49:59 +02:00
Jonathan T. Looney 5b59ff1e16 ip6: add SO_BINTIME support
This adds support for obtaining timestamps from IPv6 packets using the
SO_BINTIME socket option, bringing it in parity with IPv4 behavior.

Enable testing the SO_BINTIME option in the relevant (manual) regression
test.

PR:		289423
Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D52504

(cherry picked from commit cd02a8a9f8)
2025-09-29 15:03:02 +00:00
Mitchell Horne 16de4bc011 MODULE_PNP_INFO.9: tweak list indent
So that it renders as intended.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2025-09-29 10:23:49 -03:00
Mitchell Horne f54dfda721 if_re: Add PNP info for module
Add PNP info so it the module can be by devmatch(8) and automatically
loaded. On non-x86 platforms it is not included in GENERIC.

Reviewed by:	imp
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D52557
2025-09-29 10:23:42 -03:00
Mateusz Piotrowski 93bc812788 ports.7: Fix example of passing variables on the command line
make(1)'s -D flag does not allow for setting the value of the variable.
It just defines the variable and sets its value to 1. In fact, make(1)
treats "=" as just another character in the variable name:

```
$ make -DA=2 -V A  # Output is just an empty line.

$ make -DA=2 -V A=2  # Variable "A=2" is defined and set to "1".
1
```

Fixes:	d25f7d324a ports.7: Document DEBUG_FLAGS and the process of debugging ports
MFC after:	3 days

(cherry picked from commit 9365a32859)
2025-09-28 11:38:42 +02:00
Mateusz Piotrowski 6284c753e5 d.7: Fix synopsis
A predicate cannot be used without an action.

MFC after:	3 days
Event:		EuroBSDCon DevSummit 2025

(cherry picked from commit ba05cddcc6)
2025-09-28 11:37:23 +02:00
Michael Tuexen 125e23572c tcp: refactor tcp_send_challenge_ack()
Refactor tcp_send_challenge_ack() such that the logic checking whether
a challenge ACK is sent or not is available in the separate function
tcp_challenge_ack_check(). This new function will also be used for
sending challenge ACKs in the SYN-cache code, which will be added in
upcoming commits.
No functional change intended.

Reviewed by:		cc, Nick Banks, Peter Lei
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52717

(cherry picked from commit db37256ce5)
2025-09-28 11:10:00 +02:00
Michael Tuexen cfda7828e3 tcp: whitespace cleanup
No functional change intended.

Sponsored by:	Netflix, Inc.

(cherry picked from commit 40417930f6)
2025-09-28 11:09:11 +02:00
Alexander Ziaee b15ef791f9 build.7: Improve building pkgbase
The packages target was previously listed under kernel, move it to the
general source make targets listing. Add the update-packages target as
well. Adjust the release building targets with package in their names
to clarify they are unrelated to pkgbase. Add the OBJROOT and REPODIR
variables to ENVIRONMENT.

MFC after:              3 days
Reviewed by:		ivy, markj (both previous versions)
Suggestions by:         des, emaste, ivy, kevans, markj
Fixes:                  1d26746cfd (Document the packages target)
Fixes:                  0ac8aa55da (Add incremental packages)
Fixes:                  26490d9b74 (allow update-packages for first)
Differential Revision:	https://reviews.freebsd.org/D50289

(cherry picked from commit 7e8fb7756c)
2025-09-27 23:49:58 -04:00
Minsoo Choo a32d033e49 kerneldocs: Update latex package
MFC after:	3 days
Reviewed by:	ziaee
Signed-off-by:	Minsoo Choo <[email protected]>
Closes:		https://github.com/freebsd/freebsd-src/pull/1853

(cherry picked from commit cd813380ad)
2025-09-27 23:49:57 -04:00
Alexander Ziaee db14f5c96d build/development.7: System building examples
Consolidate examples to build the system in the build(7) manual where
the details about the syntax involved is documented. Remove them from
development(7), instead adding examples for patching the trees. They
are left in UPDATING for now, to hopefully be removed eventually.

Reduce documentation proliferation and create consistent, maintainable
doc about building the system, eventually removing the COMMMON ITEMS
section of UPDATING so there is a single source of truth in the cannon
and well-integrated location, the in-band system reference manual.

+ Example 1: Build and upgrade system in place
+ Example 2: Build and upgrade a custom kernel in place
+ Example 3: Build and upgrade a single piece of userspace
+ Example 4: Build and upgrade a loadable kernel module
+ Example 5: Quickly rebuild a kernel in place
+ Example 6: Cross-compiling for different architectures

The examples section of development(7) now contains examples for
applying patches to the trees.

There is certainy much more to do here, but it needs to be chunked.

MFC after:              3 days
Reviewed by:		imp (previous version), ivy (previous version)
Discussed with:         emaste, imp, jhb, ivy
Differential Revision:  https://reviews.freebsd.org/D48693

(cherry picked from commit 275f61111f)
2025-09-27 23:49:53 -04:00
Alexander Ziaee 9acd6934bb blackhole.4: Describe even better, take two
I meant to change this to tuexen's suggestion upon commit but failed.

MFC after:	3 days
Fixes:		9e02de4ad6c3 (blackhole.4: Describe even better)

(cherry picked from commit 1a9ec72022)
2025-09-27 23:48:45 -04:00
Alexander Ziaee 1db80c5b93 blackhole.4: Describe even better
Rewrite the document description to omit ficticious "UDP connections".

Fixes:			38f6a44674 (blackhole.4: Describe better)
MFC after:		3 days
Reviewed by:		tuexen
Reported by:		tuexen, zi
Differential Revision:	https://reviews.freebsd.org/D52696

(cherry picked from commit f9a71840d8)
2025-09-27 23:48:45 -04:00
Alexander Ziaee 31dfc27754 blackhole.4: Describe better
Rewrite the document description to fit cleanly on one line and omit
crossreferences, to clean up apropos results.

MFC after:		3 days
Reviewed by:		tuexen, cperciva
Differential Revision:	https://reviews.freebsd.org/D52695

(cherry picked from commit 38f6a44674)
2025-09-27 23:48:44 -04:00
Konstantin Belousov 0c3b3c7482 amd64 cpufunc.h: add rcs(), to read code selector
(cherry picked from commit 50ee990e18)
2025-09-28 03:43:50 +03:00
Konstantin Belousov 071a785e91 x86: directly use clflushopt mnemonic in cpufunc.h
(cherry picked from commit 5c55b2f3ba)
2025-09-28 03:43:20 +03:00
Konstantin Belousov 88d23b649c arm/atomic.h: remove misleading comment
(cherry picked from commit 1c0465a3d3)
2025-09-28 03:43:20 +03:00
Konstantin Belousov e8abf61e63 arm, powerpc, riscv: implement atomic_set/clear_16
(cherry picked from commit b31abc95eb)
2025-09-28 03:43:20 +03:00
Zhenlei Huang 032918dfd1 tcp: Add CTLFLAG_VNET flag to some sysctls
The two sysctls net.inet.tcp.hostcache.list and net.inet.tcp.hostcache.histo
are readonly and are to operate hostcache of vnet jails. Add CTLFLAG_VNET
flag to them since they are per-vnet sysctls.

This change does not have any impact on reading the two sysctls, but
`sysctl -ANV net.inet.tcp.hostcache` will report them correctly.

Reviewed by:	tuexen, #transport, #network
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D52693

(cherry picked from commit b1f96169cf)
2025-09-27 22:00:56 +08:00
Zhenlei Huang fa30199a3d tcp: Fix expiring and purging hostcache entries of vnet jails
A jailed process, `sysctl -j foo` or `jexec foo sysctl`, do not have
privilege to write to non-vnet sysctls but only to those marked as jail
writable, aka sysctls those marked with CTLFLAG_VNET flag.

Without this change we will get EPERM when trying to expire and purge
hostcache entries of vnet jails via the net.inet.tcp.hostcache.purgenow
sysctl. Fix that by adding a CTLFLAG_VNET flag.

Reviewed by:	tuexen, #transport, #network
Fixes:	2645638064 Add a new sysctl net.inet.tcp.hostcache.purgenow=1 to expire ...
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D52692

(cherry picked from commit 33ceb31e25)
2025-09-27 22:00:56 +08:00
Jose Luis Duran a84744caa2 pf tests: Add python3 as a dependency
These tests use pft_ping.py, which requires python3 and Scapy.

Reviewed by:	ngie
Approved by:	emaste (mentor)
Fixes:	65c3186301 ("pf: Add prefer-ipv6-nexthop option for route-to pools")
MFC after:	10 days
Differential Revision:	https://reviews.freebsd.org/D52589

(cherry picked from commit dea1dd6690)
2025-09-27 10:55:32 +00:00
Jose Luis Duran 4b1b8a5587 cron: Fix comment from "root's" to "system" crontab
It is referred to in the documentation as the system crontab, not root's
crontab.

PR:		289099
Reviewed by:	emaste
Approved by:	emaste (mentor)
Fixes:	d33daab934 ("Call /etc/crontab the "system crontab", not "root's crontab".  While here, fix some other wording issues")
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D52503

(cherry picked from commit c806defe8f)
2025-09-27 10:55:01 +00:00
Vladimir Kondratyev 64b530b38b u2f(4): Invert U2F_MAKE_UHID_ALIAS kernel build option
This makes non-GENERIC kernel configs easier to maintain.

Requested by:	glebius
MFC after:	2 days

(cherry picked from commit e43fbf2797)
2025-09-27 13:25:11 +03:00
Vladimir Kondratyev d82a9494e7 u2f(4): Use taskqueue to start USB transfers from kqueue context
to avoid recursion on u2f mutex and taking of hidbus sleepable lock.

Tested by:	emaste
PR:		289494
MFC after:	2 days

(cherry picked from commit 186e433300)
2025-09-27 13:25:05 +03:00
Paul Floyd 510a9e3885 libc/aarch64: fix ELF size of timingsafe_memcmp
Looks like a copy and paste error.
The ELF size of 0 prevents Valgrind from redirecting this function.

PR:		289845
Reviewed by:	fuz
Fixes:		3f224333af
See also:	https://bugs.kde.org/show_bug.cgi?id=509406
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1854
MFC after:	1 day
Event:		EuroBSDcon 2025

(cherry picked from commit 7feac79331)
2025-09-27 10:51:33 +02:00
Colin Percival d2b670b27f pkgbase-stage: Use unique PKG_DBDIR
Prior to this commit, pkgbase-stage.lua used a hard-coded PKG_DBDIR
"./pkgdb"; unfortunately this creates a race condition if we start
building disc1.iso and dvd1.iso at the same time

  pkg: sqlite error while executing CREATE TABLE licenses [...]
  in file pkgdb.c:2330: table licenses already exists

since pkg checks to see if the pkgdb is initialized and initializes
it if not.

Use separate pkgdb-disc1 and pkgdb-dvd directories.

MFC after:	1 minute
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D52755

(cherry picked from commit 523fece9d1)
2025-09-26 21:09:37 -07:00
John-Mark Gurney d2518851f2 e1000: fix igb VF stats
igb VF must not read normal stat registers and only read a limited
set of registers.  The PF registers also don't make since as the VF
is an internal port, and there is no PHY to collect stats like CRC
errors from.

This is effectively a cherry-pick of 3c60ea7764, which had to be
adapted due to another commit.  This is diff id 161565.

PR:     282309
Obtained from:  Juniper Networks, Inc.
Differential Revision:  https://reviews.freebsd.org/D52326
2025-09-26 13:16:16 -07:00
Brian Behlendorf 654a2ccc74 Linux 6.17 compat: META
Update the META file to reflect compatibility with the 6.17
kernel.

Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Rob Norris <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #17789
2025-09-26 12:16:17 -07:00
Brian Behlendorf ddecc5ff21 CI: update perf and bpftools with the kernel packages
When updating a Fedora instance to an experimental kernel make sure
to include the matching versioned perf and bpftool packages.  This
helps ensure there are no unexpected conflicts which would prevent
the new packages from being installed.

Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #17791
2025-09-26 12:16:14 -07:00
Alan Somers 5206983e76 fusefs: fix a kernel panic regarding SCM_RIGHTS
If the last copy of an open file resides within the socket buffer of a
unix-domain socket, then VOP_CLOSE will be called with no thread
information.  Fix fusefs to handle that case, and add a regression test.

Also add a test case for writes to a file that lies within a sockbuf.
Along with close, a write from the writeback cache is the only other
operation I can think of that might apply to a file residing in a
sockbuf.

PR:		289686
Reported by:	[email protected]
Sponsored by:	ConnectWise
Reviewed by:	glebius, markj
Differential Revision: https://reviews.freebsd.org/D52625

(cherry picked from commit e043af9ca5)
2025-09-26 12:11:37 -06:00
Michael Tuexen ccbc5f307a tcp lro: remove redundant check
Remove a check which is also done in tcp_lro_rx_common().

Reviewed by:		gallatin
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52683

(cherry picked from commit 43bbecaeb9)
2025-09-26 11:56:15 +02:00
Michael Tuexen a41b0e52ab tcp: fix sending of RST segments
Take endpoint parameters into account when available.

Fixes:		463b5aed0d ("tcp: retire rstreason")
Sponsored by:	Netflix, Inc.

(cherry picked from commit ab17974c12)
2025-09-26 11:55:41 +02:00
Colin Percival 54dd9fd8a5 15.0: Update to ALPHA4
Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-09-25 17:02:30 -07:00
Alan Somers 3289d38317 fusefs: fix the last_local_modify LLM/LastLocalModify.lookup/3 test
The LastLocalModify tests were originally written to simulate a race
condition between VOP_SETATTR and VOP_LOOKUP.  They were later extended
to cover some other VOPs that can affect file size, including VOP_WRITE.
However, the test never correctly simulated the race with VOP_WRITE.  So
that test only ever passed by accident.  Fix it by always opening the
file with O_DIRECT.

PR:		289237
Reported by:	Siva Mahadevan <[email protected]>

(cherry picked from commit d1eaa52d10)
2025-09-25 16:35:46 -06:00
Colin Percival 32c48d3738 release: Make toolchain OCI container use pkg set
This also indirectly addresses the lack of FreeBSD-lldb package on
the riscv64 platform by relying on that package being part of the
FreeBSD-set-devel set iff it exists.

A subsequent commit will adjust the "notoolchain" OCI container image
to also use a package set, which will indirectly affect the contents
of the "toolchain" container (which is an explicit superset of the
"notoolchain" container).

MFC after:	1 day
Co-authored-by:	dch

(cherry picked from commit 56e01d0d7e)
2025-09-25 14:07:59 -07:00
Colin Percival 8134e7f4b4 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

(cherry picked from commit 7ece602e00)
2025-09-25 12:25:55 -07:00
patrickxia e1a6ec42d4 zdb: add ZFS_KEYFORMAT_RAW support for -K option
This change adds support for ZFS_KEYFORMAT_RAW to zdb_derive_key in 
zdb.c. The implementation reads the raw key from the file specified 
by the -K option which is consistent with how raw keys are handled in 
the other parts of ZFS, along with a check to ensure that the keyfile 
doesn't have too many bytes.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Patrick Xia <[email protected]>
Closes #17783
2025-09-25 12:08:20 -07:00
Robert Evans 460858dfd6 dnode_next_offset: backtrack if lower level does not match
This changes the basic search algorithm from a single search up and down
the tree to a full depth-first traversal to handle conditions where the
tree matches at a higher level but not a lower level.

Normally higher level blocks always point to matching blocks, but there
are cases where this does not happen:

1. Racing block pointer updates from dbuf_write_ready.

   Before f664f1ee7f (#8946), both dbuf_write_ready and
   dnode_next_offset held dn_struct_rwlock which protected against
   pointer writes from concurrent syncs.

   This no longer applies, so sync context can f.e. clear or fill all
   L1->L0 BPs before the L2->L1 BP and higher BP's are updated.

   dnode_free_range in particular can reach this case and skip over L1
   blocks that need to be dirtied. Later, sync will panic in
   free_children when trying to clear a non-dirty indirect block.

   This case was found with ztest.

2. txg > 0, non-hole case. This is #11196.

   Freeing blocks/dnodes breaks the assumption that a match at a higher
   level implies a match at a lower level when filtering txg > 0.

   Whenever some but not all L0 blocks are freed, the parent L1 block is
   rewritten. Its updated L2->L1 BP reflects a newer birth txg.

   Later when searching by txg, if the L1 block matches since the txg is
   newer, it is possible that none of the remaining L1->L0 BPs match if
   none have been updated.

   The same behavior is possible with dnode search at L0.

   This is reachable from dsl_destroy_head for synchronous freeing.
   When this happens open context fails to free objects leaving sync
   context stuck freeing potentially many objects.

   This is also reachable from traverse_pool for extreme rewind where it
   is theoretically possible that datasets not dirtied after txg are
   skipped if the MOS has high enough indirection to trigger this case.

In both of these cases, without backtracking the search ends prematurely
as ESRCH result implies no more matches in the entire object.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Akash B <[email protected]>
Signed-off-by: Robert Evans <[email protected]>
Closes #16025
Closes #11196
2025-09-25 12:08:17 -07:00
Brian Behlendorf 954fe5e1be Add interface to interface spa_get_worst_case_min_alloc() function
Provide an interface to retrieve the lowest and highest minimum
allocation size for the normal allocation class.  This can be used
by external consumers of the DMU to estimate potential wasted
capacity when setting the recordsize for an object.

The new "min_alloc" and "max_alloc" keys are added to the pool
configuration and used by default_volblocksize() to warn when
an ineffecient block size is requested.  For older kmods which
don't yet include the new keys fallback to the previous logic.

Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #17758
2025-09-25 12:08:14 -07:00
Brian Behlendorf d33d0cac5a Fix 'zpool add' safety check corner cases
Three cases were discovered where 'zpool add' would fail to
warn when adding vdevs to a pool with a mismatched replication
level.  These are:

  1. When a pool contains mixed file and disk vdevs.
  2. When a pool contains an active dRAID distributed spare
  3. When a pool contains an active hot spare

The lack of warnings are caused by get_replication() assessing
the current pool configuration an inconsistent and disabling
the mismatched replication check for the new pool configuration
after 'zpool add'.  This change updates get_replication() to
be slightly more tolerant in the non-fatal case.

The zpool_add_010_pos.ksh test case was split in to separate
tests: zpool_add_warn_create.ksh, pool_add_warn_degraded.ksh,
and zpool_add_warn_removal.  These test were extended to
include coverage for dRAID pools and the three scenarios
described above.

Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #17780
2025-09-25 12:08:09 -07:00
Brian Behlendorf 9bd8f4379c ZTS: update upgrade_readonly_pool.ksh
Modify the test case to use the `zfs mount` command instead
of directly calling the mount command, create a dedicated dataset,
and use the default mount point.  These changes are intended to
preserve the intent of the original test case and resolve some
spurious mount failures which have been observed by the CI.

Reviewed-by: Igor Kozhukhov <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #17785
2025-09-25 12:08:06 -07:00
jozzsi 6dad2f61a3 contrib: dracut: install dependent kernel modules
Eliminates the need for the following workaround

> Add other drivers to dracut:

```
if grep mpt3sas /proc/modules; then
  echo 'force_drivers+=" mpt3sas "'  >> /etc/dracut.conf.d/zfs.conf
fi
if grep virtio_blk /proc/modules; then
  echo 'filesystems+=" virtio_blk "' >> /etc/dracut.conf.d/fs.conf
fi
```

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Jo Zzsi <[email protected]>
Closes #17762
2025-09-25 12:08:02 -07:00
Alexander Motin 61a68554de zdb: Fix asize overflow in verify_livelist_allocs()
Spacemap entry might be too big to fit into a block pointer ashift.
We hit an assertion trying to run `zdb -bvy` on a large pool.  But
it seems the code does not really need size there, since we only
need to search for a range of offsets, so setting it to zero should
just make btree return position just before the first entry.  I
suspect the previous code could actually miss the first entry
due to this if its size was smaller.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Igor Kozhukhov <[email protected]>
Signed-off-by: Alexander Motin <[email protected]>
Closes #17764
2025-09-25 12:07:55 -07:00
trick2011 9bcda0b5fe Use "vdev" instead of "devices" when referring to vdevs
Update documentation to use the correct terminology.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: trick2011 <[email protected]>
Closes #17734
Closes #17755
2025-09-25 12:07:52 -07:00
Tony Hutter 2380e0b679 ZTS: Fix stale symlinks with zfs-helpers.sh
zfs-helpers.sh is a utility script that sets up udev symlinks so you
can run ZTS from a local ZFS git workspace.  However, it doesn't check
that the udev symlinks point to the current workspace.  They may point
to an old workspace that has been deleted.  This means the udev rules
never get executed, which in turn causes the zvol tests to fail.

This commit removes old symlinks that do not point to the current
ZFS workspace.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #17766
2025-09-25 12:07:47 -07:00
jozzsi 83066c9627 contrib: dracut: always include zfs kernel module
This commit fixes the issue and includes the zfs kernel
module even when dracut is used in hostonly mode.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Jo Zzsi <[email protected]>
Closes #17754
2025-09-25 12:07:43 -07:00
Siva Mahadevan 093f3f26e9 bsdinstall: fix vfs.zfs.vdev.min_auto_ashift oid
Signed-off-by: Siva Mahadevan <[email protected]>
PR: 266374
Pull request: https://github.com/freebsd/freebsd-src/pull/1851
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 87a7b35f04)
2025-09-25 09:10:42 +02:00
Lexi Winter 93593875df packages: Add descriptions for all packages
Provide at least a basic description of every package we build.
Where possible, the description is taken from a relevant manpage;
when there was no suitable text in the manpage, I wrote a new
description.

Since the UCL files now contain a significant amount of English
prose which is almost certainly subject to copyright in at least
some jurisdictions, add a copyright header to every file.  Where
the text was taken from a manpage, the copyright and license are
also taken from the manpage.  A few files don't have copyright
headers added because the origin of the text is unclear, or because
the files were written by someone else.

While here, remove some orphaned UCL files for packages we no
longer ship.

MFC after:	1 day
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D52690

(cherry picked from commit c7a4cdd09f)
2025-09-25 02:00:42 +01:00
Lexi Winter 1dbe00f750 packages: Add some missing dependencies
* at requires cron, since atrun is started by cron and won't work
  without it, and also requires runtime because at runs jobs under
  /bin/sh.

* bluetooth requires ppp for rfcomm_pppd (a very common use case).

* bsdconfig and bsdinstall are written in shell script and therefore
  require /bin/sh.

* devd requires /bin/sh to invoke its hooks.

While here, document the policy for adding dependencies in the README.
This will hopefully ensure we end up with consistent dependencies.

MFC after:	1 day
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D52699

(cherry picked from commit 014647a30f)
2025-09-25 02:00:41 +01:00
Lexi Winter 4bc068b0e2 bsdinstall: Install pkg if it's available
Now that the pkg package is shipped on the pkgbase release media,
install it by default for a pkgbase install if it's present.

If it's not available (e.g., when running bsdinstall from a repository
built from src alone, without ports), skip it and assume the user will
install it another way.

MFC after:	1 day
Reviewed by:	ifreund_freebsdfoundation.org, cperciva
Differential Revision:	https://reviews.freebsd.org/D52639

(cherry picked from commit 4422265c67)
2025-09-25 02:00:41 +01:00
Lexi Winter b1187b5a12 release: Improve kernel package handling
Although support for PowerPC kernels (GENERIC64 and GENERIC64LE) was
added to pkgbase-stage.lua, the equivalent support was missing from
bsdinstall, so the installer would fail at runtime since it wouldn't
find a kernel package.

Improve the pkgbase-stage logic to have a specific list of kernels
we want to support (which avoids breaking if multiple kernels are
available), and use the same logic in both bsdinstall and pkgbase-stage.

MFC after:	1 day
Reviewed by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D52638

(cherry picked from commit 3f5385beea)
2025-09-25 02:00:41 +01:00
Lexi Winter d500f1f015 release: Install pkg from the pkgbase repo
If we're building pkgbase media, install the pkg package from the
pkgbase repository we already created, not from pkg.freebsd.org.
Aside from being more desirable, this also fixes make release for
version/architecture combinations which are missing repository
on pkg.f.o (which is nearly all of them at the time of writing).

This doesn't yet work for bootonly, since we don't build the pkgbase
repository there.  For now, restore the old behaviour of attempting
to install pkg from pkg.freebsd.org for bootonly.

MFC after:	1 day
Reviewed by:	ifreund_freebsdfoundation.org, cperciva (previous version)
Differential Revision:	https://reviews.freebsd.org/D52637

(cherry picked from commit aba986215f)
2025-09-25 02:00:41 +01:00
Lexi Winter 3608d730ad pkgbase-stage.lua: Add pkg package to the offline repo
We need a pkg package on the media so we can install it for offline
installations; copy this package from the staging repository to the
pkgbase offline repository on the media.

MFC after:	1 day
Reviewed by:	ifreund_freebsdfoundation.org, cperciva
Differential Revision:	https://reviews.freebsd.org/D52636

(cherry picked from commit 5bb96dab06)
2025-09-25 02:00:41 +01:00
Lexi Winter 9e100a7f56 release: Fail the build if pkg can't be installed
If we can't install pkg(8) on the media, instead of ignoring the error,
fail the build.  This avoids silently creating media which doesn't have
pkg(8) on, and therefore can't be used for a pkgbase install.

Installing pkg(8) can still be entirely disabled by setting NOPKG.

MFC after:	1 day
Reviewed by:	ifreund_freebsdfoundation.org, cperciva
Differential Revision:	https://reviews.freebsd.org/D52635

(cherry picked from commit 8654315ae8)
2025-09-25 02:00:41 +01:00
Lexi Winter 46a4ee6e6e Makefile.inc1: Fix package-pkg with a non-default LOCALBASE
package-pkg (via make-pkg-package.sh) passes CONFIGURE_ARGS to make when
building ports-mgmt/pkg, which overrides the port's default configure
args that are supposed to set --prefix.  This means that pkg is always
built with the default prefix of /usr/local, which then fails when ports
tries to package it from LOCALBASE.

Work around this by explicitly adding --prefix to CONFIGURE_ARGS.

MFC after:	1 day
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D52634

(cherry picked from commit f259daa708)
2025-09-25 02:00:41 +01:00
Lexi Winter 8bf853564d packages: Add a dependency from -rc to -runtime
rc(8), as well as rc scripts themselves, require /bin/sh and basic
shell utilities to work.  Currently -rc has an implicit dependency
on -runtime because of libutil, but this might change in the future
if libutil were moved to a different package.  Add an explicit dep
to ensure -runtime is installed.

MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D52654

(cherry picked from commit 9f8114a6d8)
2025-09-25 02:00:41 +01:00
Lexi Winter c7a2200050 man7: Move atf.7 and tests.7 to the right package
atf.7 should be in -atf, and tests.7 should be in -tests.

MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D52661

(cherry picked from commit 49e44e06d1)
2025-09-25 02:00:40 +01:00
Lexi Winter 20300ccbaf packages: Add devd to the minimal-jail set
I didn't add this originally since many jails don't require devd, but
it's very small (~90kB) and has no dependencies other than clibs and
runtime, so we may as well include it for parity between minimal and
minimal-jail.

While here, improve the package description.

Requested by:	imp
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D52679

(cherry picked from commit ab50101456)
2025-09-25 02:00:40 +01:00
Lexi Winter 9bcc0094b5 Makefile.inc1: Handle pkg development versions
Development versions of pkg have a version like "2.3.0-d8bbde1c3-dirty",
which is not handled by PKG_BIN_VERSION, so PKG_EXT ends up being "tar"
and this breaks update-packages.

Fix the PKG_BIN_VERSION logic, and while here, remove backwards compat
for pkg versions prior to 2.0, which no one should be using to build
main or stable/15.  This means nothing is left to use PKG_BIN_VERSION,
but continue to set it, since we might need it again in the future.

MFC after:	1 day
Reviewed by:	manu, kevans
Differential Revision:	https://reviews.freebsd.org/D52666

(cherry picked from commit f6d1cdabdd)
2025-09-25 02:00:40 +01:00
Lexi Winter 9f24933211 packages: Replace libbz2 package with a bzip2 package
Currently libbz2 is in the libbz2 package, while bzip2 itself is in
-utilities, which is inconsistent.  Move both the library and the
utility to a new -bzip2 package, and use LIB_PACKAGE to create a
separate -bzip2-lib package for runtime dependencies.

Add the bzip2 package to the minimal set, and since newsyslogd uses
bzip2 for logfile compression, add a dependency from there.

MFC after:	1 day
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D52663

(cherry picked from commit 61ca69110f)
2025-09-25 02:00:40 +01:00
Lexi Winter 846125d003 libpmc: Move libpmc and utils to a new pmc package
Due to the size of libpmc.so.5, this reduces the size of the -utilities
package by 10%.

MFC after:	1 day
Reviewed by:	manu, adrian, emaste
Differential Revision:	https://reviews.freebsd.org/D52662

(cherry picked from commit 67c3c3a274)
2025-09-25 02:00:40 +01:00
Lexi Winter f100dddd8c who: Move back to the utilities package
This was moved to -acct along with the rest of the accounting tools.
While it does work with accounting data, it's also a core Unix tool
that users would expect to be installed without having to install
the whole accounting system.

Move it back to -utilities, which is also where w(1) lives.

MFC after:	1 day
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D52653

(cherry picked from commit ef4b08a7ed)
2025-09-25 02:00:40 +01:00
Lexi Winter 9b11dacb95 packages: Move powerd to its own package
Nearly everyone wants powerd to manage CPU frequency scaling on real
hardware, even if -utilities isn't installed.  Conversely, very small
jails might want -utilities but don't need powerd.

Move it to its own package and add it to the minimal set.

MFC after:	1 day
Reviewed by:	manu, imp
Differential Revision:	https://reviews.freebsd.org/D52645

(cherry picked from commit 5efd371bba)
2025-09-25 02:00:40 +01:00
Cy Schubert cc785755e6 krb5: Remove tests
Tests contains a file that contains spaces in it. This causes the
freebsd-update build scripts some issues. As we don't need the tests
directory let's simply remove it.

(cherry picked from commit 3e13aae0d1)
2025-09-24 11:09:00 -07:00
Kristof Provost e70a2bcdc4 pf: fix rules_counter:keepcounters test
The previous pf_krule_global leak fix was a bit too aggressive and cleaned up
the inactive tree pointer before we needed it to preserve counters. Only clean
up anchors that are entirely unused. Clean up pf_main_ruleset on pf shutdown.

PR:		289299
MFC after:	1 week
Fixes:		275ff85b25 ("pf: fix struct pf_krule_global leak")
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit e63534edbc)
2025-09-24 15:32:11 +02:00
Zhenlei Huang 6bcce275a5 ifconfig: Display the IFCAP_HWSTATS capability without netlink
This follows the commit 4cdc1f5421, which introduces the IFCAP_HWSTATS
capability.

Fixes:	4cdc1f5421 There are some high performance NICs that count statistics in hardware
MFC after:	3 days

(cherry picked from commit 595acb29a3)
2025-09-24 21:29:24 +08:00
Zhenlei Huang 5f472754ba ifconfig: Fix the display of the IFCAP_MEXTPG capability without netlink
Historically this capability is IFCAP_NOMAP but it was renamed to
IFCAP_MEXTPG. Catch up with the change 3f43ada98c.

PR:		289545
Fixes:		3f43ada98c Catch up with 6edfd179c8: mechanically rename IFCAP_NOMAP to IFCAP_MEXTPG
MFC after:	3 days

(cherry picked from commit 5017fdb728)
2025-09-24 21:29:24 +08:00
Vladimir Kondratyev 1bc5c9a232 rc.d/moused: Fix misplaced basename
This fixes "usage: basename string [suffix]" message.

Reported by:	cy
MFC after:	1 day

(cherry picked from commit f586fc0cf8)
2025-09-24 10:42:04 +03:00
Jilles Tjoelker ca771d7ae5 init: Use root's home directory in single-user mode
When starting single-user mode, use the home directory from user root as
current directory and for the HOME environment variable. If the
directory does not exist, set HOME=/.

Also adjust /root/.profile to stop setting HOME, since it should always
have been set now.

This is intended to keep shell startup files working in single-user mode
after /.profile has been removed.

Reviewed by:	emaste, ivy, kevans
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D52527

(cherry picked from commit 779812d669)
2025-09-23 23:38:07 +02:00
Alexander Ziaee 63f76d75ee cdceem.4: Clean description for apropos, tag spdx
CDCEEM is already defined in the document name, no need to list it in
parentheticals a second time in the document description. This brings
the apropos listing down to one line on the one true standard console.

MFC after:	3 days

(cherry picked from commit 89bc43a1ea)
2025-09-23 14:02:18 -04:00
Alexander Ziaee 6abce6f7b8 stand/man: Fix mdoc typos for emails, tag spdx
MFC after:	3 days

(cherry picked from commit a37825313f)
2025-09-23 14:02:18 -04:00
Alexander Ziaee 66c3e6d2ca ObsoleteFiles: Remove the miscapitalized vimage.9
MFC after:      3 days
Fixes: 08d41d8803 (ObsoleteFiles: Remove the miscapitalized vnet.9)
Fixes: 3049b2f511 (vnet.9: Rename vnet.9/vimage.9 to VNET.9/VIMAGE.9)

(cherry picked from commit 8f7a4d7949)
2025-09-23 14:02:18 -04:00
Alexander Ziaee c0f829e0f4 ObsoleteFiles: Remove the miscapitalized vnet.9
MFC after:	3 days
Fixes:		3049b2f511 (vnet.9: Rename vnet.9/vimage.9)

(cherry picked from commit 08d41d8803)
2025-09-23 14:02:17 -04:00
Quentin Thébault f3fa449dc8 vnet.9: Rename vnet.9/vimage.9 to VNET.9/VIMAGE.9
Fix crossreferences to VNET(9) by correcting it's capitalization.

MFC after:	3 days
Reviewed by:	enji, ziaee
Closes:		https://github.com/freebsd/freebsd-src/pull/1848

(cherry picked from commit 3049b2f511)
2025-09-23 14:02:14 -04:00
Alan Somers ef9b7dde91 Fix a printf format specifier on FreeBSD/i386
This is breaking the build on FreeBSD/i386.  Originally committed
downstream as https://github.com/freebsd/freebsd-src/commit/2d76470b701

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by:	Alan Somers <[email protected]>
Sponsored by:	ConnectWise
Closes #17705
2025-09-17 16:34:24 -07:00
Alan Somers 9c6f72021d Fix atomic-alignment warnings in libspl on FreeBSD/i386
On i386, Clang complains about misaligned atomic operations.  Silence
these warnings to fix the build on FreeBSD/i386.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by:	Alan Somers <[email protected]>
Sponsored by:	ConnectWise
Closes #17708
2025-09-17 16:34:19 -07:00
Rob Norris 15a6b982c5 linux/super: add tunable to request immediate reclaim of unused dentries
Traditionally, unused dentries would be cached in the dentry cache until
the associated entry is no longer on disk. The cached dentry continues
to hold an inode reference, causing the inode to be pinned (see previous
commit).

Here we implement the dentry op d_delete, which is roughly analogous to
the drop_inode superblock op, and add a zfs_delete_dentry tunable to
control its behaviour. By default it continues the traditional
behaviour, but when the tunable is enabled, we signal that an unused
dentry should be freed immediately, releasing its inode reference, and
so allowing that inode to be deleted if no longer in use.

Sponsored-by: Klara, Inc.
Sponsored-by: Fastmail Pty Ltd
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #17746
2025-09-17 16:34:14 -07:00
Rob Norris 42b9995f88 linux/super: add tunable to request immediate reclaim of unused inodes
Traditionally, unused inodes would be held on the superblock inode cache
until the associated on-disk file is removed or the kernel requests
reclaim.  On filesystems with millions of rarely-used files, this can be
a lot of unusable memory.

Here we implement the superblock drop_inode method, and add a
zfs_delete_inode tunable to control its behaviour. By default it
continues the traditional behaviour, but when the tunable is enabled, we
signal that the inode should be deleted immediately when the last
reference is dropped, rather than cached. This releases the associated
data to the dbuf cache and ARC, allowing them to be reclaimed normally.

Sponsored-by: Klara, Inc.
Sponsored-by: Fastmail Pty Ltd
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #17746
2025-09-17 16:34:09 -07:00
buzzingwires a056b3c341 Add typesets to zhack label repair test scripts
As a quality assurance measure, `typeset` is added to local variable
declarations to actually enforce their intended scope.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: buzzingwires <[email protected]>
Closes #17732
2025-09-17 16:34:04 -07:00
buzzingwires 5f7253ca11 Refactor zhack label repair and fix -c regression on nonzero TXG
This commit fixes a likely regression introduced by 64db435 where the
checksum repair functionality (`-c` or default behavior) will perform
checks and access data associated with the newer undetach (`-u`)
functionality, resulting in a failure when an uberblock's TXG is not 0
as required by `-u` but not `-c`

Additionally, code is refactored for better separation of tasks.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: buzzingwires <[email protected]>
Closes #17732
2025-09-17 16:33:59 -07:00
Rob Norris e3eb3ca3dc man: add silent rules for mancheck
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Paul Dagnelie <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #17747
2025-09-17 16:33:52 -07:00
Rob Norris d0084a4109 mancheck: allow single files
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Paul Dagnelie <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #17747
2025-09-17 16:33:48 -07:00
Rob Norris 4698208c78 Shellcheck.am: add silent rules for shellcheck and checkbashisms
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Paul Dagnelie <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #17747
2025-09-17 16:33:42 -07:00
Alexander Motin 406f76b7e3 CI: Switch FreeBSD 15 to 15.0-ALPHA2
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Alexander Motin <[email protected]>
Closes #17749
2025-09-15 12:44:05 -07:00
Igor Ostapenko 1ca4cd8a33 Fix txg_log_time ZAP key typo
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Igor Ostapenko <[email protected]>
Sponsored-by: Klara, Inc.
Closes #17748
2025-09-15 12:44:01 -07:00
Kyle Evans 8b548776ff zfsprops(7): attempt to clarify the keylocation description
The current description is somewhat difficult to parse through, and in
some cases is a little unclear as to the behavior.

Split it into a paragraphs based on the three distinct behaviors you
may get: prompt, file URL, HTTP(S) URL.  The descriptions of the file
and HTTP(s) behavior seems fine, but prompt is a little vague- expand
on it and make it clear that the behavior is actively based on whether
the inquisitor of key-data is provided with a tty for stdin or not.

Also clarify *why* one shouldn't "place keys which should be kept secret
on the command line" and note that you *have* to supply the key via
stdin if it's a raw key, just to be sure.

Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: George Melikov <[email protected]>
Signed-off-by: Kyle Evans <[email protected]>
Closes #17742
2025-09-15 12:43:57 -07:00
Brian Behlendorf a4cb155e8d ZTS: default to random data in fill_fs
Update the fill_fs helper function to request a random fill pattern
when the "data" argument isn't specified.  This ensures the default
behavior is to perform a more realistic fill of incompressible blocks.

Additionally, update a few test cases to specify a random fill.

Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #17739
2025-09-15 12:43:52 -07:00
Brian Behlendorf 53c8d7071d ZTS: Fix zfs_send_delegation_user test
Correct the path in the common.run file.  The zfs_send_delegation_user
test is installed under cli_user not cli_root.

Reviewed-by: Allan Jude <[email protected]>
Reviewed-by: Paul Dagnelie <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #17740
2025-09-15 12:43:48 -07:00
Rob Norris da33cfd436 vdev_disk_close: take disk write lock before destroying it
Many IO operations are submitted to the kernel async, and so the zio can
complete and followup actions before the submission call returns. If one
of the followup actions closes the disk (eg during pool create/import),
the initiator may be left holding a lock on the disk at destruction.

Instead, take the write lock before finishing up and decoupling the disk
state from the vdev proper. The caller will hold until all IO is
submitted and locks released.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #17719
2025-09-15 12:43:44 -07:00
Alexander Motin efdb4bf07a Fix two infinite loops if dmu_prefetch_max set to zero
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Alexander Motin <[email protected]>
Closes #17692
Closes #17729
2025-09-15 12:43:39 -07:00
Paul Dagnelie cac483dbd4 Fix time database update calculations
The time database update math assumed that the timestamps were in
nanoseconds, but at some point in the development or review process they
changed to seconds. This PR fixes the math to use seconds instead.
    
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Closes #17735
2025-09-15 12:43:34 -07:00
Brian Behlendorf c9de42e089 ZTS: refreserv/refreserv_raidz improvements
Several small changes intended to make this test reliable.

- Leave the default compression enabled for the pool and switch
  to using /dev/urandom as the data source.  Functionally this
  shouldn't impact the test but it's preferable to test with
  the pool defaults when possible.

- Verify the device is created and removed as required.  Switch
  to a unique volume name for a more clarity in the logs.

- Use the ZVOL_DEVDIR to specify the device path.

- Speed up the test by creating the pool with an ashift=12 and
  testing 4K, 8K, 128K volblocksizes.

Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #17725
2025-09-12 15:05:26 -07:00
Alexander Motin 41c6eaac8b Fix type in dbrrd_closest()
For ABS() to work, the argument must be signed, but rrdd_time is
uint64_t.  Clang noticed it.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Mariusz Zaborski <[email protected]>
Signed-off-by: Alexander Motin <[email protected]>
Fixes #16853
Closes #17733
2025-09-12 15:05:22 -07:00
Alexander Motin b5d41deca9 FreeBSD: Satisfy ASSERT_VOP_IN_SEQC()
zfs_aclset_common() might be called for newly created or not even
created vnodes, that triggers assertions on newer FreeBSD versions
with DEBUG_VFS_LOCKS included into INVARIANTS.  In the first case
make sure to call vn_seqc_write_begin()/_end(), in the second just
skip the assertion.

The similar has to be done for project management IOCTL and file-
bases extended attributes, since those are not going through VFS.

Signed-off-by: Alexander Motin <[email protected]>
Closes #17722
2025-09-12 15:05:18 -07:00
Paul Dagnelie 2f41193a26 Make new zhack test a little more reliable
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Closes #17728
2025-09-12 15:05:14 -07:00
Chunwei Chen 95d677efde Fix ddle memleak in ddt_log_load
In ddt_log_load(), when removing dup entry from flushing tree, it doesn't
free the entry causing memleak.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Co-authored-by: Chunwei Chen <[email protected]>
Closes #17657
Closes #17730
2025-09-12 15:05:10 -07:00
JT Pennington 43a9d9ac57 Add send:encrypted test
Create tests for the new send:encrypted permission

Sponsored-by: Klara, Inc.
Sponsored-by: Karakun AG
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: JT Pennington <[email protected]>
Closes #17543
2025-09-12 15:05:05 -07:00
Allan Jude 6c4ede4026 ZFS allow send:encrypted
A new `zfs allow` permissions that ONLY allows sending replication
streams in raw (encrypted) mode, so encrypted data will not be
decrypted as part of the replication process.

Sponsored-by: Klara, Inc.
Sponsored-by: Karakun AG
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Co-authored-by: JT Pennington <[email protected]>
Signed-off-by: Allan Jude <[email protected]>
Closes #17543
2025-09-12 15:05:02 -07:00
Tony Hutter 4a7a04630d zed: Add synchronous zedlets
Historically, ZED has blindly spawned off zedlets in parallel and never
worried about their completion order.  This means that you can
potentially have zedlets for event number 2 starting before zedlets for
event number 1 had finished.  Most of the time this is fine, and it
actually helps a lot when the system is getting spammed with hundreds
of events.

However, there are times when you want your zedlets to be executed
in sequence with the event ID.  That is where synchronous zedlets
come in.

ZED will wait for all previously spawned zedlets to finish before
running a synchronous zedlet.  Synchronous zedlets are guaranteed to be
the only zedlet running.  No other zedlets may run in parallel with a
synchronous zedlet.  Users should be careful to only use synchronous
zedlets when needed, since they decrease parallelism.

To make a zedlet synchronous, simply add a "-sync-" immediately
following the event name in the zedlet's file name:

	EVENT_NAME-sync-ZEDLETNAME.sh

For example, if you wanted a synchronous statechange script:

	statechange-sync-myzedlet.sh

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #17335
2025-09-11 15:58:59 -07:00
Brian Behlendorf 3dc345851c Prevent scrubbing a read-only pool
While it would be nice to be able to scrub a pool imported read-only
this will currently trip an ASSERT.  Before we can support this there
are some designs challenges which need to be thought through first.

For starters, a read-only import skips reading certain information 
from disk which it knows won't be needed, such as the space maps.
Furthermore, the scrub process expects to be checkpoint it's progress, 
update the on disk error log, and issue repair IO.  None of which 
would be possible when the pool is imported read-only.  

Each of these wrinkles can certainly be handled, but that will take 
some signifcant work.  In the meanwhile we disable the 'zpool scrub' 
command when the pool is imported read-only.

Reviewed-by: Alan Somers <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue #17527
Closes #17717
2025-09-11 15:58:52 -07:00
Paul Dagnelie df55ba7c49 Detect a slow raidz child during reads
A single slow responding disk can affect the overall read
performance of a raidz group.  When a raidz child disk is
determined to be a persistent slow outlier, then have it
sit out during reads for a period of time. The raidz group
can use parity to reconstruct the data that was skipped.

Each time a slow disk is placed into a sit out period, its
`vdev_stat.vs_slow_ios count` is incremented and a zevent
class `ereport.fs.zfs.delay` is posted.

The length of the sit out period can be changed using the
`raid_read_sit_out_secs` module parameter.  Setting it to
zero disables slow outlier detection.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Contributions-by: Don Brady <[email protected]>
Contributions-by: Brian Behlendorf <[email protected]>
Closes #17227
2025-09-10 15:31:30 -07:00
Paul Dagnelie 0df85ec27c Remove RAIDZ reconstruct flags from debug defaults
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Closes #17227
2025-09-10 15:31:25 -07:00
Tony Hutter 123bfc32f3 ZTS: Print warning if running ZTS user_run test locally
Print a warning if you're attempting to run a ZTS test that calls
'user_run', and the ephemeral user doesn't have permissions to
access the test binaries.

This can happen if you're running ZTS from a local git repo.  In
that case the test user (say, 'testuser1') may need access to the
ZTS binaries in:

/home/<your_username>/zfs/tests/zfs-tests/bin/

... but 'testuser1' doesn't have permission to enter your home dir:

/home/<your_username>

The warning will help alert users to what is going on.  This will
not be an issue when ZTS is actually installed on the system
(via 'make install' or from packages).

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #17721
2025-09-10 15:01:42 -07:00
Alan Somers 177e9d07d0 Fix the build of crypto_test on LP32 architectures
test->id is a uint64_t, not a long.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by:	Alan Somers <[email protected]>
Sponsored by:	ConnectWise
Closes #17707
2025-09-10 15:01:37 -07:00
Paul Dagnelie e2e708241a Enable zhack to work properly with 4k sector size disks
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Closes #17576
2025-09-10 15:01:32 -07:00
Paul Dagnelie 26983d6fa7 Add allocation profile export and zhack subcommand for import
When attempting to debug performance problems on large systems, one of
the major factors that affect performance is free space
fragmentation. This heavily affects the allocation process, which is an
area of active development in ZFS. Unfortunately, fragmenting a large
pool for testing purposes is time consuming; it usually involves filling
the pool and then repeatedly overwriting data until the free space
becomes fragmented, which can take many hours. And even if the time is
available, artificial workloads rarely generate the same fragmentation
patterns as the natural workloads they're attempting to mimic.

This patch has two parts. First, in zdb, we add the ability to export
the full allocation map of the pool. It iterates over each vdev,
printing every allocated segment in the ms_allocatable range tree. This
can be done while the pool is online, though in that case the allocation
map may actually be from several different TXGs as new ones are loaded
on demand.

The second is a new subcommand for zhack, zhack metaslab leak (and its
supporting kernel changes). This is a zhack subcommand that imports a
pool and then modified the range trees of the metaslabs, allowing the
sync process to write them out normall. It does not currently store
those allocations anywhere to make them reversible, and there is no
corresponding free subcommand (which would be extremely dangerous); this
is an irreversible process, only intended for performance testing. The
only way to reclaim the space afterwards is to destroy the pool or roll
back to a checkpoint.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Paul Dagnelie <[email protected]>
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Closes #17576
2025-09-10 15:01:28 -07:00
Shengqi Chen ca4f7d6d49 contrib/debian: install files into merged /usr
This commit synchronizes the debian packaging files with the distro
version (also maintained by me) as much as possible.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Colm Buckley <[email protected]>
Signed-off-by: Shengqi Chen <[email protected]>
Closes #17712
2025-09-10 15:01:24 -07:00
Shengqi Chen 717c57c834 cmd: rename arcstat to zarcstat
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Colm Buckley <[email protected]>
Signed-off-by: Shengqi Chen <[email protected]>
Closes #16357
Closes #17712
2025-09-10 15:01:20 -07:00
Shengqi Chen 743866cd2a cmd: rename arc_summary to zarcsummary
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Colm Buckley <[email protected]>
Signed-off-by: Shengqi Chen <[email protected]>
Closes #16357
Closes #17712
2025-09-10 15:01:16 -07:00
Shengqi Chen 5bf1500ee3 Remove renaming notice and symlinks for arcstat and arc_summary
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Colm Buckley <[email protected]>
Signed-off-by: Shengqi Chen <[email protected]>
Closes #16357
Closes #17712
2025-09-10 15:01:12 -07:00
Rob Norris dc53e5c484 linux/rw_destroy: assert no holders before destroying
While rw_destroy() may do nothing on Linux, we still want to make sure
that we don't have any holders outstanding like we do for mutexes.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #17718
2025-09-10 15:01:02 -07:00
Rob Norris 0df91abe82 Linux 6.17: d_set_d_op() is no longer available
We only have extremely narrow uses, so move it all into a single
function that does only what we need, with and without d_set_d_op().

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #17621
2025-09-09 17:06:55 -07:00
Rob Norris d469371033 config: restore ZFS_AC_KERNEL_DENTRY tests
Accidentally removed calls in ed048fdc5b.

Sponsored-by: https://despairlabs.com/sponsor/
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #17621
2025-09-09 17:06:52 -07:00
Tony Hutter 87e35bd3ab ZTS: Fix fault_limits timeouts
fault_limits would often hit the 10min timeout and be killed on Fedora
41-42.  Investigation showed that the 'fill_fs' portion of the test,
which would fill the pool with junk data before vdev replacement, was
writing highly compressible data (~126x), which would have taxed the
CPUs, potentially causing the timeout.

The fix is to write random data and reduce the number of writes.
This has an added benefit that more real data being is written to the
pool (~1GB) vs the old way (~300-400MB).  It also speeds up the test.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Paul Dagnelie <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes #17709
2025-09-09 17:06:48 -07:00
Alan Somers cfd640c3e8 Fix warnings about sha2_is_supported on FreeBSD/i386
This is one problem currently preventing OpenZFS from building on
FreeBSD/i386.

Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by:	Alan Somers <[email protected]>
Sponsored by:	ConnectWise
Closes #17704
2025-09-09 17:06:40 -07:00
Alan Somers b23eae62be Fix the build on 32-bit FreeBSD with GCC
GCC complains about casting a 64-bit integer to a 32-bit pointer.
Originally committed downstream as
https://github.com/freebsd/freebsd-src/commit/2d76470b701

Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by:	Alan Somers <[email protected]>
Sponsored by:	ConnectWise
Closes #17706
2025-09-09 17:06:37 -07:00
rmacklem b727163db9 zfs_vnops_os.c: Add support for the _PC_CLONE_BLKSIZE name
FreeBSD now has a pathconf name called _PC_CLONE_BLKSIZE
which is the block size supported for block cloning for
the file system.  Since ZFS's block size varies per file,
return the largest size likely to be used, or zero if block
cloning is not supported.

Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Rick Macklem <[email protected]>
Closes #17645
2025-09-09 17:06:33 -07:00
Rob Norris 02fa962af0 cmd: force zarcstat/zarc_summary recreation at install
If the target already exists, lt will fail. Force it to recreate the
symlinks.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #17702
2025-09-09 17:06:29 -07:00
Chunwei ChenandChunwei Chen c755aa486d Fix wrong dedup_table_size for legacy dedup
If we call ddt_log_load() for legacy ddt, we will end up going into
ddt_log_update_stats() and filling uninitialized value into ddo_dspace.
This value will then get added to dedup_table_size during
ddt_get_dedup_object_stats().

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Closes #17019
Closes #17699

Signed-off-by: Chunwei Chen <[email protected]>
Co-authored-by: Chunwei Chen <[email protected]>
2025-09-09 17:06:24 -07:00
Shengqi Chen 34ca2b8392 Install zarcstat and zarcsummary in deb / rpm build rules
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Shengqi Chen <[email protected]>
Closes #16357
Closes #17695
2025-09-09 17:06:13 -07:00
Shengqi Chen f8e2152db7 Install zarcstat and zarcsummary symlinks in Makefile
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Shengqi Chen <[email protected]>
Closes #16357
Closes #17695
2025-09-09 17:05:30 -07:00
Shengqi Chen cbc6d57012 Add upcoming renaming notice for arc_summary and arcstat
They will become zarcsummary and zarcstat in 2.4.0.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Shengqi Chen <[email protected]>
Closes #16357
Closes #17695
2025-09-09 17:05:26 -07:00
Shengqi Chen e5132a3382 ci: fix syntax issues in zfs-qemu.yml
Otherwise it might become `if [ == "" ]` which is ill-formed.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Shengqi Chen <[email protected]>
Closes #17695
2025-09-09 17:05:21 -07:00
Shengqi Chen b5b6deb985 ci: use real head sha instead of GITHUB_SHA when generating CI type
Because GitHub creates a merge commit on top of real head, so the check
on HEAD will fail regardlessly.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Shengqi Chen <[email protected]>
Closes #17695
2025-09-09 17:05:17 -07:00
Maksym Shkolnyi 886f29e1f6 config: Add warning if ARCH environment variable is set
If ARCH environment variable is set it can cause the failure of the
kernel modules check during the configure step. The resulting error
will be confusing, and may looks like this:

>    checking for kernel config option compatibility... done
>    checking whether CONFIG_MODULES is defined... no
>    configure: error:
>        *** This kernel does not include the required loadable module
>        *** support!

Detect when ARCH is print a warning.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Maksym Shkolnyi <[email protected]>
Closes #17680
2025-09-09 17:04:39 -07:00
Rob Norris 56e8ab4a3e zvol: reject suspend attempts when zvol is shutting down
Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes #17690
2025-09-09 17:04:32 -07:00
Brian Behlendorf 24baccb75e config: Fix LLVM-21 -Wuninitialized-const-pointer warning
LLVM-21 enables -Wuninitialized-const-pointer which results in the
following compiler warning and the bdev_file_open_by_path() interface
not being detected for 6.9 and newer kernels.  The blk_holder_ops
are not used by the ZFS code so we can safely use a NULL argument
for this check.

    bdev_file_open_by_path/bdev_file_open_by_path.c:110:54: error:
    variable 'h' is uninitialized when passed as a const pointer
    argument here [-Werror,-Wuninitialized-const-pointer]

Reviewed-by: Rob Norris <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #17682
Closes #17684
2025-09-09 17:04:24 -07:00
Alexander Ziaee 92d4b135b6 manuals: Audit/bump dates for last content change
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Alexander Ziaee <[email protected]>
Closes #17676
2025-09-09 17:04:19 -07:00
classabbyamp 31b9646681 linux: use sys/stat.h instead of linux/stat.h
glibc includes linux/stat.h for statx, but musl defines its own statx
struct and associated constants, which does not include STATX_MNT_ID
yet. Thus, including linux/stat.h directly should be avoided for
maximum libc compatibility.

Tested on:
  - glibc: x86_64, i686, aarch64, armv7l, armv6l
  - musl: x86_64, aarch64, armv7l, armv6l

Reviewed-by: Brian Behlendorf <[email protected]>
Tested-By: Achill Gilgenast <[email protected]>
Signed-off-by: classabbyamp <[email protected]>
Closes #17675
2025-09-09 17:04:15 -07:00
Eric A. Borisch 04d991dbc4 Update pam_zfs_key.c defaultt path for FreeBSD
As described in https://github.com/freebsd/freebsd-src/pull/1305,
FreeBSD's installer defaults to zroot/home for user home directories.

For FreeBSD only, set the default prefix for pam_zfs_key to match.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Eric A. Borisch <[email protected]>
Closes #17600
2025-09-09 17:04:06 -07:00
ofthesun9 5846a85155 Update compatibility.d files
Add an openzfs-2.4 compatibility file for the next release.

While there are no compatibility difference between Linux and
FreeBSD for 2.4 symlinks for the -linux and -freebsd names are
created for any scripts expecting that convention.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: ofthesun9 <[email protected]>
Closes #17672
Closes #17673
2025-09-09 17:04:01 -07:00
Shawn Bayern 8604e67dc9 Add description of default sorting behavior to zfs_list.8
The sorting logic is all in cmd/zfs/zfs_iter.c.  I borrowed
where I could from the comments in the source code, but please
note that the comment to zfs_sort() is a little imprecise, or at
least incomplete, because it doesn't give any indication of the
chronological sort that will be used by default for snapshots in
zfs_compare().

While adding this description, I took the liberty to copy-edit
the rest of the file lightly.

In those edits, I've removed "If specified, you can list
property information by the absolute pathname or the relative
pathname" because, in context, it seems more confusing than
helpful.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: George Melikov <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Reviewed-by: Rob Norris <[email protected]>
Signed-off-by: Shawn Bayern <[email protected]>
Closes #15713
Closes #15869
2025-09-09 17:03:55 -07:00
Ivan Shapovalov c00c3e33bb config: add and use KERNEL_CC check for -Wno-format-zero-length
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ivan Shapovalov <[email protected]>
Closes #16997
2025-09-09 17:03:49 -07:00
Ivan Shapovalov 92579489e0 config: cleanup KERNEL_CC checks, fix broken status output
If $KERNEL_CC was not defined, configure status output would print an
empty string where the kernel compiler should have been. Fix this and
simplify the code generally.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ivan Shapovalov <[email protected]>
Closes #16997
2025-09-09 17:03:44 -07:00
Tony Hutter c539d6f211 ZTS: add mount_loopback to test zfs behind loop dev
Add a test case to reproduce issue #17277:

1. Make a pool
2. Write a file to the pool
3. Mount the file as a loopback device
4. Make an XFS filesystem on the loopback device
5. Mount the XFS filesystem... <hangs>

Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Rob Norris <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Issue #17277
Closes #17329
2025-09-09 17:03:36 -07:00
Mark Johnston 2fc6bf82b6 zdb: Fix format strings on 32-bit systems
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Mark Johnston <[email protected]>
Closes #17665
2025-09-09 17:03:31 -07:00
youzhongyang 774a34f3ff Synchronize the update of feature refcount
The concurrent execution of feature_sync() can lead to a panic due 
to an unprotected update of the feature refcount.  Resolve this by
using the spa->spa_feat_stats_lock to synchronize the update of the 
refcount.

Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Youzhong Yang <[email protected]>
Closes #17184
Closes #17632
2025-09-09 17:03:27 -07:00
Cong Zhang e3392a5e7d Prompt user to unlock when login from dropbear
Update the zfsunlock initramfs hook to provide instructions on how
to unlock the root filesystem when appropriate.  The intent is to
make the dropbear ssh MOTD more user friendly.

Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Ahelenia Ziemiańska <[email protected]>
Signed-off-by: Cong Zhang <[email protected]>
Closes #17661
Closes #17662
2025-09-09 17:03:22 -07:00
ShengYi Hung 60b0c7e66f ichwd: address unused function warning by marking as __unused
Reported by:    markj, bz
Approved by:    markj (mentor)
Fixes:  2b74ff5fce ("ichwd: introduce i6300esbwd watch dog driver")
Differential Revision: https://reviews.freebsd.org/D52476

(cherry picked from commit 3449a3abab)
2023-01-01 18:29:28 -05:00
ShengYi Hung c4f9b0df3f snd_hda: Add patch for Framework 16 AMD Ryzen AI 300 Series
The new Framework 16 with ALC285 exhibits the same issue as the previous
model. Therefore, we apply the same fix to the new model.

Reviewed by:    emaste, Daniel Schaefer <[email protected]>
Approved by:    lwhsu (mentor)
Sponsored by:   The FreeBSD Foundation
Sponsored by:   Framework Computer Inc
Differential Revision: https://reviews.freebsd.org/D52423

(cherry picked from commit 7f81b2519a)
2023-01-01 18:29:21 -05:00
Konstantin Belousov cb72d02843 libc: properly reference setgroups@FBSD_1.0 in initgroups@FBSD_1.0
by forwarding the reference to libsys syscall symbol, for the libc.so
case.

Reviewed and tested by:	kevans
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D52672

(cherry picked from commit f72908c94d)
2025-09-23 17:50:33 +02:00
Corvin Köhne 5a8172dd63 bhyve: assign a valid INTPIN to NVIDIA GPUs
When passing an NVIDIA GPU to a Linux VM, the GPU driver refuses to work and
complains about a missing IRQ:

[ 77.208984] NVRM: Can't find an IRQ for your NVIDIA card!
[ 77.212697] NVRM: Please check your BIOS settings.
[ 77.212699] NVRM: [Plug & Play OS] should be set to NO
[ 77.212700] NVRM: [Assign IRQ to VGA] should be set to YES
[ 77.212702] nvidia: probe of 0000:00:07.0 failed with error -1

By setting a valid INTPIN in the PCI config space those error messages
disappear. Additionally, tools like nvidia-smi are able to detect the GPU and
the GPU driver seems to work properly.

Note that bhyve still doesn't support legacy interrupts. So, the guest
shouldn't try to use it even though we're assigning an INTPIN.

Reviewed by:		jhb
Tested by:		chuck
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D51892

(cherry picked from commit effcd0ded0)
2025-09-23 15:52:51 +02:00
Zhenlei Huang b1c96e54b9 ipfw: Teach ipfw that EtherIP is an upper layer protocol
so that we do not discard EtherIP packets ( over IPv6 network ) when
net.inet6.ip6.fw.deny_unknown_exthdrs is set to 1 ( which is the default
value ).

PR:		227450
Reviewed by:	ae, #network
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52566

(cherry picked from commit 0418e6690e)
2025-09-23 21:07:33 +08:00
Dag-Erling Smørgrav 519a1c971e cp: Drop test helper
Now that stat(1) can report whether a file is sparse, we no longer need
a helper program for our tests.

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52482

(cherry picked from commit 9b8224b950)
2025-09-23 12:57:30 +00:00
Dag-Erling Smørgrav 697d7905ab stat: Add option to list holes
Add a new -h option that causes stat to print a list of holes for each
file argument.

Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52481

(cherry picked from commit 1a7a067da4)
2025-09-23 12:57:30 +00:00
Dag-Erling Smørgrav 898d513ab1 tools: Drop cryptotest
This has been supplanted by cryptocheck and has bitrotted to the point
where it no longer builds.

PR:		289325
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D52399

(cherry picked from commit 4c6cf6107b)
2025-09-23 12:57:30 +00:00
Dag-Erling Smørgrav fd017bf5ef man: Fix usage message
PR:		289245
Fixes:		14b61b2e93 ("man: Add -l option")
(cherry picked from commit dc38cf116c)
2025-09-23 12:57:29 +00:00
Olivier Certner 0479fdf7f7 stress2: Fix removal of supplementary groups
To this end, call setgroups(0, NULL) instead of passing the effective
GID.  This stance is fully compatible with older versions of FreeBSD.

Fixes:          9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) to match other platforms")
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52290

(cherry picked from commit de48322896)
2025-09-23 14:02:49 +02:00
Olivier Certner b0395b4497 tools/regression/priv: Don't call setgroups() with the effective GID
The 'setgroups(0, NULL);' stance works the same on all versions of
FreeBSD, getting rid of all supplementary groups.  The replaced code
would force the effective GID to also be a supplementary group.

Fixes:          9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) to match other platforms")
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52289

(cherry picked from commit ff7252cdaf)
2025-09-23 14:02:49 +02:00
Olivier Certner bc71d7400e ucred.9: crsetgroups_and_egid(): Clarify differences with crsetgroups()
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52288

(cherry picked from commit 6b26d0a335)
2025-09-23 14:02:48 +02:00
Olivier Certner dc18b884d5 group.5: Add a reference to setcred(2)
Reviewed by:    gbe
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52287

(cherry picked from commit 313d769e99)
2025-09-23 14:02:48 +02:00
Olivier Certner 2932e6f59b getgroups.2: Clarify, mention ascending order, add SECURITY CONSIDERATIONS
Clarify and be more precise about the behavior of getgroups(2), in
particular with respect to 'gidsetlen'.

Prefer a terminology referring to POSIX terms, i.e., use "supplementary
groups" instead of "group access list".

Say that getgroups(2) reports the supplementary groups in strictly
ascending order and returns the cardinal of the set they form (and
mention this has been the case since FreeBSD 14.3).

Add a new SECURITY CONSIDERATIONS section contrasting the new behavior
after commit 9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) to
match other platforms") with the historical one.

While here, fix some style.

Note for MFC to stable/14: The content will have to be revised as the
new behavior is not in place.  The latter should be mentioned as
upcoming in 15.

Reviewed by:    gbe (older version)
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52286

(cherry picked from commit 4be38acc82)
2025-09-23 14:02:48 +02:00
Olivier Certner af6ac32284 setcred.2: Remove now obsolete mention of setgroups(2)'s different behavior
Reviewed by:    gbe
Fixes:          9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) to match other platforms")
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52285

(cherry picked from commit 66b54c48b2)
2025-09-23 14:02:47 +02:00
Olivier Certner 7132fb5edb setgroups.2: Add SECURITY CONSIDERATIONS, fix the groups limit, rework
Add a new SECURITY CONSIDERATIONS section describing in details what the
new behavior is after commit 9da2fe96ff ("kern: fix setgroups(2) and
getgroups(2) to match other platforms"), what setgroups(2) does not
do anymore, and how programs using it are affected.

Fix the groups limit after commit 9da2fe96ff ("kern: fix setgroups(2)
and getgroups(2) to match other platforms").

Prefer a terminology referring to POSIX terms, i.e., use "effective
group list" instead of "group access list".

While here, fix some style.

Note for MFC to stable/14: The content will have to be revised as the
new behavior is not in place.  The latter should still be mentioned as
upcoming in 15.

Fixes:          9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) to match other platforms")
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52284

(cherry picked from commit 6d22cd6b5f)
2025-09-23 14:02:47 +02:00
Olivier Certner d0aa1b863d getgrouplist.3: Rework, use more appropriate terminology
Bring up to date with NSS by substituting "file" with "database".

Describe more precisely which database is accessed, i.e., only the group
database, which value should be used and where it lands in the result.

Prefer a terminology referring to POSIX terms, i.e., use "effective
group list" instead of "group access list".

Reviewed by:    gbe
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52283

(cherry picked from commit 9294eb44ee)
2025-09-23 14:02:46 +02:00
Olivier Certner 8878569103 initgroups(3): Add a pre-FreeBSD-15-compatible version
After commit 9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) to
match other platforms"), initgroups() does not set the effective GID
anymore and uses all passed groups as the supplementary group list.
This effectively breaks backwards compatibility with programs/libraries
compiled on a FreeBSD 14 or earlier system.

Restore compatibility by creating a new version of the 'initgroups'
symbol that designates the current implementation and providing
a pre-FreeBSD-15-compatible version under the symbol's previously
exported version.  The new version calls the new setgroups(2) system
call, while the compatible one calls the original one (called
freebsd14_setgroups()).

Update the manual page with some history and comparison with other
current open-source systems.  Add a "SECURITY CONSIDERATIONS" section
highlighting some security properties of this approach and the reasons
we adopt it.  While here, revamp the manual page, in particular to use
the exact POSIX terminology where possible.

Note for MFC to stable/14: Only the manual page update is to be MFCed,
and the text changed to reflect the old behavior and inform readers of
the new upcoming behavior in 15.

Reviewed by:    kib
Fixes:          9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) to match other platforms")
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52282

(cherry picked from commit 9dc1ac8691)
2025-09-23 14:02:46 +02:00
Olivier Certner fda64d005e initgroups(3): Fix return value on allocation failure
We must not return ENOMEM, but rather -1 with 'errno' set to ENOMEM, as
described in the manual page and as other implementations are doing.
A malloc() failure actually already sets ENOMEM for us.  Add comments
indicating which function set 'errno' each time we return.

While here, improve style and remove useless headers.

Reviewed by:    kib, emaste
Fixes:          54404cfb13 ("In preparation for raising NGROUPS and NGROUPS_MAX, ...")
MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52580

(cherry picked from commit 0b018cfd81)
2025-09-23 14:02:46 +02:00
Olivier Certner bea59ce7c9 syscalls: Old setgroups(2)/getgroups(2): Remove superfluous STD type
An examination of the scripts under 'sys/tools/syscalls' indicates that
keeping STD as a type in the presence of COMPATxx does not make any
difference, and regenerating system call files with STD removed does
indeed not show any difference.  Moreover, this practice is inconsistent
with the rest of the file.

Thus, remove the superfluous STD type for the two above-mentioned system
calls.  While here, re-order the remaining types for getgroups() to be
consistent with other such occurences (COMPATxx before CAPENABLED).

Reviewed by:    kevans, emaste
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52499

(cherry picked from commit 696cfb27ca)
2025-09-23 14:02:46 +02:00
Olivier Certner bef5c3713c hastd: Remove some now useless assertion
It is in fact redundant with the previous one, as the set of
supplementary groups is expected to be empty.

MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52281

(cherry picked from commit 59049f4b47)
2025-09-23 14:02:45 +02:00
Olivier Certner 5eaee33a2a linux: getsockopt(): Simplify exporting groups a bit
No functional change (intended).

Go through conversion to a 'l_gid_t' before copying out in order to cope
with differing group types (except for not representable values, of
course).  This is what is done, e.g., for getgroups() in 'linux_misc.c'.
As Linux's group type is the same as ours on all architectures, we could
as well just stop bothering and copy out our memory representation,
eliminating the loop here.  Whatever the choice, though, it has to be
consistent here and there.

Introduce 'out' of type 'l_gid_t' to avoid performing "by hand" array
arithmetics when copying out.

MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52280

(cherry picked from commit 10b789d7e1)
2025-09-23 14:02:45 +02:00
Olivier Certner db27bce904 linux: setgroups16(): Pre-extend the groups array
For the size we know we will need in the end.

No functional change (intended).

MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52279

(cherry picked from commit b1326edddb)
2025-09-23 14:02:45 +02:00
Olivier Certner fa96d3e64e linux: setgroups(): Avoid allocation under the process lock
This was missed in commit 838d985825 ("Rework the credential code to
support larger values of NGROUPS (...)").

No functional change (intended).

MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52278

(cherry picked from commit b7a87d7c0d)
2025-09-23 14:02:44 +02:00
Olivier Certner 469c3a4139 linux: setgroups(): Fix the group number's upper limit
'ngroups_max' is the maximum number of supplementary groups the system
will accept, and this has not changed.

Fixes:          9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) to match other platforms")
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52277

(cherry picked from commit bbdea7c9f4)
2025-09-23 14:02:44 +02:00
Olivier Certner 8013a7137d linux: Simplify further getgroups() after 'cr_gid' not in cr_groups[]
No functional change (intended).

While here, fix/improve style a bit and in setgroups().

MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52276

(cherry picked from commit a207833f4f)
2025-09-23 14:02:44 +02:00
Olivier Certner 7bab0263aa cr_canseeothergids(): Make the logic easier to grasp
Invert the initial test on whether the policy is in force so that, if
there are no restrictions, the function bails out early, allowing to
de-indent the rest of the code and have it finish with a non-zero (deny)
'return'.

No functional change (intended).

MFC after:      5 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52272

(cherry picked from commit f75d0dc533)
2025-09-23 14:02:43 +02:00
Olivier Certner dd5c76309a MAC/do: Restore matching the first supplementary group
As 'cr_gid' was in fact stored in cr_groups[0],
rule_grant_supplementary_groups() would loop only on further elements of
cr_groups[].  Now that cr_groups[0] is not 'cr_gid' anymore, but some
supplementary group, take it into account.

Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52271

(cherry picked from commit d39756f23f)
2025-09-23 14:02:43 +02:00
Olivier Certner a482c69758 MAC/bsdextended: Restore matching subjects' effective GID
Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52270

(cherry picked from commit ab7186a486)
2025-09-23 14:02:43 +02:00
Olivier Certner ee8c31c6da cred: 'struct ucred': Rework comment on 'cr_gid'/cr_groups[]
Make it more straightforward for consumers.  Also, recommend using
cr_sgroups[] for supplementary groups, as this can generally alleviate
index problems and will help us spot and change consumers if/when
'struct ucred' is evolved incompatibly (and cr_sgroups[] suppressed).

MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52269

(cherry picked from commit 0abeb8d8d8)
2025-09-23 14:02:42 +02:00
Olivier Certner 0d836d1261 cred: Restore proper checking of effective groups in some security policies
The removal of 'cr_gid' from cr_groups[] as cr_groups[0] made
cr_canseeothergids() skip considering the subject's first supplementary
group, causing the 'security.bsd.see_other_gids' policy to be too
restrictive, and cr_xids_subset() miss a check on the effective GID,
relaxing the "can debug" and "can export KTLS keys" checks.

Fix these policies.

Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52268

(cherry picked from commit fa1cbb02d1)
2025-09-23 14:02:42 +02:00
Olivier Certner f9b269731c cred: Remove obsolete comment after getgroups() not returning the eGID
No functional change.

Fixes:          9da2fe96ff ("kern: fix setgroups(2) and getgroups(2) to match other platforms")
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52267

(cherry picked from commit 30193fce43)
2025-09-23 14:02:42 +02:00
Olivier Certner 9466d35acc cred: Update some comments after 'cr_gid' is no more cr_groups[0]
While here, fix style of some already-updated comments.

Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52266

(cherry picked from commit 9397b2ef74)
2025-09-23 14:02:41 +02:00
Olivier Certner 8cda100def cred: 'kern.ngroups' tunable: Rework the comment on the initial value
Remove the parts about the effective GID being stored as the first
element of the groups array, as this is generally not the case now after
commit be1f7435ef ("kern: start tracking cr_gid outside of
cr_groups[]") (some credentials export structures still have the old
layout, and need to do the 'ngroups_max + 1' computation, but given the
computation needed to obtain a size in bytes, this detail is not really
important here).

Remove the part about 32-bit machines, avoiding another modification
when support for them is removed.

No functional change.

MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52265

(cherry picked from commit a61e7b5c98)
2025-09-23 14:02:41 +02:00
Olivier Certner 5e4493dca3 nfsd: nfsd_excred(): Remove an obsolete comment
This comment has been obsoleted by commit be1f7435ef ("kern: start
tracking cr_gid outside of cr_groups[].").

No functional change.

MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52264

(cherry picked from commit 5fa6ca8b8a)
2025-09-23 14:02:41 +02:00
Olivier Certner 97e7c06af7 fuse: Fix GID when sending FUSE_INTERRUPT to a FUSE daemon
Due to the partial-only changes of commit 46c07316f9 ("kern: adopt the
cr_gid macro for cr_groups[0] more widely"), subsequent commit
be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
caused a mismatch between filling cr_groups[0] in 'reused_creds' in
fuse_interrupt_send() and reading 'cr_gid' from it in
fuse_setup_ihead(), with the consequence that the kernel would send
a FUSE_INTERRUPT message to the FUSE deamon with an uninitialized GID in
its header (which, besides being wrong, would disclose 4 bytes from its
stack).

Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52255

(cherry picked from commit d22592cd6f)
2025-09-23 14:02:41 +02:00
Olivier Certner 052d8f6acf unix: SCM_CREDS: Restore passing the effective GID
cmcred_groups[0] in 'struct cmsgcred' must be the effective GID.

Note that the code in unp_addsockcred() filling up 'struct
sockcred'/'struct sockcred2' (LOCAL_CREDS/LOCAL_CREDS_PERSISTENT
options) was in fact "wrong" before 'cr_gid' was moved out of
cr_groups[], in the sense that it would transmit the effective GID
twice, both separately as 'sc_egid' and as the first element of
'sc_groups'.  It is now exact, so is left unchanged, which causes
a difference in output (the effective GID is no more in 'sc_groups',
unless it is also a supplementary group) that is unlikely to affect
applications in practice.

Reviewed by:    glebius
Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52262

(cherry picked from commit c5e920e49c)
2025-09-23 14:02:40 +02:00
Olivier Certner d36c8416e7 libprocstat: procstat_getgroups_kvm(): Output again the effective GID
In particular, fixes 'procstat -s -M' (for processes with more than 16
groups).

Reviewed by:    kib
Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52275

(cherry picked from commit 11cbb7d122)
2025-09-23 14:02:40 +02:00
Olivier Certner cd7ed5b7b6 dtrace: Fix effective GID shown by 'curpsinfo'
Reviewed by:    emaste
Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      5 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52274

(cherry picked from commit e4cc7f9930)
2025-09-23 14:02:40 +02:00
Olivier Certner f049b71c24 libc: compat.h: Remove a superfluous blank line at end
No functional change (intended).

MFC after:      5 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 580d2d4295)
2025-09-23 14:02:35 +02:00
Andrey V. Elsukov fb4be86611 IPv6: fix off-by-one in pltime and vltime expiration checks
Previously, the macros used '>' instead of '>=' when comparing elapsed
time against the preferred and valid lifetimes. This caused any deprecated
address to become usable again for one extra second after receiving each
Router Advertisement. In that short window, the address could be
selected as a source for outgoing connections.

Update the checks to use '>=' so that addresses are deprecated or
invalid when their lifetime expires.

PR: 		289177
Reported by:	Dmitry Nexus <fbsd.4f6a at nexus tel>
Reviewed by:	zlei
Submitted by:	Marek Zarychta
Differential Revision:	https://reviews.freebsd.org/D52323

(cherry picked from commit 588a5fad3e)
2025-09-23 11:31:12 +03:00
Konstantin Belousov a05c806a78 vm/vm_fault.c: update and split comments for vm_fault() and vm_fault_trap()
(cherry picked from commit 22cce201da)
2025-09-23 03:40:33 +03:00
Konstantin Belousov 0add74cd82 remote coredump: fully initialize coredump_vnode_ctx and coredump_writer structs
(cherry picked from commit 11205b0854)
2025-09-23 03:40:33 +03:00
Timo Völker 28f2d9b86d vtnet: deprecate loader tunable fixup_needs_csum
If this tunable is enabled and vtnet receives a packet with
VIRTIO_NET_HDR_F_NEEDS_CSUM set, vtnet computes the TCP/UDP checksum
and writes it in the checksum field.
This was somewhat useful when vtnet pretended that such a packet has
a correct checksum and set the mbuf flag CSUM_DATA_VALID.
But this is not the case anymore.

Reviewed by:		tuexen
Differential Revision:	https://reviews.freebsd.org/D52546

(cherry picked from commit 5da388d939)
2025-09-17 06:49:54 +02:00
Michael Tuexen 65a9bef469 tcp: improve compilation of cc and their helper modules
* Allow the congestion control modules CDG, CHD, HD, and vegas also
  to be compiled into the kernel for IPv6 only kernel configs.
* Compile the helper module h_ertt for round trip time estimation only
  into the kernel, if one of the congestion control module using it
  (one of CDG, CDH, HD, or vegas) is also compiled into the kernel.
Please note the second point implies that TCP TSO is done whenever
possible as long as none of the congestion control modules CDG, CHD,
HD, or vegas is loaded or compiled into the kernel.

Reviewed by:		cc
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D52547

(cherry picked from commit 1bb72d3d6e)
2025-09-17 06:49:21 +02:00
Gleb Smirnoff dbff738735 cpucontrol: return selected revision from ucode_amd_find()
This fixes two printing bugs in cpucontrol(1).  First, the utility will
now print "updating from rev X to rev Y", instead of incorrect "updating
to revision X", where X is actually the old revision.  This also matches
what Intel updater prints.  Second, the utility won't incorrectly warn
that the update failed after reading the new revision post update.

Reviewed by:		kib, markj
Differential Revision:	https://reviews.freebsd.org/D52506

(cherry picked from commit 83804499b7)
2025-09-22 09:11:33 -07:00
Gleb Smirnoff 797e92944d cpuctl: run amd_ucode_wrmsr only on one CPU and report if it failed
The CPUCTL_UPDATE is supposed to be applied only to the CPU the ioctl(2)
was performed on.  This is true for Intel CPUs, but for AMD the SMP
rendezvouz of amd_ucode_wrmsr() effectively executed it on all CPUs.
Also, the update failure was not reported.

Reviewed by:		markj
Differential Revision:	https://reviews.freebsd.org/D52466

(cherry picked from commit 6683dcf61b)
2025-09-22 09:11:33 -07:00
Gleb Smirnoff 7a7fbb13f5 cpucontrol: fix -DDEBUG build
(cherry picked from commit f113980fe2)
2025-09-22 09:11:33 -07:00
Gleb Smirnoff 418bf33874 Revert "linux: fix reporting NL_RTM_DELLINK to Netlink sockets"
I received a report that certain Linux application would crash on a
message of a departure of an interface with FreeBSD name.  Looks like
dropping NL_RTM_DELLINK is a lesser evil than relay them with FreeBSD
names.

This reverts commit 554907bac3.

(cherry picked from commit 1014003c53)
2025-09-22 09:11:33 -07:00
Andrew Turner 88489d90af arm64: Fix enabling CPU features
Previously when enabling CPU feature we assumed the no check function
means the feature was unconditionally enabled. When adding support to
disable features on boot this check was incorrectly partially left in
place. As all current features have a check function this meant all
features were disabled.

Fix this by restoring the previous behaviour while also allowing the
user to disable the feature.

Reviewed by:	emaste
Fixes:		4bc68fa98f ("arm64: Support managing features from loader")
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52579

(cherry picked from commit 5e690f1e12)
2025-09-20 02:00:54 +01:00
Andrew Turner 3c25261ea2 arm64: Read the CPU feature tunables once
Rather than reading the CPU tunables each time we enable a feature
just read them once on boot. Reading them early on non-boot CPUs
causes issues where they try to allocate memory before the core is set
up to do so. As they don't change it is safe to cache the state of
them.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52578

(cherry picked from commit 5e0e256528)
2025-09-20 02:00:53 +01:00
Andrew Turner 20fee5aa50 arm64: Add cpu_feat_disabled for disabled features
When a feature is disabled we may need to run a cleanup handler, e.g.
to remove a feature from the sanitized ID registers. Add support for
this with a new feat_disabled handler.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52577

(cherry picked from commit 055229eda6)
2025-09-20 02:00:53 +01:00
Andrew Turner 6492b62478 arm64: Move the FEAT_PAN check later
We only need to enable PAN (Privileged access never) before userspace
is running. Before that there are no unprivileged mappings to protect
the kernel from accessing.

While here switch to use get_kernel_reg to handle the case some CPUs
have FEAT_PAN, while some don't.

Reviewed by:	emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D52576

(cherry picked from commit 72828486ca)
2025-09-20 02:00:52 +01:00
Andrew Turner e52a47446e arm64: Fix the FEAT_WFxT check
The check was always true so would incorrectly enable the feature when
it wasn't supported.

Due to another bug this was harmless.

Sponsored by:	Arm Ltd

(cherry picked from commit 226375a1f6)
2025-09-20 02:00:52 +01:00
Andrew Turner f408052d7b arm64: Add the new C1 CPU IDs
Add the Arm C1-Nano, C1-Pro, C1-Premium, and C1-Ultra CPUs from their
Technical Reference Manuals.

Sponsored by:	Arm Ltd

(cherry picked from commit 8fee6b9ecc)
2025-09-20 02:00:51 +01:00
Dag-Erling Smørgrav 6d3de81798 ifconfig: Enter jail as soon as possible
Some options (in particular, -g) are processed immediately upon being
parsed.  This will produce the wrong result in combination with -j since
we only attach to the jail after we're done parsing arguments.  Solve
this by attaching to the jail immediately when -j is encountered.  The
downside is that e.g. `ifconfig -j foo -j bar` would previously attach
to jail “bar”, whereas now it will attempt to attach to jail “foo”, and
if successful, attempt to attach to jail “bar” within jail “foo”.  This
may be considered a feature.

PR:		289134
MFC after:	1 week
Reviewed by:	zlei
Differential Revision:	https://reviews.freebsd.org/D52501

(cherry picked from commit 18fd1443d2)
2025-09-22 10:26:59 +00:00
Vladimir Kondratyev a4417b9f9c moused(8): Start moused with devd
It is appeared that currently starting of moused does not depend on
moused_enable variable value in rc.conf. That leads to missing USB mice
support in default configuration. Start moused in traditional per
device mode with devd to follow POLA.

One daemon per system mode still can be enabled with setting of
moused_port="auto"
moused_nondefault_enable="NO"
variables in /etc/rc.conf

To revert to sysmouse mode add moused_type="sysmouse" to /etc/rc.conf

Reported by:	many
Requested by:	glebius
Reviewed by:	glebius
MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D52430

(cherry picked from commit 66e7f048f0)
2025-09-22 12:22:24 +03:00
Vladimir Kondratyev d5f63d6b37 moused(8): Add command line option to restrict interface type
to evdev or sysmouse. It is required to avoid receiving of double events
on hybrid devices supporting both interfaces like ums (4).

MFC after:	1 day
Reviewed by:	glebius (via private chat)
Differential Revision:	https://reviews.freebsd.org/D52647

(cherry picked from commit 1335bf5ce1)
2025-09-22 12:22:12 +03:00
Xin LI 78b179fe92 MFC: MFV: libexpat 2.7.2
(cherry picked from commit 627b778d9e)
2025-09-21 22:55:22 -07:00
Konstantin Belousov c6dc9decd7 iommu_get_requester(): make it more resilient against arbitrary dev arg
PR:	289318

(cherry picked from commit c745a6818b)
2025-09-22 07:56:13 +03:00
Konstantin Belousov 23004dbe58 Revert "zfsctl_root_readdir: if there were no dirents to copy out, return EINVAL"
(cherry picked from commit 72924ce99c)
2025-09-22 02:25:16 +03:00
Konstantin Belousov de19a7d54d Revert "zfs readdir: if there were no dirents to copy out, return EINVAL same as UFS"
PR:	289485, 289678

(cherry picked from commit 932e404f12)
2025-09-22 02:25:16 +03:00
Ahmad Khalifa 7fcd41dfa6 gpioled: remove redundant -1 check
The function is never called with onoff = -1

MFC after:	3 days
MFC with:	9ae3c30

(cherry picked from commit e0c83ab3b3)
2025-09-21 13:03:14 +03:00
Stéphane Rochoy f3ecec554b gpioled: use hw pin inversion if available
Add hint.gpioled.%d.invmode to allow setting the pin inversion method. Accept
the following values:

- auto Use hardware pin inversion if available, else fallback to software pin
       inversion.
- hw   Use hardware pin inversion.
- sw  Use software pin inversion.

Default is auto. This hint is ignored when no pin inversion is
requested (hint.gpioled.%d.invert=0).

Signed-off-by: Stéphane Rochoy <[email protected]>
Sponsored-by: Stormshield
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1805

(cherry picked from commit 9ae3c3010a)
2025-09-21 13:03:10 +03:00
Colin Percival 26988773d1 15.0: Update to ALPHA3
Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-09-20 06:52:09 -07:00
Colin Percival 5b71011507 release.sh: Use mkdir -p
Don't fail if directories already exist.

Fixes:	08adaf71e2 ("release.sh: Bootstrap pkg from the ports tree")
MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit f0b1e0470a)
2025-09-20 06:51:07 -07:00
Colin Percival c2e6178e68 release.sh: Bootstrap pkg from the ports tree
When building OCI continers, we create a pkgbase repository; but we
need pkg in order to do this, and it may not be fetchable.  Bootstrap
it from the ports tree instead.

Note that this pkgbase repository is not the same one as we ship as
part of the release build; this duplication of package-creation will
be fixed at a later date.

MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 08adaf71e2)
2025-09-20 06:51:07 -07:00
Colin Percival 91970dfbaf pkgbootstrap: Gate building from ports
In release builds we want to build pkg from the ports tree for reasons
mentioned in a previous commit; but non-release pkgbase builds may be
just fine with installing pkg from pkg.freebsd.org.

Gate it behind BOOTSTRAP_PKG_FROM_PORTS rather than building form ports
any time we have a ports tree available.

While I'm here, make the pkgbase-repo target in release/Makefile
create the temporary directories we need for building.

Reviewed by:	ivy
MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva
Fixes:	2c06b82443 ("pkgbootstrap: Build pkg if PORTSDIR exists")

(cherry picked from commit e87b75a8bf)
2025-09-20 06:50:56 -07:00
Colin Percival 42143eb176 pkgbase: Don't include pkg by default
We need to put pkg into the pkgbase repository for release builds, but
not for non-release pkgbase builds.  Gate the contents of package-pkg
behind INCLUDE_PKG_IN_PKGBASE_REPO=YES and set that when building
releases.

Reviewed by:	ivy
MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 060f7edadc)
2025-09-20 06:50:56 -07:00
Colin Percival 9183529955 release: More fixes for building pkg package
* Ignore "wrong major" errors when obtaining WRKDIR.
* Put distfiles in /tmp in case /usr/ports is read-only.

MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 088e210005)
2025-09-20 06:50:56 -07:00
Colin Percival 9c56bf2d1f release: Allow pkg build on "wrong" major
While we usually build FreeBSD releases on the same major version, we
do need to be able to e.g. build 15 on 16.  Tell the ports tree that
we know what we're doing.  (We don't, not really, but we can at least
pretend...)

MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 5918b4866a)
2025-09-20 06:50:56 -07:00
Colin Percival 04ad9d737d pkgbootstrap: Build pkg if PORTSDIR exists
If we don't already have the pkg tool installed, we need to install it
before we can build packages for pkgbase.  (This arises in release
builds which run in clean chroots; most users will have pkg installed
already.)  Installing it from pkg.freebsd.org via "pkg bootstrap" runs
into two problems: First, it's an external dependency with security
implications; and second, there's a bootstrapping problem on new major
versions where pkg.freebsd.org does not have packages yet.

Instead, if we have a ports tree, use it to build pkg ourselves.

With hat:	re
MFC after:	6 hours
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 2c06b82443)
2025-09-20 06:50:56 -07:00
Colin Percival 7ca9dc8864 release: Always dist sets on dvd1
In the !NOPKGBASE && !NODISTSETS case, we only want the pkgbase repo
on disc1; but we want both packaging formats on dvd in order to allow
for offline installs in both methods and also tools which ingest the
dist sets from the dvd image.

MFC after:	12 hours
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D52537

(cherry picked from commit 7c0bc6c703)
2025-09-20 06:50:56 -07:00
Colin Percival 0a4eca324c release: Make PKGBASE the default
Replace the PKGBASE option by a NOPKGBASE option.

Check for both whether the option is defined and whether it is empty,
since when running from release.sh we always define NOPKGBASE.

MFC after:	12 hours
Sponsored by:	https://www.patreon.com/cperciva
Differential Revision:	https://reviews.freebsd.org/D52536

(cherry picked from commit 35b81af1ee)
2025-09-20 06:50:55 -07:00
Colin Percival 1adc9b9c45 Bootstrap pkg before building a pkg package
At sufficiently high levels of build parallelism we can try to create
the pkg before any of the other pkgbase-creation steps have taken
care of the bootstrap.

Fixes:	6b5adf3387 ("Include a pkg package in the pkgbase repo")
MFC after:	12 hours
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 98d7449361)
2025-09-20 06:50:55 -07:00
Colin Percival 33f8c98c92 Include a pkg package in the pkgbase repo
It is essential that users be able to install the FreeBSD base system
from release media and have all the bits needed to update the FreeBSD
base system without touching the ports tree or pkg.freebsd.org.  To
that end, resurrect (and heavily rewrite) the make-pkg-package.sh
script and hook it into the create-packages target; if /usr/ports
exists when building pkgbase packages, we'll also (cross)build pkg
and include it in the repository.

Scripting for actually installing this package as part of the FreeBSD
installation process to come later, but I wanted this in the tree in
time to test it in this week's snapshots.

MFC after:	1 day
Sponsored by:	https://www.patreon.com/cperciva
2025-09-20 06:50:55 -07:00
Colin Percival 5a5e68aac3 release: Fix typo in powerpc mkisoimages.sh
"[ n foo ]" is an error and should have been "[ -n foo ]".

Fortunately the only ill effect was to result in garbage in /tmp/ when
creating powerpc ISO images.

Fixes:	6c3e01bf85 ("release: Randomize powerpc boot block file name")
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit 8c9a919aba)
2025-09-20 06:50:55 -07:00
Colin Percival e02775bf04 release: Pass ABI to running pkgbase-stage on dvd
I did this for disc1 but forgot to amend the dvd invocation.

Fixes:	340e68fd7c ("release: Pass ABI to pkgbase-stage.lua")
MFC after:	3 days
Sponsored by:	https://www.patreon.com/cperciva

(cherry picked from commit b050bfa88d)
2025-09-20 06:50:55 -07:00
Evgenii Ivanov 856510e160 rk_tsadc: use tsadc_temp_to_raw for shutdown_temp
Use tsadc_temp_to_raw instead of tsadc_raw_to_temp, otherwise rk3566/68
get stuck in a kernel reboot cycle.

https://forums.freebsd.org/threads/running-freebsd-on-radxa-rock-3c-rk3566-board.89389/post-624890

Submitted by:	covacat
Reviewed by:	mmel
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D52309

(cherry picked from commit 2b0f8c6907)
2025-09-20 10:47:16 +03:00
Alan Somers 27331c63bc sockstat: fix the -j option with piped output after libxo integration
The legacy code handling -j in display() was causing xo_finish() to be
skipped.  It has also been causing a memory leak since 0726c6574f
(sockstat: Add automatic column sizing and remove -w option)

Fixes:		7b35b4d196 (sockstat: add libxo support)
Reported by:	glebius
Reviewed by:	glebius
Sponsored by:	ConnectWise
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1842

(cherry picked from commit 9bfbc6826f)
2025-09-19 13:41:17 -06:00
Lexi Winter 724972790e mtree: Add package tags to some root directories
This ensures the normally-empty directories /proc, /net, /media and /mnt
are created on a fresh pkgbase install.

Put /proc, /mnt and /media in -runtime since those are basic directories
that should always exist.  /net is only used by the automounter, so put
that in -autofs.  While here, also tag /rescue in -rescue, since nothing
else installs there.

After discussion with cperciva, this is being MFC'd early so we can land
it in the 15.0-ALPHA3 build.

Reported by:	Graham Perrin <[email protected]>
PR:		289654
MFC after:	3 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D52622

(cherry picked from commit b346820299)
2025-09-19 17:42:54 +01:00
Dave Cottlehuber 48578fbefa release: Add images for almost all packages, with & without toolchain
Contains almost everything of use in a container except:

- *lib32
- *dev
- *dbg
- *src
- anything expecting hardware such as device config tools

Differential Revision:	https://reviews.freebsd.org/D51471

Reviewed by:	dfr, emaste
Approved by:	cperciva
MFC after:	1 day
Sponsored by:	SkunkWerks, GmbH

(cherry picked from commit 7295620108834090187cb9b429dbd664a7ab953d)
2025-09-19 11:47:10 +00:00
Olivier Certner 83ad6d8d8e vm_domainset: Refactor iterators, multiple fixes
vm_domainset_iter_first() would not check if the initial domain selected
by the policy was effectively valid (i.e., allowed by the domainset and
not marked as ignored by vm_domainset_iter_ignore()).  It would just try
to skip it if it had less pages than 'free_min', and would not take into
account the possibility of no domains being valid.

Factor out code that logically belongs to the iterator machinery and is
not tied to how allocations (or impossibility thereof) are to be
handled.  This allows to remove duplicated code between
vm_domainset_iter_page() and vm_domainset_iter_policy(), and between
vm_domainset_iter_page_init() and _vm_domainset_iter_policy_init().
This also allows to remove the 'pages' parameter from
vm_domainset_iter_page_init().

This also makes the two-phase logic clearer, revealing an inconsistency
between setting 'di_minskip' to true in vm_domainset_iter_init()
(implying that, in the case of waiting allocations, further attempts
after the first sleep should just allocate for the first domain,
regardless of their situation with respect to their 'free_min') and
trying to skip the first domain if it has too few pages in
vm_domainset_iter_page_init() and _vm_domainset_iter_policy_init().  Fix
this inconsistency by resetting 'di_minskip' to 'true' in
vm_domainset_iter_first() instead so that, after each vm_wait_doms()
(waiting allocations that could not be satisfied immediately), we again
start with only the domains that have more than 'free_min' pages.

While here, fix the minor quirk that the round-robin policy would start
with the domain after the one pointed to by the initial value of
'di_iter' (this just affects the case of resetting '*di_iter', and would
not cause domain skips in other circumstances, i.e., for waiting
allocations that actually wait or at each subsequent new iterator
creation with same iteration index storage).

PR:             277476
Tested by:      Kenneth Raplee <kenrap_kennethraplee.com>
Fixes:          7b11a48326 ("Add files for r327895")
Fixes:          e5818a53db ("Implement several enhancements to NUMA policies.")
Fixes:          23984ce5cd ("Avoid resource deadlocks when one domain has exhausted its memory."...)
MFC after:      10 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D51251

(cherry picked from commit 637d9858e6)
2025-09-19 12:07:04 +02:00
Olivier Certner 9b8f6e2d75 vm_domainset: Simplify vm_domainset_iter_next()
As we are now visiting each domain only once, the test in
vm_domainset_iter_prefer() about skipping the preferred domain (the one
initially visited for policy DOMAINSET_POLICY_PREFER) becomes redundant.
Removing it makes this function essentially the same as
vm_domainset_iter_rr().

Thus, remove vm_domainset_iter_prefer().  This makes all policies behave
the same in vm_domainset_iter_next().

No functional change (intended).

PR:             277476
MFC after:      10 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D51250

(cherry picked from commit d0b691a7c1)
2025-09-19 12:07:03 +02:00
Olivier Certner da257e519b vm_domainset: Only probe domains once when iterating, instead of up to 4 times
Because of the 'di_minskip' logic, which resets the initial domain, an
iterator starts by considering only domains that have more than
'free_min' pages in a first phase, and then all domains in a second one.
Non-"underpaged" domains are thus examined twice, even if the allocation
can't succeed.

Re-scanning the same domains twice just wastes time, as allocation
attempts that must not wait may rely on failing sooner and those that
must will loop anyway (a domain previously scanned twice has more pages
than 'free_min' and consequently vm_wait_doms() will just return
immediately).

Additionally, the DOMAINSET_POLICY_FIRSTTOUCH policy would aggravate
this situation by reexamining the current domain again at the end of
each phase.  In the case of a single domain, this means doubling again
the number of times domain 0 is probed.

Implementation consists in adding two 'domainset_t' to 'struct
vm_domainset_iter' (and removing the 'di_n' counter).  The first,
'di_remain_mask', contains domains still to be explored in the current
phase, the first phase concerning only domains with more pages than
'free_min' ('di_minskip' true) and the second one concerning only
domains previously under 'free_min' ('di_minskip' false).  The second,
'di_min_mask', holds the domains with less pages than 'free_min'
encountered during the first phase, and serves as the reset value for
'di_remain_mask' when transitioning to the second phase.

PR:             277476
Fixes:          e5818a53db ("Implement several enhancements to NUMA policies.")
Fixes:          23984ce5cd ("Avoid resource deadlocks when one domain has exhausted its memory."...)
MFC after:      10 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D51249

(cherry picked from commit d440953942)
2025-09-19 12:06:55 +02:00
Zhenlei Huang 7efef20a8d sx: Sprinkle const qualifiers where appropriate
No functional change intended.

MFC after:	2 weeks

(cherry picked from commit 306f0c4cf1)
2025-09-19 10:00:51 +08:00
Zhenlei Huang 6626e0af0b rwlock: Sprinkle const qualifiers where appropriate
No functional change intended.

MFC after:	2 weeks

(cherry picked from commit 3c3686b3c7)
2025-09-19 10:00:51 +08:00
Zhenlei Huang 662d5359dd rmlock: Sprinkle const qualifiers where appropriate
No functional change intended.

MFC after:	2 weeks

(cherry picked from commit bec0532010)
2025-09-19 10:00:51 +08:00
Zhenlei Huang 2ab1b6b2d3 mtx: Sprinkle const qualifiers where appropriate
No functional change intended.

MFC after:	2 weeks

(cherry picked from commit 7bbfcc5408)
2025-09-19 10:00:50 +08:00
Zhenlei Huang a876cfb54c kenv: Sprinkle const qualifiers where appropriate
No functional change intended.

MFC after:	2 weeks

(cherry picked from commit 2a0ed0bef2)
2025-09-19 10:00:50 +08:00
Isaac Freund 2bf7d850c5 release: use sets to select base packages
The introduction of package sets allows us to replace the current
fragile string matching with this simpler and more robust alternative.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 seconds
Reviewed by:	emaste, ivy
Differential Revision:	https://reviews.freebsd.org/D52592

(cherry picked from commit 6cdca18d79b9e247d8a34e266fe2215e4bfa1b05)
2025-09-19 02:18:42 +01:00
Lexi Winter e554d44c3a bsdinstall: Use package sets for pkgbase install
Update the pkgbase component selection dialogue to take the components
list from the meta-package sets available on the install media, except
for "kernel" which is still handled magically.

Always install "minimal", and by default select "base", "kernel-dbg"
and any libcompat sets (e.g., lib32) if they're available.

Replace the various "dbg" options with a single "debug" component that
installs the debug symbols for all the components the user selected,
except for kernel since we handle that separately and it's common to
want kernel debugs symbols without userland debug symbols.

MFC after:	3 seconds
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D52558

(cherry picked from commit 55ba5550d25d58144007ae02b07450ec8cda7ee5)
2025-09-19 02:18:41 +01:00
Lexi Winter 957875ebcf packages: Add a mandoc package
Move mandoc to its own package so users can install it independently of
-utilities.  Put the package in the minimal set, since we also ship
manpages in minimal and "man" is a basic Unix utility.

Add a pkg-triggers(5) hook to run makewhatis when new manpages are
installed, so that apropos(1) works.  This depends on a new pkg(8)
feature expected to be in in the upcoming 2.3.2 release; in the mean
time, this is a no-op (i.e., having an older pkg doesn't break anything,
it just won't run the trigger).

MFC after:	3 seconds
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D52564

(cherry picked from commit ea5e50c298)
2025-09-19 02:18:41 +01:00
Lexi Winter 22ae80be55 packages: Remove the tests-dev package
We don't want a tests-dev package, because this means set-devel depends
on tests-dev, which transitively depends on tests, which means you can't
install set-devel without also getting tests.

The only real "dev" files in tests-dev are from ATF (libprivateatf),
so move that to its own package and add a dependency from tests.

Also move Kyua to its own package, since this might be useful for
running tests even when the user doesn't want the whole set of base
tests installed.

Add a dependency from -tests to both -atf and -kyua, and a dependency
on -set-base, since the tests won't work without the full base system
installed.

The remaining "dev" files in tests are actually test artifacts, not real
development libraries.  Add a new NO_DEV_PACKAGE option to bsd.lib.mk,
which causes dev files to be installed in the base package instead of
creating a -dev package, and set this option for everything that
installs test libraries.

While here, add a slightly more informative description for the tests
package.

MFC after:	3 seconds
Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D52597

(cherry picked from commit 9065390ddc)
2025-09-19 02:17:29 +01:00
Lexi Winter f3cc44c118 packages: Move kernel-man to the minimal set
Currently this is in the "kernels" set, which doesn't make sense
because it's not a kernel.

Move it to the "minimal" set, on the basis that minimal already includes
a bunch of manpages, and a user who installs with minimal expects that
e.g. "man ix" will work.

MFC after:	3 seconds
Reported by:	des
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D52560

(cherry picked from commit a2783fb754)
2025-09-19 02:17:28 +01:00
Lexi Winter 8f1cddbf0c packages: Mark all sets as vital
At least "minimal" must be vital, because it's required for a functional
system.  For example, we might create new packages in the future which
are required for the multi-user system and are part of the minimal set,
so it's important that users don't remove set-minimal to ensure they get
those new packages.

For the other sets, it's debatable whether they should be vital or not,
but let's start out with the assumption that if the user installed a
set, they should have to have to explicit request it be removed.  This
means if, for example, they install set-devel, then remove lldb, pkg
won't remove set-devel and cause the next "pkg autoremove" to remove
everything else that was in set-devel.

We might want to adjust this later (or possibly adjust the behaviour
of pkg(8) itself) based on user feedback.

While here, fix a typo in the description of the devel set.

Suggested by:	bapt
MFC after:	3 seconds
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D52562

(cherry picked from commit 9537aa02f4)
2025-09-19 02:17:28 +01:00
Lexi Winter 6a31dbc16e packages: Add minimal-jail set
This is minimal, but without bootloader, hardware and networking support
that's typically not required in jails.

This requires extending the 'set' annotation to be a comma-separated
list, so that packages can be in multiple sets.

MFC after:	3 seconds
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D52591

(cherry picked from commit 9b7bddfd08)
2025-09-19 02:17:28 +01:00
Isaac Freund 4b9edaa813 packages: remove tests from base set
Create a new tests package set to hold the tests, which are not useful
to all users and don't belong in the base set.

Reviewed by:	emaste, ivy
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52574

(cherry picked from commit 36edc5014f)
2025-09-19 02:17:28 +01:00
Isaac Freund 297a665072 packages: remove src from base set
The FreeBSD-src package is the largest single pkgbase package at 158M
currently. Remove it and FreeBSD-src-sys (87M) from the base set as
they are not useful to all users.

Reviewed by:	emaste, ivy
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52573

(cherry picked from commit 87a78d9618)
2025-09-19 02:17:28 +01:00
Lexi Winter 351bf9563a share/man/man[49]: Set PACKAGE=kernel-man
When MANSPLITPKG is disabled (which is now the default), the kernel
manpages in sections 4 and 9 are installed in the -kernel package
instead of the -kernel-man package, because bsd.man.mk doesn't add
the -man suffix.

Since we already have handling for kernel-man in generate-ucl.lua,
set PACKAGE=kernel-man to make sure they're always in the right
package.

To avoid creating -kernel-man-man when WITH_MANSPLITPKG is enabled,
add some logic to bsd.man.mk (suggested by kevans) to avoid adding
the -man suffix if the package already has a -man suffix, and while
here, ensure ${__group}PACKAGE is always defined.

MFC after:	3 seconds
Reviewed by:	des, bapt
Differential Revision:	https://reviews.freebsd.org/D52525

(cherry picked from commit 6d83ae143b)
2025-09-19 02:17:28 +01:00
Lexi Winter bcf3a9e040 bridge: Do outbound VLAN filtering in bridge_enqueue
Outbound VLAN filtering wasn't being done for host-originated frames,
because bridge_output was missing a call to bridge_vfilter_out, like
in bridge_forward and bridge_broadcast.

Rather than adding another call, move the filtering to bridge_enqueue,
which ensures all frames will be filtered.  This slightly changes the
observable behaviour since we now do pfil before vlan filtering, but
that's probably closer to what users expect anyway.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52380

(cherry picked from commit 6a888f6241)
2025-09-19 02:17:28 +01:00
Lexi Winter 00ae91fa64 packages: Add meta-package sets
Add several metapackages which contain no files themselves, but depend
on other packages.  This allows the user to install a system by using
a set like "FreeBSD-set-minimal" instead of having to know which
specific packages are required, and it means if we add more package
in the future, existing installations will get them automatically as
long as they were installed using a set.

The defined sets are significantly less granular than the actual
packages; the assumption is that users who want a very specific set of
packages installed can do that manually, while sets are intended more
for typical users who just want to install FreeBSD.

The following sets are defined:

* minimal: the set of packages required to boot the system and bring
  up a multi-user UNIX system.  This includes hardware support,
  networking (wireless, DHCP), basic functionality like syslogd, cron
  and periodic.  It does not include a kernel, because the kernels are
  quite large and the user might want to use a custom kernel.

  sendmail and DMA are not included in minimal.  Since we provide two
  MTAs, the user should select which one they want, or install one from
  ports.  sshd is not included because it's not required for the base
  system, and the user might want to install it from ports.

  Some other significant subsystems (e.g. NFS, Kerberos) are also not
  included.

  The minimal set does not include any libraries itself, since we rely
  on dependencies to pull these in.  This implies it doesn't include
  library manpages, which is fine, since users won't want manpages for
  libraries unless they've also installed the development packages.

* devel: the compiler toolchain for building software, along with all
  "-dev" packages which include header files and static libraries.

* lib32: 32-bit compatibility packages.  This includes both runtime
  and development packages.

* kernels: the kernel packages.  For freebsd.org builds, this will be
  GENERIC, GENERIC-DEBUG, etc., for custom builds it will be whatever
  was set in $KERNCONF.

* base: everything else; this includes the entire base system.

For each set, also generate a <setname>-dbg set containing the debug
packages for the set.

The sets are built along with the rest of the packages using a new
script called create-sets.sh, which examines the "set" annotation in
each package and puts it in the appropriate set.  This is in
anticipation of the later "groups" feature appearing in pkg itself, at
which point we can simply replace the set annotation with the group.

MFC after:	3 days
Reviewed by:	imp, bapt
Differential Revision:	https://reviews.freebsd.org/D52412

(cherry picked from commit 66f36c3686)
2025-09-19 02:17:27 +01:00
Lexi Winter 74e73673d5 packages: Add correct license for zoneinfo
Source: contrib/tzdata/LICENSE

MFC after:	3 days
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D51886

(cherry picked from commit 163f8625c4)
2025-09-19 02:17:27 +01:00
Lexi Winter f0971db258 packages: Use LIB_PACKAGE for zfs and ufs packages
Commit f9513c334f moved the shared libraries for ZFS and UFS into
separate packages (libzfs and libufs), which resulted in a rather
large number of packages being created, e.g. for ZFS:

FreeBSD-libzfs
FreeBSD-libzfs-dbg
FreeBSD-libzfs-dbg-lib32
FreeBSD-libzfs-dev
FreeBSD-libzfs-dev-lib32
FreeBSD-libzfs-lib32
FreeBSD-zfs
FreeBSD-zfs-dbg
FreeBSD-zfs-dbg-lib32
FreeBSD-zfs-dev
FreeBSD-zfs-dev-lib32
FreeBSD-zfs-lib32
FreeBSD-zfs-man

Use LIB_PACKAGE instead, which significantly reduces the number of
packages:

FreeBSD-zfs
FreeBSD-zfs-dbg
FreeBSD-zfs-dbg-lib32
FreeBSD-zfs-dev
FreeBSD-zfs-dev-lib32
FreeBSD-zfs-lib
FreeBSD-zfs-lib32
FreeBSD-zfs-man

MFC after:	3 days
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D52416

(cherry picked from commit 29185c9a26)
2025-09-19 02:17:27 +01:00
Lexi Winter 7e9f0bf1c0 packages: Turn off MANSPLITPKG by default
Manpages are very small, and having a separate manpages package for
every base package is quite annoying for users.  Turn this option
off by default.

Discussed with:	bapt
Reviewed by:	manu, emaste
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D52417

(cherry picked from commit a8a18eeb5e)
2025-09-19 02:17:27 +01:00
Steve Kargl 92801ed024 lib/msun: cpow{,f,l}(CMLX(0.0, 0.0)) should return 1.0
PR:	289447

(cherry picked from commit 8b41ba845c)
2025-09-19 03:58:53 +03:00
Alexander Ziaee c8d87fd983 rmuser.sh: Improve prompt consistency with adduser
While here, improve userlist error message.

PR:			289399
MFC after:		3 days
Reviewed by:		kbowling, rgrimes
Approved by:		kbowling, rgrimes (src)
Reported by:		michaeldexter, rgrimes
Differential Revision:	https://reviews.freebsd.org/D52464

(cherry picked from commit fc68f8aac6)
2025-09-18 20:45:25 -04:00
Zhenlei Huang bd721f6e80 tslog: Move sysinit_tslog_shim() into kern_tslog.c
struct sysinit's func pointer requires its address, thus a real function
is generated in every translation unit when the source file has SYSINITs
declared. That results in plenty of identical sysinit_tslog_shim in the
final kernel file, in which only one is used and others are left useless.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52413

(cherry picked from commit 5f9a05e574)
2025-09-19 00:15:53 +08:00
Zhenlei Huang 6fb046515e qlnxe: Report speeds in decimal format
It is more natural to read the speed in decimal format than hexadecimal
one.

Spotted this while diagnosing PR 287445,

```
[__ecore_configure_pf_max_bandwidth:6864(qlnx-0)]Configured MAX bandwidth to be 000061a8 Mb/sec
[__ecore_configure_pf_min_bandwidth:6922(qlnx-0)]Configured MIN bandwidth to be 750 Mb/sec
```

Reviewed by:	kbowling
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52376

(cherry picked from commit e1c5e04396)
2025-09-19 00:15:52 +08:00
Zhenlei Huang 817bc70092 qlnxe: Support SIOCGIFXMEDIA ioctl
ifconfig(8) will try SIOCGIFXMEDIA first and then retry SIOCGIFMEDIA if
that fails. Since the driver reports extended media types, support
SIOCGIFXMEDIA ioctl directly rather than doing another round.

Reviewed by:	kbowling
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52375

(cherry picked from commit 6e3c8c0f70)
2025-09-19 00:15:52 +08:00
Zhenlei Huang 5aa49c98ed qlnxe: Unconditionally enable extended media types
Those extended media types are available since about 2015 [1]. All
supported branches already have them defined.

No functional change intended.

[1] eb7e25b22f ifmedia changes: Extend the number of available subtypes for Ethernet media ...

Reviewed by:	kbowling
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D52374

(cherry picked from commit 08356a733e)
2025-09-19 00:15:52 +08:00
Li-Wen Hsu e8d181eeb2 udbc(4): connect to build
Reviewed by:	thj
MFC with:	d566b6a70b
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a75c3c2c63)
2025-09-18 13:53:13 +01:00
Tom Jones 46e6e91738 udbc: Add usb debug host mode driver
xhci offers a debugging interface which uses a special usb 3 cable with the D+,
D- and VBUS pairs disconnected. This interface allows a target device to
configure its xhci controller as a debugging channel which can then be used to
provide a serial link between the target and a debug host.

This change extracts the udbc host mode driver from hrs@'s xhci debug
implementation.

Reviewed by:	bcr (man page)
MFC after:	Before 15-ALPHA3 builds
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D51299

(cherry picked from commit d566b6a70b)
2025-09-18 13:53:13 +01:00
Christos Margiolis 3501e2597e sdp(3): Change bdaddr parameter type in sdp_register_service()
Fixes compiler error when the caller passes a const bdaddr_t *
paramemeter (e.g., NG_HCI_BDADDR_ANY).

Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D52582

(cherry picked from commit 3d14cc82d7)
2025-09-18 12:57:22 +03:00
Mark Johnston 3ed8934310 ng_btsocket_rfcomm: Mark a couple buffers as const in a helper function
Fixes:	680f9acc36 ("ng_hci: Cast NG_HCI_BDADDR_ANY to const bdaddr_t *")
(cherry picked from commit 18fd3f8ec5)
2025-09-18 12:57:07 +03:00
Christos Margiolis 8813774ceb ng_hci: Cast NG_HCI_BDADDR_ANY to const bdaddr_t *
This is needed to address some compiler errors cleanly, where consumer
functions want this address to be a const pointer.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	markj
Differential Revision: https://reviews.freebsd.org/D52310

(cherry picked from commit 680f9acc36)
2025-09-18 12:57:07 +03:00
Olivier Certner 7140f620a5 jail.2: Mention EPERM is returned on open directories
The manual page does not directly mention this reason for getting EPERM,
instead referring the reader to chroot(2).  We have had some questions
about it recently, in part due to a bug (fixed), and this case is not an
obvious permission/problem, so let's be more explicit.

PR:             280809
Reviewed by:    jamie
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52319

(cherry picked from commit ef2f36be8f)
2025-09-18 10:50:31 +02:00
Kyle Evans 2e71d10524 libc: fix the _FORTIFY_SOURCE build of getgrouplist(3)
We need <unistd.h> to get our prototype normally, but WARNS in libc is
way too low to surface that.

Additionally, _FORTIFY_SOURCE needs to include <ssp/unistd.h> by way of
<unistd.h> to actually export an implementation of getgrouplist(3).  The
version defined in the .c gets named __ssp_real_getgrouplist() and the
actual implementation comes from the redirect stub in <ssp/unistd.h>,
which basically gets optimized away in the built object because our
__builtin_object_size() check is trivially false when we cannot resolve
any object sizes in this translation unit.

This could be argued as a design flaw in _FORTIFY_SOURCE, but we should
grab <unistd.h> for our prototype anyways so let's kick the can down
the road instead of re-thinking it for 15.0.

Reported by:	Shawn Webb (HardenedBSD)
Fixes:		d3f8ed6066 ("getgrouplist(3): Remove superfluous [...]")
MFC after:	3 days

(cherry picked from commit 91ea7e2ce2)
2025-09-18 10:50:31 +02:00
Olivier Certner b5bd974601 getgrouplist(3): Remove superfluous headers, bogus comment and whitespace
No functional change (intended).

Fixes:          a59d6a8724 ("Implementing 'fallback' nsswitch source.")
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit d3f8ed6066)
2025-09-18 10:50:31 +02:00
Olivier Certner 32606eb5c4 'kern.proc.groups' sysctl knob: Restore outputting the effective GID
In particular, fixes 'procstat -s' on a live system (for processes with
more than 16 groups).

Reviewed by:    kib, emaste
Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      9 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52261

(cherry picked from commit faf7e99375)
2025-09-18 10:50:31 +02:00
Olivier Certner 53a9f16190 kvm_proclist(): Restore outputting the effective GID
In particular, fixes 'procstat -s -M' (only if there are less than 16
groups).

Reviewed by:    kib, emaste
Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      9 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52260

(cherry picked from commit 7676df2fae)
2025-09-18 10:50:30 +02:00
Olivier Certner 74d3fdf040 kinfo_proc: Restore outputting the effective GID
In particular, fixes 'procstat -s' on a live system or a core file (only
if there are less than 16 groups).

Reviewed by:    kib
Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      9 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52259

(cherry picked from commit 63a40ca813)
2025-09-18 10:50:30 +02:00
Olivier Certner 96a2fc5643 imgact_elf: procstat groups: Restore sending the effective GID
Fixes 'procstat -s' run on a core file when the number of groups in
effect at the moment of core dump exceeds KI_NGROUPS (16).

Reviewed by:    kib
Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      9 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52258

(cherry picked from commit 5568b4441d)
2025-09-18 10:50:30 +02:00
Olivier Certner 79c1160fb9 procfs: Restore printing the effective GID in 'status'
Reviewed by:    kib
Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      9 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52257

(cherry picked from commit d859d4c57e)
2025-09-18 10:50:29 +02:00
Olivier Certner 702888ce72 nfscl: Restore sending the effective GID to the server
Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      9 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52256

(cherry picked from commit 71db323476)
2025-09-18 10:50:29 +02:00
Olivier Certner a5e6ecb889 nfs: newnfs_setroot(): Remove an obsolete comment
This comment is obsolete, as:
1. This code is FreeBSD-specific and is not shared with other BSDs.
2. With our recent changes in commit be1f7435ef ("kern: start
   tracking cr_gid outside of cr_groups[]"), all of NetBSD, OpenBSD and
   FreeBSD have the effective GID in a separate field (DragonFlyBSD
   remains to this day an outlier).

MFC after:      9 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52254

(cherry picked from commit 67f8bd5986)
2025-09-18 10:50:29 +02:00
Olivier Certner 97a56375ca hwt: On attach, ensure owner is a target effective GID's member
This restores a check that existed prior to commit be1f7435ef
("kern: start tracking cr_gid outside of cr_groups[]").

Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      9 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52253

(cherry picked from commit d9e11f01ef)
2025-09-18 10:50:29 +02:00
Olivier Certner 30ea55ff5e hwpmc: On attach, fix allowing a PMC's owner to attach it to itself
The returned value in this case was wrong, and would basically prevent
some PMC's owner process to attach that PMC to itself although the
security checks underneath would have allowed it.

Now that this early return has been fixed, its block basically becomes
a performance short-circuit which has no effect from a functional
standpoint.

Fixes:          ebccf1e3a6 ("Bring a working snapshot of hwpmc(4), ...")
MFC after:      9 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 1c40b15971)
2025-09-18 10:50:28 +02:00
Olivier Certner 018b8acde0 hwpmc: On attach, ensure owner is a target effective GID's member
This restores a check that existed prior to commit be1f7435ef
("kern: start tracking cr_gid outside of cr_groups[]").

While here, improve pmc_can_attach()'s style by changing the type of
'decline_attach' to 'bool', fixing tests on it, adding missing
parentheses to 'return' statements, and by changing its return value
type to 'bool'.

Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      9 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52252

(cherry picked from commit 1c3c698ba4)
2025-09-18 10:50:28 +02:00
Olivier Certner 960dbe036d ddb ps: Print again the effective GID, separately
Following commit be1f7435ef ("kern: start tracking cr_gid outside
of cr_groups[]"), cr_groups[] doesn't contain the effective GID anymore.
Fix the 'show proc' DDB command to show it again, and make it stand out
with respect to the supplementary ones.

Fixes:          be1f7435ef ("kern: start tracking cr_gid outside of cr_groups[]")
MFC after:      9 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52251

(cherry picked from commit de974a0f1b)
2025-09-18 10:50:22 +02:00
Michael Osipov 221a5fb331 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 f304c5bb8b)
2025-09-17 22:29:50 +02:00
Baptiste Daroussin 3767aeec35 usb_vendors: update to 2025-07-26
(cherry picked from commit 70afc95fc6)
2025-09-17 21:34:47 +02:00
Baptiste Daroussin c3f0a93e70 pci_vendors: update to 2025-07-11
(cherry picked from commit 2e72bd4229)
2025-09-17 21:34:47 +02:00
Seyed Pouria Mousavizadeh Tehrani ab41f840e7 pkg(7): Add support for pkg+ prefix to bootstrap pubkey
MFC After: 	1 day
Sponsored by:	Amn Afzar Hoopad Inc
Differencial Revision:	https://reviews.freebsd.org/D52418

(cherry picked from commit 08b8843137)
2025-09-17 21:34:46 +02:00
Jesús Daniel Colmenares Oviedo 24e5700d47 nuageinit: Add doas support
* Set mode of etc directory to 0755.
* Use user.localbase sysctl instead of /usr/local.
* Add test case for doas.
* Set ${LOCALBASE} instead of /usr/local in nuageinit(7) man page.

Reviewed by:            bapt@
Approved by:            bapt@
Differential Revision:  https://reviews.freebsd.org/D52437

(cherry picked from commit 9a829e8656)
2025-09-17 21:33:57 +02:00
Jesús Daniel Colmenares Oviedo 4a01ddbcd6 nuageinit: Allow the use of network parameters from network-config
To better comply with the cloud-init specification, we need to
support the configuration of network-related parameters from
the network-config file, which is common in most deployments.

Reviewed by:            bapt@
Approved by:            bapt@
Differential Revision:  https://reviews.freebsd.org/D52419

(cherry picked from commit 95230b248f)
2025-09-17 21:33:57 +02:00
Jesús Daniel Colmenares Oviedo dd293fbc08 nuageinit: Add me to copyright list
Approved by:    bapt@

(cherry picked from commit 18555060dc)
2025-09-17 21:33:57 +02:00
Jesús Daniel Colmenares Oviedo a00410fa19 nuageinit: chmod sudoers directory instead of chmod (again) sudoers file
* Set mode of sudoers to 0440.

Reviewed by:            bapt@, jlduran@
Approved by:            bapt@, jlduran@
Differential Revision:  https://reviews.freebsd.org/D52438

(cherry picked from commit a5cc9b7b96)
2025-09-17 21:33:56 +02:00
Jesús Daniel Colmenares Oviedo 7a7f44d618 nuageinit: Remove duplicate description of users.{user}.groups
Reviewed by:            bapt@
Approved by:            bapt@
Differential Revision:  https://reviews.freebsd.org/D52436

(cherry picked from commit 9f3330f522)
2025-09-17 21:33:56 +02:00
Stefan Eßer 4c178fe36e contrib/bc upgrade to version 7.1.0
This update fixes a few bugs:
- Improper response to double SIGINT with editline.
- Not letting libedit handle terminal size changes.
- A dc crash from improperly handling an error.
- A duplicate check for reference arrays.
- Build failures with GCC 15.

Merge commit '682da5a0fdb2c38ecc3951047a882471d62aa1d1'

(cherry picked from commit fdc4a7c801)

usr.bin/gh-bc: fix invocation of test scripts

The “all.sh” script in version 7.1.0 accepts one less parameter for
selecting the tests to be run.

(cherry picked from commit 1a6ffcb27d)

usr.bin/gh-bc: update for version 7.1.0

Add extra defines required for bc-7.1.0 to the Makefiles.

(cherry picked from commit 2d06844521)
2025-09-17 18:25:56 +02:00
Damjan Jovanovic 0caba70938 sound: Honor CHN_F_NBIO
If the device is opened with O_NONBLOCK, even though we check for it in
order to set CHN_F_NBIO, the subsequent chn_reset() calls will clear all
flags, except those set in CHN_F_RESET, which does not include
CHN_F_NBIO.

Add CHN_F_NBIO to CHN_F_RESET. Additionally, because primary channels
can be reused, make sure we do not unintentionally keep CHN_F_NBIO set
if the channel is re-opened, but without O_NONBLOCK.

PR:		289441
MFC after:	2 days
Reviewed by:	christos, markj
Differential Revision:	https://reviews.freebsd.org/D52493

(cherry picked from commit e8b5025c38)
2025-09-17 12:27:06 +03:00
Kristof Provost 6e00a34c76 ifconfig: also fix removing IPv6 addresses without netlink
Reported by:	bdrewery
MFC after:	1 week
See also:	da50f49977
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit c8fb5a4d03)
2025-09-17 10:08:16 +02:00
Colin Percival 37de183f06 release: CLEANDIRS += pkgdb
This directory gets created by pkgbase-stage.lua.

MFC after:	3 days
Sponsored by:	https://www.patreon.com/c/cperciva

(cherry picked from commit fa9ea99be6)
2025-09-16 19:45:26 -07:00
Ed Maste f9d8f808b2 src.conf.5: Regen 2025-09-16 21:01:05 -04:00
Ed Maste 79e4dfe2a5 libc: Have memcmp test what the standard requires
libc's C memcmp currently returns the difference in byte values rather
than just -1/0/1 as the AArch64 assembly implementation, many non-
FreeBSD implementations, and compiler built-in optimizations do.

It is a bug for a user to expect memcmp to return the difference in the
byte values as the compiler is free to inline memcmp() with an
implementation that does not do this.  Change the test to validate only
what the standard requires.

PR:		289084
Reviewed by:	markj, fuz
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D52502

(cherry picked from commit e0eaabb80d)
2025-09-16 13:34:32 -04:00
Dag-Erling Smørgrav f6ff04831a uptime: Mention libxo support in manual page
MFC after:	3 days
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D52489

(cherry picked from commit 55bd607b99)
2025-09-16 13:27:45 +00:00
Dag-Erling Smørgrav 340f2a6513 src.sys.mk: Support src.conf in SRCTOP
If SRCCONF is not defined and src.conf exists at the top level of the
source tree, use that instead of /etc/src.conf.

MFC after:	3 days
Reviewed by:	kevans, imp
Differential Revision:	https://reviews.freebsd.org/D52470

(cherry picked from commit dd8c666d8b)

UPDATING: mention the src.conf change

Fixes:		dd8c666d8b ("src.sys.mk: Support src.conf in SRCTOP")
(cherry picked from commit ab2fea3f9a)
2025-09-16 13:27:43 +00:00
Ingo Schwarze 668fbde7df man: Add -l option
Add a -l option which causes man to interpret all arguments as paths to
open directly rather than man pages to search for in MANPATH.  See the
PR for a detailed rationale.

PR:		289245
MFC after:	1 week
Reviewed by:	ziaee, emaste
Differential Revision:	https://reviews.freebsd.org/D52385

(cherry picked from commit 14b61b2e93)
2025-09-16 13:05:52 +00:00
Dag-Erling Smørgrav abe8e3aece unbound: Update to 1.23.1
Release notes at
	https://nlnetlabs.nl/news/2025/Jul/16/unbound-1.23.1-released/

Since we don't enable ECS, this is mostly a nop for us.

Merge commit 'c8864f6ba46ff3271d97b4ae1c3cc6ce01eaf18a'

MFC after:	3 days

(cherry picked from commit 5a0119491a)
2025-09-16 13:05:52 +00:00
Konstantin Belousov c2427a67c7 kern/kern_event.c: properly spell COMPAT_FREEBSD32
PR:	289504

(cherry picked from commit cab4cf201a)
2025-09-16 05:45:13 +03:00
Konstantin Belousov 1234bd1b72 geom: only set TDP_GEOM for user threads
PR:	289204

(cherry picked from commit b0474e1489)
2025-09-16 05:45:12 +03:00
Konstantin Belousov 7140a4790c kern_thr_exit(): clear kASTs in advance
PR:	289204

(cherry picked from commit f51d7d5139)
2025-09-16 05:45:12 +03:00
Bjoern A. Zeeb b0469fa7f1 LinuxKPI: 802.11: avoid recursive wiphy lock
When freeing the last reference of the net80211 node the net80211
node_free() code may directly call into the crypto code to delete
the keys.  While we still holding the wiphy lock this would lead to
a recursion on the non-recursive wiphy lock.  Defer freeing the
reference until we are back under the net80211 com lock.

Reported by:	Mark Phillips (mark freebsdfoundation.org) on 15.0-ALPHA1

(cherry picked from commit 3c38dce87e)
2025-09-15 14:53:07 +00:00
Bjoern A. Zeeb f20a09e161 LinuxKPI: devres: divorce dem_kfree from lkpi_devm_kmalloc_release
dem_kfree() is called from all over the place and should actually
do something;  contrary to lkpi_devm_kmalloc_release() it can also
take a const void *.  We have to __DECONST() that though as the
entire devres framework does otherwise not take a const argument.

This was discovered during the rtw89 upadte to 6.16.

Sponsored by:	The FreeBSD Foundation (initially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52082

(cherry picked from commit 4ab64e3491)
2025-09-15 14:53:01 +00:00
Bjoern A. Zeeb 88122c8eb7 LinuxKPI: maths64: implement roundup_u64()
Needed by a wifi driver update.

Sponsored by:	The FreeBSD Foundation (initially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52080

(cherry picked from commit 2a44e10edb)
2025-09-15 14:52:54 +00:00
Bjoern A. Zeeb 3753913c9e LinuxKPI: kunit: add static_stub.h and more dummy headers
These came up during a wifi driver update.

Sponsored by:	The FreeBSD Foundation (initially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52079

(cherry picked from commit 7c47393362)
2025-09-15 14:52:49 +00:00
Bjoern A. Zeeb cd2bd8bf67 LinuxKPI: sync overflow.h from Linux v6.16
It seems overflow.h wsa imported directly from Linux in 3208d4ad2b.
Update the file to the newer version as needed for wireless driver updates.

Sponsored by:	The FreeBSD Foundation (initially)
Obtained from:	git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
		038d61fd642278 (tag: v6.16)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52078

(cherry picked from commit 70c508e691)
2025-09-15 14:52:42 +00:00
Bjoern A. Zeeb 310885b40a LinuxKPI: add __struct_size
Use __builtin_object_size() by default.
If __builtin_dynamic_object_size() is available use that instead.

I would hope that in a future version we can remove the conditional
checks but in order to be able to MFC this without checking all
compiler versions simply keep it this way for now.

Sponsored by:	The FreeBSD Foundation (initially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52077

(cherry picked from commit ff5bcb7428)
2025-09-15 14:52:36 +00:00
Bjoern A. Zeeb 4d5a78c5f4 LinuxKPI: add DEFINE_LOCK_GUARD_0 for rcu
This adds guard support for non-real-types like rcu locking meaning
that we need to keep the lock state separately ourselves.  _T is still
special and needs to be updated.  Given it may not be used it needs
an __unused attribute (we are using the LinuxKPI __maybe_unused which
indeed is more expressive in this case).

Sponsored by:	The FreeBSD Foundation (initially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52076

(cherry picked from commit 3f48a0fe53)
2025-09-15 14:52:31 +00:00
Bjoern A. Zeeb 830cc677d9 LinuxKPI: cleanup: implement __free() and DEFINE_FREE(); use for kfree()
A wifi driver update needs this.

Sponsored by:	The FreeBSD Foundation (initially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52075

(cherry picked from commit 39e9290d89)
2025-09-15 14:52:25 +00:00
Bjoern A. Zeeb 88198564db LinuxKPI: timer KPI *_timer -> timer_*
del_timer() got renamed to timer_delete() approximately in Linux 6.2
(similar for *_sync and likely others).
Keep the old functions as compat; unclear when we can gc them.
We should also re-define them with a linuxkpi_ prefix to avoid possible
conflicts in the future if we do a full pass over this at some point.

Sponsored by:	The FreeBSD Foundation (intiially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52074

(cherry picked from commit 5cb64a1d3f)
2025-09-15 14:51:48 +00:00
Bjoern A. Zeeb 352be5b48b LinuxKPI: rename from_timer() to timer_container_of()
With Linux 6.16 from_timer() got renamed to timer_container_of(); add
the LINUXKPI_VERSION check with a default to the current version.
Update all in-tree consumers (apart from wireless drivers managed
otherwise).

Sponsored by:	The FreeBSD Foundation (initially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52073

(cherry picked from commit 81cb7c4c8e)
2025-09-15 14:51:41 +00:00
Bjoern A. Zeeb aa673b7101 LinuxKPI: acpi; fix type to acpi_get_handle()
The native AcpiGetHandle() and acpi_get_handle() take a
const char * argument for pathname and not an acpi_string (char *).
For that they spell it out fully as 'const char *', so should we.

Sponsored by:	The FreeBSD Foundation (intially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52072

(cherry picked from commit c1264b6238)
2025-09-15 14:51:36 +00:00
Bjoern A. Zeeb ab45c85937 LinuxKPI: correct the LINUXKPI_VERSION check for abs_diff()
The code introduced abs_diff() as migrated from drm to standard
linux headers.  The LINUXKPI_VERSION check did not allow this to
be visible by default in-tree.  Make sure the v6.6 check is optional.
drm-kmod always defines LINUXKPI_VERSION so this should be fine.

Sponsored by:	The FreeBSD Foundation (initially)
Fixes:		afc450fac9
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52071

(cherry picked from commit 736b16e88d)
2025-09-15 14:51:26 +00:00
Bjoern A. Zeeb 8fca57469f LinuxKPI: pci: allow children to be attached to a pci_dev
This will be used for hooking suspend/resume in for LinuxKPI 802.11
based drivers.

Sponsored by:	The FreeBSD Foundation (initially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52070

(cherry picked from commit 627234627b)
2025-09-15 14:51:18 +00:00
Bjoern A. Zeeb ff31767e53 LinuxKPI: pci: implement [linuxkpi_]pcim_request_all_regions()
Factor out the pci_request_region() implementation into an internal
function and make pci_request_region() a simple wrapperaround it.
Likewise implement pcim_request_all_regions() as a loop calling
pci_request_region() for each entry.

In two cases which we returned an error before (bar index is valid but
bar is not (no len), and neither IO nor MEM) we now reutrn success
(nothing to do for us).  Otherwise callers, especially
pcim_request_all_regions() would error out for the wrong reasons.
This seems to also match the expected behaviour of pci_request_region().

Sponsored by:	The FreeBSD Foundation (intially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52068

(cherry picked from commit 7e21158d44)
2025-09-15 14:51:12 +00:00
Bjoern A. Zeeb cfb8f4bf2c LinuxKPI: pci: implement pcim_iomap()
Like pci_iomap() add the devres version pcim_iomap() using the former
to get the resource.

Add a helper function to validate that the bar is within a valid range
and sprinkle that check also to other related functions.

Sponsored by:	The FreeBSD Foundation (intially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52067

(cherry picked from commit 2f9064a5d2)
2025-09-15 14:51:01 +00:00
Bjoern A. Zeeb 68f8fa4ada LinuxKPI: pci: implement for_each_pci_dev() and improve pci_get_device()
Implement for_each_pci_dev() needed by a wireless driver update.
For that also improve pci_get_device() and add the functionality to
support the odev argument to start searching from that.

Sponsored by:	The FreeBSD Foundation (intially)
Reviewed by:	dumbbell
Differential Revision:	https://reviews.freebsd.org/D52066

(cherry picked from commit 910cf345d0)
2025-09-15 14:50:49 +00:00
Jamie Gritton deaa609d06 jaildesc: remove desc from the sysctl parameter list
Like lastjid, desc should count as a pseudo-parameter.  The difference
lies entirely in the security.jail.param sysctls, which list all of
the jail parameters.  Since desc opens and returns a file descriptor,
it has no place in such uses as "jls all."  Like lastjid, it's still
recognized by the kernel if passed in/out, and hard-coded into libjail
so it can be recognized there.

(cherry picked from commit e75dda31c1)
2025-09-14 20:34:00 -07:00
Jamie Gritton 9d7f89ef26 jaildesc: add kevent support
Give jail descriptors the same kevent flags as jails.  Also fix the
event reporting in jails, where it was including data for events the
user didn't ask for.

(cherry picked from commit 66d8ffe304)
2025-09-14 20:33:48 -07:00
Jamie Gritton 1a849ff1e9 jail: simplify EVFILT_JAIL events
Instead of using the EVFILT_PROC model of attempting to automatically
register new events when a child jail is created, just give a single
event when a child jail is created.  As was already done with jail
attach events, make a best-effort report of the added jail's id in
kn_data.  If the are multiple NOTE_JAIL_CHILD and/or NOTE_JAIL_ATTACH
events, set the NOTE_JAIL_MULTI flag, and don't report anything in
data, indicating that the caller will need to query the system state
on their own.

(cherry picked from commit dbcaac13e4)
2025-09-14 20:33:18 -07:00
Michael Tuexen ba71944297 tcp: minor cleanup
No functional change intended.

Sponsored by:	Netflix, Inc.

(cherry picked from commit c3d5387a7b)
2025-09-14 22:16:42 +02:00
Michael Tuexen 1162a78e0d dhclient: improve UDP checksum handling
When sending UDP packets:
* compute the checksum in the correct order. This only has an impact
  if the length of the payload is odd.
* don't send packet with a checksum of zero, use 0xffff instead as
  required.
When receiving UDP packets:
* don't do any computations when the checksum is zero.
* compute the checksum in the correct order. This only has an impact
  if the length of the payload is odd.
* when computing the checksum, store the pseudo header checksum
* if the checksum is computed as zero, use 0xffff instead.
* also accept packets, when the checksum in the packet is the pseudo
  header checksum.
The last point fixes a problem when the DHCP client runs in a VM,
the DHCP server runs on the host serving the VM and the network
interface supports transmit checksum offloading. Since dhclient
doesn't use UDP sockets but bpf devices to read the packets, the
checksum will be incorrect and only contain the checksum of the
pseudo header.

PR:			263229
Reviewed by:		markj, Timo Völker
Tested by:		danilo
Differential Revision:	https://reviews.freebsd.org/D52394

(cherry picked from commit 187ee62c71)
2025-09-14 22:15:57 +02:00
Cy Schubert b36435210a krb5: Enable PRINC_LOOK_AHEAD in ksu
PRINC_LOOK_AHEAD is the upstream default. Normally ksu determines the
target princiapl by (quoted from the man page)

a. default principal of the source cache

b. target_user@local_realm

c. source_user@local_realm

With PRINC_LOOK_AHEAD emabled, for each candidate in the above
list, select an authorized principal that has the same realm name
and first part of the principal name equal to the prefix of the
candidate. For example if candidate a) is [email protected] and
jqpublic/[email protected] is authorized to access the target account
then the default principal is set to jqpublic/[email protected].

Case 2: source user is root.

If the target user is non-root then the default principal name
is target_user@local_realm.  Else, if the source cache exists
the default principal name is set to the default principal of
the source cache.  If the source cache does not exist, default
principal name is set to root\@local_realm.

This commit restores the same behaviour as Heimdal ksu.

Reported by:		Dan Mahoney <[email protected]>
Requested by:		Dan Mahoney <[email protected]>
Differential revision:	 https://reviews.freebsd.org/D52478

(cherry picked from commit b0e7b55a0e)
2025-09-14 08:20:53 -07:00
Lars Engels 7dd02bd9d6 backlight(9): add cross-ref to backlight(8)
Reviewed by:	bcr
MFC after:	3 days

(cherry picked from commit a74c8b8236)
2025-09-14 13:23:41 +02:00
Colin Percival da62a299de release: Pass ABI to pkgbase-stage.lua
We then pass ABI from pkgbase-stage.lua to pkg(8); without this,
cross-building releases with PKGBASE enabled fails with

pkg: wrong architecture: ...
pkg: repository FreeBSD-base contains packages with wrong ABI: ...

MFC after:	1 minute
Discussed with:	emaste, jrtc27
Sponsored by:	https://www.patreon.com/c/cperciva

(cherry picked from commit 340e68fd7c)
2025-09-13 19:05:21 -07:00
ShengYi Hung 6faaef201c contrib/libxo: fix API header files inclusions in C++ source files
C++ source files need `extern "C"` to disable C++ name mangling.

MFC after:	1 week
Reviewed by:	aokblast (previous version), phil, imp (previous version)
Differential Revision:	https://reviews.freebsd.org/D47930

(cherry picked from commit 11ace56fa0)
2025-09-14 00:30:34 +00:00
Jamie Gritton 5df0b57b74 MFC jaildesc: remove file-mode-based access controls
Jail descriptors were given a file-like mode, user, and group, for the
purpose of controlling how the descriptor may be used.  This is too far
removed from the file paradigm to make sense.  Remove it in favor of a
better access control method to be added, such as Capsicum.

Also add missing code in jaildesc_fill_kinfo.

Reported by:	crest at rlwinm.de, kib
MFC after:	3 days

(cherry picked from commit d81b337d69)
2025-09-13 15:38:10 -07:00
Jamie Gritton 0c23ee96c6 MFC jaildesc: fix typo and style(9) violations.
Reported by:	kib
MFC after:	3 days

(cherry picked from commit d8d5324ef5)
2025-09-13 15:37:56 -07:00
Jamie Gritton 595a705062 MFC jaildesc: replace EBADF with EINVAL
Following fd9e09cb, EBADF is not the suitable error code for a non-
jail descriptor passed to jail_set, jail_get, jail_attach_fd, and
jail_remove_fd.

Reported by:	kib

(cherry picked from commit 16f600dc30)
2025-09-13 15:37:38 -07:00
Jamie Gritton 4ecbb3f19b MFC jaildesc: fix a misplaced error check and a spurious finit call
Reported by:	kib

(cherry picked from commit 8ec7a830f1)
2025-09-13 15:37:07 -07:00
Colin Percival 89e9d3ca62 release.sh: Pass *PKGBASE* through
It helps to get the variable name right...

Fixes:	d4282cfa97 ("release.sh: Pass PKGCONF through to make release")
MFC after:	1 minute
Sponsored by:	https://www.patreon.com/c/cperciva

(cherry picked from commit 5f14800ca5)
2025-09-13 08:35:40 -07:00
Kristof Provost 4403631977 pf: fix possible pd->pcksum NULL deref
Ensure that we always populate pcksum, not just for TCP/UDP/SCTP/ICMP.
We may end up using it (through pf_change_ap()) if we're doing NAT, so
ensure it's available even if it's sometimes just a dummy variable.

Reported-by: [email protected]
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit c23eda976a)
2025-09-13 15:05:13 +02:00
Colin Percival e2f40ab4ce release.sh: Pass PKGCONF through to make release
Otherwise setting PKGCONF=1 in the release.conf file doesn't actually
result in pkgbase bits being produced and shipped on images.

MFC after:	1 minute
Sponsored by:	https://www.patreon.com/c/cperciva

(cherry picked from commit d4282cfa97)
2025-09-12 19:23:49 -07:00
Baptiste Daroussin c8a4d636af pkgbase: fix alpha and beta versioning
MFC After: 	1 day

(cherry picked from commit 1bc7ee74b6)
2025-09-12 17:37:38 +02:00
Olivier Certner 5d13480bac sys: NOTES: Fix comment for wlan_* devices; GENERIC*: Re-order 'wlan_tkip'
Fix the comment introducing the 'wlan_*' devices (AES-CCMP is missing)
after introducing AES-GCMP.

While here, re-order the devices in order of appearance of the related
technologies.

No functional change (intended).

Reviewed by:    adrian, emaste
Fixes:          7bf82ea4fd ("sys: add wlan_gcmp to GENERIC kernels as appropriate")
MFC after:      3 days
MFC to:         stable/15
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D52444

(cherry picked from commit c1eff1d745)
2025-09-12 11:26:33 +02:00
Olivier Certner 30d631a3be NOTES: Fix whitespace in "options MAC_DO"
For "options", we put a space before a TAB so that commenting out an
option doesn't move the columns.

No functional change.

Fixes:          c8d8cac2a8 ("mac_do(4): allow compiling into kernel")
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 1cf67b5870)
2025-09-12 11:26:28 +02:00
Kevin Bowling 19650d19a5 ixgbe: Correct ixgbe_link_speed_to_str comment
PR:		288960
Reported by:	michaelo

(cherry picked from commit c1532f74e4)
2025-09-11 17:35:09 -07:00
Yogesh Bhosale 98f7ad4160 ixgbe: Fix incomplete speed coverage in link status logging
Originally ixgbe_if_update_admin_status() only handled 1G and 10G speeds,
causing any other speeds to display as "1 Gbps" in link status logs.

This issue is fixed by adding link speed to string conversion logic through
the introduction of a helper function, ixgbe_link_speed_to_str(), which
corrects the misleading logs to reflect accurate link speeds.

Signed-off-by: Yogesh Bhosale [email protected]

PR:		288960
Reported by:	Mike Belanger - QNX
Differential Revision:	https://reviews.freebsd.org/D52442

(cherry picked from commit 46347b3619)
2025-09-11 17:34:42 -07:00
Colin Percival 99cc54090e 15.0: Update to ALPHA2
Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-09-11 17:00:37 -07:00
Dimitry Andric 6d4fdf7869 BSD.usr.dist: remove obsolete usr/share/examples/drivers entry
In base 8f0a6a9aad, usr/share/examples/drivers was cleaned up,
because it contained unmaintained scripts. The directory itself is
cleaned up by ObsoleteFiles.inc, but there was still an entry in
BSD.usr.dist that re-created the directory. Remove it.

Fixes:		8f0a6a9aad
MFC after:	3 days

(cherry picked from commit ac2f284258)
2025-09-11 12:32:22 +02:00
Michael Tuexen c031033faa vtnet: fix compilation for NOIP configs
Reported by:	bz
Fixes:		3008f30d2c ("vtnet: improve checksum offloading")

(cherry picked from commit 614e9b33bf)
2025-09-11 08:20:19 +02:00
Timo Völker 5a8f33f52a vtnet: improve checksum offloading
When transmitting a packet over the vtnet interface, map the
csum flags CSUM_DATA_VALID | CSUM_PSEUDO_HDR to the virtio
flag VIRTIO_NET_HDR_F_DATA_VALID.
When receiving a packet over the virtio network channel, translate
the virtio flag VIRTIO_NET_HDR_F_NEEDS_CSUM not to CSUM_DATA_VALID |
CSUM_PSEUDO_HDR, but to CSUM_TCP, CSUM_TCP_IPV6, CSUM_UDP, or
CSUM_UDP_IPV6.
The second change fixes a series of issue related to checksum
offloading for if_vtnet.
While there, improve the stats counters to allow a detailed view
on what is going on in relation to checksum offloading.

PR:			165059
Reviewed by:		tuexen, manpages
Differential Revision:	https://reviews.freebsd.org/D51686

(cherry picked from commit 3008f30d2c)
2025-09-11 08:17:12 +02:00
Yasuhiro Kimura 122c416148 leap-seconds: Update to leap-seconds.3960835200 from IERS
Current leap-seconds file has already expired on 28 June 2025

PR:		289352
Obtained from:	https://hpiers.obspm.fr/iers/bul/bulc/ntp/leap-seconds.3960835200

(cherry picked from commit 4729d5e2e2)
2025-09-10 22:40:11 -07:00
Zhenlei Huang ab7858d90e ngctl: Fix build without JAIL
Reported by:	Michael Dexter
Fixes:		72d01e62b0 netgraph: teach ngctl to attach and run itself in a jail
MFC after:	1 day

(cherry picked from commit 685e60e860)
2025-09-11 12:01:37 +08:00
Joseph Mingrone f834384fda stand: Remove Spleen 32x64 fonts from INDEX
The Spleen 32x64 fonts cause some systems such as the AMD Framework 16
to boot extremely slowly.  Adding screen.font="16x32" to
/boot/loader.conf is a partial workaround, but text displayed before the
boot menu still takes ~30 seconds to render on that laptop.  With this
change, the same text renders immediately.

By leaving the font files in place but removing them from the INDEX,
users who want to use them can still load them manually.  Once pending
work is committed to allow normal booting with these fonts, they can be
added back to the INDEX.

PR:		289007
Reviewed by:	emaste, kevans, tsoome, ziaee
Fixes:		1ec2c8b2f3 (stand: Enable Spleen 32x64 font in the bootloader)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D52402

(cherry picked from commit 5e82eeccd2)
2025-09-10 23:05:50 -03:00
Mark Johnston 7626ba0280 src.opts.mk: Remove REPRODUCIBLE_BUILD from the default list
It was added to the list in bsd.opts.mk in commit 4f81c42fbd, so
should have been removed here.

On stable/15, this also fixes a problem in commit
6e7cc49f94 ("Make stable/15 a stable branch"), which made
REPRODUCIBLE_BUILD a default-yes option.  It modified src.opts.mk
instead of bsd.opts.mk.  This change modifies the latter accordingly.

Reported by:	cperciva
Approved by:	re (cperciva)
Fixes:		4f81c42fbd ("share/mk: Substitute reproducible prefixes in dwarf info")
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.

(cherry picked from commit b2f5dc591e)
2025-09-08 20:56:37 +00:00
Michael Tuexen ca0ba818cf Revert "vtnet: improve checksum offloading"
This reverts commit 1c23d8f9f3.
Will be committed again with correct authorship.

(cherry picked from commit f217bc7651)
2025-09-08 22:29:59 +02:00
Colin Percival 0b3d82579a 15.0: Mark the tree as ALPHA1
Builds for 15.0-ALPHA1 will begin shortly; we're just waiting for the
latest amd64 package set to propagate out to mirrors.

Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-09-05 15:30:24 -07:00
Colin Percival 8ba76c6565 Add -DEBUG kernel configurations
Also include these in GENERIC-K*SAN kernels (which previously depended on
GENERIC configurations which debug-enabled until the branch point).

Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-09-05 15:05:03 -07:00
Colin Percival bc96364a4d Turn off PTHREAD assertions in stable/15
Direct commit to stable/15; the assertions stay on in -CURRENT.

Reported by:	Mark Millard
Discussed with:	kib
Approved by:	re (implicit)
2025-09-05 14:36:25 -07:00
Colin Percival c09d21f713 Add description for WITH_PTHREADS_ASSERTIONS
This option is turned on by default in -CURRENT but will be turned off
in 15-STABLE; this description will land in the src.conf(5) man page
in that branch.

MFC after:	1 minute

(cherry picked from commit af60084978)
2025-09-05 14:36:19 -07:00
Michael Tuexen 9866ce5d5c tcp: improve compilability
When building with DDB support, the inclusion of in_kdtrace.h
is needed. Make this explicit and don't rely on tcp_var.h to do this.
This is required for stable/14.

Fixes:		a62c6b0de4 ("ddb: add optional printing of BBLog entries")
Sponsored by:	Netflix, Inc.

(cherry picked from commit 4cb50d74c1)
2025-09-05 08:07:52 +02:00
Warner Losh bc7bb3966a moused: Fix movement of moused/moused to moused/moused/moused
So aef807876c moved moused down a level, so make depend broke. This
fixes it.

Sponsored by:		Netflix

(cherry picked from commit edd8c4c655)
2025-09-04 23:53:30 -06:00
Colin Percival 1aad58b919 Remove std.debug from kernel configs
The default on stable branches is without debugging enabled.

Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-09-04 17:06:45 -07:00
Colin Percival c1d5c5a3ef Remove NODEBUG kernels
The default on stable branches is without debugging enabled.

Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-09-04 17:06:45 -07:00
Colin Percival 6e7cc49f94 Make stable/15 a stable branch
* Turn off LLVM assertions
* Turn on production malloc and reproductible builds
* Set dumpdev="NO" in /etc/defaults/rc.conf
* Remove witness sysctl setting from install images
* Adjust branch to stable/15 in release.conf.sample
* Bump __FreeBSD_version
* Update UPDATING

Adjustments to kernel configurations will come in later commits.

Approved by:	re (implicit)
Sponsored by:	https://www.patreon.com/cperciva
2025-09-04 17:06:39 -07:00
4663 changed files with 239361 additions and 150179 deletions

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ compute_engine_instance:
# gcloud compute images list --project freebsd-org-cloud-dev --no-standard-images
platform: freebsd
image_project: freebsd-org-cloud-dev
image: freebsd-14-2-release-amd64-ufs
image: freebsd-14-3-release-amd64-ufs
cpu: 8
memory: 8G
disk: 40
+1
View File
@@ -29,3 +29,4 @@ tags
.clangd
.ccls-cache
sys/*/compile
/src.conf
+8 -1
View File
@@ -175,7 +175,7 @@ TGTS= all all-man buildenv buildenvvars buildetc buildkernel buildworld \
create-packages-world create-packages-kernel \
create-packages-kernel-repo create-packages-world-repo \
create-packages-source create-packages \
update-packages packages installconfig real-packages real-update-packages \
installconfig real-packages real-update-packages \
sign-packages package-pkg print-dir test-system-compiler test-system-linker \
test-includes
@@ -219,6 +219,8 @@ META_TGT_WHITELIST+= build${libcompat}
.ORDER: buildworld distribute
.ORDER: buildworld distributeworld
.ORDER: buildworld buildkernel
.ORDER: buildworld packages
.ORDER: buildworld update-packages
.ORDER: distrib-dirs distribute
.ORDER: distrib-dirs distributeworld
.ORDER: distrib-dirs installworld
@@ -232,6 +234,8 @@ META_TGT_WHITELIST+= build${libcompat}
.ORDER: buildkernel installkernel.debug
.ORDER: buildkernel reinstallkernel
.ORDER: buildkernel reinstallkernel.debug
.ORDER: buildkernel packages
.ORDER: buildkernel update-packages
.ORDER: kernel-toolchain buildkernel
# Only sanitize PATH on FreeBSD.
@@ -517,6 +521,9 @@ kernels: .PHONY
worlds: .PHONY
@cd ${.CURDIR}; ${SUB_MAKE} UNIVERSE_TARGET=buildworld universe
packages update-packages: .PHONY
${_+_}@cd ${.CURDIR}; ${_MAKE} DISTDIR=/ ${.TARGET}
#
# universe
#
+93 -32
View File
@@ -466,7 +466,7 @@ SUBDIR+= ${_DIR}
# by calling 'makedb' in share/man. This is only relevant for
# install/distribute so they build the whatis file after every manpage is
# installed.
.if make(installworld) || make(install)
.if make(installworld) || make(install) || make(distributeworld) || make(distribute)
SUBDIR+=.WAIT
.endif
SUBDIR+=etc
@@ -585,10 +585,10 @@ BRANCH_EXT= ${MAJOR_REVISION}.snap
EXTRA_REVISION= .snap${_TIMENOW}
.elif ${_BRANCH:MALPHA*}
BRANCH_EXT= alpha
EXTRA_REVISION= .${_BRANCH:C/ALPHA([0-9]+).*/\1/}.${_TIMENOW}
EXTRA_REVISION= .a${_BRANCH:C/ALPHA([0-9]+).*/\1/}.${_TIMENOW}
.elif ${_BRANCH:MBETA*}
BRANCH_EXT= beta
EXTRA_REVISION= .${_BRANCH:C/BETA([0-9]+).*/\1/}.${_TIMENOW}
EXTRA_REVISION= .b${_BRANCH:C/BETA([0-9]+).*/\1/}.${_TIMENOW}
.elif ${_BRANCH:MRC*}
BRANCH_EXT= rc
EXTRA_REVISION= .rc${_BRANCH:C/RC([0-9]+).*/\1/}.${_TIMENOW}
@@ -600,7 +600,16 @@ PKG_VERSION:= ${_PKG_REVISION}${EXTRA_REVISION:C/[[:space:]]//g}
.endif
.endif # !defined(_MKSHOWCONFIG)
PKG_NAME_PREFIX?= FreeBSD
PKG_MAINTAINER?= [email protected]
PKG_WWW?= https://www.FreeBSD.org
PKG_WORKERS_COUNT?= 1
.if make(*package*)
.export PKG_NAME_PREFIX
.export PKG_MAINTAINER
.export PKG_WWW
.if !defined(PKG_TIMESTAMP)
.if !empty(GIT_CMD) && exists(${GIT_CMD}) && exists(${SRCDIR}/.git)
SOURCE_DATE_EPOCH!= ${GIT_CMD} -C ${SRCDIR} show -s --format=%ct HEAD
@@ -611,14 +620,6 @@ SOURCE_DATE_EPOCH= ${TIMEEPOCHNOW:gmtime}
.else
SOURCE_DATE_EPOCH= ${PKG_TIMESTAMP}
.endif
PKG_WORKERS_COUNT?= 1
PKG_NAME_PREFIX?= FreeBSD
PKG_MAINTAINER?= [email protected]
PKG_WWW?= https://www.FreeBSD.org
.export PKG_NAME_PREFIX
.export PKG_MAINTAINER
.export PKG_WWW
.endif
.if !defined(_MKSHOWCONFIG)
@@ -1366,6 +1367,28 @@ __installcheck_DESTDIR: .PHONY
.endif
.endif
#
# Don't allow installworld or installkernel on a pkgbase system. This avoids
# accidentally updating a pkgbase system with install{world,kernel}, causing
# the installed system to become out of date with the package database.
#
# Skip the check if DESTDIR is defined on the assumption the user knows what
# they're doing. This means the check can be disabled for the running system
# using DESTDIR=/.
#
.if !make(distributeworld) && !defined(DESTDIR)
_installcheck_world: __installcheck_PKG
_installcheck_kernel: __installcheck_PKG
__installcheck_PKG: .PHONY
.if exists(${LOCALBASE}/sbin/pkg-static)
@if ${LOCALBASE}/sbin/pkg-static info -e ${PKG_NAME_PREFIX}-runtime; then \
echo >&2 "ERROR: This target should not be used on a system installed from packages." ; \
echo >&2 " To override this check, set DESTDIR=/."; \
false; \
fi
.endif
.endif
.if !defined(DB_FROM_SRC)
#
# Check for missing UIDs/GIDs.
@@ -1977,6 +2000,7 @@ REPODIR?= ${OBJROOT}repo
PKG_FORMAT?= tzst
PKG_LEVEL?= -1
PKG_CLEVEL?= ${"${PKG_FORMAT:Mtar}" != "":?:-l ${PKG_LEVEL}}
PKG_CTHREADS?= 0
PKG_REPO_SIGNING_KEY?= # empty
PKG_OUTPUT_DIR?= ${PKG_VERSION}
PKG_ABI_FILE?= ${WSTAGEDIR}/usr/bin/uname
@@ -1992,16 +2016,20 @@ PKG_ABI!= ${PKG_CMD} -o ABI_FILE=${PKG_ABI_FILE} config ABI
_pkgbootstrap: .PHONY
.if make(*package*) && !exists(${LOCALBASE}/sbin/pkg)
.if defined(BOOTSTRAP_PKG_FROM_PORTS)
env - UNAME_r=${UNAME_r} PATH=$$PATH \
make -C ${PORTSDIR}/ports-mgmt/pkg \
I_DONT_CARE_IF_MY_BUILDS_TARGET_THE_WRONG_RELEASE=1 \
BATCH=1 WRKDIRPREFIX=/tmp/ports DISTDIR=/tmp/distfiles \
all install clean
.else
@env ASSUME_ALWAYS_YES=YES pkg bootstrap
.endif
.endif
PKG_BIN_VERSION!=${PKG_CMD} --version </dev/null 2>/dev/null |\
awk -F. '/^[0-9.]+$$/ {print $$1 * 10000 + $$2 * 100 + $$3}'
.if ${PKG_BIN_VERSION} < 11700
PKG_EXT= ${PKG_FORMAT}
.else
awk -F. '/^[0-9.]+(-.*)?$$/ {print $$1 * 10000 + $$2 * 100 + $$3}'
PKG_EXT= pkg
.endif
.if !defined(PKG_VERSION_FROM) && make(real-update-packages) && \
exists(${PKG_ABI_FILE}) && exists(${REPODIR}/${PKG_ABI}/latest)
@@ -2038,13 +2066,17 @@ packages: .PHONY
update-packages: .PHONY
${_+_}${MAKE} -C ${.CURDIR} ${PKGMAKEARGS} real-update-packages
package-pkg: .PHONY
package-pkg: _pkgbootstrap _repodir .PHONY
.if defined(INCLUDE_PKG_IN_PKGBASE_REPO)
.if exists(${PORTSDIR})
rm -rf /tmp/ports.${TARGET} || :
env ${WMAKEENV:Q} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} REVISION=${_REVISION} \
env ${WMAKEENV} SRCDIR=${.CURDIR} PORTSDIR=${PORTSDIR} REVISION=${_REVISION} \
PKG_CMD=${PKG_CMD} PKG_VERSION=${PKG_VERSION} REPODIR=${REPODIR} \
WSTAGEDIR=${WSTAGEDIR} \
OSVERSION="${SRCRELDATE}" \
OSVERSION="${SRCRELDATE}" LOCALBASE=${LOCALBASE} \
sh ${.CURDIR}/release/scripts/make-pkg-package.sh
.endif
.endif
real-packages: stage-packages create-packages sign-packages .PHONY
@@ -2097,6 +2129,15 @@ create-packages-world: _pkgbootstrap _repodir .PHONY
DESTDIR=${WSTAGEDIR} \
PKG_VERSION=${PKG_VERSION} create-world-packages
.ORDER: create-packages-world create-packages-sets
.ORDER: create-packages-kernel create-packages-sets
.ORDER: create-packages-source create-packages-sets
create-packages-sets: _pkgbootstrap _repodir .PHONY
${_+_}@cd ${.CURDIR}; \
${MAKE} -f Makefile.inc1 \
DESTDIR=${WSTAGEDIR} \
PKG_VERSION=${PKG_VERSION} create-sets-packages
create-packages-kernel: _pkgbootstrap _repodir .PHONY
${_+_}@cd ${.CURDIR}; \
${MAKE} -f Makefile.inc1 \
@@ -2109,6 +2150,8 @@ create-packages-kernel-repo: .PHONY create-packages-kernel sign-packages
create-packages-world-repo: .PHONY create-packages-world sign-packages
create-packages-sets-repo: .PHONY create-packages-sets sign-packages
create-packages-source: _pkgbootstrap _repodir .PHONY
${_+_}@cd ${.CURDIR}; \
${MAKE} -f Makefile.inc1 \
@@ -2117,7 +2160,7 @@ create-packages-source: _pkgbootstrap _repodir .PHONY
SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
create-source-packages
create-packages: .PHONY create-packages-world create-packages-kernel create-packages-source
create-packages: .PHONY create-packages-world create-packages-kernel create-packages-source package-pkg create-packages-sets
create-source-src-package: _pkgbootstrap .PHONY
rm -f ${SSTAGEDIR}/src.plist 2>/dev/null || :
@@ -2138,7 +2181,7 @@ create-source-src-package: _pkgbootstrap .PHONY
${SSTAGEDIR}/src.ucl
${PKG_CMD} -o ABI=${PKG_ABI} \
-o OSVERSION="${SRCRELDATE}" \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
-M ${SSTAGEDIR}/src.ucl \
-p ${SSTAGEDIR}/src.plist \
-r ${SRCDIR} \
@@ -2164,7 +2207,7 @@ create-source-src-sys-package: _pkgbootstrap .PHONY
${SSTAGEDIR}/src-sys.ucl
${PKG_CMD} -o ABI=${PKG_ABI} \
-o OSVERSION="${SRCRELDATE}" \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
-M ${SSTAGEDIR}/src-sys.ucl \
-p ${SSTAGEDIR}/src-sys.plist \
-r ${SRCDIR} \
@@ -2207,20 +2250,38 @@ create-world-package-${pkgname}: .PHONY
fi
${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
-o OSVERSION="${SRCRELDATE}" \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
-M ${WSTAGEDIR}/${pkgname}.ucl \
-p ${WSTAGEDIR}/${pkgname}.plist \
-r ${WSTAGEDIR} \
-o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}
.endfor
create-sets-packages-jobs: .PHONY create-sets-packages
create-sets-packages: .PHONY
@echo "==> Creating set metapackages."
sh "${SRCDIR}/release/packages/create-sets.sh" "${SRCDIR}" \
"${WSTAGEDIR}" "${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}" \
VERSION "${PKG_VERSION}" \
PKG_NAME_PREFIX "${PKG_NAME_PREFIX}" \
PKG_MAINTAINER "${PKG_MAINTAINER}" \
PKG_WWW "${PKG_WWW}"
@for manifest in ${WSTAGEDIR}/set-*.ucl; do \
echo "--> Processing manifest: $$manifest"; \
${PKG_CMD} -o ABI=${PKG_ABI} -o OSVERSION="${SRCRELDATE}" \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
-M $$manifest \
-o "${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR}" \
|| exit 1; \
done
_default_flavor= -default
.if make(*package*) && exists(${KSTAGEDIR}/kernel.meta)
. if ${MK_DEBUG_FILES} != "no"
_debug=-dbg
. endif
create-dtb-package:
create-dtb-package: .PHONY
@if [ -f ${KSTAGEDIR}/${DISTDIR}/dtb.plist ]; then \
${SRCDIR}/release/packages/generate-ucl.lua \
PKGNAME "dtb" \
@@ -2238,16 +2299,19 @@ create-dtb-package:
${KSTAGEDIR}/${DISTDIR}/dtb.ucl ; \
${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
-o OSVERSION="${SRCRELDATE}" \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
-M ${KSTAGEDIR}/${DISTDIR}/dtb.ucl \
-p ${KSTAGEDIR}/${DISTDIR}/dtb.plist \
-r ${KSTAGEDIR}/${DISTDIR} \
-o ${REPODIR}/${PKG_ABI}/${PKG_OUTPUT_DIR} ; \
fi
create-kernel-packages: .PHONY
create-kernel-packages: .PHONY create-kernel-flavored-packages create-dtb-package
create-kernel-flavored-packages: .PHONY
.ORDER: create-kernel-flavored-packages create-dtb-package
. for flavor in "" ${_debug}
create-kernel-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},} create-dtb-package
create-kernel-flavored-packages: create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}
create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap .PHONY
@cd ${KSTAGEDIR}/${DISTDIR} ; \
${METALOG_SORT_CMD} ${KSTAGEDIR}/kernel.meta | \
@@ -2272,7 +2336,7 @@ create-kernel-packages-flavor${flavor:C,^""$,${_default_flavor},}: _pkgbootstrap
${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl ; \
${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
-o OSVERSION="${SRCRELDATE}" \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
-M ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.ucl \
-p ${KSTAGEDIR}/${DISTDIR}/kernel.${INSTALLKERNEL}${flavor}.plist \
-r ${KSTAGEDIR}/${DISTDIR} \
@@ -2312,7 +2376,7 @@ create-kernel-packages-extra-flavor${flavor:C,^""$,${_default_flavor},}-${_kerne
${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl ; \
${PKG_CMD} -o ABI=${PKG_ABI} -o ALLOW_BASE_SHLIBS=yes \
-o OSVERSION="${SRCRELDATE}" \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} \
create -f ${PKG_FORMAT} ${PKG_CLEVEL} -T${PKG_CTHREADS} \
-M ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.ucl \
-p ${KSTAGEDIR}/kernel.${_kernel}/kernel.${_kernel}${flavor}.plist \
-r ${KSTAGEDIR}/kernel.${_kernel} \
@@ -2331,9 +2395,6 @@ sign-packages: .PHONY
real-sign-packages: _pkgbootstrap .PHONY
printf "version = 2;\n" > ${WSTAGEDIR}/meta
.if ${PKG_BIN_VERSION} < 11700
printf "packing_format = \"${PKG_FORMAT}\";\n" >> ${WSTAGEDIR}/meta
.endif
@${PKG_CMD} -o ABI=${PKG_ABI} -o OSVERSION="${SRCRELDATE}" \
-o WORKERS_COUNT=${PKG_WORKERS_COUNT} repo \
-m ${WSTAGEDIR}/meta \
+27
View File
@@ -51,6 +51,33 @@
# xargs -n1 | sort | uniq -d;
# done
# 20251121: Remove duplicate pam_krb5 manual page
OLD_FILES+=usr/share/man/man8/pam-krb5.8.gz
# 20251112: Remove pccard(4) and related
OLD_FILES+=share/man/man4/pccard.4.gz
OLD_FILES+=share/man/man4/pcic.4.gz
# 20251006: Remove libnss_tacplus.a (it never should have been installed)
OLD_FILES+=usr/lib/libnss_tacplus.a
# 20250930: Rename wlanstats to wlanstat
OLD_FILES+=usr/sbin/wlanstats
OLD_FILES+=usr/share/man/man8/wlanstats.8.gz
# 20250929: Remove ftpd(8)
OLD_FILES+=etc/rc.d/ftpd
OLD_FILES+=usr/libexec/ftpd
OLD_FILES+=usr/share/man/man5/ftpchroot.5.gz
OLD_FILES+=usr/share/man/man8/ftpd.8.gz
# 20250917: Remove a miscapitalized manual
OLD_FILES+=usr/share/man/man9/vnet.9.gz
OLD_FILES+=usr/share/man/man9/vimage.9.gz
# 20250911: This tool is no longer needed
OLD_FILES+=usr/tests/bin/cp/sparse
# 20250826: Remove a misspelled manual
OLD_FILES+=usr/share/man/man3/sysdecode_syscallnames.3.gz
+109 -15
View File
@@ -1,4 +1,4 @@
Updating Information for users of FreeBSD-CURRENT.
Updating Information for users of FreeBSD stable/15.
This file is maintained and copyrighted by M. Warner Losh <[email protected]>.
See end of file for further details. For commonly done items, please see the
@@ -12,20 +12,114 @@ Items affecting the ports and packages system can be found in
/usr/ports/UPDATING. Please read that file before updating system packages
and/or ports.
NOTE TO PEOPLE WHO THINK THAT FreeBSD 15.x IS SLOW:
FreeBSD 15.x has many debugging features turned on, in both the kernel
and userland. These features attempt to detect incorrect use of
system primitives, and encourage loud failure through extra sanity
checking and fail stop semantics. They also substantially impact
system performance. If you want to do performance measurement,
benchmarking, and optimization, you'll want to turn them off. This
includes various WITNESS- related kernel options, INVARIANTS, malloc
debugging flags in userland, and various verbose features in the
kernel. Many developers choose to disable these features on build
machines to maximize performance. (To completely disable malloc
debugging, define WITH_MALLOC_PRODUCTION in /etc/src.conf and rebuild
world, or to merely disable the most expensive debugging functionality
at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20251202:
15.0-RELEASE.
20251126:
15.0-RC4-p1 SA-25:10.unbound
Fix DNS cache poison through YXDOMAIN and nodata non-referral
answers. [SA-25:10.unbound]
20251115:
The FreeBSD-base repository is now defined in /etc/pkg/FreeBSD.conf,
disabled by default. In -CURRENT and -STABLE this points at nightly
builds on pkg.freebsd.org; for BETA/RC/RELEASE builds it points at
release engineering builds on pkgbase.freebsd.org.
Users of pkgbase will need to replace any existing definition of the
FreeBSD-base repository in /usr/local/etc/pkg/repos/ with a single
line "FreeBSD-base: { enabled: yes }".
20251030:
flua(1) has moved to the new FreeBSD-flua package. If you use flua,
you may want to install this package if it's not otherwise installed
as a dependency of something else. This change only affects pkgbase
users.
20251023:
Bump __FreeBSD_version to 1500068 for LinuxKPI. An embedded struct
has changed size and might possibly be an issue otherwise.
20251022:
15.0-BETA2-p1 SA-25:09.netinet
SO_REUSEPORT_LB breaks connect(2) for UDP sockets. [SA-25:09.netinet]
20251015:
The "FreeBSD-unbound" package is renamed to "FreeBSD-local-unbound".
If you have set-optional or set-base installed, the new package will
be installed automatically, otherwise you should manually install the
new package and remove the old one.
This change only affects pkgbase users.
20251001:
The deprecated ftpd(8) has been removed. Users who still need ftpd
can install the ftp/freebsd-ftpd port. pkgbase users should remove
the orphaned FreeBSD-ftpd package.
20251012:
Blacklist has been renamed upstream to Blocklist. If you have it
configured, rename all configuration files, firewall anchors or
sentinel files to reflect the new nomenclature. Old setups will
continue to work emitting a warning.
20251002:
Audio-related utilities including mixer(8) and virtual_oss(8) have
moved to the new FreeBSD-sound package. If you have set-optional or
set-base installed this package will be installed automatically,
otherwise you should install it manually if you need these utilities.
20250929:
Both drm-kmod and nividia-drm ports had to be updated to either no
longer conflict on LinuxKPI vs. native PCI changes and/or to keep
working after some LinuxKPI PCI adjustments which were previously
hidden behind native PCI.
Bump __FreeBSD_version so users will pick up updated packages.
20250924:
Several changes which affect pkgbase users (only):
powerd has been moved to a new FreeBSD-powerd package. If you have
FreeBSD-set-minimal installed, the new package will be installed
automatically, otherwise you may want to install it by hand.
libpmc and related utilities (/usr/sbin/pmc*) have moved to the new
FreeBSD-pmc package. If you use these, you may want to install the
package.
The libbz2 package has been renamed to bzip2, and /usr/bin/bzip2 has
been moved to the new package. If you have set-minimal installed,
the new package will be added automatically, otherwise you may want
to manually install it.
20250918:
The MANSPLITPKG knob has been turned off by default, so pkgbase builds
will no longer generate "-man" subpackages; instead the manpages will
be shipped in the packages they belong to. If you want to continue
building split man packages, set WITH_MANSPLITPKG=1.
20250918:
mandoc (including /usr/bin/man) has been moved to a new package,
FreeBSD-mandoc. If you have the minimal set installed, this package
will be installed automatically, otherwise you may want to install it.
20250918:
Kyua has been moved to the FreeBSD-kyua package, and ATF has been moved
to the FreeBSD-atf* packages. If you have FreeBSD-tests installed,
these packages will be installed automatically, otherwise you should
manually install them if you need these tools.
This only affects pkgbase users.
20250916:
If SRCCONF is unset and a file named src.conf is present at
the top of the source tree, it will now be used instead of
/etc/src.conf.
20250905:
__FreeBSD_version 1500064 after branching stable/15 from main.
20250903:
The BLOAT_KERNEL_WITH_EXTERR kernel config option has been renamed to
+6 -1
View File
@@ -433,6 +433,8 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat)
sep = strchr(to.base, '\0');
sep[0] = '/';
sep[1] = '\0';
} else if (strcmp(curr->fts_name, "/") == 0) {
/* special case when source is the root directory */
} else {
/* entering a directory; append its name to to.path */
len = snprintf(to.end, END(to.path) - to.end, "%s%s",
@@ -520,6 +522,8 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat)
if (type == DIR_TO_DNE &&
curr->fts_level == FTS_ROOTLEVEL) {
/* this is actually our created root */
} else if (strcmp(curr->fts_name, "/") == 0) {
/* special case when source is the root directory */
} else {
while (to.end > to.path && *to.end != '/')
to.end--;
@@ -551,7 +555,8 @@ copy(char *argv[], enum op type, int fts_options, struct stat *root_stat)
/* Not an error but need to remember it happened. */
if (to.path[0] == '\0') {
/*
* This can happen in two cases:
* This can happen in three cases:
* - The source path is the root directory.
* - DIR_TO_DNE; we created the directory and
* populated root_stat earlier.
* - FILE_TO_DIR if a source has a trailing slash;
-2
View File
@@ -1,7 +1,5 @@
PACKAGE= tests
ATF_TESTS_SH= cp_test
PROGS+= sparse
BINDIR= ${TESTSDIR}
.include <bsd.test.mk>
+20 -5
View File
@@ -90,7 +90,7 @@ hardlink_body()
echo "foo" >foo
atf_check cp -l foo bar
atf_check -o inline:"foo\n" cat bar
atf_check_equal "$(stat -f%d,%i foo)" "$(stat -f%d,%i bar)"
atf_check test foo -ef bar
}
atf_test_case hardlink_exists
@@ -105,7 +105,7 @@ hardlink_exists_body()
echo "bar" >bar
atf_check -s not-exit:0 -e match:exists cp -l foo bar
atf_check -o inline:"bar\n" cat bar
atf_check_not_equal "$(stat -f%d,%i foo)" "$(stat -f%d,%i bar)"
atf_check test ! foo -ef bar
}
atf_test_case hardlink_exists_force
@@ -120,7 +120,7 @@ hardlink_exists_force_body()
echo "bar" >bar
atf_check cp -fl foo bar
atf_check -o inline:"foo\n" cat bar
atf_check_equal "$(stat -f%d,%i foo)" "$(stat -f%d,%i bar)"
atf_check test foo -ef bar
}
atf_test_case matching_srctgt
@@ -384,12 +384,12 @@ samefile_body()
file_is_sparse()
{
atf_check ${0%/*}/sparse "$1"
atf_check -o match:"^[0-9]+-[0-9]" stat -h "$1"
}
files_are_equal()
{
atf_check_not_equal "$(stat -f%d,%i "$1")" "$(stat -f%d,%i "$2")"
atf_check test ! "$1" -ef "$2"
atf_check cmp "$1" "$2"
}
@@ -747,9 +747,23 @@ dstmode_body()
atf_check cmp dir/file dst/file
}
atf_test_case root
root_head()
{
atf_set "descr" "Test copying the root directory"
}
root_body()
{
atf_check mkdir dst
atf_check -s exit:1 \
-e inline:"cp: / is a directory (not copied).\n" \
cp / dst
}
atf_test_case to_root cleanup
to_root_head()
{
atf_set "descr" "Test copying to the root directory"
atf_set "require.user" "unprivileged"
}
to_root_body()
@@ -893,6 +907,7 @@ atf_init_test_cases()
atf_add_test_case to_deaddirlink
atf_add_test_case to_link_outside
atf_add_test_case dstmode
atf_add_test_case root
atf_add_test_case to_root
atf_add_test_case dirloop
atf_add_test_case unrdir
-73
View File
@@ -1,73 +0,0 @@
/*-
* Copyright (c) 2023 Klara, Inc.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <err.h>
#include <fcntl.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
#include <unistd.h>
static bool verbose;
/*
* Returns true if the file named by its argument is sparse, i.e. if
* seeking to SEEK_HOLE returns a different value than seeking to
* SEEK_END.
*/
static bool
sparse(const char *filename)
{
off_t hole, end;
int fd;
if ((fd = open(filename, O_RDONLY)) < 0 ||
(hole = lseek(fd, 0, SEEK_HOLE)) < 0 ||
(end = lseek(fd, 0, SEEK_END)) < 0)
err(1, "%s", filename);
close(fd);
if (end > hole) {
if (verbose)
printf("%s: hole at %zu\n", filename, (size_t)hole);
return (true);
}
return (false);
}
static void
usage(void)
{
fprintf(stderr, "usage: sparse [-v] file [...]\n");
exit(EX_USAGE);
}
int
main(int argc, char *argv[])
{
int opt, rv;
while ((opt = getopt(argc, argv, "v")) != -1) {
switch (opt) {
case 'v':
verbose = true;
break;
default:
usage();
break;
}
}
argc -= optind;
argv += optind;
if (argc == 0)
usage();
rv = EXIT_SUCCESS;
while (argc-- > 0)
if (!sparse(*argv++))
rv = EXIT_FAILURE;
exit(rv);
}
+1 -1
View File
@@ -28,7 +28,7 @@
atf_check_same_file()
{
atf_check_equal "$(stat -f %d,%i "$1")" "$(stat -f %d,%i "$2")"
atf_check test "$1" -ef "$2"
}
atf_check_symlink_to()
+4 -2
View File
@@ -30,7 +30,7 @@
.\" USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
.\" OF SUCH DAMAGE.
.\"
.Dd January 21, 2021
.Dd October 22, 2025
.Dt PWAIT 1
.Os
.Sh NAME
@@ -39,7 +39,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl t Ar duration
.Op Fl ov
.Op Fl opv
.Ar pid
\&...
.Sh DESCRIPTION
@@ -51,6 +51,8 @@ The following option is available:
.Bl -tag -width indent
.It Fl o
Exit when any of the given processes has terminated.
.It Fl p
On exit, print a list of processes that have not terminated.
.It Fl t Ar duration
If any process is still running after
.Ar duration ,
+84 -44
View File
@@ -33,23 +33,40 @@
#include <sys/types.h>
#include <sys/event.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/tree.h>
#include <sys/wait.h>
#include <err.h>
#include <errno.h>
#include <signal.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysexits.h>
#include <unistd.h>
struct pid {
RB_ENTRY(pid) entry;
pid_t pid;
};
static int
pidcmp(const struct pid *a, const struct pid *b)
{
return (a->pid > b->pid ? 1 : a->pid < b->pid ? -1 : 0);
}
RB_HEAD(pidtree, pid);
static struct pidtree pids = RB_INITIALIZER(&pids);
RB_GENERATE_STATIC(pidtree, pid, entry, pidcmp);
static void
usage(void)
{
fprintf(stderr, "usage: pwait [-t timeout] [-ov] pid ...\n");
fprintf(stderr, "usage: pwait [-t timeout] [-opv] pid ...\n");
exit(EX_USAGE);
}
@@ -61,42 +78,55 @@ main(int argc, char *argv[])
{
struct itimerval itv;
struct kevent *e;
int oflag, tflag, verbose;
int i, kq, n, nleft, opt, status;
long pid;
struct pid k, *p;
char *end, *s;
double timeout;
size_t sz;
long pid;
pid_t mypid;
int i, kq, n, ndone, nleft, opt, pid_max, ret, status;
bool oflag, pflag, tflag, verbose;
oflag = 0;
tflag = 0;
verbose = 0;
oflag = false;
pflag = false;
tflag = false;
verbose = false;
memset(&itv, 0, sizeof(itv));
while ((opt = getopt(argc, argv, "ot:v")) != -1) {
while ((opt = getopt(argc, argv, "opt:v")) != -1) {
switch (opt) {
case 'o':
oflag = 1;
oflag = true;
break;
case 'p':
pflag = true;
break;
case 't':
tflag = 1;
tflag = true;
errno = 0;
timeout = strtod(optarg, &end);
if (end == optarg || errno == ERANGE || timeout < 0) {
errx(EX_DATAERR, "timeout value");
}
switch(*end) {
case 0:
switch (*end) {
case '\0':
break;
case 's':
end++;
break;
case 'h':
timeout *= 60;
/* FALLTHROUGH */
case 'm':
timeout *= 60;
end++;
break;
default:
errx(EX_DATAERR, "timeout unit");
}
if (*end != '\0') {
errx(EX_DATAERR, "timeout unit");
}
if (timeout > 100000000L) {
errx(EX_DATAERR, "timeout value");
}
@@ -106,7 +136,7 @@ main(int argc, char *argv[])
(suseconds_t)(timeout * 1000000UL);
break;
case 'v':
verbose = 1;
verbose = true;
break;
default:
usage();
@@ -121,53 +151,57 @@ main(int argc, char *argv[])
usage();
}
kq = kqueue();
if (kq == -1) {
if ((kq = kqueue()) < 0)
err(EX_OSERR, "kqueue");
}
e = malloc((argc + tflag) * sizeof(struct kevent));
if (e == NULL) {
sz = sizeof(pid_max);
if (sysctlbyname("kern.pid_max", &pid_max, &sz, NULL, 0) != 0) {
pid_max = 99999;
}
if ((e = malloc((argc + tflag) * sizeof(*e))) == NULL) {
err(EX_OSERR, "malloc");
}
nleft = 0;
ndone = nleft = 0;
mypid = getpid();
for (n = 0; n < argc; n++) {
s = argv[n];
/* Undocumented Solaris compat */
if (!strncmp(s, "/proc/", 6)) {
if (strncmp(s, "/proc/", 6) == 0) {
s += 6;
}
errno = 0;
pid = strtol(s, &end, 10);
if (pid < 0 || *end != '\0' || errno != 0) {
if (pid < 0 || pid > pid_max || *end != '\0' || errno != 0) {
warnx("%s: bad process id", s);
continue;
}
if (pid == getpid()) {
if (pid == mypid) {
warnx("%s: skipping my own pid", s);
continue;
}
for (i = 0; i < nleft; i++) {
if (e[i].ident == (uintptr_t)pid) {
break;
}
if ((p = malloc(sizeof(*p))) == NULL) {
err(EX_OSERR, NULL);
}
if (i < nleft) {
p->pid = pid;
if (RB_INSERT(pidtree, &pids, p) != NULL) {
/* Duplicate. */
free(p);
continue;
}
EV_SET(e + nleft, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
if (kevent(kq, e + nleft, 1, NULL, 0, NULL) == -1) {
if (errno != ESRCH)
err(EX_OSERR, "kevent()");
warn("%ld", pid);
if (oflag) {
exit(EX_OK);
}
RB_REMOVE(pidtree, &pids, p);
free(p);
ndone++;
} else {
nleft++;
}
}
if (nleft > 0 && tflag) {
if ((ndone == 0 || !oflag) && nleft > 0 && tflag) {
/*
* Explicitly detect SIGALRM so that an exit status of 124
* can be returned rather than 142.
@@ -182,7 +216,8 @@ main(int argc, char *argv[])
err(EX_OSERR, "setitimer");
}
}
while (nleft > 0) {
ret = EX_OK;
while ((ndone == 0 || !oflag) && ret == EX_OK && nleft > 0) {
n = kevent(kq, NULL, 0, e, nleft + tflag, NULL);
if (n == -1) {
err(EX_OSERR, "kevent");
@@ -192,29 +227,34 @@ main(int argc, char *argv[])
if (verbose) {
printf("timeout\n");
}
exit(124);
ret = 124;
}
pid = e[i].ident;
if (verbose) {
status = e[i].data;
if (WIFEXITED(status)) {
printf("%ld: exited with status %d.\n",
(long)e[i].ident,
WEXITSTATUS(status));
pid, WEXITSTATUS(status));
} else if (WIFSIGNALED(status)) {
printf("%ld: killed by signal %d.\n",
(long)e[i].ident,
WTERMSIG(status));
pid, WTERMSIG(status));
} else {
printf("%ld: terminated.\n",
(long)e[i].ident);
printf("%ld: terminated.\n", pid);
}
}
if (oflag) {
exit(EX_OK);
k.pid = pid;
if ((p = RB_FIND(pidtree, &pids, &k)) != NULL) {
RB_REMOVE(pidtree, &pids, p);
free(p);
ndone++;
}
--nleft;
}
}
exit(EX_OK);
if (pflag) {
RB_FOREACH(p, pidtree, &pids) {
printf("%d\n", p->pid);
}
}
exit(ret);
}
+38
View File
@@ -310,6 +310,43 @@ or_flag_cleanup()
wait $p2 $p4 $p6 >/dev/null 2>&1
}
atf_test_case print
print_head()
{
atf_set "descr" "Test the -p flag"
}
print_body()
{
sleep 1 &
p1=$!
sleep 5 &
p5=$!
sleep 10 &
p10=$!
atf_check \
-o inline:"$p5\n$p10\n" \
-s exit:124 \
pwait -t 2 -p $p10 $p5 $p1 $p5 $p10
atf_check \
-e inline:"kill: $p1: No such process\n" \
-s exit:1 \
kill -0 $p1
atf_check kill -0 $p5
atf_check kill -0 $p10
}
print_cleanup()
{
kill $p1 $p5 $p10 >/dev/null 2>&1
wait $p1 $p5 $p10 >/dev/null 2>&1
}
atf_init_test_cases()
{
atf_add_test_case basic
@@ -318,4 +355,5 @@ atf_init_test_cases()
atf_add_test_case timeout_no_timeout
atf_add_test_case timeout_many
atf_add_test_case or_flag
atf_add_test_case print
}
-7
View File
@@ -69,11 +69,4 @@ token.h: mktokens
HAS_TESTS=
SUBDIR.${MK_TESTS}+= tests
beforeinstallconfig:
rm -f ${DESTDIR}/.profile
LINKMODE=${CONFMODE}
afterinstallconfig:
${INSTALL_LINK} ${TAG_ARGS:D${TAG_ARGS},config} ${DESTDIR}/root/.profile ${DESTDIR}/.profile
.include <bsd.prog.mk>
-2
View File
@@ -1,6 +1,4 @@
#
HOME=/root
export HOME
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin
export PATH
TERM=${TERM:-xterm}
@@ -2242,11 +2242,10 @@ dt_format_bytes_get(dtrace_hdl_t *dtp, caddr_t addr, size_t nbytes)
static int
dt_format_memory(dtrace_hdl_t *dtp, caddr_t addr)
{
size_t nbytes = *((uintptr_t *) addr);
size_t nbytes = *((size_t *) addr);
char *s;
s = dt_format_bytes_get(dtp, addr + sizeof(uintptr_t), nbytes);
s = dt_format_bytes_get(dtp, addr + sizeof(size_t), nbytes);
if (s == NULL)
return (-1);
@@ -2260,9 +2259,9 @@ static int
dt_print_memory(dtrace_hdl_t *dtp, FILE *fp, caddr_t addr)
{
int quiet = (dtp->dt_options[DTRACEOPT_QUIET] != DTRACEOPT_UNSET);
size_t nbytes = *((uintptr_t *) addr);
size_t nbytes = *((size_t *) addr);
return (dt_print_bytes(dtp, fp, addr + sizeof(uintptr_t),
return (dt_print_bytes(dtp, fp, addr + sizeof(size_t),
nbytes, 50, quiet, 1));
}
+3 -1
View File
@@ -1,6 +1,8 @@
.PATH: ${SRCTOP}/sys/contrib/openzfs/module/avl
PACKAGE= libzfs
PACKAGE= zfs
LIB_PACKAGE=
LIB= avl
LIBADD= spl
SRCS= avl.c
+2
View File
@@ -2,6 +2,8 @@
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/lib/libctf/common
.PATH: ${SRCTOP}/sys/cddl/contrib/opensolaris/common/ctf
PACKAGE= ctf
LIB_PACKAGE=
LIB= ctf
SRCS= ctf_create.c \
ctf_decl.c \
+1 -1
View File
@@ -55,7 +55,7 @@ translator psinfo_t < struct proc *T > {
pr_uid = T->p_ucred->cr_ruid;
pr_euid = T->p_ucred->cr_uid;
pr_gid = T->p_ucred->cr_rgid;
pr_egid = T->p_ucred->cr_groups[0];
pr_egid = T->p_ucred->cr_gid;
pr_addr = 0;
pr_psargs = (T->p_args == 0) ? "" :
memstr(T->p_args->ar_args, ' ', T->p_args->ar_length);
+2
View File
@@ -1,6 +1,8 @@
.PATH: ${SRCTOP}/sys/contrib/openzfs/module/icp
PACKAGE= zfs
LIB_PACKAGE=
LIB= icp
LIBADD=
+3 -1
View File
@@ -2,10 +2,12 @@
.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libnvpair
.PATH: ${SRCTOP}/sys/contrib/openzfs/include
PACKAGE= zfs
LIB_PACKAGE=
LIB= nvpair
LIBADD= spl
PACKAGE= libzfs
# user
INCS= libnvpair.h
SRCS= libnvpair.c \
+3 -1
View File
@@ -4,9 +4,11 @@
.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libspl
.PATH: ${SRCTOP}/sys/contrib/openzfs/include
PACKAGE= zfs
LIB_PACKAGE=
LIB= spl
LIBADD=
PACKAGE= libzfs
SRCS = \
assert.c \
+4 -3
View File
@@ -1,11 +1,12 @@
.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libtpool
.PATH: ${SRCTOP}/sys/contrib/openzfs/include
PACKAGE= zfs
LIB_PACKAGE=
LIB= tpool
LIB= tpool
SHLIBDIR?= /lib
LIBADD= spl
PACKAGE= libzfs
LIBADD= spl
INCS= thread_pool_impl.h
SRCS= thread_pool.c
+3 -1
View File
@@ -1,6 +1,8 @@
.PATH: ${SRCTOP}/cddl/compat/opensolaris/lib/libumem
PACKAGE= libzfs
PACKAGE= zfs
LIB_PACKAGE=
LIB= umem
SRCS= umem.c
WARNS?= 3
+3 -1
View File
@@ -1,6 +1,8 @@
.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libuutil
PACKAGE= libzfs
PACKAGE= zfs
LIB_PACKAGE=
LIB= uutil
SRCS=\
uu_alloc.c \
+3 -1
View File
@@ -1,8 +1,10 @@
.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzdb
.PATH: ${SRCTOP}/sys/contrib/openzfs/include
LIB= zdb
PACKAGE= zfs
LIB_PACKAGE=
LIB= zdb
INCS = libzdb.h
+3 -1
View File
@@ -7,7 +7,9 @@
.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zstd
.PATH: ${SRCTOP}/sys/contrib/openzfs/module/zstd/lib
PACKAGE= libzfs
PACKAGE= zfs
LIB_PACKAGE=
LIB= zfs
LIBADD= \
avl \
+2 -1
View File
@@ -3,10 +3,11 @@
.PATH: ${SRCTOP}/sys/contrib/openzfs/include/os/freebsd/zfs
.PATH: ${SRCTOP}/sys/contrib/openzfs/module/os/freebsd/zfs
PACKAGE= zfs
LIB_PACKAGE=
LIB= zfs_core
LIBADD= nvpair spl zutil
PACKAGE= libzfs
INCS= libzfs_core.h
SRCS= libzfs_core.c \
+2
View File
@@ -2,6 +2,8 @@
.PATH: ${SRCTOP}/sys/contrib/openzfs/include
PACKAGE= zfs
LIB_PACKAGE=
LIB= zfsbootenv
SHLIB_MAJOR= 1
+2
View File
@@ -29,6 +29,8 @@ PICFLAG= -fPIC
.endif
PACKAGE= zfs
LIB_PACKAGE=
LIB= zpool
USER_C = \
+3 -1
View File
@@ -2,9 +2,11 @@
.PATH: ${SRCTOP}/sys/contrib/openzfs/lib/libzutil/os/freebsd
.PATH: ${SRCTOP}/sys/contrib/openzfs/module/os/freebsd/zfs
PACKAGE= zfs
LIB_PACKAGE=
LIB= zutil
LIBADD= avl geom m tpool
PACKAGE= libzfs
INCS = zutil_import.h
+4 -1
View File
@@ -24,6 +24,7 @@ FILES= \
openzfs-2.1-linux \
openzfs-2.2 \
openzfs-2.3 \
openzfs-2.4 \
zol-0.6.1 \
zol-0.6.4 \
zol-0.6.5 \
@@ -60,7 +61,9 @@ LINKS= \
${FILESDIR}/openzfs-2.2 ${FILESDIR}/openzfs-2.2-linux \
${FILESDIR}/openzfs-2.2 ${FILESDIR}/openzfs-2.2-freebsd \
${FILESDIR}/openzfs-2.3 ${FILESDIR}/openzfs-2.3-linux \
${FILESDIR}/openzfs-2.3 ${FILESDIR}/openzfs-2.3-freebsd
${FILESDIR}/openzfs-2.3 ${FILESDIR}/openzfs-2.3-freebsd \
${FILESDIR}/openzfs-2.4 ${FILESDIR}/openzfs-2.4-linux \
${FILESDIR}/openzfs-2.4 ${FILESDIR}/openzfs-2.4-freebsd
LINKMODE= ${NOBINMODE}
+1 -1
View File
@@ -3,7 +3,7 @@
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/tools/ctf/common
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/tools/ctf/cvt
PACKAGE= ctf-tools
PACKAGE= ctf
PROG= ctfconvert
SRCS= alist.c \
ctf.c \
+1 -1
View File
@@ -1,7 +1,7 @@
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/tools/ctf/common
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/tools/ctf/dump
PACKAGE= ctf-tools
PACKAGE= ctf
PROG= ctfdump
SRCS= dump.c \
symbol.c \
+1 -1
View File
@@ -1,7 +1,7 @@
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/tools/ctf/common
.PATH: ${SRCTOP}/cddl/contrib/opensolaris/tools/ctf/cvt
PACKAGE= ctf-tools
PACKAGE= ctf
PROG= ctfmerge
SRCS= alist.c \
barrier.c \
+2 -2
View File
@@ -1,6 +1,6 @@
# License
Copyright (c) 2018-2024 Gavin D. Howard <gavin@gavinhoward.com>
Copyright (c) 2018-2025 Gavin D. Howard <gavin@gavinhoward.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
@@ -60,7 +60,7 @@ The files `src/rand.c` and `include/rand.h` are under the following copyrights
and license:
Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors<br>
Copyright (c) 2018-2024 Gavin D. Howard <gavin@gavinhoward.com>
Copyright (c) 2018-2025 Gavin D. Howard <gavin@gavinhoward.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
+80
View File
@@ -0,0 +1,80 @@
# Maintenance Terms
> Last Updated: 27 June 2025
The code, text, and other materials in this repository are provided as-is under
the terms of the repository's [`LICENSE.md`][0] file, as a gift to the commons
and the common good. In providing this software as-is, its author(s) admit no
further obligations from anyone using the software for any reason, particularly
with respect to:
* Releases,
* Response time,
* Change review and integration,
* Disclosure schedules,
* Discretionary, proprietary or otherwise secretive communications, and
* Any other non-contractual obligations or conventions, regardless of their
presumed urgency or severity.
Should anyone wish to make a contract with me (Gavin Howard) to ensure that work
he or she deems critical gets done, the terms are as follows:
* Compute time will be charged at \$25/hr.
* My time will be charged at \$100/hr.
* All issues deemed critical by either me or the requester, that also change the
source code (anything in `gen`, `include`, or `src`) will require at least two
weeks of fuzzing without error.
* If errors are found, those hours will still be charged on top of the final
two weeks.
* All changes will require running the [release script][2] on Linux (GCC), Linux
(Clang), FreeBSD, OpenBSD, macOS, Windows.
* Any hours spent on bugs or code that have been, or are suspected to have been,
generated by "AI" will be charged double rates.
Compute time includes, but is not limited to:
* Fuzzing.
* Running my [release script][2].
* Running tests and my [release script][2] on macOS.
My time includes, but is not limited to:
* Code review.
* Reading bug reports.
* Design.
* Coding.
* Any compute time that interferes with my ability to do any other work:
* Fuzzing makes my computer unusable, so fuzzing for the 8-12 hours of the
day that I could be working will be charged at \$100/hr.
* Same with running my [release script][2] because I run two instances on my
machine and two in VMs at the same time.
* Running my [release script][2] or any other compute time on Windows
because Windows blocks me from doing my main work on Linux.
* Any other instances of blocking compute time.
All amounts will be billed by, and paid to, [Yzena, LLC][2]. Invoices will be
provided, including line items for what each hour was spent on.
It is suggested that the following amounts be budgeted:
* At least \$3000 for a non-critical issue or change.
The release script takes about 10 hours, and I would need to run it once on
Linux (and others at the same time) and once on Windows, which is 20 hours.
Most of that won't be at the \$100/hr rate, but some probably will be. Then
an extra \$1000 for other work.
* At least \$15,000 for a critical issue or change.
The \$3000 above is the start, which leaves \$12,000. Fuzzing is expected to
cost \$11,400 (6 days a week, 8 hours a day, at \$100, the rest at \$25), and
rounded up to \$12,000 for good measure.
---
This document is inspired by [Mike Hoye's Maintenance Terms][1].
[0]: LICENSE.md
[1]: https://github.com/mhoye/maintenance-terms
[2]: scripts/release.sh
[3]: https://yzena.com/
+21 -262
View File
@@ -1,7 +1,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2024 Gavin D. Howard and contributors.
# Copyright (c) 2018-2025 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -38,6 +38,8 @@ GENDIR = $(ROOTDIR)/gen
BUILDDIR = %%BUILDDIR%%
VERSION = %%VERSION%%
SRC = %%SRC%%
OBJ = %%OBJ%%
GCDA = %%GCDA%%
@@ -99,17 +101,16 @@ BC_FUZZER_C = $(BIN)/$(BC)_fuzzer_C
DC_FUZZER = $(BIN)/$(DC)_fuzzer_c
DC_FUZZER_C = $(BIN)/$(DC)_fuzzer_C
BC_TEST_OUTPUTS = tests/bc_outputs
BC_FUZZ_OUTPUTS = tests/fuzzing/bc_outputs1 tests/fuzzing/bc_outputs2 tests/fuzzing/bc_outputs3
DC_TEST_OUTPUTS = tests/dc_outputs
DC_FUZZ_OUTPUTS = tests/fuzzing/dc_outputs
LIB = libbcl
LIB_NAME = $(LIB).a
LIBBC = $(BIN)/$(LIB_NAME)
BCL = bcl
BCL_TEST = $(BIN)/$(BCL)
BCL_TEST_C = $(TESTSDIR)/$(BCL).c
GENERATE_TESTS = %%GENERATE_TESTS%%
PROBLEMATIC_TESTS = %%PROBLEMATIC_TESTS%%
MANUALS = manuals
BC_MANPAGE_NAME = $(EXEC_PREFIX)$(BC)$(EXEC_SUFFIX).1
@@ -152,11 +153,11 @@ BC_ENABLE_EXTRA_MATH = %%EXTRA_MATH%%
BC_ENABLE_NLS = %%NLS%%
BC_EXCLUDE_EXTRA_MATH = %%EXCLUDE_EXTRA_MATH%%
BC_ENABLE_AFL = %%FUZZ%%
BC_ENABLE_OSSFUZZ = %%OSSFUZZ%%
BC_ENABLE_MEMCHECK = %%MEMCHECK%%
BC_ENABLE_AFL = 0
BC_ENABLE_OSSFUZZ = 0
BC_ENABLE_MEMCHECK = 0
LIB_FUZZING_ENGINE = %%LIB_FUZZING_ENGINE%%
LIB_FUZZING_ENGINE = 0
BC_DEFAULT_BANNER = %%BC_DEFAULT_BANNER%%
BC_DEFAULT_SIGINT_RESET = %%BC_DEFAULT_SIGINT_RESET%%
@@ -189,10 +190,6 @@ KARATSUBA = $(SCRIPTSDIR)/karatsuba.py
LOCALE_INSTALL = $(SCRIPTSDIR)/locale_install.sh
LOCALE_UNINSTALL = $(SCRIPTSDIR)/locale_uninstall.sh
VALGRIND_ARGS = --error-exitcode=100 --leak-check=full --show-leak-kinds=all --errors-for-leak-kinds=all
TEST_STARS = ***********************************************************************
BC_NUM_KARATSUBA_LEN = %%KARATSUBA_LEN%%
BC_DEFS0 = -DBC_DEFAULT_BANNER=$(BC_DEFAULT_BANNER)
@@ -218,7 +215,7 @@ CPPFLAGS6 = $(CPPFLAGS5) -DBC_ENABLE_NLS=$(BC_ENABLE_NLS)
CPPFLAGS7 = $(CPPFLAGS6) -D$(BC_ENABLE_EXTRA_MATH_NAME)=$(BC_ENABLE_EXTRA_MATH)
CPPFLAGS8 = $(CPPFLAGS7) -DBC_ENABLE_HISTORY=$(BC_ENABLE_HISTORY) -DBC_ENABLE_LIBRARY=$(BC_ENABLE_LIBRARY)
CPPFLAGS9 = $(CPPFLAGS8) -DBC_ENABLE_MEMCHECK=$(BC_ENABLE_MEMCHECK) -DBC_ENABLE_AFL=$(BC_ENABLE_AFL)
CPPFLAGS = $(CPPFLAGS9) -DBC_ENABLE_OSSFUZZ=$(BC_ENABLE_OSSFUZZ)
CPPFLAGS = -DVERSION=$(VERSION) $(CPPFLAGS9) -DBC_ENABLE_OSSFUZZ=$(BC_ENABLE_OSSFUZZ)
CFLAGS = $(CPPFLAGS) $(BC_DEFS) $(DC_DEFS) %%CPPFLAGS%% %%CFLAGS%%
LDFLAGS = %%LDFLAGS%%
@@ -293,236 +290,10 @@ help:
@printf ' check alias for `make test`\n'
@printf ' clean removes all build files\n'
@printf ' clean_config removes all build files as well as the generated Makefile\n'
@printf ' clean_tests removes all build files, the generated Makefile,\n'
@printf ' and generated tests\n'
@printf ' install installs binaries to "%s%s"\n' "$(DESTDIR)" "$(BINDIR)"
@printf ' and (if enabled) manpages to "%s%s"\n' "$(DESTDIR)" "$(MAN1DIR)"
@printf ' karatsuba runs the karatsuba script (requires Python 3)\n'
@printf ' karatsuba_test runs the karatsuba script while running tests\n'
@printf ' (requires Python 3)\n'
@printf ' uninstall uninstalls binaries from "%s%s"\n' "$(DESTDIR)" "$(BINDIR)"
@printf ' and (if enabled) manpages from "%s%s"\n' "$(DESTDIR)" "$(MAN1DIR)"
@printf ' test runs the test suite\n'
@printf ' test_bc runs the bc test suite, if bc has been built\n'
@printf ' test_dc runs the dc test suite, if dc has been built\n'
@printf ' time_test runs the test suite, displaying times for some things\n'
@printf ' time_test_bc runs the bc test suite, displaying times for some things\n'
@printf ' time_test_dc runs the dc test suite, displaying times for some things\n'
@printf ' timeconst runs the test on the Linux timeconst.bc script,\n'
@printf ' if it exists and bc has been built\n'
run_all_tests: bc_all_tests timeconst_all_tests dc_all_tests
run_all_tests_np: bc_all_tests_np timeconst_all_tests dc_all_tests_np
bc_all_tests:
%%BC_ALL_TESTS%%
bc_all_tests_np:
%%BC_ALL_TESTS_NP%%
timeconst_all_tests:
%%TIMECONST_ALL_TESTS%%
dc_all_tests:
%%DC_ALL_TESTS%%
dc_all_tests_np:
%%DC_ALL_TESTS_NP%%
history_all_tests:
%%HISTORY_TESTS%%
check: test
test: %%TESTS%%
test_bc: test_bc_header test_bc_tests test_bc_scripts test_bc_errors test_bc_stdin test_bc_read test_bc_other
@printf '\nAll bc tests passed.\n\n$(TEST_STARS)\n'
test_bc_tests:%%BC_TESTS%%
test_bc_scripts:%%BC_SCRIPT_TESTS%%
test_bc_stdin:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/stdin.sh bc %%BC_TEST_EXEC%%
test_bc_read:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/read.sh bc %%BC_TEST_EXEC%%
test_bc_errors: test_bc_error_lines%%BC_ERROR_TESTS%%
test_bc_error_lines:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/errors.sh bc %%BC_TEST_EXEC%%
test_bc_other:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/other.sh bc $(BC_ENABLE_EXTRA_MATH) %%BC_TEST_EXEC%%
test_bc_header:
@printf '$(TEST_STARS)\n\nRunning bc tests...\n\n'
test_dc: test_dc_header test_dc_tests test_dc_scripts test_dc_errors test_dc_stdin test_dc_read test_dc_other
@printf '\nAll dc tests passed.\n\n$(TEST_STARS)\n'
test_dc_tests:%%DC_TESTS%%
test_dc_scripts:%%DC_SCRIPT_TESTS%%
test_dc_stdin:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/stdin.sh dc %%DC_TEST_EXEC%%
test_dc_read:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/read.sh dc %%DC_TEST_EXEC%%
test_dc_errors: test_dc_error_lines%%DC_ERROR_TESTS%%
test_dc_error_lines:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/errors.sh dc %%DC_TEST_EXEC%%
test_dc_other:
@export BC_TEST_OUTPUT_DIR="$(BUILDDIR)/tests"; sh $(TESTSDIR)/other.sh dc $(BC_ENABLE_EXTRA_MATH) %%DC_TEST_EXEC%%
test_dc_header:
@printf '$(TEST_STARS)\n\nRunning dc tests...\n\n'
timeconst:
%%TIMECONST%%
test_history: test_history_header test_bc_history test_dc_history
@printf '\nAll history tests passed.\n\n$(TEST_STARS)\n'
test_bc_history:%%BC_HISTORY_TEST_PREREQS%%
test_bc_history_all: test_bc_history0 test_bc_history1 test_bc_history2 test_bc_history3 test_bc_history4 test_bc_history5 test_bc_history6 test_bc_history7 test_bc_history8 test_bc_history9 test_bc_history10 test_bc_history11 test_bc_history12 test_bc_history13 test_bc_history14 test_bc_history15 test_bc_history16 test_bc_history17 test_bc_history18 test_bc_history19 test_bc_history20 test_bc_history21
test_bc_history_skip:
@printf 'No bc history tests to run\n'
test_bc_history0:
@sh $(TESTSDIR)/history.sh bc 0 %%BC_TEST_EXEC%%
test_bc_history1:
@sh $(TESTSDIR)/history.sh bc 1 %%BC_TEST_EXEC%%
test_bc_history2:
@sh $(TESTSDIR)/history.sh bc 2 %%BC_TEST_EXEC%%
test_bc_history3:
@sh $(TESTSDIR)/history.sh bc 3 %%BC_TEST_EXEC%%
test_bc_history4:
@sh $(TESTSDIR)/history.sh bc 4 %%BC_TEST_EXEC%%
test_bc_history5:
@sh $(TESTSDIR)/history.sh bc 5 %%BC_TEST_EXEC%%
test_bc_history6:
@sh $(TESTSDIR)/history.sh bc 6 %%BC_TEST_EXEC%%
test_bc_history7:
@sh $(TESTSDIR)/history.sh bc 7 %%BC_TEST_EXEC%%
test_bc_history8:
@sh $(TESTSDIR)/history.sh bc 8 %%BC_TEST_EXEC%%
test_bc_history9:
@sh $(TESTSDIR)/history.sh bc 9 %%BC_TEST_EXEC%%
test_bc_history10:
@sh $(TESTSDIR)/history.sh bc 10 %%BC_TEST_EXEC%%
test_bc_history11:
@sh $(TESTSDIR)/history.sh bc 11 %%BC_TEST_EXEC%%
test_bc_history12:
@sh $(TESTSDIR)/history.sh bc 12 %%BC_TEST_EXEC%%
test_bc_history13:
@sh $(TESTSDIR)/history.sh bc 13 %%BC_TEST_EXEC%%
test_bc_history14:
@sh $(TESTSDIR)/history.sh bc 14 %%BC_TEST_EXEC%%
test_bc_history15:
@sh $(TESTSDIR)/history.sh bc 15 %%BC_TEST_EXEC%%
test_bc_history16:
@sh $(TESTSDIR)/history.sh bc 16 %%BC_TEST_EXEC%%
test_bc_history17:
@sh $(TESTSDIR)/history.sh bc 17 %%BC_TEST_EXEC%%
test_bc_history18:
@sh $(TESTSDIR)/history.sh bc 18 %%BC_TEST_EXEC%%
test_bc_history19:
@sh $(TESTSDIR)/history.sh bc 19 %%BC_TEST_EXEC%%
test_bc_history20:
@sh $(TESTSDIR)/history.sh bc 20 %%BC_TEST_EXEC%%
test_bc_history21:
@sh $(TESTSDIR)/history.sh bc 21 %%BC_TEST_EXEC%%
test_dc_history:%%DC_HISTORY_TEST_PREREQS%%
test_dc_history_all: test_dc_history0 test_dc_history1 test_dc_history2 test_dc_history3 test_dc_history4 test_dc_history5 test_dc_history6 test_dc_history7 test_dc_history8 test_dc_history9 test_dc_history10
test_dc_history_skip:
@printf 'No dc history tests to run\n'
test_dc_history0:
@sh $(TESTSDIR)/history.sh dc 0 %%DC_TEST_EXEC%%
test_dc_history1:
@sh $(TESTSDIR)/history.sh dc 1 %%DC_TEST_EXEC%%
test_dc_history2:
@sh $(TESTSDIR)/history.sh dc 2 %%DC_TEST_EXEC%%
test_dc_history3:
@sh $(TESTSDIR)/history.sh dc 3 %%DC_TEST_EXEC%%
test_dc_history4:
@sh $(TESTSDIR)/history.sh dc 4 %%DC_TEST_EXEC%%
test_dc_history5:
@sh $(TESTSDIR)/history.sh dc 5 %%DC_TEST_EXEC%%
test_dc_history6:
@sh $(TESTSDIR)/history.sh dc 6 %%DC_TEST_EXEC%%
test_dc_history7:
@sh $(TESTSDIR)/history.sh dc 7 %%DC_TEST_EXEC%%
test_dc_history8:
@sh $(TESTSDIR)/history.sh dc 8 %%DC_TEST_EXEC%%
test_dc_history9:
@sh $(TESTSDIR)/history.sh dc 9 %%DC_TEST_EXEC%%
test_dc_history10:
@sh $(TESTSDIR)/history.sh dc 10 %%DC_TEST_EXEC%%
test_history_header:
@printf '$(TEST_STARS)\n\nRunning history tests...\n\n'
library_test: $(LIBBC)
$(CC) $(CFLAGS) -lpthread $(BCL_TEST_C) $(LIBBC) -o $(BCL_TEST)
test_library: library_test
%%BCL_TEST_EXEC%%
karatsuba:
%%KARATSUBA%%
karatsuba_test:
%%KARATSUBA_TEST%%
coverage_output:
%%COVERAGE_OUTPUT%%
coverage:%%COVERAGE_PREREQS%%
manpages:
$(MANPAGE) bc
@@ -559,37 +330,25 @@ clean_config: clean clean_benchmarks
@$(RM) -f compile_commands.json
@$(RM) -f $(BCL_PC)
clean_coverage:
@printf 'Cleaning coverage files...\n'
@$(RM) -f *.gcov
@$(RM) -f *.html *.css
@$(RM) -f *.gcda *.gcno
@$(RM) -f *.profraw
@$(RM) -f $(GCDA) $(GCNO)
@$(RM) -f $(BC_GCDA) $(BC_GCNO)
@$(RM) -f $(DC_GCDA) $(DC_GCNO)
@$(RM) -f $(HISTORY_GCDA) $(HISTORY_GCNO)
@$(RM) -f $(RAND_GCDA) $(RAND_GCNO)
@$(RM) -f $(BC_LIB_GCDA) $(BC_LIB_GCNO)
@$(RM) -f $(BC_LIB2_GCDA) $(BC_LIB2_GCNO)
@$(RM) -f $(BC_HELP_GCDA) $(BC_HELP_GCNO)
@$(RM) -f $(DC_HELP_GCDA) $(DC_HELP_GCNO)
test:
@if [ $(BC_ENABLED) -ne 0 ]; then $(TESTSDIR)/all.sh -n bc $(BC_ENABLE_EXTRA_MATH) 1 $(GENERATE_TESTS) $(PROBLEMATIC_TESTS) $(BC_EXEC); fi
@if [ $(DC_ENABLED) -ne 0 ]; then $(TESTSDIR)/all.sh -n dc $(BC_ENABLE_EXTRA_MATH) 1 $(GENERATE_TESTS) $(PROBLEMATIC_TESTS) $(DC_EXEC); fi
clean_tests: clean clean_config clean_coverage
clean_tests: clean clean_config
@printf 'Cleaning test files...\n'
@$(RM) -fr $(BC_TEST_OUTPUTS) $(DC_TEST_OUTPUTS)
@$(RM) -fr $(BC_FUZZ_OUTPUTS) $(DC_FUZZ_OUTPUTS)
@$(RM) -f $(TESTSDIR)/bc/parse.txt $(TESTSDIR)/bc/parse_results.txt
@$(RM) -f $(TESTSDIR)/bc/print.txt $(TESTSDIR)/bc/print_results.txt
@$(RM) -f $(TESTSDIR)/bc/parse_*.txt $(TESTSDIR)/bc/parse_*_results.txt
@$(RM) -f $(TESTSDIR)/bc/print_*.txt $(TESTSDIR)/bc/print_*_results.txt
@$(RM) -f $(TESTSDIR)/bc/bessel.txt $(TESTSDIR)/bc/bessel_results.txt
@$(RM) -f $(TESTSDIR)/bc/strings2.txt $(TESTSDIR)/bc/strings2_results.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/bessel.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/parse.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/print.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/add.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/divide.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/multiply.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/subtract.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/add_*.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/divide_*.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/multiply_*.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/subtract_*.txt
@$(RM) -f $(TESTSDIR)/bc/scripts/strings2.txt
@$(RM) -f $(TESTSDIR)/dc/scripts/prime.txt
@$(RM) -f .log_*.txt
+23
View File
@@ -1,5 +1,27 @@
# News
## 7.1.0
This is an ***UNTESTED*** release. If you would like testing, see the
[maintenance terms][23].
This fixes a few bugs:
* Improper response to double `SIGINT` with editline.
* Not letting `libedit` handle terminal size changes.
* A `dc` crash from improperly handling an error.
* A duplicate check for reference arrays.
* Build failures with GCC 15.
It also has a performance increase in the `band()` function and others in the
math library.
## 7.0.3
This is a production release that fixes build warnings on the musl libc.
Other users do ***NOT*** need to upgrade.
## 7.0.2
This is a production release that fixes `Ctrl+d` on FreeBSD and Linux when using
@@ -1588,3 +1610,4 @@ not thoroughly tested.
[20]: https://github.com/apjanke/ronn-ng
[21]: https://pandoc.org/
[22]: ./scripts/locale_uninstall.sh
[23]: ./MAINTENANCE-TERMS.md
+1 -1
View File
@@ -1,6 +1,6 @@
# Notice
Copyright 2018-2024 Gavin D. Howard and contributors.
Copyright 2018-2025 Gavin D. Howard and contributors.
## Contributors
+17 -4
View File
@@ -1,9 +1,7 @@
# `bc`
***WARNING: New user registration for <https://git.gavinhoward.com/> is disabled
because of spam. If you need to report a bug with `bc`, email gavin at this site
minus the `git.` part for an account, and I will create one for you. Or you can
report an issue at [GitHub][29].***
***WARNING: This project has moved back to GitHub temporarily; self-hosted Git
forges are not working for me, so I am trying to replace them.***
***WARNING: This project has moved to [https://git.gavinhoward.com/][20] for
[these reasons][21], though GitHub will remain a mirror.***
@@ -282,6 +280,12 @@ The easiest way to run this script is with `make karatsuba`.
If desired, maintainers can also skip running this script because there is a
sane default for the Karatsuba number.
##### `timeconst.bc`
The test suite will print a warning in normal usage. The warning is about a
missing `timeconst.bc`. This file [comes from][37] the [Linux kernel][38], which
has an incompatible license. The warning can be ignored.
## Status
This `bc` is robust.
@@ -432,6 +436,8 @@ Other projects based on this bc are:
* [macOS `bc`][35]. Any bugs in that `bc` should be reported to me, but do
expect bugs because the version is old.
* [Android Open Source `bc`][32]. Any bugs in that `bc` can be reported here.
* [A Fedora package][36]. If this package does not have any patches, you can
report bugs to me.
This is a non-comprehensive list of Linux distros that use this `bc` as the
system `bc`:
@@ -469,12 +475,16 @@ Files:
.gitignore The git ignore file (maintainer use only).
.gitattributes The git attributes file (maintainer use only).
bcl.pc.in A template pkg-config file for bcl.
build.gaml The GAML file with options for building under Rig.
build.pkg.rig The Rig build package file.
build.rig The Rig build script.
configure A symlink to configure.sh to make packaging easier.
configure.sh The configure script.
LICENSE.md A Markdown form of the BSD 2-clause License.
Makefile.in The Makefile template.
NEWS.md The changelog.
NOTICE.md List of contributors and copyright owners.
VERSION.txt A file containing the version.
Folders:
@@ -516,3 +526,6 @@ Folders:
[33]: https://github.com/gentoo/gentoo/blob/master/app-alternatives/bc/bc-0.ebuild#L8
[34]: https://www.linuxfromscratch.org/lfs/view/stable/chapter08/bc.html
[35]: https://github.com/apple-oss-distributions/bc/tree/main/bc
[36]: https://copr.fedorainfracloud.org/coprs/tkbcopr/bc-gh/
[37]: https://github.com/torvalds/linux/blob/master/kernel/time/timeconst.bc
[38]: https://github.com/torvalds/linux
+1
View File
@@ -0,0 +1 @@
7.1.0
+402
View File
@@ -0,0 +1,402 @@
/*
* *****************************************************************************
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* *****************************************************************************
*
* The build options file.
*
*/
project: @com.gavinhoward.bc
language: @C11
version: {
min: @24.04.05
}
mode: {
language: @iterative
stampers: @metadata
dependencies: @dynamic
}
default_target: @all
presets: {
debug: {
debug: true
optimization: "0"
memcheck: true
devtools: true
strip: false
}
release: {
optimization: "3"
lto: true
}
// This is the predefined build for BSDs.
bsd: {
optimization: "3"
history: @editline
generated_tests: false
install_manpages: false
install_locales: @system
strip: true
bc_default_banner: false
bc_default_sigint_reset: true
dc_default_sigint_reset: true
bc_default_tty_mode: true
dc_default_tty_mode: false
bc_default_prompt: @off
dc_default_prompt: @off
bc_default_expr_exit: true
dc_default_expr_exit: true
bc_default_digit_clamp: false
dc_default_digit_clamp: false
}
// This is the predefined build to match the GNU bc/dc.
gnu: {
optimization: "3"
generated_tests: false
install_manpages: true
install_locales: @system
strip: true
bc_default_banner: true
bc_default_sigint_reset: true
dc_default_sigint_reset: false
bc_default_tty_mode: true
dc_default_tty_mode: false
bc_default_prompt: @tty_mode
dc_default_prompt: @tty_mode
bc_default_expr_exit: true
dc_default_expr_exit: true
bc_default_digit_clamp: false
dc_default_digit_clamp: false
}
// This is the preferred release build of the author, Gavin D. Howard.
gdh: {
optimization: "3"
install_manpages: true
install_locales: @none
bc/default_banner: true
bc/default_sigint_reset: true
dc/default_sigint_reset: true
bc/default_tty_mode: true
dc/default_tty_mode: true
bc/default_prompt: @tty_mode
dc/default_prompt: @tty_mode
bc/default_expr_exit: false
dc/default_expr_exit: false
bc/default_digit_clamp: true
dc/default_digit_clamp: true
}
// This is the preferred debug build of the author, Gavin D. Howard.
dbg: {
optimization: "0"
debug: true
strip: false
install_manpages: true
install_locales: @system
bc/default_banner: true
bc/default_sigint_reset: true
dc/default_sigint_reset: true
bc/default_tty_mode: true
dc/default_tty_mode: true
bc/default_prompt: @tty_mode
dc/default_prompt: @tty_mode
bc/default_expr_exit: false
dc/default_expr_exit: false
bc/default_digit_clamp: true
dc/default_digit_clamp: true
}
}
default_development: @debug
default_release: @release
options: {
build_mode: {
type: @option
options: [
@both
@bc
@dc
@library
]
default: @both
desc: "Which of the executables or library to build."
}
extra_math: {
type: @bool
default: true
desc: "Enable the extra math extensions."
}
history: {
type: @option
options: [
@none
@builtin
@editline
@readline
]
default: @builtin
desc: "Which history implementation should be used, if any."
}
locales: {
type: @option
options: [
@none
@system
@all
]
default: @system
desc: "Whether to disable locales, use just the system ones, or use all (for building a package)."
}
bc/default_banner: {
type: @bool
default: false
desc: "Whether to display the bc version banner by default when in interactive mode."
}
bc/default_sigint_reset: {
type: @bool
default: true
desc: "Whether SIGINT will reset bc by default, instead of exiting, when in interactive mode."
}
dc/default_sigint_reset: {
type: @bool
default: true
desc: "Whether SIGINT will reset dc by default, instead of exiting, when in interactive mode."
}
bc/default_tty_mode: {
type: @bool
default: true
desc: "Whether TTY mode for bc should be on by default when available."
}
dc/default_tty_mode: {
type: @bool
default: false
desc: "Whether TTY mode for dc should be on by default when available."
}
bc/default_prompt: {
type: @option
options: [
@off
@tty_mode
@on
]
default: @tty_mode
desc: "Whether the prompt for bc should be on by default in TTY mode. This defaults to match TTY mode."
}
dc/default_prompt: {
type: @option
options: [
@off
@tty_mode
@on
]
default: @tty_mode
desc: "Whether the prompt for dc should be on by default in TTY mode. This defaults to match TTY mode."
}
bc/default_expr_exit: {
type: @bool
default: true
desc: "Whether to exit bc by default if an expression or expression file is given with the -e or -f options."
}
dc/default_expr_exit: {
type: @bool
default: true
desc: "Whether to exit dc by default if an expression or expression file is given with the -e or -f options."
}
bc/default_digit_clamp: {
type: @bool
default: false
desc: "Whether to have bc, by default, clamp digits that are greater than or equal to the current ibase when parsing numbers."
}
dc/default_digit_clamp: {
type: @bool
default: false
desc: "Whether to have dc, by default, clamp digits that are greater than or equal to the current ibase when parsing numbers."
}
karatsuba_len: {
type: @num
default: 32
desc: "Set the Karatsuba length (default is 32). Must be a number and greater than or equal to 16."
}
execprefix: {
type: @string
default: ""
desc: "The prefix to prepend to the executable names, to prevent collisions."
}
execsuffix: {
type: @string
default: ""
desc: "The suffix to append to the executable names, to prevent collisions."
}
debug: {
type: @bool
default: false
desc: "Enable debug info."
}
optimization: {
type: @string
default: "0"
desc: "The optimization level for the C compiler."
}
lto: {
type: @bool
default: false
desc: "Build with link-time optimization, if available."
}
strip: {
type: @bool
default: true
desc: "Strip any binaries."
}
strict: {
type: @bool
default: true
desc: "Build with strict compiler options."
}
force: {
type: @bool
default: false
desc: "Force options that don't work. THIS IS FOR DEV ONLY!"
}
memcheck: {
type: @bool
default: false
desc: "Enable memcheck mode, to check for memory leaks."
}
valgrind: {
type: @bool
default: false
desc: "Enable Valgrind mode, to check for memory bugs."
}
afl: {
type: @bool
default: false
desc: "Enable AFL++ mode."
}
ossfuzz: {
type: @bool
default: false
desc: "Enable OSSFUZZ mode."
}
generated_tests: {
type: @bool
default: true
desc: "Enable tests generated from a GNU bc-compatible program."
}
problematic_tests: {
type: @bool
default: true
desc: "Enable tests that may be problematic."
}
coverage: {
type: @bool
default: false
desc: "Enable code coverage (only works on GCC)."
}
install_manpages: {
type: @bool
default: true
desc: "Whether to install manpages or not."
}
cflags: {
type: @list
default: []
desc: "The command-line flags for the C compiler."
}
ldflags: {
type: @list
default: []
desc: "The command-line flags for the C linker."
}
destdir: {
type: @path
default: ""
desc: "The equivalent of $DESTDIR in other build systems."
}
prefix: {
type: @path
default: "/usr/local"
desc: "The default prefix to install everything into."
}
bindir: {
type: @path
default: ""
desc: "The directory to install executables into. Defaults to \"$prefix/bin\"."
}
libdir: {
type: @path
default: ""
desc: "The directory to install libraries into. Defaults to \"$prefix/lib\"."
}
includedir: {
type: @path
default: ""
desc: "The location to install headers in. Defaults to \"$prefix/include\"."
}
nlspath: {
type: @path
default: "/usr/share/locale/%L/%N"
desc: "The location to install locales."
}
pc_path: {
type: @path
default: ""
desc: "The location to pkg-config files to. Defaults to the output of `pkg-config --variable=pc_path pkg-config`."
}
datarootdir: {
type: @path
default: ""
desc: "The root directory for data files. Defaults to `$prefix/share`."
}
datadir: {
type: @path
default: ""
desc: "The directory for data files. Defaults to `$datarootdir`."
}
mandir: {
type: @path
default: ""
desc: "The root directory for manpages. Defaults to `$datadir/man`."
}
man1dir: {
type: @path
default: ""
desc: "The directory for manpages in section 1. Defaults to `$mandir/man1`."
}
man3dir: {
type: @path
default: ""
desc: "The directory for manpages in section 3. Defaults to `$mandir/man3`."
}
}
File diff suppressed because it is too large. Load diff
+575
View File
@@ -0,0 +1,575 @@
/*
* *****************************************************************************
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* *****************************************************************************
*
* The build script file.
*
*/
if OS == "Windows" && bool(config["lto"])
{
error("Link-time optimization is not supported on Windows");
}
if LIBRARY_ENABLED == "0"
{
if OS != "Windows" && NLS_ENABLED != "0"
{
io.eprint("Testing NLS...\n");
clang_flags: []str =
if CC contains "clang"
{
@[ "-Wno_unreachable-code" ];
};
flags: []str = clang_flags +~ @[
DEFOPT +~ "BC_ENABLE_NLS=1",
DEFOPT +~ "BC_ENABLED=" +~ BC_ENABLED,
DEFOPT +~ "DC_ENABLED=" +~ DC_ENABLED,
DEFOPT +~ "BC_ENABLE_HISTORY=0",
DEFOPT +~ "BC_ENABLE_LIBRARY=0",
DEFOPT +~ "BC_ENABLE_AFL=0",
DEFOPT +~ "BC_ENABLE_EXTRA_MATH=" +~ EXTRA_MATH_ENABLED,
DEFOPT +~ "BC_ENABLE_OSSFUZZ=0",
DEFOPT +~ "_POSIX_C_SOURCE=200809L",
DEFOPT +~ "_XOPEN_SOURCE=700",
INCOPT,
];
res := $ $CC %(flags) -c @(path.join(src_dir, "src/vm.c")) -E;
if res.exitcode != 0
{
if FORCE
{
io.eprint("Forcing NLS...\n");
}
else
{
error("NLS does not work\n");
}
}
else
{
if path.isfile("vm.o")
{
path.rm("vm.o");
}
io.eprint("NLS works.\n\n");
io.eprint("Testing gencat...\n");
res2 := $ gencat ./en_US.cat
@(path.join(src_dir, "locales/en_US.msg"));
if res2.exitcode != 0
{
if FORCE
{
io.eprint("Forcing NLS...\n");
}
else
{
error("gencat does not work\n");
}
}
else
{
io.eprint("gencat works.\n\n");
if platform != host
{
error("Cross compiles will not work!\n\n");
}
}
}
}
if OS != "Windows" && sym(config["history"]) != @none
{
io.eprint("Testing history...\n");
flags: []str = @[
DEFOPT +~ "BC_ENABLE_HISTORY=1",
DEFOPT +~ "BC_ENABLED=" +~ BC_ENABLED,
DEFOPT +~ "DC_ENABLED=" +~ DC_ENABLED,
DEFOPT +~ "BC_ENABLE_NLS=" +~ NLS_ENABLED,
DEFOPT +~ "BC_ENABLE_LIBRARY=0",
DEFOPT +~ "BC_ENABLE_AFL=0",
DEFOPT +~ "BC_ENABLE_EDITLINE=" +~ EDITLINE_ENABLED,
DEFOPT +~ "BC_ENABLE_READLINE=" +~ READLINE_ENABLED,
DEFOPT +~ "BC_ENABLE_EXTRA_MATH=" +~ EXTRA_MATH_ENABLED,
DEFOPT +~ "BC_ENABLE_OSSFUZZ=0",
DEFOPT +~ "_POSIX_C_SOURCE=200809L",
DEFOPT +~ "_XOPEN_SOURCE=700",
INCOPT,
];
res := $ $CC %(flags) -c @(path.join(src_dir, "src/history.c")) -E;
if res.exitcode != 0
{
if FORCE
{
io.eprint("Forcing history...\n");
}
else
{
error("History does not work\n");
}
}
else
{
if path.isfile("history.o")
{
path.rm("history.o");
}
io.eprint("History works.\n\n");
}
}
}
freebsd_flags: []str =
if OS != "FreeBSD"
{
@[ DEFOPT +~ "_POSIX_C_SOURCE=200809L", DEFOPT +~ "_XOPEN_SOURCE=700" ];
};
macos: bool = (OS == "Darwin");
macos_flags: []str =
if macos
{
@[ DEFOPT +~ "_DARWIN_C_SOURCE" ];
};
openbsd_flags: []str =
if OS == "OpenBSD"
{
if READLINE_ENABLED != "0"
{
error("Cannot use readline on OpenBSD");
}
@[ DEFOPT +~ "_BSD_SOURCE" ];
};
strip_flag: []str =
if OS != "Windows" && !bool(config["debug"]) && !macos && bool(config["strip"])
{
@[ "-s" ];
};
lto_flag: []str =
if bool(config["lto"])
{
@[ "-flto" ];
};
strict_flags: []str =
if bool(config["strict"])
{
// Strict build only works for GCC and Clang, so we do want to set that
// here.
if CC contains "gcc" || CC contains "clang"
{
// These are the standard strict build flags for both compilers.
std_strict: []str = @[ "-Wall", "-Wextra", "-Werror", "-pedantic" ];
// Clang has -Weverything, which I ensure Yc builds under.
//
// I also want unlimited errors because Clang is my development
// compiler; it caps at 20 by default.
compiler_strict: []str =
if CC contains "clang"
{
// Oh, and add the standard.
@[ "-Weverything", "-ferror-limit=100000", "-Wno-padded",
"-Wno-unknown-warning-option", "-Wno-unsafe-buffer-usage",
"-Wno-documentation-unknown-command", "-Wno-pre-c11-compat",
"-Wno-enum-enum-conversion", "-Wno-switch-default" ];
};
// Return the combination of the sets.
std_strict +~ compiler_strict;
}
else if OS == "Windows"
{
// Return the combo of the strict options, the standard, and the
// sanitizer defines.
@[ "/W4", "/WX", "/wd\"4996\"", "/permissive-" ];
}
};
version_contents: str = io.read_file(path.join(src_dir, "VERSION.txt"));
version_lines: []str = version_contents.split("\n");
version: str = version_lines[0];
version_flag: []str = @[ DEFOPT +~ "VERSION=" +~ version ];
other_flags: []str = freebsd_flags +~ macos_flags +~ openbsd_flags +~
lto_flag +~ strict_flags +~ version_flag +~
if bool(config["debug"])
{
@[ compiler_db["opt.debug"] ];
};
history_files: []str =
if HISTORY != @none
{
HISTORY_C_FILES;
};
c_files: []str =
if BUILD_MODE == @both
{
COMMON_C_FILES +~ EXEC_C_FILES +~ BC_C_FILES +~ DC_C_FILES +~ history_files;
}
else if BUILD_MODE == @bc
{
COMMON_C_FILES +~ EXEC_C_FILES +~ BC_C_FILES +~ history_files;
}
else if BUILD_MODE == @dc
{
COMMON_C_FILES +~ EXEC_C_FILES +~ DC_C_FILES +~ history_files;
}
else
{
COMMON_C_FILES +~ LIBRARY_C_FILES;
};
build_config: Gaml = @(gaml){
other_cflags: $other_flags
strip_flag: $strip_flag
};
targets: []str =
push build_config: config_stack
{
gen_o_files: []str =
if BUILD_MODE != @library
{
@[
txt2o("gen/lib.bc", "bc_lib", "bc_lib_name", "BC_ENABLED", true),
txt2o("gen/lib2.bc", "bc_lib2", "bc_lib2_name",
"BC_ENABLED && BC_ENABLE_EXTRA_MATH", true),
txt2o("gen/bc_help.txt", "bc_help", "", "BC_ENABLED", false),
txt2o("gen/dc_help.txt", "dc_help", "", "DC_ENABLED", false),
];
};
obj_files: []str = gen_o_files +~
for f: c_files
{
c2o(f);
};
if BUILD_MODE == @both || BUILD_MODE == @bc
{
if OS != "Windows" && bool(config["install_manpages"])
{
src: str = path.join("manuals/bc", BUILD_TYPE +~ ".1");
target BC_MANPAGE: src
{
$ cp -f @(file_dep) @(tgt);
}
}
exe(BC_BIN, obj_files);
}
if BUILD_MODE == @both || BUILD_MODE == @dc
{
if OS != "Windows" && bool(config["install_manpages"])
{
src: str = path.join("manuals/dc", BUILD_TYPE +~ ".1");
target DC_MANPAGE: src
{
$ cp -f @(file_dep) @(tgt);
}
}
if BUILD_MODE == @both
{
ln(DC_BIN, BC_BIN);
}
else
{
exe(DC_BIN, obj_files);
}
}
if BUILD_MODE == @library
{
lib(LIBRARY, obj_files);
}
if BUILD_MODE == @both
{
@[ BC_BIN, DC_BIN ];
}
else if BUILD_MODE == @bc
{
@[ DC_BIN ];
}
else if BUILD_MODE == @dc
{
@[ DC_BIN ];
}
else
{
includedir: str = get_includedir();
libdir: str = get_libdir();
pc_config: Gaml = @(gaml){
INCLUDEDIR: $includedir
LIBDIR: $libdir
VERSION: $version
};
push pc_config: config_stack
{
target PC_FILE: PC_FILE +~ ".in"
{
configure_file(file_dep, tgt, "%%");
}
}
@[ LIBRARY, PC_FILE ];
}
};
if OS != "Windows"
{
if LIBRARY_ENABLED == "0"
{
target @install: targets
{
bindir: str = get_bindir();
if BC_ENABLED != "0"
{
$ $SAFE_INSTALL $EXEC_INSTALL_MODE $BC_BIN
@(path.join(bindir, BC_BIN));
}
if DC_ENABLED != "0"
{
if BC_ENABLED != "0"
{
$ ln -sf @("./" +~ BC_BIN) @(path.join(bindir, DC_BIN));
}
else
{
$ $SAFE_INSTALL $EXEC_INSTALL_MODE $BC_BIN
@(path.join(bindir, BC_BIN));
}
}
if NLS_ENABLED != "0"
{
locale_install_args: []str =
if sym(config["locales"]) == @all
{
@[ "-l" ];
};
if DESTDIR != ""
{
$ @(path.join(src_dir, "scripts/locale_install.sh"))
%(locale_install_args) @(str(config["nlspath"]))
$MAINEXEC $DESTDIR;
}
else
{
$ @(path.join(src_dir, "scripts/locale_install.sh"))
%(locale_install_args) @(str(config["nlspath"]))
$MAINEXEC;
}
}
if bool(config["install_manpages"])
{
man1dir: str = get_man1dir();
if BC_ENABLED != "0"
{
$ rm -rf @(path.join(man1dir, BC_MANPAGE));
}
if DC_ENABLED != "0"
{
$ rm -rf @(path.join(man1dir, DC_MANPAGE));
}
}
}
target @uninstall
{
bindir: str = get_bindir();
if BC_ENABLED != "0"
{
$ rm -rf @(path.join(bindir, BC_BIN));
}
if DC_ENABLED != "0"
{
$ rm -rf @(path.join(bindir, DC_BIN));
}
if NLS_ENABLED != "0"
{
if DESTDIR != ""
{
$ @(path.join(src_dir, "scripts/locale_uninstall.sh"))
@(str(config["nlspath"])) $MAINEXEC $DESTDIR;
}
else
{
$ @(path.join(src_dir, "scripts/locale_uninstall.sh"))
@(str(config["nlspath"])) $MAINEXEC;
}
}
if bool(config["install_manpages"])
{
man1dir: str = get_man1dir();
$ rm -rf @(path.join(man1dir, BC_MANPAGE))
@(path.join(man1dir, DC_MANPAGE));
}
}
}
else
{
target @install: targets, BCL_HEADER_PATH
{
full_libdir: str = get_libdir();
$ $SAFE_INSTALL $EXEC_INSTALL_MODE @(file_dep)
@(path.join(full_libdir, file_dep));
full_pc_path: str = get_pc_path();
bcl_pc: str = file_deps[1];
$ $SAFE_INSTALL $MANPAGE_INSTALL_MODE $bcl_pc
@(path.join(full_pc_path, bcl_pc));
full_includedir: str = get_includedir();
$ $SAFE_INSTALL $MANPAGE_INSTALL_MODE @(file_deps[2])
@(path.join(full_includedir, BCL_HEADER));
if bool(config["install_manpages"])
{
$ $SAFE_INSTALL $MANPAGE_INSTALL_MODE
@(path.join(src_dir, path.join("manuals", BCL_MANPAGE)))
@(path.join(get_man3dir(), BCL_MANPAGE));
}
}
target @uninstall
{
$ rm -rf @(path.join(get_libdir(), LIBRARY))
@(path.join(get_pc_path(), PC_FILE))
@(path.join(get_includedir(), BCL_HEADER));
if bool(config["install_manpages"])
{
$ rm -rf @(path.join(get_man3dir(), BCL_MANPAGE));
}
}
}
}
// If the platform matches the host, we can run the test suite.
if platform == host
{
// If we have the library, build and run that test.
if BUILD_MODE == @library
{
libtesto: str = c2o("tests/bcl.c");
libtest: str = "bcl";
exe(libtest, @[ libtesto, targets[0] ]);
test @bcl: libtest
{
$ @(str(tgt_name));
}
}
else
{
if BUILD_MODE != @dc
{
exe_tests("bc");
}
if BUILD_MODE != @bc
{
exe_tests("dc");
}
target @clean_tests
{
for f: path.find_ext(build_dir, "txt")
{
path.rm(f);
}
}
}
}
target "bitfuncgen"
{
error("TODO: Make this");
}
target @bitfuncgen: "bitfuncgen"
{
error("TODO: Make this");
}
target "ministat"
{
error("TODO: Make this");
}
target @ministat: "ministat"
{
error("TODO: Make this");
}
target @all: targets;
+3
View File
@@ -1,6 +1,9 @@
-Weverything
-pedantic
-Wno-unsafe-buffer-usage
-Wno-pre-c11-compat
-Wno-unknown-warning-option
-Wno-switch-default
-D_POSIX_C_SOURCE=200809L
-D_XOPEN_SOURCE=700
-D_BSD_SOURCE
+24 -453
View File
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2024 Gavin D. Howard and contributors.
# Copyright (c) 2018-2025 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -55,7 +55,7 @@ usage() {
printf ' %s [-a|-bD|-dB|-c] [-CeEfgGHilmMNPrtTvz] [-O OPT_LEVEL] [-k KARATSUBA_LEN]\\\n' "$script"
printf ' [-s SETTING] [-S SETTING] [-p TYPE]\n'
printf ' %s \\\n' "$script"
printf ' [--library|--bc-only --disable-dc|--dc-only --disable-bc|--coverage] \\\n'
printf ' [--library|--bc-only --disable-dc|--dc-only --disable-bc] \\\n'
printf ' [--force --debug --disable-extra-math --disable-generated-tests] \\\n'
printf ' [--disable-history --disable-man-pages --disable-nls --disable-strip] \\\n'
printf ' [--enable-editline] [--enable-readline] [--enable-internal-history] \\\n'
@@ -74,7 +74,7 @@ usage() {
printf '\n'
printf ' -a, --library\n'
printf ' Build the libbcl instead of the programs. This is meant to be used with\n'
printf ' Other software like programming languages that want to make use of the\n'
printf ' other software like programming languages that want to make use of the\n'
printf ' parsing and math capabilities. This option will install headers using\n'
printf ' `make install`.\n'
printf ' -b, --bc-only\n'
@@ -83,10 +83,6 @@ usage() {
printf ' -B, --disable-bc\n'
printf ' Disable bc. It is an error if "-b", "--bc-only", "-D", or "--disable-dc"\n'
printf ' are specified too.\n'
printf ' -c, --coverage\n'
printf ' Generate test coverage code. Requires gcov and gcovr.\n'
printf ' It is an error if either "-b" ("-D") or "-d" ("-B") is specified.\n'
printf ' Requires a compiler that use gcc-compatible coverage options\n'
printf ' -C, --disable-clean\n'
printf ' Disable the clean that configure.sh does before configure.\n'
printf ' -d, --dc-only\n'
@@ -133,8 +129,6 @@ usage() {
printf ' Installs all locales, regardless of how many are on the system. This\n'
printf ' option is useful for package maintainers who want to make sure that\n'
printf ' a package contains all of the locales that end users might need.\n'
printf ' -m, --enable-memcheck\n'
printf ' Enable memcheck mode, to ensure no memory leaks. For development only.\n'
printf ' -M, --disable-man-pages\n'
printf ' Disable installing manpages.\n'
printf ' -N, --disable-nls\n'
@@ -172,17 +166,9 @@ usage() {
printf ' Set the default named by SETTING to off. See below for possible values\n'
printf ' for SETTING. For multiple instances of the -s or -S for the the same\n'
printf ' setting, the last one is used.\n'
printf ' -t, --enable-test-timing\n'
printf ' Enable the timing of tests. This is for development only.\n'
printf ' -T, --disable-strip\n'
printf ' Disable stripping symbols from the compiled binary or binaries.\n'
printf ' Stripping symbols only happens when debug mode is off.\n'
printf ' -v, --enable-valgrind\n'
printf ' Enable a build appropriate for valgrind. For development only.\n'
printf ' -z, --enable-fuzz-mode\n'
printf ' Enable fuzzing mode. THIS IS FOR DEVELOPMENT ONLY.\n'
printf ' -Z, --enable-ossfuzz-mode\n'
printf ' Enable fuzzing mode for OSS-Fuzz. THIS IS FOR DEVELOPMENT ONLY.\n'
printf ' --prefix PREFIX\n'
printf ' The prefix to install to. Overrides "$PREFIX" if it exists.\n'
printf ' If PREFIX is "/usr", install path will be "/usr/bin".\n'
@@ -254,12 +240,12 @@ usage() {
printf ' path (or contain one). This is treated the same as the POSIX\n'
printf ' definition of $NLSPATH (see POSIX environment variables for\n'
printf ' more information). Default is "/usr/share/locale/%%L/%%N".\n'
printf ' PC_PATH The location to install pkg-config files to. Must be an\n'
printf ' PC_PATH The location to install pkg-config files to. Must be a\n'
printf ' path or contain one. Default is the first path given by the\n'
printf ' output of `pkg-config --variable=pc_path pkg-config`.\n'
printf ' EXECSUFFIX The suffix to append to the executable names, used to not\n'
printf ' interfere with other installed bc executables. Default is "".\n'
printf ' EXECPREFIX The prefix to append to the executable names, used to not\n'
printf ' EXECPREFIX The prefix to prepend to the executable names, used to not\n'
printf ' interfere with other installed bc executables. Default is "".\n'
printf ' DESTDIR For package creation. Default is "". If it is empty when\n'
printf ' `%s` is run, it can also be passed to `make install`\n' "$script"
@@ -482,7 +468,7 @@ find_src_files() {
}
# This function generates a list of files to go into the Makefile. It generates
# the list of object files, as well as the list of test coverage files.
# the list of object files.
#
# @param contents The contents of the Makefile template to put the list of
# files into.
@@ -503,8 +489,6 @@ gen_file_list() {
_gen_file_list_needle_src="SRC"
_gen_file_list_needle_obj="OBJ"
_gen_file_list_needle_gcda="GCDA"
_gen_file_list_needle_gcno="GCNO"
_gen_file_list_replacement=$(find_src_files $_gen_file_list_unneeded | tr '\n' ' ')
_gen_file_list_contents=$(replace "$_gen_file_list_contents" \
@@ -521,151 +505,9 @@ gen_file_list() {
_gen_file_list_contents=$(replace "$_gen_file_list_contents" \
"$_gen_file_list_needle_obj" "$_gen_file_list_replacement")
_gen_file_list_replacement=$(replace_exts "$_gen_file_list_replacement" "o" "gcda")
_gen_file_list_contents=$(replace "$_gen_file_list_contents" \
"$_gen_file_list_needle_gcda" "$_gen_file_list_replacement")
_gen_file_list_replacement=$(replace_exts "$_gen_file_list_replacement" "gcda" "gcno")
_gen_file_list_contents=$(replace "$_gen_file_list_contents" \
"$_gen_file_list_needle_gcno" "$_gen_file_list_replacement")
printf '%s\n' "$_gen_file_list_contents"
}
# Generates the proper test targets for each test to have its own target. This
# allows `make test` to run in parallel.
#
# @param name Which calculator to generate tests for.
# @param extra_math An integer that, if non-zero, activates extra math tests.
# @param time_tests An integer that, if non-zero, tells the test suite to time
# the execution of each test.
gen_std_tests() {
_gen_std_tests_name="$1"
shift
_gen_std_tests_extra_math="$1"
shift
_gen_std_tests_time_tests="$1"
shift
_gen_std_tests_extra_required=$(cat "$scriptdir/tests/extra_required.txt")
for _gen_std_tests_t in $(cat "$scriptdir/tests/$_gen_std_tests_name/all.txt"); do
if [ "$_gen_std_tests_extra_math" -eq 0 ]; then
if [ -z "${_gen_std_tests_extra_required##*$_gen_std_tests_t*}" ]; then
printf 'test_%s_%s:\n\t@printf "Skipping %s %s\\n"\n\n' \
"$_gen_std_tests_name" "$_gen_std_tests_t" "$_gen_std_tests_name" \
"$_gen_std_tests_t" >> "Makefile"
continue
fi
fi
printf 'test_%s_%s:\n\t@export BC_TEST_OUTPUT_DIR="%s/tests"; sh $(TESTSDIR)/test.sh %s %s %s %s %s\n\n' \
"$_gen_std_tests_name" "$_gen_std_tests_t" "$builddir" "$_gen_std_tests_name" \
"$_gen_std_tests_t" "$generate_tests" "$time_tests" \
"$*" >> "Makefile"
done
}
# Generates a list of test targets that will be used as prerequisites for other
# targets.
#
# @param name The name of the calculator to generate test targets for.
gen_std_test_targets() {
_gen_std_test_targets_name="$1"
shift
_gen_std_test_targets_tests=$(cat "$scriptdir/tests/${_gen_std_test_targets_name}/all.txt")
for _gen_std_test_targets_t in $_gen_std_test_targets_tests; do
printf ' test_%s_%s' "$_gen_std_test_targets_name" "$_gen_std_test_targets_t"
done
printf '\n'
}
# Generates the proper test targets for each error test to have its own target.
# This allows `make test_bc_errors` and `make test_dc_errors` to run in
# parallel.
#
# @param name Which calculator to generate tests for.
gen_err_tests() {
_gen_err_tests_name="$1"
shift
_gen_err_tests_fs=$(ls "$scriptdir/tests/$_gen_err_tests_name/errors/")
for _gen_err_tests_t in $_gen_err_tests_fs; do
printf 'test_%s_error_%s:\n\t@export BC_TEST_OUTPUT_DIR="%s/tests"; sh $(TESTSDIR)/error.sh %s %s %s %s\n\n' \
"$_gen_err_tests_name" "$_gen_err_tests_t" "$builddir" "$_gen_err_tests_name" \
"$_gen_err_tests_t" "$problematic_tests" "$*" >> "Makefile"
done
}
# Generates a list of error test targets that will be used as prerequisites for
# other targets.
#
# @param name The name of the calculator to generate test targets for.
gen_err_test_targets() {
_gen_err_test_targets_name="$1"
shift
_gen_err_test_targets_tests=$(ls "$scriptdir/tests/$_gen_err_test_targets_name/errors/")
for _gen_err_test_targets_t in $_gen_err_test_targets_tests; do
printf ' test_%s_error_%s' "$_gen_err_test_targets_name" "$_gen_err_test_targets_t"
done
printf '\n'
}
# Generates the proper script test targets for each script test to have its own
# target. This allows `make test` to run in parallel.
#
# @param name Which calculator to generate tests for.
# @param extra_math An integer that, if non-zero, activates extra math tests.
# @param generate An integer that, if non-zero, activates generated tests.
# @param time_tests An integer that, if non-zero, tells the test suite to time
# the execution of each test.
gen_script_tests() {
_gen_script_tests_name="$1"
shift
_gen_script_tests_extra_math="$1"
shift
_gen_script_tests_generate="$1"
shift
_gen_script_tests_time="$1"
shift
_gen_script_tests_tests=$(cat "$scriptdir/tests/$_gen_script_tests_name/scripts/all.txt")
for _gen_script_tests_f in $_gen_script_tests_tests; do
_gen_script_tests_b=$(basename "$_gen_script_tests_f" ".${_gen_script_tests_name}")
printf 'test_%s_script_%s:\n\t@export BC_TEST_OUTPUT_DIR="%s/tests"; sh $(TESTSDIR)/script.sh %s %s %s 1 %s %s %s\n\n' \
"$_gen_script_tests_name" "$_gen_script_tests_b" "$builddir" "$_gen_script_tests_name" \
"$_gen_script_tests_f" "$_gen_script_tests_extra_math" "$_gen_script_tests_generate" \
"$_gen_script_tests_time" "$*" >> "Makefile"
done
}
set_default() {
_set_default_on="$1"
@@ -710,7 +552,6 @@ predefined_build() {
BSD)
bc_only=0
dc_only=0
coverage=0
debug=0
optimization="3"
hist=1
@@ -723,11 +564,6 @@ predefined_build() {
strip_bin=1
all_locales=0
library=0
fuzz=0
ossfuzz=0
time_tests=0
vg=0
memcheck=0
clean=1
bc_default_banner=0
bc_default_sigint_reset=1
@@ -744,7 +580,6 @@ predefined_build() {
GNU)
bc_only=0
dc_only=0
coverage=0
debug=0
optimization="3"
hist=1
@@ -757,11 +592,6 @@ predefined_build() {
strip_bin=1
all_locales=0
library=0
fuzz=0
ossfuzz=0
time_tests=0
vg=0
memcheck=0
clean=1
bc_default_banner=1
bc_default_sigint_reset=1
@@ -777,10 +607,10 @@ predefined_build() {
GDH)
CFLAGS="-Weverything -Wno-padded -Wno-unsafe-buffer-usage -Wno-poison-system-directories"
CFLAGS="$CFLAGS -Wno-switch-default -Werror -pedantic -std=c11"
CFLAGS="$CFLAGS -Wno-unknown-warning-option -Wno-switch-default -Wno-pre-c11-compat"
CFLAGS="$CFLAGS -Werror -pedantic -std=c11"
bc_only=0
dc_only=0
coverage=0
debug=0
optimization="3"
hist=1
@@ -793,11 +623,6 @@ predefined_build() {
strip_bin=1
all_locales=0
library=0
fuzz=0
ossfuzz=0
time_tests=0
vg=0
memcheck=0
clean=1
bc_default_banner=1
bc_default_sigint_reset=1
@@ -813,10 +638,10 @@ predefined_build() {
DBG)
CFLAGS="-Weverything -Wno-padded -Wno-unsafe-buffer-usage -Wno-poison-system-directories"
CFLAGS="$CFLAGS -Wno-switch-default -Werror -pedantic -std=c11"
CFLAGS="$CFLAGS -Wno-unknown-warning-option -Wno-switch-default -Wno-pre-c11-compat"
CFLAGS="$CFLAGS -Werror -pedantic -std=c11"
bc_only=0
dc_only=0
coverage=0
debug=1
optimization="0"
hist=1
@@ -829,11 +654,6 @@ predefined_build() {
strip_bin=1
all_locales=0
library=0
fuzz=0
ossfuzz=0
time_tests=0
vg=0
memcheck=1
clean=1
bc_default_banner=1
bc_default_sigint_reset=1
@@ -852,36 +672,12 @@ predefined_build() {
esac
}
# Generates a list of script test targets that will be used as prerequisites for
# other targets.
#
# @param name The name of the calculator to generate script test targets for.
gen_script_test_targets() {
_gen_script_test_targets_name="$1"
shift
_gen_script_test_targets_tests=$(cat "$scriptdir/tests/$_gen_script_test_targets_name/scripts/all.txt")
for _gen_script_test_targets_f in $_gen_script_test_targets_tests; do
_gen_script_test_targets_b=$(basename "$_gen_script_test_targets_f" \
".$_gen_script_test_targets_name")
printf ' test_%s_script_%s' "$_gen_script_test_targets_name" \
"$_gen_script_test_targets_b"
done
printf '\n'
}
# This is a list of defaults, but it is also the list of possible options for
# users to change.
#
# The development options are: force (force options even if they fail), valgrind
# (build in a way suitable for valgrind testing), memcheck (same as valgrind),
# and fuzzing (build in a way suitable for fuzzing).
# The development options are: force (force options even if they fail).
bc_only=0
dc_only=0
coverage=0
karatsuba_len=32
debug=0
hist=1
@@ -895,11 +691,6 @@ force=0
strip_bin=1
all_locales=0
library=0
fuzz=0
ossfuzz=0
time_tests=0
vg=0
memcheck=0
clean=1
problematic_tests=1
@@ -920,13 +711,12 @@ dc_default_digit_clamp=0
# getopts is a POSIX utility, but it cannot handle long options. Thus, the
# handling of long options is done by hand, and that's the reason that short and
# long options cannot be mixed.
while getopts "abBcdDeEfgGhHik:lMmNO:p:PrS:s:tTvzZ-" opt; do
while getopts "abBcdDeEfgGhHik:lMNO:p:PrS:s:T-" opt; do
case "$opt" in
a) library=1 ;;
b) bc_only=1 ;;
B) dc_only=1 ;;
c) coverage=1 ;;
C) clean=0 ;;
d) dc_only=1 ;;
D) bc_only=1 ;;
@@ -940,7 +730,6 @@ while getopts "abBcdDeEfgGhHik:lMmNO:p:PrS:s:tTvzZ-" opt; do
i) hist_impl="internal" ;;
k) karatsuba_len="$OPTARG" ;;
l) all_locales=1 ;;
m) memcheck=1 ;;
M) install_manpages=0 ;;
N) nls=0 ;;
O) optimization="$OPTARG" ;;
@@ -949,11 +738,7 @@ while getopts "abBcdDeEfgGhHik:lMmNO:p:PrS:s:tTvzZ-" opt; do
r) hist_impl="readline" ;;
S) set_default 0 "$OPTARG" ;;
s) set_default 1 "$OPTARG" ;;
t) time_tests=1 ;;
T) strip_bin=0 ;;
v) vg=1 ;;
z) fuzz=1 ;;
Z) ossfuzz=1 ;;
-)
arg="$1"
arg="${arg#--}"
@@ -963,7 +748,6 @@ while getopts "abBcdDeEfgGhHik:lMmNO:p:PrS:s:tTvzZ-" opt; do
library) library=1 ;;
bc-only) bc_only=1 ;;
dc-only) dc_only=1 ;;
coverage) coverage=1 ;;
debug) debug=1 ;;
force) force=1 ;;
prefix=?*) PREFIX="$LONG_OPTARG" ;;
@@ -1077,27 +861,20 @@ while getopts "abBcdDeEfgGhHik:lMmNO:p:PrS:s:tTvzZ-" opt; do
enable-editline) hist_impl="editline" ;;
enable-readline) hist_impl="readline" ;;
enable-internal-history) hist_impl="internal" ;;
enable-test-timing) time_tests=1 ;;
enable-valgrind) vg=1 ;;
enable-fuzz-mode) fuzz=1 ;;
enable-ossfuzz-mode) ossfuzz=1 ;;
enable-memcheck) memcheck=1 ;;
install-all-locales) all_locales=1 ;;
help* | bc-only* | dc-only* | coverage* | debug*)
help* | bc-only* | dc-only* | debug*)
usage "No arg allowed for --$arg option" ;;
disable-bc* | disable-dc* | disable-clean*)
usage "No arg allowed for --$arg option" ;;
disable-extra-math*)
usage "No arg allowed for --$arg option" ;;
disable-generated-tests* | disable-history*)
disable-history*)
usage "No arg allowed for --$arg option" ;;
disable-man-pages* | disable-nls* | disable-strip*)
usage "No arg allowed for --$arg option" ;;
disable-problematic-tests*)
usage "No arg allowed for --$arg option" ;;
enable-fuzz-mode* | enable-test-timing* | enable-valgrind*)
usage "No arg allowed for --$arg option" ;;
enable-memcheck* | install-all-locales*)
install-all-locales*)
usage "No arg allowed for --$arg option" ;;
enable-editline* | enable-readline*)
usage "No arg allowed for --$arg option" ;;
@@ -1221,33 +998,7 @@ link="@printf 'No link necessary\\\\n'"
main_exec="BC"
executable="BC_EXEC"
tests="test_bc timeconst test_dc"
bc_test="@export BC_TEST_OUTPUT_DIR=\"$builddir/tests\"; \$(TESTSDIR)/all.sh bc $extra_math 1 $generate_tests $problematic_tests $time_tests \$(BC_EXEC)"
bc_test_np="@export BC_TEST_OUTPUT_DIR=\"$builddir/tests\"; \$(TESTSDIR)/all.sh -n bc $extra_math 1 $generate_tests $problematic_tests $time_tests \$(BC_EXEC)"
dc_test="@export BC_TEST_OUTPUT_DIR=\"$builddir/tests\"; \$(TESTSDIR)/all.sh dc $extra_math 1 $generate_tests $problematic_tests $time_tests \$(DC_EXEC)"
dc_test_np="@export BC_TEST_OUTPUT_DIR=\"$builddir/tests\"; \$(TESTSDIR)/all.sh -n dc $extra_math 1 $generate_tests $problematic_tests $time_tests \$(DC_EXEC)"
timeconst="@export BC_TEST_OUTPUT_DIR=\"$builddir/tests\"; \$(TESTSDIR)/bc/timeconst.sh \$(TESTSDIR)/bc/scripts/timeconst.bc \$(BC_EXEC)"
# In order to have cleanup at exit, we need to be in
# debug mode, so don't run valgrind without that.
if [ "$vg" -ne 0 ]; then
debug=1
bc_test_exec='valgrind $(VALGRIND_ARGS) $(BC_EXEC)'
dc_test_exec='valgrind $(VALGRIND_ARGS) $(DC_EXEC)'
bcl_test_exec='valgrind $(VALGRIND_ARGS) $(BCL_TEST)'
else
bc_test_exec='$(BC_EXEC)'
dc_test_exec='$(DC_EXEC)'
bcl_test_exec='$(BCL_TEST)'
fi
test_bc_history_prereqs="test_bc_history_all"
test_dc_history_prereqs="test_dc_history_all"
karatsuba="@printf 'karatsuba cannot be run because one of bc or dc is not built\\\\n'"
karatsuba_test="@printf 'karatsuba cannot be run because one of bc or dc is not built\\\\n'"
bc_lib="\$(GEN_DIR)/lib.o"
bc_help="\$(GEN_DIR)/bc_help.o"
@@ -1274,9 +1025,6 @@ if [ "$library" -ne 0 ]; then
default_target_prereqs="\$(BIN) \$(OBJ)"
default_target_cmd="ar -r -cu \$(LIBBC) \$(OBJ)"
default_target="\$(LIBBC)"
tests="test_library"
test_bc_history_prereqs=" test_bc_history_skip"
test_dc_history_prereqs=" test_dc_history_skip"
install_prereqs=" install_library"
uninstall_prereqs=" uninstall_library"
@@ -1292,10 +1040,6 @@ elif [ "$bc_only" -eq 1 ]; then
executables="bc"
dc_test="@printf 'No dc tests to run\\\\n'"
dc_test_np="@printf 'No dc tests to run\\\\n'"
test_dc_history_prereqs=" test_dc_history_skip"
install_prereqs=" install_execs"
install_man_prereqs=" install_bc_manpage"
uninstall_prereqs=" uninstall_bc"
@@ -1303,7 +1047,6 @@ elif [ "$bc_only" -eq 1 ]; then
default_target="\$(BC_EXEC)"
second_target="\$(DC_EXEC)"
tests="test_bc timeconst"
elif [ "$dc_only" -eq 1 ]; then
@@ -1318,58 +1061,11 @@ elif [ "$dc_only" -eq 1 ]; then
main_exec="DC"
executable="DC_EXEC"
bc_test="@printf 'No bc tests to run\\\\n'"
bc_test_np="@printf 'No bc tests to run\\\\n'"
test_bc_history_prereqs=" test_bc_history_skip"
timeconst="@printf 'timeconst cannot be run because bc is not built\\\\n'"
install_prereqs=" install_execs"
install_man_prereqs=" install_dc_manpage"
uninstall_prereqs=" uninstall_dc"
uninstall_man_prereqs=" uninstall_dc_manpage"
tests="test_dc"
elif [ "$ossfuzz" -eq 1 ]; then
if [ "$bc_only" -ne 0 ] || [ "$dc_only" -ne 0 ]; then
usage "An OSS-Fuzz build must build both fuzzers."
fi
bc=1
dc=1
# Expressions *cannot* exit in an OSS-Fuzz build.
bc_default_expr_exit=0
dc_default_expr_exit=0
executables="bc_fuzzer and dc_fuzzer"
karatsuba="@\$(KARATSUBA) 30 0 \$(BC_EXEC)"
karatsuba_test="@\$(KARATSUBA) 1 100 \$(BC_EXEC)"
if [ "$library" -eq 0 ]; then
install_prereqs=" install_execs"
install_man_prereqs=" install_bc_manpage install_dc_manpage"
uninstall_prereqs=" uninstall_bc uninstall_dc"
uninstall_man_prereqs=" uninstall_bc_manpage uninstall_dc_manpage"
else
install_prereqs=" install_library install_bcl_header"
install_man_prereqs=" install_bcl_manpage"
uninstall_prereqs=" uninstall_library uninstall_bcl_header"
uninstall_man_prereqs=" uninstall_bcl_manpage"
tests="test_library"
fi
second_target_prereqs="src/bc_fuzzer.o $default_target_prereqs"
default_target_prereqs="\$(BC_FUZZER) src/dc_fuzzer.o $default_target_prereqs"
default_target_cmd="\$(CXX) \$(CFLAGS) src/dc_fuzzer.o \$(LIB_FUZZING_ENGINE) \$(OBJS) \$(LDFLAGS) -o \$(DC_FUZZER) \&\& ln -sf ./dc_fuzzer_c \$(DC_FUZZER_C)"
second_target_cmd="\$(CXX) \$(CFLAGS) src/bc_fuzzer.o \$(LIB_FUZZING_ENGINE) \$(OBJS) \$(LDFLAGS) -o \$(BC_FUZZER) \&\& ln -sf ./bc_fuzzer_c \$(BC_FUZZER_C)"
default_target="\$(DC_FUZZER) \$(DC_FUZZER_C)"
second_target="\$(BC_FUZZER) \$(BC_FUZZER_C)"
else
bc=1
@@ -1378,7 +1074,6 @@ else
executables="bc and dc"
karatsuba="@\$(KARATSUBA) 30 0 \$(BC_EXEC)"
karatsuba_test="@\$(KARATSUBA) 1 100 \$(BC_EXEC)"
if [ "$library" -eq 0 ]; then
install_prereqs=" install_execs"
@@ -1390,7 +1085,6 @@ else
install_man_prereqs=" install_bcl_manpage"
uninstall_prereqs=" uninstall_library uninstall_bcl_header"
uninstall_man_prereqs=" uninstall_bcl_manpage"
tests="test_library"
fi
second_target_prereqs="$default_target_prereqs"
@@ -1399,18 +1093,6 @@ else
fi
if [ "$fuzz" -ne 0 ] && [ "$ossfuzz" -ne 0 ]; then
usage "Fuzzing mode and OSS-Fuzz mode are mutually exclusive"
fi
# We need specific stuff for fuzzing.
if [ "$fuzz" -ne 0 ] || [ "$ossfuzz" -ne 0 ]; then
debug=1
hist=0
nls=0
optimization="3"
fi
# This sets some necessary things for debug mode.
if [ "$debug" -eq 1 ]; then
@@ -1429,26 +1111,6 @@ if [ -n "$optimization" ]; then
CFLAGS="-O$optimization $CFLAGS"
fi
# Set test coverage defaults.
if [ "$coverage" -eq 1 ]; then
if [ "$bc_only" -eq 1 ] || [ "$dc_only" -eq 1 ]; then
usage "Can only specify -c without -b or -d"
fi
CFLAGS="-fprofile-arcs -ftest-coverage -g -O0 $CFLAGS"
CPPFLAGS="-DNDEBUG $CPPFLAGS"
COVERAGE_OUTPUT="@gcov -pabcdf \$(GCDA) \$(BC_GCDA) \$(DC_GCDA) \$(HISTORY_GCDA) \$(RAND_GCDA)"
COVERAGE_OUTPUT="$COVERAGE_OUTPUT;\$(RM) -f \$(GEN)*.gc*"
COVERAGE_OUTPUT="$COVERAGE_OUTPUT;gcovr --exclude-unreachable-branches --exclude-throw-branches --html-details --output index.html"
COVERAGE_PREREQS=" test coverage_output"
else
COVERAGE_OUTPUT="@printf 'Coverage not generated\\\\n'"
COVERAGE_PREREQS=""
fi
# Set some defaults.
if [ -z "${DESTDIR+set}" ]; then
destdir=""
@@ -1567,7 +1229,7 @@ if [ "$nls" -ne 0 ]; then
printf 'NLS works.\n\n'
printf 'Testing gencat...\n'
gencat "./en_US.cat" "$scriptdir/locales/en_US.msg" > /dev/null
gencat "./en_US.cat" "$scriptdir/locales/en_US.msg" 2>&1
err="$?"
@@ -1672,26 +1334,10 @@ else
fi
# We have to disable the history tests if it is disabled or valgrind is on. Or
# if we are using editline or readline.
if [ "$hist" -eq 0 ] || [ "$vg" -ne 0 ]; then
test_bc_history_prereqs=" test_bc_history_skip"
test_dc_history_prereqs=" test_dc_history_skip"
history_tests="@printf 'Skipping history tests...\\\\n'"
if [ "$hist" -eq 0 ]; then
CFLAGS="$CFLAGS -DBC_ENABLE_EDITLINE=0 -DBC_ENABLE_READLINE=0"
else
if [ "$editline" -eq 0 ] && [ "$readline" -eq 0 ]; then
history_tests="@printf '\$(TEST_STARS)\\\\n\\\\nRunning history tests...\\\\n\\\\n'"
history_tests="$history_tests \&\& \$(TESTSDIR)/history.sh bc -a \&\&"
history_tests="$history_tests \$(TESTSDIR)/history.sh dc -a \&\& printf"
history_tests="$history_tests '\\\\nAll history tests passed.\\\\n\\\\n\$(TEST_STARS)\\\\n'"
else
test_bc_history_prereqs=" test_bc_history_skip"
test_dc_history_prereqs=" test_dc_history_skip"
history_tests="@printf 'Skipping history tests...\\\\n'"
fi
# We are also setting the CFLAGS and LDFLAGS here.
if [ "$editline" -ne 0 ]; then
LDFLAGS="$LDFLAGS -ledit"
@@ -1795,7 +1441,7 @@ GEN_DIR="$scriptdir/gen"
# `gen/strgen.sh` is used.
GEN="strgen"
GEN_EXEC_TARGET="\$(HOSTCC) -DBC_ENABLE_AFL=0 -DBC_ENABLE_OSSFUZZ=0 -I$scriptdir/include/ \$(HOSTCFLAGS) -o \$(GEN_EXEC) \$(GEN_C)"
CLEAN_PREREQS=" clean_gen clean_coverage"
CLEAN_PREREQS=" clean_gen"
if [ -z "${GEN_HOST+set}" ]; then
GEN_HOST=1
@@ -1803,7 +1449,6 @@ else
if [ "$GEN_HOST" -eq 0 ]; then
GEN="strgen.sh"
GEN_EXEC_TARGET="@printf 'Do not need to build gen/strgen.c\\\\n'"
CLEAN_PREREQS=" clean_coverage"
fi
fi
@@ -1848,9 +1493,7 @@ else
headers="$headers \$(DC_HEADERS)"
fi
# This convoluted mess does pull the version out. If you change the format of
# include/version.h, you may have to change this line.
version=$(cat "$scriptdir/include/version.h" | grep "VERSION " - | awk '{ print $3 }' -)
version=$(cat "$scriptdir/VERSION.txt" | head -n1)
if [ "$library" -ne 0 ]; then
@@ -1880,14 +1523,6 @@ if [ "$library" -ne 0 ]; then
fi
elif [ "$ossfuzz" -ne 0 ]; then
unneeded="$unneeded library.c main.c"
PC_PATH=""
pkg_config_install=""
pkg_config_uninstall=""
else
unneeded="$unneeded library.c"
@@ -1909,10 +1544,6 @@ if [ "$manpage_args" = "" ]; then
manpage_args="A"
fi
if [ "$vg" -ne 0 ] || [ "$ossfuzz" -ne 0 ]; then
memcheck=1
fi
if [ "$bc_default_prompt" = "" ]; then
bc_default_prompt="$bc_default_tty_mode"
fi
@@ -1921,14 +1552,6 @@ if [ "$dc_default_prompt" = "" ]; then
dc_default_prompt="$dc_default_tty_mode"
fi
# Generate the test targets and prerequisites.
bc_tests=$(gen_std_test_targets bc)
bc_script_tests=$(gen_script_test_targets bc)
bc_err_tests=$(gen_err_test_targets bc)
dc_tests=$(gen_std_test_targets dc)
dc_script_tests=$(gen_script_test_targets dc)
dc_err_tests=$(gen_err_test_targets dc)
printf 'unneeded: %s\n' "$unneeded"
# Print out the values; this is for debugging.
@@ -1949,7 +1572,6 @@ printf 'BC_ENABLE_LIBRARY=%s\n\n' "$library"
printf 'BC_ENABLE_HISTORY=%s\n' "$hist"
printf 'BC_ENABLE_EXTRA_MATH=%s\n' "$extra_math"
printf 'BC_ENABLE_NLS=%s\n\n' "$nls"
printf 'BC_ENABLE_AFL=%s\n' "$fuzz"
printf '\n'
printf 'BC_NUM_KARATSUBA_LEN=%s\n' "$karatsuba_len"
printf '\n'
@@ -2046,26 +1668,11 @@ contents=$(replace "$contents" "BUILDDIR" "$builddir")
contents=$(replace "$contents" "HEADERS" "$headers")
contents=$(replace "$contents" "VERSION" "$version")
contents=$(replace "$contents" "BC_ENABLED" "$bc")
contents=$(replace "$contents" "DC_ENABLED" "$dc")
contents=$(replace "$contents" "BC_ALL_TESTS" "$bc_test")
contents=$(replace "$contents" "BC_ALL_TESTS_NP" "$bc_test_np")
contents=$(replace "$contents" "BC_TESTS" "$bc_tests")
contents=$(replace "$contents" "BC_SCRIPT_TESTS" "$bc_script_tests")
contents=$(replace "$contents" "BC_ERROR_TESTS" "$bc_err_tests")
contents=$(replace "$contents" "BC_TEST_EXEC" "$bc_test_exec")
contents=$(replace "$contents" "TIMECONST_ALL_TESTS" "$timeconst")
contents=$(replace "$contents" "DC_ALL_TESTS" "$dc_test")
contents=$(replace "$contents" "DC_ALL_TESTS_NP" "$dc_test_np")
contents=$(replace "$contents" "DC_TESTS" "$dc_tests")
contents=$(replace "$contents" "DC_SCRIPT_TESTS" "$dc_script_tests")
contents=$(replace "$contents" "DC_ERROR_TESTS" "$dc_err_tests")
contents=$(replace "$contents" "DC_TEST_EXEC" "$dc_test_exec")
contents=$(replace "$contents" "BCL_TEST_EXEC" "$bcl_test_exec")
contents=$(replace "$contents" "BUILD_TYPE" "$manpage_args")
contents=$(replace "$contents" "EXCLUDE_EXTRA_MATH" "$exclude_extra_math")
@@ -2073,10 +1680,6 @@ contents=$(replace "$contents" "LIBRARY" "$library")
contents=$(replace "$contents" "HISTORY" "$hist")
contents=$(replace "$contents" "EXTRA_MATH" "$extra_math")
contents=$(replace "$contents" "NLS" "$nls")
contents=$(replace "$contents" "FUZZ" "$fuzz")
contents=$(replace "$contents" "OSSFUZZ" "$ossfuzz")
contents=$(replace "$contents" "MEMCHECK" "$memcheck")
contents=$(replace "$contents" "LIB_FUZZING_ENGINE" "$LIB_FUZZING_ENGINE")
contents=$(replace "$contents" "BC_LIB_O" "$bc_lib")
contents=$(replace "$contents" "BC_HELP_O" "$bc_help")
@@ -2099,8 +1702,6 @@ contents=$(replace "$contents" "CPPFLAGS" "$CPPFLAGS")
contents=$(replace "$contents" "LDFLAGS" "$LDFLAGS")
contents=$(replace "$contents" "CC" "$CC")
contents=$(replace "$contents" "HOSTCC" "$HOSTCC")
contents=$(replace "$contents" "COVERAGE_OUTPUT" "$COVERAGE_OUTPUT")
contents=$(replace "$contents" "COVERAGE_PREREQS" "$COVERAGE_PREREQS")
contents=$(replace "$contents" "INSTALL_PREREQS" "$install_prereqs")
contents=$(replace "$contents" "INSTALL_MAN_PREREQS" "$install_man_prereqs")
contents=$(replace "$contents" "INSTALL_LOCALES" "$install_locales")
@@ -2126,22 +1727,14 @@ contents=$(replace "$contents" "BC_EXEC_CMD" "$bc_exec_cmd")
contents=$(replace "$contents" "DC_EXEC_PREREQ" "$dc_exec_prereq")
contents=$(replace "$contents" "DC_EXEC_CMD" "$dc_exec_cmd")
contents=$(replace "$contents" "GENERATE_TESTS" "$generate_tests")
contents=$(replace "$contents" "PROBLEMATIC_TESTS" "$problematic_tests")
contents=$(replace "$contents" "EXECUTABLES" "$executables")
contents=$(replace "$contents" "MAIN_EXEC" "$main_exec")
contents=$(replace "$contents" "EXEC" "$executable")
contents=$(replace "$contents" "TESTS" "$tests")
contents=$(replace "$contents" "BC_HISTORY_TEST_PREREQS" "$test_bc_history_prereqs")
contents=$(replace "$contents" "DC_HISTORY_TEST_PREREQS" "$test_dc_history_prereqs")
contents=$(replace "$contents" "HISTORY_TESTS" "$history_tests")
contents=$(replace "$contents" "VG_BC_TEST" "$vg_bc_test")
contents=$(replace "$contents" "VG_DC_TEST" "$vg_dc_test")
contents=$(replace "$contents" "TIMECONST" "$timeconst")
contents=$(replace "$contents" "KARATSUBA" "$karatsuba")
contents=$(replace "$contents" "KARATSUBA_TEST" "$karatsuba_test")
contents=$(replace "$contents" "LONG_BIT_DEFINE" "$LONG_BIT_DEFINE")
@@ -2169,28 +1762,6 @@ contents=$(replace "$contents" "DC_DEFAULT_DIGIT_CLAMP" "$dc_default_digit_clamp
# Do the first print to the Makefile.
printf '%s\n%s\n\n' "$contents" "$SRC_TARGETS" > "Makefile"
# Generate the individual test targets.
if [ "$bc" -ne 0 ]; then
gen_std_tests bc "$extra_math" "$time_tests" $bc_test_exec
gen_script_tests bc "$extra_math" "$generate_tests" "$time_tests" $bc_test_exec
gen_err_tests bc $bc_test_exec
fi
if [ "$dc" -ne 0 ]; then
gen_std_tests dc "$extra_math" "$time_tests" $dc_test_exec
gen_script_tests dc "$extra_math" "$generate_tests" "$time_tests" $dc_test_exec
gen_err_tests dc $dc_test_exec
fi
if [ "$ossfuzz" -ne 0 ]; then
printf 'bc_fuzzer_c: $(BC_FUZZER)\n\tln -sf $(BC_FUZZER) bc_fuzzer_c\n' >> Makefile
printf 'bc_fuzzer_C: $(BC_FUZZER)\n\tln -sf $(BC_FUZZER) bc_fuzzer_C\n' >> Makefile
printf 'dc_fuzzer_c: $(DC_FUZZER)\n\tln -sf $(DC_FUZZER) dc_fuzzer_c\n' >> Makefile
printf 'dc_fuzzer_C: $(DC_FUZZER)\n\tln -sf $(DC_FUZZER) dc_fuzzer_C\n' >> Makefile
fi
# Copy the correct manuals to the expected places.
mkdir -p manuals
cp -f "$scriptdir/manuals/bc/$manpage_args.1.md" manuals/bc.1.md
+2 -2
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -37,7 +37,7 @@ usage: %s [options] [file...]
bc is a command-line, arbitrary-precision calculator with a Turing-complete
language. For details, use `man %s` or see the online documentation at
https://git.gavinhoward.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md.
https://github.com/gavinhoward/bc/tree/%s/manuals/bc/%s.1.md .
This bc is compatible with both the GNU bc and the POSIX bc spec. See the GNU bc
manual (https://www.gnu.org/software/bc/manual/bc.html) and bc spec
+2 -2
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -37,7 +37,7 @@ usage: %s [options] [file...]
dc is a reverse-polish notation command-line calculator which supports unlimited
precision arithmetic. For details, use `man %s` or see the online documentation
at https://git.gavinhoward.com/gavin/bc/src/tag/%s/manuals/bc/%s.1.md.
at https://github.com/gavinhoward/bc/tree/%s/manuals/dc/%s.1.md .
This dc is (mostly) compatible with the OpenBSD dc and the GNU dc. See the
OpenBSD man page (http://man.openbsd.org/OpenBSD-current/man1/dc.1) and the GNU
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+45 -70
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -444,108 +444,77 @@ define void uint64(x){uintn(x,8)}
define void int64(x){intn(x,8)}
define void uint(x){uintn(x,ubytes(x))}
define void int(x){intn(x,sbytes(x))}
define bunrev(t){
auto a,s,m[]
s=scale
scale=0
t=abs(t)$
while(t!=1){
t=divmod(t,2,m[])
a*=2
a+=m[0]
}
scale=s
return a
}
define band(a,b){
auto s,t,m[],n[]
auto r,p,s,m[]
a=abs(a)$
b=abs(b)$
if(b>a){
t=b
b=a
a=t
}
r=0
p=1
s=scale
scale=0
t=1
while(b){
while(a&&b) {
a=divmod(a,2,m[])
b=divmod(b,2,n[])
t*=2
t+=(m[0]&&n[0])
if(m[0]){
b=divmod(b,2,m[])
if(m[0])r+=p
}else b/=2
p*=2
}
scale=s
return bunrev(t)
return r
}
define bor(a,b){
auto s,t,m[],n[]
auto r,p,s,m[]
a=abs(a)$
b=abs(b)$
if(b>a){
t=b
b=a
a=t
}
r=0
p=1
s=scale
scale=0
t=1
while(b){
while(a||b){
a=divmod(a,2,m[])
b=divmod(b,2,n[])
t*=2
t+=(m[0]||n[0])
}
while(a){
a=divmod(a,2,m[])
t*=2
t+=m[0]
if(!m[0])b=divmod(b,2,m[])
else b/=2
if(m[0])r+=p
p*=2
}
scale=s
return bunrev(t)
return r
}
define bxor(a,b){
auto s,t,m[],n[]
auto r,p,s,m[],n[]
a=abs(a)$
b=abs(b)$
if(b>a){
t=b
b=a
a=t
}
r=0
p=1
s=scale
scale=0
t=1
while(b){
while(a||b){
a=divmod(a,2,m[])
b=divmod(b,2,n[])
t*=2
t+=(m[0]+n[0]==1)
}
while(a){
a=divmod(a,2,m[])
t*=2
t+=m[0]
if(m[0]+n[0]==1)r+=p
p*=2
}
scale=s
return bunrev(t)
return r
}
define bshl(a,b){return abs(a)$*2^abs(b)$}
define bshr(a,b){return(abs(a)$/2^abs(b)$)$}
define bnotn(x,n){
auto s,t,m[]
auto r,p,s,t,m[]
s=scale
scale=0
t=2^(abs(n)$*8)
x=abs(x)$%t+t
t=1
r=2^(abs(n)$*8)
x=abs(x)$%r+r
r=0
p=1
while(x!=1){
x=divmod(x,2,m[])
t*=2
t+=!m[0]
if(!m[0])r+=p
p*=2
}
scale=s
return bunrev(t)
return r
}
define bnot8(x){return bnotn(x,1)}
define bnot16(x){return bnotn(x,2)}
@@ -553,13 +522,19 @@ define bnot32(x){return bnotn(x,4)}
define bnot64(x){return bnotn(x,8)}
define bnot(x){return bnotn(x,ubytes(x))}
define brevn(x,n){
auto s,t,m[]
auto a,s,m[]
s=scale
scale=0
t=2^(abs(n)$*8)
x=abs(x)$%t+t
a=2^(abs(n)$*8)
x=abs(x)$%a+a
a=0
while(x!=1){
x=divmod(x,2,m[])
a*=2
a+=m[0]
}
scale=s
return bunrev(x)
return a
}
define brev8(x){return brevn(x,1)}
define brev16(x){return brevn(x,2)}
+2 -2
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -68,7 +68,7 @@ static const char* const bc_gen_ex_end = "{{ end }}";
// This is exactly what it looks like. It just slaps a simple license header on
// the generated C source file.
static const char* const bc_gen_header =
"// Copyright (c) 2018-2024 Gavin D. Howard and contributors.\n"
"// Copyright (c) 2018-2025 Gavin D. Howard and contributors.\n"
"// Licensed under the 2-clause BSD license.\n"
"// *** AUTOMATICALLY GENERATED FROM %s. DO NOT MODIFY. ***\n\n";
// clang-format on
+2 -2
View File
@@ -2,7 +2,7 @@
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2018-2024 Gavin D. Howard and contributors.
# Copyright (c) 2018-2025 Gavin D. Howard and contributors.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -96,7 +96,7 @@ if [ -n "$remove_tabs" ]; then
fi
cat<<EOF
// Copyright (c) 2018-2024 Gavin D. Howard and contributors.
// Copyright (c) 2018-2025 Gavin D. Howard and contributors.
// Licensed under the 2-clause BSD license.
// *** AUTOMATICALLY GENERATED FROM ${input}. DO NOT MODIFY. ***
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+4 -4
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -265,9 +265,9 @@ bc_lex_token(BcLex* l);
* @return An expression entry for bc_parse_exprs[].
*/
#define BC_PARSE_EXPR_ENTRY(e1, e2, e3, e4, e5, e6, e7, e8) \
((UINTMAX_C(e1) << 7) | (UINTMAX_C(e2) << 6) | (UINTMAX_C(e3) << 5) | \
(UINTMAX_C(e4) << 4) | (UINTMAX_C(e5) << 3) | (UINTMAX_C(e6) << 2) | \
(UINTMAX_C(e7) << 1) | (UINTMAX_C(e8) << 0))
((UINT8_C(e1) << 7) | (UINT8_C(e2) << 6) | (UINT8_C(e3) << 5) | \
(UINT8_C(e4) << 4) | (UINT8_C(e5) << 3) | (UINT8_C(e6) << 2) | \
(UINT8_C(e7) << 1) | (UINT8_C(e8) << 0))
/**
* Returns true if token @a i is a token that belongs in an expression.
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -25
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -120,30 +120,6 @@ typedef struct BcHistory
extern const char bc_history_editrc[];
extern const size_t bc_history_editrc_len;
#ifdef __APPLE__
/**
* Returns true if the line is a valid line, false otherwise.
* @param line The line.
* @param len The length of the line.
* @return True if the line is valid, false otherwise.
*/
#define BC_HISTORY_INVALID_LINE(line, len) \
((line) == NULL && ((len) == -1 || errno == EINTR))
#else // __APPLE__
/**
* Returns true if the line is a valid line, false otherwise.
* @param line The line.
* @param len The length of the line.
* @return True if the line is valid, false otherwise.
*/
#define BC_HISTORY_INVALID_LINE(line, len) \
((line) == NULL && (len) == -1 && errno == EINTR)
#endif // __APPLE__
#else // BC_ENABLE_EDITLINE
#if BC_ENABLE_READLINE
+5 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -533,6 +533,10 @@ typedef enum BcType
} BcType;
#if BC_ENABLED
/// Check if type array or array reference
#define BC_IS_ARRAY(e) (e == BC_TYPE_ARRAY || e == BC_TYPE_REF)
/// An auto variable in bc.
typedef struct BcAuto
{
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+12 -4
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -145,6 +145,9 @@ typedef struct BcProgram
#endif // BC_ENABLED
/// The number of results that have not been retired.
size_t nresults;
// The BcDig array for strmb. This uses BC_NUM_LONG_LOG10 because it is used
// in bc_num_ulong2num(), which attempts to realloc, unless it is big
// enough. This is big enough.
@@ -207,11 +210,16 @@ typedef struct BcProgram
* operands while preserving the result (which we assumed was pushed before the
* actual operation).
* @param p The program.
* @param nres The number of results returned by the instruction.
* @param nops The number of operands used by the instruction.
*/
#define bc_program_retire(p, nres, nops) \
(bc_vec_npopAt(&(p)->results, (nops), (p)->results.len - (nres + nops)))
#define bc_program_retire(p, nops) \
do \
{ \
bc_vec_npopAt(&(p)->results, (nops), \
(p)->results.len - ((p)->nresults + nops)); \
p->nresults = 0; \
} \
while (0)
#if DC_ENABLED
+1 -1
View File
@@ -13,7 +13,7 @@
* This code is under the following license:
*
* Copyright (c) 2014-2017 Melissa O'Neill and PCG Project contributors
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
+1 -6
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -683,12 +683,7 @@ typedef enum BcMode
#define BC_NO_SIG_EXC(vm) \
BC_LIKELY((vm)->status == (sig_atomic_t) BC_STATUS_SUCCESS && !(vm)->sig)
#ifndef _WIN32
#define BC_SIG_INTERRUPT(vm) \
BC_UNLIKELY((vm)->sig != 0 && (vm)->sig != SIGWINCH)
#else // _WIN32
#define BC_SIG_INTERRUPT(vm) BC_UNLIKELY((vm)->sig != 0)
#endif // _WIN32
#if BC_DEBUG
+1 -1
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
-42
View File
@@ -1,42 +0,0 @@
/*
* *****************************************************************************
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* *****************************************************************************
*
* The version of bc.
*
*/
#ifndef BC_VERSION_H
#define BC_VERSION_H
/// The current version.
#define VERSION 7.0.2
#endif // BC_VERSION_H
+1 -2
View File
@@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2018-2024 Gavin D. Howard and contributors.
* Copyright (c) 2018-2025 Gavin D. Howard and contributors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -52,7 +52,6 @@
#endif // BC_ENABLE_NLS
#include <version.h>
#include <status.h>
#include <num.h>
#include <lex.h>
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+1 -1
View File
@@ -1,7 +1,7 @@
$ $
$ SPDX-License-Identifier: BSD-2-Clause
$ $
$ Copyright (c) 2018-2024 Gavin D. Howard and contributors.
$ Copyright (c) 2018-2025 Gavin D. Howard and contributors.
$ $
$ Redistribution and use in source and binary forms, with or without
$ modification, are permitted provided that the following conditions are met:
+2 -13
View File
@@ -1,7 +1,7 @@
.\"
.\" SPDX-License-Identifier: BSD-2-Clause
.\"
.\" Copyright (c) 2018-2024 Gavin D. Howard and contributors.
.\" Copyright (c) 2018-2025 Gavin D. Howard and contributors.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
@@ -2109,17 +2109,6 @@ If you want to a use signed two\[cq]s complement argument, use
\f[B]s2u(x)\f[R] to convert.
.RE
.TP
\f[B]bunrev(t)\f[R]
Assumes \f[B]t\f[R] is a bitwise\-reversed number with an extra set bit
one place more significant than the real most significant bit (which was
the least significant bit in the original number).
This number is reversed and returned without the extra set bit.
.RS
.PP
This function is used to implement other bitwise functions; it is not
meant to be used by users, but it can be.
.RE
.TP
\f[B]plz(x)\f[R]
If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that
\f[B]\-1\f[R] and less than \f[B]1\f[R], it is printed with a leading
@@ -2943,7 +2932,7 @@ Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
the \f[B]quit\f[R] statement.
.PP
No other bugs are known.
Report bugs at https://git.gavinhoward.com/gavin/bc .
Report bugs at https://github.com/gavinhoward/bc .
.SH AUTHORS
Gavin D. Howard \c
.MT [email protected]
Loaded 100 of 4663 files, more files were not shown because too many files have changed in this diff. Show more