HardenedBSD/src 6113937 — contrib/netbsd-tests/kernel t_mqueue.c, share/man/man9 style.9

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+17-38tests/sys/kern/ssl_sendfile.c
+13-13tests/freebsd_test_suite/macros.h
+15-3tests/sys/net/routing/rtsock_config.h
+15-1share/man/man9/style.9
+0-4contrib/netbsd-tests/kernel/t_mqueue.c
+1-1sys/dev/mii/mii.c
+61-601 files not shown
+62-607 files

HardenedBSD/src a844d96 — contrib/netbsd-tests/kernel t_mqueue.c, share/man/man9 style.9

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+17-38tests/sys/kern/ssl_sendfile.c
+13-13tests/freebsd_test_suite/macros.h
+15-3tests/sys/net/routing/rtsock_config.h
+15-1share/man/man9/style.9
+0-4contrib/netbsd-tests/kernel/t_mqueue.c
+1-1sys/dev/mii/mii.c
+61-601 files not shown
+62-607 files

HardenedBSD/src dea9259 — usr.sbin/bhyve/riscv fdt.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+9-9usr.sbin/bhyve/riscv/fdt.c
+9-91 files

HardenedBSD/src f992c08 — contrib/netbsd-tests/kernel t_mqueue.c, tests/freebsd_test_suite macros.h

Remove {ATF,PLAIN}_REQUIRE_KERNEL_MODULE macros

These macros predated the `require.kmod` (ATF) and `required_kmods`
(kyua) test metadata and are no longer needed.

Add a hint to freebsd_test_suite/macros.h about the `*FEATURE*` macros
going away soon. See [this kyua issue][kyua-issue] for more details.

MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D61082

[kyua-issue]: https://github.com/freebsd/kyua/issues/346
DeltaFile
+13-13tests/freebsd_test_suite/macros.h
+15-3tests/sys/net/routing/rtsock_config.h
+0-4contrib/netbsd-tests/kernel/t_mqueue.c
+1-0tests/sys/kern/Makefile
+29-204 files

HardenedBSD/src ef3c76f — sys/dev/mii mii.c

mii: call only PHY_STATUS() from mii_pollstat()

When we are in mii_pollstat() which effectively is called only from
ue_mii_sts methods of various drivers, we are interested in polling the
status and not making any actions.

What PHY_SERVICE(,, MII_POLLSTAT) effectively did was PHY_STATUS()
followed by mii_phy_update().  The latter is undesired, as we already may
be servicing a link state change event and posting a second one is not
what we want.  Usually mostly harmless, this second event would panic when
device is calling into mii during its detach (e.g. USB device).

NB: there are few drivers that would do extra stuff between PHY_STATUS()
and mii_phy_update() in their mii_service methods. This seems irrelevant
to me when we are in ue_mii_stat/mii_pollstat. But I could be wrong.

See the PR for longer discussion.

PR:             290417
DeltaFile
+1-1sys/dev/mii/mii.c
+1-11 files

HardenedBSD/src ba04542 — tests/sys/kern ssl_sendfile.c

tests/ssl_sendfile: size socket buffers before connecting

The :grow, :truncate and :eagain_vs_eof cases rely on the socket buffers
filling up before the whole file has been sent. :grow and :truncate shrank
SO_SNDBUF and SO_RCVBUF only after the connection was established, when
the receiver had already advertised a window based on the default buffer
size; TCP does not shrink an advertised window. :eagain_vs_eof used the
default, autosized buffers. With a large net.inet.tcp.recvspace, or once
autosizing has grown the buffers, the whole 2 MB file fits in the socket
buffers:

  :grow and :truncate: sendfile(2) returns before the file is resized, and
the poll loop that waits for the sender to block spins forever on a
writable socket.
  :eagain_vs_eof: the loop that keeps writing until
EAGAIN never sees it, since sendfile(2) returns 0 at EOF.

Either way kyua reports a timeout, which is why doubling the timeouts did
not help. Apply a 128 KB buffer size to the listening socket, which the

    [12 lines not shown]
DeltaFile
+15-17tests/sys/kern/ssl_sendfile.c
+15-171 files

HardenedBSD/src d851c68 — usr.sbin/bhyve/riscv fdt.c

bhyve/riscv: fix PCIe FDT interrupt-map entry stride

In bhyve arm64, each PCIe interrupt-map entry spans 10 cells because the
ARM GIC specifies #interrupt-cells = 3. On RISC-V, the APLIC uses
#interrupt-cells = 2, so each entry spans only 9 cells.

When the PCIe FDT code was originally adapted from arm64, the property
allocation size and cell assignments were reduced to 9 cells per entry,
but the loop multiplier retained the 10-cell stride. This caused the
interrupt-map array to be packed incorrectly with gaps, breaking PCI
interrupt routing in guest operating systems and overflowing the
allocation by 16 cells.

Correct the loop stride to 9 cells so the interrupt map is properly
formed.

Reviewed by:    jrtc27
Fixes:          7ab1a32cd43c ("bhyve/riscv: Initial import")
MFC after:      3 days

    [3 lines not shown]
DeltaFile
+9-9usr.sbin/bhyve/riscv/fdt.c
+9-91 files

HardenedBSD/src a24fc8c — usr.sbin/bhyve/riscv fdt.c

Revert "bhyve/riscv: fix PCIe FDT interrupt-map entry stride"

Thanks to past me's foolish choice not to alter the commit message such
that none of its lines start with a #, Git got very confused the
cherry-pick and included its own commented-out instructions. Reverting
to re-land with a fixed body.

This is a direct commit to stable/15.

This reverts commit 69f76efd01a72fe0d6cb68442d2c15d3174a268f.
DeltaFile
+9-9usr.sbin/bhyve/riscv/fdt.c
+9-91 files

HardenedBSD/src 69f76ef — usr.sbin/bhyve/riscv fdt.c

bhyve/riscv: fix PCIe FDT interrupt-map entry stride

In bhyve arm64, each PCIe interrupt-map entry spans 10 cells because the
ARM GIC specifies #interrupt-cells = 3. On RISC-V, the APLIC uses
#interrupt-cells = 2, so each entry spans only 9 cells.

When the PCIe FDT code was originally adapted from arm64, the property
allocation size and cell assignments were reduced to 9 cells per entry,
but the loop multiplier retained the 10-cell stride. This caused the
interrupt-map array to be packed incorrectly with gaps, breaking PCI
interrupt routing in guest operating systems and overflowing the
allocation by 16 cells.

Correct the loop stride to 9 cells so the interrupt map is properly
formed.

Reviewed by:    jrtc27
Fixes:          7ab1a32cd43c ("bhyve/riscv: Initial import")
MFC after:      3 days

    [25 lines not shown]
DeltaFile
+9-9usr.sbin/bhyve/riscv/fdt.c
+9-91 files

HardenedBSD/src 9b7959f — tests/sys/kern ssl_sendfile.c

Revert "tests/sys/kern/ssl_sendfile: double timeouts for :grow and :truncate"

A proper fix is being done in https://reviews.freebsd.org/D61752 .

PR:     299447

This reverts commit 932996069a5343b1d6563e97a12308a81c34d4fe.
DeltaFile
+2-21tests/sys/kern/ssl_sendfile.c
+2-211 files

HardenedBSD/src b66f818 — sys/dev/sound/pci hdsp-pcm.c hdspe-pcm.c

HBSD: Resolve merge conflicts

Signed-off-by:  Shawn Webb <shawn.webb at hardenedbsd.org>
DeltaFile
+0-6sys/dev/sound/pci/hdspe-pcm.c
+0-3sys/dev/sound/pci/hdsp-pcm.c
+0-92 files

HardenedBSD/src 25df601 — contrib/sqlite3 shell.c sqlite3.c, crypto/openssh ChangeLog ed25519.c

Merge remote-tracking branch 'rad/hardened/current/master' into quarterly/hardened/current/master-2026q4

Conflicts:
        sys/dev/sound/pci/hdsp-pcm.c (unresolved)
        sys/dev/sound/pci/hdspe-pcm.c (unresolved)
DeltaFile
+5,620-4,102contrib/sqlite3/sqlite3.c
+4,598-1,983crypto/openssh/ed25519.c
+0-5,021sys/crypto/openssl/aarch64/vpsm4-armv8.S
+0-4,543sys/crypto/openssl/aarch64/vpsm4_ex-armv8.S
+3,375-809contrib/sqlite3/shell.c
+1,973-1,163crypto/openssh/ChangeLog
+15,566-17,6213,987 files not shown
+206,691-82,1703,993 files

HardenedBSD/src a8fd8a5 — share/man/man9 style.9

style.9: Avoid C++ keywords

Headers may be included by C++ code, and sometimes we might like to
use exinst code as C++.  Encourage authors to avoid C++ keywords as
identifiers.

Reviewed by:    des, imp (earlier version)
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D61767
DeltaFile
+15-1share/man/man9/style.9
+15-11 files

HardenedBSD/src 5280c30 — share/man/man9 cpuset.9, sys/ufs/ffs ffs_snapshot.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+173-57usr.sbin/pkg/pkg.c
+212-0usr.sbin/pkg/tests/pkg_test.sh
+190-0tests/sys/netpfil/pf/nat46.sh
+33-17sys/ufs/ffs/ffs_snapshot.c
+23-5usr.sbin/pkg/pkg.7
+23-1share/man/man9/cpuset.9
+654-8035 files not shown
+819-12741 files

HardenedBSD/src ea2b2c7 — share/man/man9 cpuset.9, sys/ufs/ffs ffs_snapshot.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+173-57usr.sbin/pkg/pkg.c
+212-0usr.sbin/pkg/tests/pkg_test.sh
+190-0tests/sys/netpfil/pf/nat46.sh
+33-17sys/ufs/ffs/ffs_snapshot.c
+23-5usr.sbin/pkg/pkg.7
+23-1share/man/man9/cpuset.9
+654-8035 files not shown
+819-12741 files

HardenedBSD/src 9df81d5 — sys/dev/acpica acpi_pci_link.c, sys/dev/cxgbe/crypto t7_kern_tls.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+239-135sys/dev/cxgbe/crypto/t7_kern_tls.c
+68-59sys/kern/sched_ule.c
+54-47sys/kern/sched_4bsd.c
+54-26sys/dev/acpica/acpi_pci_link.c
+41-11sys/sys/sched.h
+52-0sys/kern/sched_ns.h
+508-27818 files not shown
+639-31024 files

HardenedBSD/src 8364b6b — sys/netpfil/ipfw ip_fw_sockopt.c ip_fw_compat.c

ipfw: fix off-by-one in the IP_FW_XADD rule count check

Restore the pre-4a77657cbc0 ">=" comparison, otherwise parse_rules_v1()
writes one rule_check_info beyond the allocated buffer.

Do the same in ip_fw_compat.c, which has a copy of the loop but is not
built at the moment.

stable/14 is not affected.

Reviewed by:    ae
Fixes:          4a77657cbc0 ("ipfw: migrate ipfw to 32-bit size rule numbers")
MFC after:      1 week
MFC to:         stable/15
Found with:     Claude Code Opus 5.5
Differential Revision:  https://reviews.freebsd.org/D61727
DeltaFile
+1-1sys/netpfil/ipfw/ip_fw_sockopt.c
+1-1sys/netpfil/ipfw/ip_fw_compat.c
+2-22 files

HardenedBSD/src 8651589 — usr.sbin/bhyve bhyve.8, usr.sbin/bhyvectl bhyvectl.8

bhyve.8: mention VM nodes in /dev/vmm

Currently, VM nodes in /dev/vmm are only described in the
EXAMPLES section of bhyvectl.8. Add a FILES section to bhyve.8
to make this information easier to find.

Update the bhyvectl.8 example to say "Existing VMs"
instead of "Running VMs" as the VMs listed in /dev/vmm
are not necessarily running.

Update bhyvectl.8 to refer to vmm(4).

Reviewed by:    ziaee
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61623
DeltaFile
+3-2usr.sbin/bhyvectl/bhyvectl.8
+5-0usr.sbin/bhyve/bhyve.8
+8-22 files

HardenedBSD/src 457873b — tests/sys/pmc pmc_rdpmc_test.c pmc_ss_test.c

tests/sys/pmc: Skip pmc_ss and getmsr_refusals without a hardware PMC

In a guest without a PMU, hwpmc(4) registers only the SOFT class, but
the "instructions" alias still resolves from the pmu-events tables, so
pmc_allocate() fails with EINVAL.  pmc_ss_test checked only the alias
and getmsr_refusals required the allocation, so both failed in CI
instead of skipping.

Probe the allocation the tests make and skip if it fails, as
rdpmc_reads_own_counter already does.

PR:             300856 (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300856)
Reported by:    ngie
Reviewed by:    mhorne, ngie
Fixes:          d546356523f3 ("tests/sys/pmc: add PERF, RDPMC, row, sampling and unload tests")
Sponsored by:   Advanced Micro Devices, Inc.
Signed-off-by:  Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision:  https://reviews.freebsd.org/D61689
DeltaFile
+8-4tests/sys/pmc/pmc_ss_test.c
+3-1tests/sys/pmc/pmc_rdpmc_test.c
+11-52 files

HardenedBSD/src 1768d48 — sys/dev/hwpmc hwpmc_amd.c

hwpmc: keep AMD UMC counters from saturating

UMC counters saturate at 2^48 instead of wrapping, after about a day
and a half of memory clock cycles.  Clear bit 47 on a read once it is
set and count the carries in the per-CPU overflow count of the PMC,
like the arm64 and armv7 drivers do for their 32-bit counters.

Reviewed by:    mhorne
Sponsored by:   Advanced Micro Devices, Inc.
Signed-off-by:  Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision:  https://reviews.freebsd.org/D60771
DeltaFile
+21-3sys/dev/hwpmc/hwpmc_amd.c
+21-31 files

HardenedBSD/src ed4bad7 — usr.sbin/bhyve bhyve.8

bhyve.8: mention config files for VM parameters

Mention that virtual CPUs, memory and other options can be configured
with a configuration file, and refer to the -k option.

Reviewed by:    ziaee
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D61718
DeltaFile
+4-2usr.sbin/bhyve/bhyve.8
+4-21 files

HardenedBSD/src cd2ec1b — usr.bin/top display.c

top: fix off-by-one in screenbuf

There is a heap overflow for screenbuf originating from
the top import to the tree. The i_process()/u_process() functions
write a terminating NUL one byte past each screenbuf line slot
when the line fills the slot, which is a 1-byte heap overflow on the last slot.

The display_resize() function allocates screen_width bytes per line.
i_process() and u_process() cut lines to screen_width characters and
then stpcpy() them into the slot, which writes screen_width + 1 bytes.
line_update() can do the same with *old = ch. For inner slots,
the NUL lands in byte 0 of the next slot. This can corrupt the saved
contents used when updating the next line. For the last slot, it writes
one byte past the end of screenbuf.

Fix by allocating (screen_width + 1) bytes per line and updating the
line offsets to fit the terminating NUL.

Reviewed by:    kib

    [5 lines not shown]
DeltaFile
+3-3usr.bin/top/display.c
+3-31 files

HardenedBSD/src 5165da2 — sys/netpfil/pf pf_lb.c, tests/sys/netpfil/pf Makefile nat46.sh

pf: fix nat46 ICMP handling

When porting from OpenBSD I typo'd the variable where we store the ICMP
type, in the nat46 direction. The nat64 direction was correct. Fix this
so ICMP translation works for nat46.

Add a test case for this, as well as basic TCP and UDP cases because
nat46 was entirely untested.

PR:             300461
MFC after:      1 week
Submitted by:   Charles Marshall <charles at wozi.com> (pf patch)
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+190-0tests/sys/netpfil/pf/nat46.sh
+2-2sys/netpfil/pf/pf_lb.c
+1-0tests/sys/netpfil/pf/Makefile
+193-23 files

HardenedBSD/src e536321 — sys/netpfil/pf pf_norm.c

pf: fix sctp normalisation cleanup

If we fail to allocate the dst scrub structure we should free the src
one too, but we passed src rather than src->scrub.

Reported by:    llm-postcr
MFC after:      1 week
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+1-1sys/netpfil/pf/pf_norm.c
+1-11 files

HardenedBSD/src 5131335 — tests/sys/netpfil/pf snmp.sh

pf tests: test pfTablesTblCount in snmp_pf

This works fine on main, but not on stable/15 so add a test.

PR:     300818
MFC after:      3 days
Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+13-0tests/sys/netpfil/pf/snmp.sh
+13-01 files

HardenedBSD/src c589ea8 — tests/sys/netpfil/pf/ioctl Makefile validation.c

pf tests: run the ioctl tests in their own vnet too

Fix the validation:settflags test, because using a NULL buffer succeeds
if there's no table to set tflags in. Create a table to fix the test.

Sponsored by:   Rubicon Communications, LLC ("Netgate")
DeltaFile
+8-0tests/sys/netpfil/pf/ioctl/validation.c
+4-0tests/sys/netpfil/pf/ioctl/Makefile
+12-02 files

HardenedBSD/src 670bad0 — sys/kern kern_fail.c

pause fail point: affirm sleeping without a lock

The previous patch to fail_point_pause removed a lock wrapping a sleep.
INVARIANTS assertions require we affirm we are deliberately sleeping
without a lock or timeout via the PNOLOCK flag.

Reported by:    netchild
Reviewed by:    netchild
Fixes:  331613ddd8a5 ("Pause failpoint: replace mtx_sleep with tsleep")
Differential Revision:  https://reviews.freebsd.org/D61730
DeltaFile
+1-1sys/kern/kern_fail.c
+1-11 files

HardenedBSD/src 3049f0b — sys/dev/nvme nvme.h

nvme: Typo ranage -> range

Sponsored by:   Chelsio Communications

(cherry picked from commit bfdce403f4a613bacf2c342a417974a606981b12)
DeltaFile
+1-1sys/dev/nvme/nvme.h
+1-11 files

HardenedBSD/src b061a4b — usr.sbin/ctld nvmf.cc

ctld: Use expand_unsigned for parsing unsigned NVMe option values

Sponsored by:   Chelsio Communications

(cherry picked from commit cc33771bf77102291db1e50037a07c1501a24075)
DeltaFile
+3-4usr.sbin/ctld/nvmf.cc
+3-41 files

HardenedBSD/src 033c0cd — usr.sbin/ctld nvmf.cc

ctld: Fix namespace IDs for exported NVMe namespaces

NVMe namespace IDs are 1-based, but CTL LUN IDs are 0-based.  The
in-kernel NVMe ctl(4) target accounts for this by adding one to the
LUN ID to compute a namespace ID.  ctld was attempting to handle this
by translating namespace IDs from config files to internal LUN IDs,
but it did this incorrectly resulting in the namespace configured for
as namespace N actually showing up as namespace N + 1.

Fixes:          66b5296f1b29 ("ctld: Add support for NVMe over Fabrics")
Sponsored by:   Chelsio Communications
(cherry picked from commit 9c8be6518e2e5f396055ecdab8098ce19c4b2218)
DeltaFile
+2-2usr.sbin/ctld/nvmf.cc
+2-21 files