HardenedBSD/src 0cdfd37 — sys/ofed/drivers/infiniband/ulp/nfsclrdma clnt_rdma.c, usr.sbin/sysrc sysrc sysrc.subr

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+50-0usr.sbin/sysrc/tests/sysrc_test.sh
+6-6usr.sbin/sysrc/sysrc.subr
+6-2sys/ofed/drivers/infiniband/ulp/nfsclrdma/clnt_rdma.c
+1-1usr.sbin/sysrc/sysrc
+63-94 files

HardenedBSD/src 08e6c36 — sys/ofed/drivers/infiniband/ulp/nfsclrdma clnt_rdma.c, usr.sbin/sysrc sysrc sysrc.subr

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+50-0usr.sbin/sysrc/tests/sysrc_test.sh
+6-6usr.sbin/sysrc/sysrc.subr
+6-2sys/ofed/drivers/infiniband/ulp/nfsclrdma/clnt_rdma.c
+1-1usr.sbin/sysrc/sysrc
+63-94 files

HardenedBSD/src 2496a1c — usr.sbin/sysrc sysrc sysrc.subr, usr.sbin/sysrc/tests sysrc_test.sh

sysrc: Restore alignment with rc(8) boot process [again]

Fix the second issue identified in post-commit review of d0a1676:

POSTCR-68d4c95925656e301be7bcaec72a6796cc02a00b-2:
set -f in f_sysrc_service_configs stops local_startup glob expansion,
so -s/-L miss rc.conf.d files that rc(8) loads

A second partial "revert" of d0a167652278; this time with respect to
local_startup.

Add another ATF test to ensure we maintain rc(8) alignment.

Reported by:    llm-postcr
Fixes:          d0a167652278 ("sysrc: Support special characters in file names")
DeltaFile
+50-0usr.sbin/sysrc/tests/sysrc_test.sh
+6-6usr.sbin/sysrc/sysrc.subr
+1-1usr.sbin/sysrc/sysrc
+57-73 files

HardenedBSD/src 056925e — sys/ofed/drivers/infiniband/ulp/nfsclrdma clnt_rdma.c

clnt_rdma.c: Change handling of a 0 credit request

Although I do not think it should ever happen, if a
server replies with an rdma_credit == 0, the Linux
client just sets it to 1.

This patch makes the FreeBSD NFS over RDMA client
do the same.

Reported by:    llm-postcr
MFC after:      1 month
Fixes:  80bee4d83637 ("nfsclrdma: Add code to support client side NFS over RDMA")
DeltaFile
+6-2sys/ofed/drivers/infiniband/ulp/nfsclrdma/clnt_rdma.c
+6-21 files

HardenedBSD/src fdb94c1 — sys/compat/linuxkpi/common/src linux_compat.c, usr.sbin/bhyve ipc.c

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+28-2sys/compat/linuxkpi/common/src/linux_compat.c
+2-2usr.sbin/bhyve/ipc.c
+30-42 files

HardenedBSD/src fce2ae8 — sys/compat/linuxkpi/common/src linux_compat.c, usr.sbin/bhyve ipc.c

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+28-2sys/compat/linuxkpi/common/src/linux_compat.c
+2-2usr.sbin/bhyve/ipc.c
+30-42 files

HardenedBSD/src 81e7a6e — sys/netpfil/ipfw ip_fw_sockopt.c ip_fw_compat.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+1-1sys/netpfil/ipfw/ip_fw_sockopt.c
+1-1sys/netpfil/ipfw/ip_fw_compat.c
+2-22 files

HardenedBSD/src 2fb943a — 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

(cherry picked from commit 8364b6bc0c36ab66f71cb2b3e00479326132c80f)
DeltaFile
+1-1sys/netpfil/ipfw/ip_fw_sockopt.c
+1-1sys/netpfil/ipfw/ip_fw_compat.c
+2-22 files

HardenedBSD/src 4ba6fd2 — sys/compat/linuxkpi/common/src linux_compat.c

linuxkpi: Bound the retries of a fault handler that inserts no page

linux_cdev_pager_populate() calls the fault handler again for as long
as it returns VM_FAULT_NOPAGE without inserting a page.  When the page
can never be inserted, for instance because another mapping of the
same buffer holds it, the thread loops in the kernel forever, about
450000 handler calls per second, and kill -9 cannot end the process.

Bound the retries in time, as vm_fault does for page allocation
(vm.pfault_oom_attempts, vm.pfault_oom_wait): after
compat.linuxkpi.fault_retry_timeout seconds the fault fails and the
thread gets SIGSEGV.  Sleep a tick before each retry.

The 30 s default is three times the 10 s after which amdgpu declares a
kernel job hung: a legitimate retry can wait for a buffer move, and a
hung move ends with that timeout and the reset.  Retries are rare:
on i915 (Raptor Lake, Meteor Lake) and amdgpu (Strix Halo), VA-API,
vkmark and llama.cpp loads gave 389768 faults and no retry.  0 fails
at once, -1 retries forever.

    [5 lines not shown]
DeltaFile
+28-2sys/compat/linuxkpi/common/src/linux_compat.c
+28-21 files

HardenedBSD/src 2534dcb — usr.sbin/bhyve ipc.c

bhyve: fix VM crash on malformed IPC messages

Currently, ipc_thread() calls nvlist_get_string(nvl, "cmd") and
compares result to NULL. It is not the right way of handling
errors because nvlist_get_string() aborts if the key does not exist.
Thus, bhyve aborts for messages with a missing command name.

Fix by checking "cmd" with nvlist_exists_string().

Reviewed by:    bnovkov
Reported by:    llm-postcr
Fixes:          04811d46d3f2 ("bhyve: Generalize the IPC thread")
Differential Revision:  https://reviews.freebsd.org/D62145
DeltaFile
+2-2usr.sbin/bhyve/ipc.c
+2-21 files

HardenedBSD/src 4d03586 — sbin/dhclient dhcpd.h packet.c, sbin/dhclient/tests functional.py

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+133-0usr.sbin/bhyve/tests/bhyve_test.sh
+81-1sbin/dhclient/tests/functional.py
+21-9sbin/dhclient/packet.c
+23-7sys/ofed/drivers/infiniband/core/ib_rdma_core.c
+6-6sbin/dhclient/dhcpd.h
+7-1sys/dev/iicbus/acpi_iicbus.c
+271-2413 files not shown
+303-3419 files

HardenedBSD/src edd79e5 — sbin/dhclient dhcpd.h packet.c, sbin/dhclient/tests functional.py

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+133-0usr.sbin/bhyve/tests/bhyve_test.sh
+81-1sbin/dhclient/tests/functional.py
+21-9sbin/dhclient/packet.c
+23-7sys/ofed/drivers/infiniband/core/ib_rdma_core.c
+6-6sbin/dhclient/dhcpd.h
+7-1sys/dev/iicbus/acpi_iicbus.c
+271-2413 files not shown
+303-3419 files

HardenedBSD/src 35b5764 — sys/netpfil/ipfw ip_dummynet.c, tests/sys/netpfil/common dummynet_config_test.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+190-0tests/sys/netpfil/pf/nat46.sh
+141-0tests/sys/netpfil/pf/pfsync.sh
+119-0tests/sys/netpfil/common/dummynet_config_test.c
+33-0tests/sys/netpfil/pf/ioctl/validation.c
+16-0sys/netpfil/ipfw/ip_dummynet.c
+13-0tests/sys/netpfil/pf/snmp.sh
+512-09 files not shown
+529-1315 files

HardenedBSD/src 58e1a0c — etc/mtree BSD.tests.dist, tools/build/mk OptionalObsoleteFiles.inc

bhyve: add basic tests

Add sanity checks for:

 * bhyve -l help
 * bhyve -s help
 * bhyve -o help
 * bhyve -o config.dump=1

Validate that commands run successfully, have no duplicates,
sorted where applicable, and the dumped configuration can be consumed
again with the -k option.

Reviewed by:    ngie, Osvaldo Janeri Filho <ojanerif at amd.com>
Sponsored by:   The FreeBSD Foundation
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D60981
DeltaFile
+133-0usr.sbin/bhyve/tests/bhyve_test.sh
+5-0usr.sbin/bhyve/tests/Makefile
+3-0usr.sbin/bhyve/Makefile
+3-0tools/build/mk/OptionalObsoleteFiles.inc
+2-0etc/mtree/BSD.tests.dist
+146-05 files

HardenedBSD/src b9103a9 — sys/dev/mmc mmc.c, sys/dev/sdhci sdhci.c

Revert "mmc: Allow HS400ES with HS400 at a single I/O voltage"

llm-postcr reports multiple issues with this as-is.

This reverts commit e70868afa99d40087363d6478488a9904459be71.
DeltaFile
+4-2sys/dev/sdhci/sdhci.c
+2-3sys/dev/mmc/mmc.c
+6-52 files

HardenedBSD/src 6392bf6 — sys/kern kern_proc.c

proc: Fix an execve race in proc_getauxv()

The SV_PROC_FLAG(p, SV_ILP32) test in proc_getauxv() is racy once we
unblock execve, resulting in a potential OOB read of heap memory.
Postpone the proc_vmspace_unref() call until after we've calculated the
auxv size.

Reviewed by:    kib
Reported by:    Albert E. of Metnir
Fixes:          a22c044cce41 ("kern_proc.c: ensure stability of the vmspace we read the strings from")
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D62107
DeltaFile
+1-1sys/kern/kern_proc.c
+1-11 files

HardenedBSD/src b5039a8 — sbin/dhclient bpf.c dhcpd.h, sbin/dhclient/tests functional.py

dhclient: Fix validation of IP and UDP lengths

decode_udp_ip_header() assumed that the sizes recorded in the IP and UDP
headers are valid, but if not, OOB memory accesses are possible.

Add checks, and use unsigned types for buffer sizes and offsets.

Add regression tests.

Reported by:    Brendan Davidson <binary141 at gmail.com>
Reviewed by:    emaste
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D62120
DeltaFile
+81-1sbin/dhclient/tests/functional.py
+21-9sbin/dhclient/packet.c
+6-6sbin/dhclient/dhcpd.h
+2-1sbin/dhclient/bpf.c
+110-174 files

HardenedBSD/src dd6004c — sys/net iflib.c

iflib: Drain the receive watchdog callout on detach

Nothing stops ifr_watchdog when an interface goes away.  If it is armed
when the interface detaches, the callout stays on the callout wheel
after iflib_rx_structures_free() has freed the queue containing it,
corrupting the wheel, or fires and enqueues a task that has already been
detached.

The window is small: the callout is armed for one tick, only when a
receive buffer refill fails, and the detach has to follow right after.

The former iflib_pseudo_deregister() drained the callout until
102540192c71 moved its teardown into iflib_tqg_detach() without the
drain, and iflib_device_deregister() never did.  Drain it in
iflib_tqg_detach().  The callout cannot be rearmed by then:
_task_fn_rx() only arms it while the interface is running, and
iflib_device_deregister() has already called iflib_stop(), which clears
the running state and then drains the receive tasks.


    [5 lines not shown]
DeltaFile
+1-0sys/net/iflib.c
+1-01 files

HardenedBSD/src afe3bfe — sys/dev/iicbus iichid.c

iichid(4): Expect I2C address provided by iicbus(4) to be in 8-bit

format rather than in 7-bit to chase "acpi_iicbus: shift the ACPI slave
address into the form iicbus(4) stores" commit.
DeltaFile
+2-2sys/dev/iicbus/iichid.c
+2-21 files

HardenedBSD/src c65af38 — . UPDATING, sys/sys param.h

__FreeBSD_version: Bump for acpi_iicbus slave address format change

Also, add UPDATING entry.
DeltaFile
+5-0UPDATING
+1-1sys/sys/param.h
+6-12 files

HardenedBSD/src b2dbfc7 — sys/dev/iicbus acpi_iicbus.c

acpi_iicbus: shift the ACPI slave address into the form iicbus(4) stores

An I2cSerialBus resource carries the 7-bit slave address, but iicbus(4)
stores and passes around the 8-bit form -- ofw_iicbus(4) shifts a device-tree
"reg" value for the same reason, and the AML address space handler in this
file already shifts before issuing a transfer.  Without the shift every
device enumerated from ACPI is addressed at half its address, and a driver
that probes by reading a register sees no ack.

Reviewed by:    wulf
Differential Revision:  https://reviews.freebsd.org/D60062
DeltaFile
+7-1sys/dev/iicbus/acpi_iicbus.c
+7-11 files

HardenedBSD/src c0724c7 — sys/powerpc/aim mmu_radix.c mmu_oea64.h

powerpc64: Fix disappearing low memory on radix MMU systems (POWER9)

The FreeBSD radix implementation piggybacks on the physical memory
allocation function from the HPT implementation, but did not share
the same state information for number of physical memory ranges.
This led to a situation where the HPT physical memory allocator
would attempt to shift the physical memory ranges in the shared
range table, but would use the wrong number of entries, thus
overwriting the large segment of low memory that should have been
available for e.g. 32-bit DMA.

Incorrect physical memory map:

real memory  = 33997058048 (32422 MB)
available KVA = 34359619583 (32767 MB)
Physical memory chunk(s):
0x0000000000003000 - 0x0000000000002fff, 0 bytes (0 pages)
0x000000000000e000 - 0x000000000000ffff, 8192 bytes (2 pages)
0x0000000000094000 - 0x0000000000ffffff, 16171008 bytes (3948 pages)

    [28 lines not shown]
DeltaFile
+2-1sys/powerpc/aim/mmu_oea64.c
+0-1sys/powerpc/aim/mmu_radix.c
+1-0sys/powerpc/aim/mmu_oea64.h
+3-23 files

HardenedBSD/src 4be27e6 — sys/ofed/drivers/infiniband/core uverbs.h ib_rdma_core.c

ibcore: Avoid quadratic uverbs ID allocation

FreeBSD's LinuxKPI xa_alloc() starts at index zero for each allocation.
The per-file uverbs XArray holds protection domains, completion queues,
queue pairs, and memory regions. As the number of live objects grows,
each new handle probes all occupied lower IDs, making large connection
setups increasingly expensive.

Keep the optimization in the OFED uverbs caller: track the next candidate
ID in ib_uverbs_file, reserve under the XArray lock, and advance the
cursor on success. On a collision, search forward and wrap through the
32-bit handle space. Existing lookup, commit, erase, and destruction
paths are unchanged. Freed lower IDs are reused after wraparound.

Signed-off-by: Lewandowski, Rafal <rafal.lewandowski at intel.com>

Reviewed by:    bartosz.sobczak_intel.com, kib
MFC after:      2 weeks
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D60405
DeltaFile
+23-7sys/ofed/drivers/infiniband/core/ib_rdma_core.c
+1-0sys/ofed/drivers/infiniband/core/uverbs.h
+24-72 files

HardenedBSD/src 29ab1cc — 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")

(cherry picked from commit e53632189f09d7b5c6664fef51cbe4429e4b3243)
DeltaFile
+1-1sys/netpfil/pf/pf_norm.c
+1-11 files

HardenedBSD/src bd2eb45 — sys/netpfil/ipfw ip_dummynet.c, tests/sys/netpfil/common Makefile dummynet_config_test.c

dummynet: validate object length before fixed-size copies in do_config()

do_config() checks that each command's o.len fits in the remaining
buffer, but the DN_LINK, DN_PROFILE, DN_SCH and DN_FS cases then copy a
fixed sizeof(struct) out of the command, which can be larger than o.len.
A command with o.len == sizeof(struct dn_id) reads past the end of the
sockopt buffer (DN_PROFILE copies about 4 KB).

Reject a command whose o.len is shorter than the structure it carries.
Add a test.

Reviewed by:    kp
MFC after:      1 week
Sponsored by:   Advanced Micro Devices, Inc.
Signed-off-by:  Osvaldo Janeri Filho <ojanerif at amd.com>
Differential Revision:  https://reviews.freebsd.org/D61440

(cherry picked from commit 42d358453d056e70bd112c63247e89c1ecf575d5)
DeltaFile
+119-0tests/sys/netpfil/common/dummynet_config_test.c
+16-0sys/netpfil/ipfw/ip_dummynet.c
+2-0tests/sys/netpfil/common/Makefile
+137-03 files

HardenedBSD/src 2a2918a — 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")

(cherry picked from commit 5131335c7d48eaec427aa9ed27862ca56e3e95bc)
DeltaFile
+13-0tests/sys/netpfil/pf/snmp.sh
+13-01 files

HardenedBSD/src 8377625 — 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")

(cherry picked from commit 5165da26f31f576328d99d5ac736bdfd1aa04fe8)
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 5188862 — lib/libvmmapi vmmapi.c, libexec/rc network.subr

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+55-25sys/amd64/vmm/intel/vmx.c
+46-0libexec/rc/network.subr
+33-11sys/arm/broadcom/bcm2835/bcm2835_fbd.c
+30-0sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h
+20-0sys/arm/broadcom/bcm2835/bcm2835_mbox.c
+10-6lib/libvmmapi/vmmapi.c
+194-425 files not shown
+216-6211 files

HardenedBSD/src e6af73c — lib/libvmmapi vmmapi.c, libexec/rc network.subr

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+55-25sys/amd64/vmm/intel/vmx.c
+46-0libexec/rc/network.subr
+33-11sys/arm/broadcom/bcm2835/bcm2835_fbd.c
+30-0sys/arm/broadcom/bcm2835/bcm2835_mbox_prop.h
+20-0sys/arm/broadcom/bcm2835/bcm2835_mbox.c
+10-6lib/libvmmapi/vmmapi.c
+194-425 files not shown
+216-6211 files

HardenedBSD/src ca4332e — sys/net/route route_ctl.c nhgrp_ctl.c, sys/netlink/route nexthop.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+23-23sys/net/route/fib_algo.c
+1-1sys/netlink/route/nexthop.c
+1-1sys/net/route/nhgrp_ctl.c
+0-1sys/net/route/route_ctl.c
+25-264 files