HardenedBSD/src a0a8c3b — contrib/lutok/api-docs/html a00044.html a00065.html

Merge remote-tracking branch 'rad/hardened/current/master' into hardened/current/pledge
DeltaFile
+0-1,693contrib/lutok/api-docs/html/a00923.html
+1,163-0contrib/lutok/api-docs/html/navtree.js
+0-532contrib/lutok/api-docs/html/a00895.html
+403-0contrib/lutok/api-docs/html/a00043.html
+0-395contrib/lutok/api-docs/html/a00065.html
+388-0contrib/lutok/api-docs/html/a00044.html
+1,954-2,620230 files not shown
+6,580-9,822236 files

HardenedBSD/src f96adba — contrib/lutok/api-docs/html a00044.html a00065.html

Merge branch 'freebsd/current/main' into hardened/current/master
DeltaFile
+0-1,693contrib/lutok/api-docs/html/a00923.html
+1,163-0contrib/lutok/api-docs/html/navtree.js
+0-532contrib/lutok/api-docs/html/a00895.html
+403-0contrib/lutok/api-docs/html/a00043.html
+0-395contrib/lutok/api-docs/html/a00065.html
+388-0contrib/lutok/api-docs/html/a00044.html
+1,954-2,620230 files not shown
+6,580-9,822236 files

HardenedBSD/src 529519b — contrib/expat/gennmtab Makefile.in, contrib/expat/lib xmlparse.c

Merge branch 'freebsd/15-stable/main' into hardened/15-stable/main
DeltaFile
+1,081-0contrib/expat/tests/fifth_edition_tests.c
+661-224contrib/expat/tests/basic_tests.c
+442-301contrib/expat/lib/xmlparse.c
+740-0contrib/expat/gennmtab/Makefile.in
+300-38contrib/expat/tests/misc_tests.c
+322-1contrib/expat/tests/xmltest.sh
+3,546-56453 files not shown
+5,594-1,17359 files

HardenedBSD/src 6b2f09d — contrib/lutok FREEBSD-Xlist FREEBSD-upgrade.md

contrib/lutok: document suggested component upgrade process

This is similar to documentation added for contrib/atf in 91fcc2d8b18c.

MFC after:      1 week
DeltaFile
+93-0contrib/lutok/FREEBSD-upgrade.md
+12-0contrib/lutok/FREEBSD-Xlist
+105-02 files

HardenedBSD/src f3d3ae5 — sys/kern kern_exit.c

kern/kern_exit.c: fix decision to give back to real parent in proc_reap()

p_oppid records the reaper by pid only, and nothing updates p_oppid when
the reaper changes. When p_oppid no longer matches, proc_realparent()
falls back to p_reaper. In proc_reap(), the test p_oppid !=
p_pptr->p_pid is then still true, so proc_reap() "gives back" the child
to proc_realparent(). That resolves to the new reaper, which is already
p_pptr. proc_reparent() returns early, the reaper gets a spurious
SIGCHLD, and proc_reap() returns without reaping.

Another problem with p_oppid check is that a parked zombie is leaked
permanently under the new reaper if the reaper changes before the
debugger waits, because p_oppid keeps the old reaper's pid.

In proc_reap(), base the give-back decision on the resolved parent
instead of the pid comparison.

Reported by:    llm-postcr
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+3-3sys/kern/kern_exit.c
+3-31 files

HardenedBSD/src 4b7dbdb — contrib/lutok config.h, lib/liblutok Makefile

contrib/lutok: update generated headers/build glue

lutok and kyua have both been updated for the new tests and the adjusted
header layout.

MFC after:      1 week
MFC with:       5e4c3200cdc7 ("contrib/lutok: update to 0.7.1")
DeltaFile
+3-3contrib/lutok/config.h
+3-2lib/liblutok/tests/Makefile
+1-1usr.bin/kyua/Makefile
+1-1lib/liblutok/Makefile
+8-74 files

HardenedBSD/src 5e4c320 — contrib/lutok/api-docs/html a00044.html a00065.html

contrib/lutok: update to 0.7.1

This is a bugfix release. Users are encouraged to take this version.

MFC after:      1 week
Merge commit 'dac7d818e3cef52d724592c6b349dbd8ad9a049a'
DeltaFile
+0-1,693contrib/lutok/api-docs/html/a00923.html
+1,163-0contrib/lutok/api-docs/html/navtree.js
+0-532contrib/lutok/api-docs/html/a00895.html
+403-0contrib/lutok/api-docs/html/a00043.html
+0-395contrib/lutok/api-docs/html/a00065.html
+388-0contrib/lutok/api-docs/html/a00044.html
+1,954-2,620165 files not shown
+5,781-9,635171 files

HardenedBSD/src dc8b0ba — etc/mtree BSD.tests.dist, lib/liblutok Makefile

contrib/lutok: compile/run tests from the project

This change adds the necessary glue to build and run the tests
distributed with each release, sans the examples tests. liblutok is
an "internal" library, so the headers and library aren't distributed
with installworld, et al, and thus the examples tests--which require the
headers/library to build tests on the fly--fail when the tests are run,
due to this difference with the upstream project.

MFC after:      1 week
DeltaFile
+37-0lib/liblutok/tests/Makefile
+5-0lib/liblutok/Makefile
+2-0etc/mtree/BSD.tests.dist
+44-03 files

HardenedBSD/src 4cd407f — sys/net iflib.c

iflib: remove the legacy interrupt before freeing the queues

iflib_device_deregister() and the iflib_device_register() failure path
freed the queue structures and ran IFDI_DETACH before tearing down an
INTx or MSI handler.  A shared INTx line can run the driver filter and
iflib_fast_intr_rxtx() at any time, so another device's interrupt in
that window used freed queues and driver state.  Tear the handler down
before anything is freed.

Reported by:    llm-postcr

Reviewed by:    gallatin
Differential Revision:  https://reviews.freebsd.org/D62040
DeltaFile
+6-3sys/net/iflib.c
+6-31 files

HardenedBSD/src e983e6d — sys/net iflib.c

iflib: clear an interrupt after freeing it

em(4) and several other drivers free their MSI-X vectors when
IFDI_MSIX_INTR_ASSIGN fails, then free them again from IFDI_DETACH,
which iflib's attach failure path runs next.  The second
iflib_irq_free() tears down a stale tag and releases a stale resource.
Clear both so it is a no-op.

Reviewed by:    gallatin
Differential Revision:  https://reviews.freebsd.org/D62039
DeltaFile
+6-2sys/net/iflib.c
+6-21 files

HardenedBSD/src dac7d81 — admin config.guess config.sub, api-docs/html a00043.html a00895.html

lutok: import lutok-0.7.1

This change adds lutok lutok-0.7.1 from upstream [1].

The lutok-0.7.1 artifact was been verified by SHA256 checksum [2].

This is a bugfix release.

The core issues addressed in this release relate to memory handling in edge
cases and a handful of build-related bugfixes found when enabling ASAN in CI.

A huge shoutout goes to @holmuk for the findings and fixes made in the library.

Users are encouraged to upgrade to this release.

More information about the release (from a high level) can be found in
the release notes [3].

Updated with [4] like: `update_lutok.sh 0.7.1 lutok-0.7.1`.

    [5 lines not shown]
DeltaFile
+1,490-927admin/config.sub
+0-1,693api-docs/html/a00923.html
+947-604admin/config.guess
+1,163-0api-docs/html/navtree.js
+0-532api-docs/html/a00895.html
+403-0api-docs/html/a00043.html
+4,003-3,756179 files not shown
+8,728-11,558185 files

HardenedBSD/src 382da2d — sys/compat/linuxkpi/common/src linux_80211.h linux_80211.c

linuxkpi: set M_AMPDU for NICs that require host reordering

Set the M_AMPDU flag on RX packets for NICs that require host
reordering.

The reporter (Denis) sees a traffic increase from ~ 100Mbit/sec
to ~365Mbit/sec and a decrease in dropped frames due to RX
sequence / RX CCMP PN reordering.

PR: 300862
Obtained from: Denis Lemire <denis at lemire.name>
MFC after: 1 month
DeltaFile
+7-0sys/compat/linuxkpi/common/src/linux_80211.c
+1-0sys/compat/linuxkpi/common/src/linux_80211.h
+8-02 files

HardenedBSD/src cfe07ee — sys/netpfil/ipfw ip_fw_nat.c, sys/netpfil/ipfw/nat64 ip_fw_nat64.c

ipfw: Run the vnet hooks of ipfw_nat, nat64 and nptv6 after ipfw's

9bcc1e97dda8 put the SYSINITs of ipfw_nat, ipfw_nat64 and ipfw_nptv6
at SI_ORDER_SECOND, the order of ipfw's own vnet hooks; before, they
ran after them.

In ipfw_nat, the module-wide hooks and the vnet hooks now share that
order too, which leaves their relative order to the sort.  As built,
kldunload ipfw_nat runs ipfw_nat_destroy() first: it clears
ipfw_nat_ptr and lookup_nat_ptr while every vnet still has
V_ipfw_nat_ready set, and a packet that hits a nat rule in between
calls a NULL pointer:

  (null)() at 0 <- ipfw_check_packet <- pfil_mbuf_in <- ip_input

Loading can open the same window the other way around.

The vnet hooks of all three modules also tie with ipfw's, and run after
them on vnet creation and before them on destruction only because ipfw

    [10 lines not shown]
DeltaFile
+6-2sys/netpfil/ipfw/ip_fw_nat.c
+3-2sys/netpfil/ipfw/nptv6/ip_fw_nptv6.c
+3-2sys/netpfil/ipfw/nat64/ip_fw_nat64.c
+12-63 files

HardenedBSD/src 8802a76 — sys/netpfil/ipfw ip_fw2.c

ipfw: Destroy global state after the vnets on unload

A module's MOD_UNLOAD handler runs before any of its SYSUNINITs.  Since
ipfw_destroy() moved into MOD_UNLOAD, vnet_ipfw_uninit() runs after it
and takes locks that ipfw_destroy() has already destroyed: the sockopt
handler lock, and vnet_mtx in a vnet that tracks interfaces.  kldunload
ipfw panics with INVARIANTS:

panic: mtx_lock() of destroyed mutex @ sys/netpfil/ipfw/ip_fw_sockopt.c:3038
ipfw_del_sopt_handler() <- ipfw_destroy_tables() <- vnet_ipfw_uninit()
<- vnet_deregister_sysuninit() <- linker_file_sysuninit()
<- linker_file_unload()

Call ipfw_destroy() from a SYSUNINIT at SI_ORDER_FIRST instead, which
runs after the SI_ORDER_SECOND vnet teardown, as before 9bcc1e97dda8
and as pf does for pf_unload().

Reviewed by:            glebius
Fixes:                  9bcc1e97dda8 ("ipfw: cleanup SYSINIT(9)s")

    [2 lines not shown]
DeltaFile
+7-3sys/netpfil/ipfw/ip_fw2.c
+7-31 files

HardenedBSD/src 878fab6 — sys/netpfil/ipfw ip_fw2.c

ipfw: Drain the state expiry task before taking the upper half lock

vnet_ipfw_uninit() takes the upper half lock and then drains the task
that expires dynamic states.  Since 331333ba0186 that task, dyn_tick(),
takes the same lock, so when it fires while a vnet is being destroyed
the two wait for each other and jail -r hangs:

  jail:  taskqueue_drain_timeout <- vnet_ipfw_uninit <- vnet_destroy
  swi6:  _sx_xlock <- dyn_tick <- taskqueue_run_locked

Drain the task first.  The pfil hooks and the sockopt handler are
detached by then, and dyn_tick() takes the lock itself.

Reviewed by:            glebius
Fixes:                  331333ba0186 ("ipfw: hold sleepable "upper half...")
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D62245
DeltaFile
+3-2sys/netpfil/ipfw/ip_fw2.c
+3-21 files

HardenedBSD/src 17dfc1a — contrib/expat/gennmtab Makefile.in, contrib/expat/lib xmlparse.c

contrib/expat: import expat 2.11.0

Changes: https://github.com/libexpat/libexpat/blob/R_2_11_0/expat/Changes

Security:       CVE-2026-124317
Security:       CVE-2026-128241
Security:       CVE-2026-134703

(cherry picked from commit aeab7c6e62d1ff6ba3d33edf2d853dcebb10c1fe)
DeltaFile
+1,081-0contrib/expat/tests/fifth_edition_tests.c
+661-224contrib/expat/tests/basic_tests.c
+442-301contrib/expat/lib/xmlparse.c
+740-0contrib/expat/gennmtab/Makefile.in
+300-38contrib/expat/tests/misc_tests.c
+322-1contrib/expat/tests/xmltest.sh
+3,546-56452 files not shown
+5,562-1,14658 files

HardenedBSD/src 07ae760 — sys/amd64/amd64 vm_machdep.c, sys/powerpc/powerpc vm_machdep.c

amd64, powerpc64: treat procctl(P_PID, 0) as request for current process

Discussed with: markj
Fixes:  f833ab9dd187 ("procctl(2): add consistent shortcut P_ID:0 as curproc")
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61919
DeltaFile
+9-3sys/powerpc/powerpc/vm_machdep.c
+9-3sys/amd64/amd64/vm_machdep.c
+18-62 files

HardenedBSD/src 56d0da2 — tests/sys/kern procdesc.c

tests/sys/kern/procdesc: test the reap by a close from a non-parent

The parent waits for its pdfork(2) child, and then another process,
which inherited the descriptor over fork(2), closes the last one and so
reaps the zombie.  Check that the child's resource usage is accounted
to the parent and not to the closing process, and that the child's
SIGCHLD is no longer pending for the parent.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+99-0tests/sys/kern/procdesc.c
+99-01 files

HardenedBSD/src c8198b5 — sys/kern sys_procdesc.c

procdesc_close(): leave a zombie parked at its debugger with it

A debugger which is not the parent of a PD_NOWAITPID child, and got the
child via PT_ATTACH, can wait for the child after it exited.  If the
parent closed the last process descriptor before the debugger waited,
the close dropped the last zombie reference, and proc_reap() gave the
zombie back to the real parent.  The real parent cannot wait for a
PD_NOWAITPID child, and the debugger got ECHILD, so the zombie stayed
until the real parent exited.

Handle a zombie parked at its debugger as procdesc_close() handles a
traced live process: keep it with the debugger, and make the reaper the
real parent.  The debugger's wait then gives the zombie to the reaper,
which proc_reparent() lets wait for it.  A debugger which is the reaper
gets PZOMBIEREF_PARENT right away.

Reported by:    llm-postcr
Fixes:  bcdb6ba94d08 ("processes: add zombie references, each of them prevents reap")
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+30-8sys/kern/sys_procdesc.c
+30-81 files

HardenedBSD/src 56d0faf — tests/sys/kern procdesc.c

tests/sys/kern/procdesc: test the debugger's wait after the last close

Attach a debugger to a PD_NOWAITPID child, let the child exit, and let
the parent close the last process descriptor before the debugger waits.
Check that a debugger which is neither the parent nor the reaper can
still wait for the child, which then goes to the reaper, and that a
reaper which is the debugger can collect the child.

The child exits on its own: kill(2) does not kill a traced process, it
only stops it for the debugger.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+217-0tests/sys/kern/procdesc.c
+217-01 files

HardenedBSD/src b00886b — sys/kern kern_exit.c

proc_reap(): account the reaped child to its parent

When the last process descriptor of a zombie is closed by a process
other than its parent, proc_reap() added the child's resource usage to
the closing process instead of the parent.  Add it to the parent, and do
it before dropping proctree_lock, which keeps the parent from being
reaped meanwhile.

Reported by:    llm-postcr
Fixes:  cfb5f7686588 ("Add experimental support for process descriptors")
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+10-4sys/kern/kern_exit.c
+10-41 files

HardenedBSD/src 66f2f76 — sys/kern kern_exit.c

proc_reap(): dequeue the child's SIGCHLD under the parent's lock

p_ksi is only queued to the parent, but proc_reap() took it off the
queue with the caller locked.  When the last process descriptor of a
zombie is closed by a process other than its parent, e.g. one which
inherited the descriptor over fork(2) or opened it with pdopenpid(2),
the parent's signal queue and p_pendingcnt were modified without the
parent's lock.

Since bcdb6ba94d08 this is easy to hit: a pdfork(2) child without
PD_NOWAITPID signals its parent with p_ksi on exit, and while the
descriptor is open, the parent's wait only drops PZOMBIEREF_PARENT and
leaves p_ksi queued if the parent blocks or catches SIGCHLD.

Lock the parent, as proc_reparent() does.

Reported by:    llm-postcr
Fixes:  cfb5f7686588 ("Add experimental support for process descriptors")
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+6-2sys/kern/kern_exit.c
+6-21 files

HardenedBSD/src 2b4bc0f — sys/conf kern.post.mk

kern.post.mk: Further refine ports module build

A handful of kmod ports have NO_PACKAGE set, which disables the package
target, which means the previous commit made things worse for those
ports rather than better.  Work around this by explicitly building the
stage target first.

Fixes:          b393df657811 ("kern.post.mk: Fix unprivileged ports module build")
DeltaFile
+1-1sys/conf/kern.post.mk
+1-11 files

HardenedBSD/src c41ba5c — share/misc usb_vendors, sys/dev/rtwn/rtl8192f r92f_chan.c r92f_rom.c

rtwn: (RTL8192FU) fix init, with_ucode build and tx power handling

- added noop for RTWN_WITHOUT_UCODE builds on sc_set_media_status
- fixed upper bound of power delta for MCS for HT20/HT40 in tx power
- moved reading per channel bb trim values after efuse and bb initialization
- use 256 bytes per TX pages as per vendor and linux rtl8xxxu
- added tab character instead of spaces in share/misc/usb_vendors after the device name

Tested on RTL8192FU

Sponsored by: Alchemilla Ventures Private Limited

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D62241
Reported by: llm-postcr
Fixes:  1f0e186e1832 ("rtwn: added support for Realtek RTL8192FU...")
DeltaFile
+34-0sys/dev/rtwn/rtl8192f/r92f_init.c
+0-17sys/dev/rtwn/rtl8192f/r92f_rom.c
+4-2sys/dev/rtwn/rtl8192f/usb/r92fu_attach.c
+1-1sys/dev/rtwn/rtl8192f/r92f_chan.c
+1-1share/misc/usb_vendors
+1-0sys/dev/rtwn/rtl8192f/usb/r92fu.h
+41-216 files

HardenedBSD/src 69a5247 — sys/dev/rge if_rge.c, sys/modules/rge Makefile

rge(4): Fix build without INET

rge_tx_pad() calls in_delayed_cksum_o() and in_cksum_skip()
unconditionally. in_delayed_cksum_o() lives in netinet/ip_output.c
(optional inet) and in_cksum_skip() lives in netinet/in_cksum.c
(optional inet | inet6). So kernels with "device rge" and no
INET fail to link. This breaks LINT-NOINET and LINT-NOIP.

Include opt_inet.h, add it to the module's SRCS, and wrap the IPv4
software checksum block in #ifdef INET.

Fixes: e3ded948ad41 ("rge(4): Implement RTL8125 UDP hardware workaround")
Reported by: llm-postcr

Differential Revision:  https://reviews.freebsd.org/D62240
DeltaFile
+4-0sys/dev/rge/if_rge.c
+1-1sys/modules/rge/Makefile
+5-12 files

HardenedBSD/src 5321904 — lib/libsys libsys_private.h

libsys: Reformat lines moved from libc_private.h in previous commit

MFC after:      1 week
DeltaFile
+3-3lib/libsys/libsys_private.h
+3-31 files

HardenedBSD/src 832f45f — lib/libc/include libc_private.h, lib/librt Makefile

libsys: Split out a new libsys_private.h from libc's libc_private.h

Downstream we have accidentally ended up referencing libc symbols from
within libsys, which went unnoticed because in practice libc is always
loaded whenever libsys is. Split out a new header to detect such cases
at build time, without relying solely on the test recently added in
493c84741c45 ("libsys: add test checking that -lsys alone is linkable").

Note we still add libc to the compiler's include path for compat.h and
(un-)namespace.h, but none of these provide declarations. Ideally that
would also be refactored, but that is a more invasive change.

Copyright header copied from those added by kib@ in 8495e8b1e9e1 ("Fix
known issues which blow up the process after dlopen("libthr.so") (or
loading a dso linked to libthr.so into process which was not linked
against threading library)."), the commit that introduced what is almost
all the code in this header; none of this code originates from jb@, to
whom libc_private.h is attributed.


    [3 lines not shown]
DeltaFile
+107-0lib/libsys/libsys_private.h
+1-63lib/libc/include/libc_private.h
+1-2lib/libsys/Makefile
+2-1lib/msun/Makefile
+2-1lib/libsys/auxv.c
+1-1lib/librt/Makefile
+114-6830 files not shown
+144-9336 files

HardenedBSD/src bedca0f — lib/libfetch ftp.c

libfetch: Fix buffer overruns in FTP code

* When parsing the reply to a CWD, PWD, or CDUP command, if we ran out
  of space in the destination buffer, we would correctly terminate the
  loop, but then incorrectly see the remaining length as non-zero,
  causing us to write a terminating NUL one past the end of the buffer
  and report success instead of a protocol error.  Additionally, the
  code would fail to notice an improperly terminated pathname, and was
  hard to follow, so rewrite the entire loop.

* When comparing the current working directory to the intended working
  directory to calculate the minimal operation to get from one to the
  other, if the current working directory was an empty string, we would
  improperly read one byte below the start of the intended working
  directory.

MFC after:      1 week
Reported by:    Laam Alif at Ibteda Digital Library
Differential Revision:  https://reviews.freebsd.org/D61502

    [2 lines not shown]
DeltaFile
+32-27lib/libfetch/ftp.c
+32-271 files

HardenedBSD/src b393df6 — sys/conf kern.post.mk

kern.post.mk: Fix unprivileged ports module build

When building ports modules along with the kernel, we run the build
target during buildkernel, and the install target during installkernel.
This was fine back in the day when we installed ports straight from the
working directory, but these days we stage them first, then build a
package, and install the package.  This staging and packaging should be
seen as part of the build process, not the installation process, so we
should use the package target, rather than the build target, during
buildkernel.

This fixes an issue where doing buildkernel as an unprivileged user,
then installkernel as root, left a root-owned staging directory in the
kernel object tree which the next unprivileged buildkernel would be
unable to remove or replace.

MFC after:      1 week
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D62195
DeltaFile
+2-2sys/conf/kern.post.mk
+2-21 files

HardenedBSD/src e79b273 — sys/compat/linuxkpi/common/src linux_compat.c

linuxkpi: Make list_sort stable

Linux's list_sort() is intended to be stable, but linuxkpi implemented
it as a wrapper around qsort(), which is not.  This used to work because
our qsort() had a bug that effectively turned it into insertion sort,
but this is no longer the case.  Replace the qsort() call with an inline
implementation of insertion sort.

MFC after:      1 week
Reviewed by:    bz, markj
Differential Revision:  https://reviews.freebsd.org/D62194
DeltaFile
+27-26sys/compat/linuxkpi/common/src/linux_compat.c
+27-261 files