FreeBSD git weekly: 2026-07-20 to 2026-07-26

Introduction

This is a display of mostly-automatically-classified git commits from 2026-07-20 to 2026-07-26.

Table of contents and commits per category:

(1) Highlighted commits (these are copies, not in stats)
8 5.4% Userland programs
10 6.7% Documentation
52 34.9% Hardware support
10 6.7% Networking
7 4.7% System administration
5 3.4% Libraries
2 1.3% Filesystems
36 24.2% Kernel
2 1.3% Build system
3 2.0% Internal organizational stuff
10 6.7% Testing
1 0.7% Style, typos, and comments
3 2.0% Contrib code
0 0.0% Reverted commits
0 0.0% Unclassified commits
149 100% total
Technical notes about this page

Highlighted commits

For extra visibility, these are copies of commits found in other sections. Most (if not all) come from the commit message containing "Relnotes:", or commits modifying UPDATING.

sh.1: Document which features are non-POSIX
Point out which features are non-POSIX and thus can not be
safely assumed to be portable and exist in other implementations.

Relnotes:               YES!
Reviewed by:            ziaee, jilles
Differential Revision:  https://reviews.freebsd.org/D55333
6ee5895f88ed7ba6b16aae9ad5833df6df6864bc Artem Bunichev 2026-07-20 21:50:57

Userland programs

Commits about commands found in man section 1 (other than networking).

hexdump: Support octal and hex for -N option
GNU hexdump supports octal and hex, we add supports for BSD style
hexdump for better compatibility.

See: https://github.com/llvm/llvm-project/pull/206581/

MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58074
b8f1972d51cf93ba4393d621b126dbd408423b87 ShengYi Hung 2026-07-07 04:49:48
m4: import fixes from OpenBSD
- gnum4.c: fix m4_warnx() to use vwarnx() instead of warnx()
- eval.c: improve error messages for empty macro names
- extern.h: remove compute_prevep() declaration
- Update OpenBSD version strings

MFC After: 3 days
8966cc0d01a29c11168e4e9d7f1703aa31ad3be6 Baptiste Daroussin 2026-07-19 18:43:31
ministat: revert "parse comma used as decimal delimiter"
This partially reverts commit 77a201b1705dbd97ea9ebe5b25b1d4ddac8a7d38.

Requested by:   des, fuz
aa588213d8f54803fc0b6b09d34f20fb30e57896 Gleb Smirnoff 2026-07-20 18:38:33
vtfontcvt: Avoid dead store in add_char
The fallback glyph is stored at index 0, and does not need to be
inserted into a mapping.

Previously there was a dead store of add_glyph's return value for the
fallback case, which upset Clang's static analyzer.  Now, cast the
return value to (void) to make it clear this is intentional.

Also change add_glyph's fallback parameter to a c99 bool to make its use
more clear.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57174
b273481f2a840a05e4039655be99528e1fa9388c Ed Maste 2026-05-22 18:08:58
Commit group #0: install: Allow installing stdin
install: Allow installing stdin

If from_name is "/dev/stdin" or "-" and the target is not a directory,
skip the comparison and copy data from standard input to the target.

MFC after:      1 week
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D58348
d34870708db9fa1eb8e29b5e085b755de1189b1f Dag-Erling Smørgrav 2026-07-21 08:03:44

install: Fix typo

MFC after:      1 week
Reported by:    markj
Fixes:          https://cgit.freebsd.org/src/commit/?id=d34870708db9 ("install: Allow installing stdin")
0eef3d01c22a5e00cd2cf10c34871eddbfd22aa0 Dag-Erling Smørgrav 2026-07-22 06:04:18
install: Code cleanup
This is mainy focused on using bool for booleans but also renames some
variables for clarity, adds some explicit comparisons, adds some braces,
with miscellanous style fixes thrown in.

MFC after:      1 week
Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D58355
134ddd372f8213885dd828ab38cec2384fd451db Dag-Erling Smørgrav 2026-07-21 08:03:49
cat: Fix a NULL pointer dereference
Check the `fdopen` return value before calling `cook_cat`.

Reviewed by:    markj, bnovkov
Differential Revision:  https://reviews.freebsd.org/D57741
MFC after:      1 week
9724f3f8974957d2cd15f6b796c347ca50250954 Jane Smith 2026-07-21 19:45:25

Documentation

Man pages, release notes, etc.

vfs_unmountall.9: Fix an outdated .Xr to boot(9)
boot.9 was moved to kern_reboot.9, but this reference was not changed
appropriately.

Reviewed by:    mhorne, kib, emaste
Fixes:  https://cgit.freebsd.org/src/commit/?id=800e74955d4e ("boot(9): update to match reality")
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D58350
5b7d6a128bef464e7fd331d172e4cf25a5d122c3 Artem Bunichev 2026-07-20 17:29:51
ptrace.2: document PT_GET_CHILDREN
Reviewed by:  markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58315
6dbeaf1afaba52ba224f24773cbaac6317e11ff2 Konstantin Belousov 2026-07-17 20:12:13
sh.1: Document which features are non-POSIX
Point out which features are non-POSIX and thus can not be
safely assumed to be portable and exist in other implementations.

Relnotes:               YES!
Reviewed by:            ziaee, jilles
Differential Revision:  https://reviews.freebsd.org/D55333
6ee5895f88ed7ba6b16aae9ad5833df6df6864bc Artem Bunichev 2026-07-20 21:50:57
aq(4): Document the Atlantic 2 (AQC113/114/115/116) devices
List every AQC part aq_vendor_info_array[] probes, each with the
maximum speed aq_hw_capabilities() grants it.

Only the Atlantic 2 parts link at 10 Megabit.  The AQC100 and AQC100S
are the only SFP+ controllers; the rest are twisted pair.

Reviewed by:            adrian, ziaee
Signed-off-by:          Nick Price <nick@spun.io>
Differential Revision:  https://reviews.freebsd.org/D58144
1d89845e90867e2f970c651c342eb07da847b6e9 Nick Price 2026-07-20 22:11:51
firewire: remove deprecation notice from manual page
Reviewed by:  ziaee, imp
Differential Revision:  https://reviews.freebsd.org/D58267
e7efe2f059a474f8f8e14393713071761a633e65 Abdelkader Boudih 2026-07-20 22:49:58
Commit group #1: contigmalloc.9: Note that M_WAITOK may still return NULL
contigmalloc.9: Note that M_WAITOK may still return NULL

Reviewed by:    markj, bapt
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58382
caabdb3aefdc45cae90203210034086801fa9005 Ed Maste 2026-07-21 18:10:00

contigmalloc.9: Correct typo

Reported by:    alc, rlibby
Fixes: https://cgit.freebsd.org/src/commit/?id=caabdb3aefdc ("contigmalloc.9: Note that M_WAITOK may still return NULL")
ba583f0c2d63f03c834047e48a69095a86a71589 Ed Maste 2026-07-21 19:05:53
cp: Correct description of SIGINFO
The manual page claimed that SIGINFO caused information to be printed to
stdout, when in fact it is printed to stderr, as one would expect.  This
has been true ever since the feature was first added in 2003.

MFC after:      1 week
Fixes:          https://cgit.freebsd.org/src/commit/?id=00d321a2b395 ("Add a SIGINFO handler.")
Reviewed by:    jilles
Differential Revision:  https://reviews.freebsd.org/D58392
5dc400ff452b0259f0c50474255ebe6e5e02edb9 Dag-Erling Smørgrav 2026-07-23 06:21:08
em(4): document adaptive interrupt moderation
Describe the disabled, adaptive, and low-latency settings and their
interrupt-rate tradeoffs.

MFC after:      1 week
b6b379b94781da5d4328f6f57273fbe7bd9dc687 Kevin Bowling 2026-07-25 22:09:48
igc(4): document adaptive interrupt moderation
Describe the disabled, adaptive, and low-latency settings and their
interrupt-rate tradeoffs.

MFC after:      1 week
297394e995e5ea1ea9bc85e609ca116255d51e97 Kevin Bowling 2026-07-26 00:10:38

Hardware support

Hardware drivers and architecture-specific code.

apei: Fix i386 build over bus read, write function
bus_{read,write}_8 are macro wrappers around the corresponding bus_space
functions in sys/bus.h, so implementing bus_{read,write}_8 won't work.
Implement the underlying bus_space function instead.

Reviewed by:    jrtc27, rlibby
Fixes:          https://cgit.freebsd.org/src/commit/?id=9313f6b01485
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58301
7fc2c9f688efb12beddd58a01628157e32b632b0 ShengYi Hung 2026-07-20 07:26:56
hwpmc: handle counter wraparound for process-mode counting PMCs
The accumulated count of a process-mode counting PMC is kept in a
64-bit software counter and seeded into the hardware counter at every
context switch in.  Hardware counters are narrower than that - each
PMC class discovers and records its own counter width, e.g. 48 bits
on current x86 (queried from CPUID on Intel, architectural on AMD) -
so once the accumulated count approaches the end of the hardware
counter range, the counter wraps during a time slice and the value
read back at switch out is smaller than the value seeded.  The
increment was computed assuming a full 64-bit counter: on INVARIANTS
kernels a long enough counting run panics with "negative increment"
the moment the accumulated count first crosses the hardware counter
range, and on other kernels the totals silently lose a full counter
range per wrap.

Compute the increment modulo the per-class hardware counter width
instead, in both places that accumulate switch-out deltas.

Reviewed by:            adrian
MFC after:              2 weeks
Assisted-by:            Claude Code (Fable 5)
Differential Revision:  https://reviews.freebsd.org/D58340
e42703f5c4b2d3a869b17e2cb8670f1b6359c8cf Alexander Leidinger 2026-07-19 07:38:52
hwpmc: drain a process-mode PMC's runcount when a live target detaches
A process-mode PMC's runcount tracks how many CPUs currently have it
loaded in hardware.  It is decremented only by the context-switch-out
and process-exit reclaim paths, both of which the scheduler invokes
only for processes flagged P_HWPMC.  Detaching a target that still has
the PMC live in hardware dropped the target and cleared P_HWPMC without
taking the PMC off the hardware or dropping the runcount reference, so
the reference leaked.  A subsequent release then spun in
pmc_wait_for_pmc_idle() forever waiting for the runcount to reach zero:
on an INVARIANTS kernel this panics ("waiting too long for pmc to be
free"), otherwise it is an unkillable loop holding the hwpmc lock.  Any
process able to allocate a PMC can trigger this by attaching a counting
PMC to itself and detaching it before releasing.

Take the PMC off the hardware and drop the runcount reference as part
of detaching, before P_HWPMC is cleared: reclaim it from the detaching
thread's own CPU directly, and, when the detach removes the PMC's last
target, wait for any references held by the target's other threads to
drain while P_HWPMC is still set (they can no longer reload it).

Reviewed by:            adrian
MFC after:              2 weeks
Assisted-by:            Claude Code (Fable 5)
Differential Revision:  https://reviews.freebsd.org/D58342
86fa065f1862f3b638efa1868523878d9db14ada Alexander Leidinger 2026-07-19 11:39:27
uvideo: increase UVIDEO_MAX_PU and UVIDEO_MAX_CT to 32
Some UVC devices (e.g. Logitech C920) expose more than 8 Processing
Unit descriptors, causing "too many PU descriptors found!" errors.
Increase both limits from 8 to 32 to accommodate such devices.
5f69e6209e09687b90343b09cc281fd1d9bc99f9 Baptiste Daroussin 2026-07-18 05:39:01
uvideo: import quirks infrastructure from OpenBSD
Import the device quirk system from OpenBSD to handle UVC devices
that need special handling. This includes:

- UVIDEO_FLAG_ISIGHT_STREAM_HEADER: non-standard streaming header
- UVIDEO_FLAG_REATTACH: needs reattach after firmware upload
- UVIDEO_FLAG_VENDOR_CLASS: incorrectly reports as vendor class
- UVIDEO_FLAG_NOATTACH: device not supported
- UVIDEO_FLAG_FORMAT_INDEX_IN_BMHINT: format index in bmHint

Add quirks table with known devices and lookup function.
Add iSight stream header decoder for Apple iSight cameras.

Obtained from:  OpenBSD
6e845b1333fdf215216dc463ebd9ed34b045c477 Baptiste Daroussin 2026-07-19 17:18:50
x86 xen: provide the prototype for xen_arch_intr_handle_upcall() in x86/apicvar.h
Sponsored by: The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D56005
0e5b1384df10e9b9700047cb79c347874212d2a9 Konstantin Belousov 2026-03-20 23:27:18
net80211: update drivers to allocate sequence numbers in the raw path
A bunch of drivers weren't properly converted.  I mistakenly
put a call to ieee80211_output_seqno_assign() wherever the
crypto header was added, which isn't exactly correct.
There are plenty of drivers which don't share enough of their
raw and normal transmit path code for that to hold true.

So after some manual review, it looks like I've captured the
places (outside of iwn(4) which I committed earlier) where
I missed ieee80211_output_seqno_assign() calls.

* For bwi(4) and bwn(4) I refactored it out into a place that is
  common enough and happens in the same lock hold window,
  so it's serialised.

* For the rest, it's just plain missing from the raw path.

Locally tested:

* ural(4)
* ral(4)
* bwi(4)

Differential Revision:  https://reviews.freebsd.org/D58098
4a4bcdc6aa3eb99948a369fe16f5cecf5828e1bb Adrian Chadd 2026-07-08 05:44:57
Commit group #2: firewire
firewire: add warn-only CRC validation for CSR ROM directories

Implemented crom_crc_valid() helper to validate IEEE 1394 config ROM CRC-16
checksums.

Skipped root header CRC validation since csrhdr.crc_len cover the entire
ROM body which is not fully read at header parse time. Per-directory
CRC checks below catch corruption where it needed.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58307
d3259935f7780507248044cdce67646b5fa3e7c6 Abdelkader Boudih 2026-07-20 22:38:41

firewire: drain pending xfers after callout stop in detach

Removes a TODO that predates the existing drain call.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58308
5b7449ad47be4582ff451ce4615753dab4a6f882 Abdelkader Boudih 2026-07-20 22:47:02

firewire: force root change when root node is not cycle master capable

When a FireWire bus resets, all devices negotiate who is the new boss.
when we detect the root node can't be cycle master,
we send a PHY config packet that forces a reelection.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58309
23ea903f68017f781ff579325caa01c928612d57 Abdelkader Boudih 2026-07-20 22:47:49

firewire: remove dead code across the subsystem

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58310
8a765654f937e30104b6ebc28be66241b53d2a9e Abdelkader Boudih 2026-07-20 22:48:17

firewire: replace magic numbers with named constants

No functional change.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58311
dd56711e83533ffe40f3f54b01565537f85381cc Abdelkader Boudih 2026-07-20 22:48:42
nvme: Explicitly cast caddr_t values
Sponsored by: Klara, Inc.
Sponsored by:   NetApp, Inc.
MFC after:      1 week
Fixes:          https://cgit.freebsd.org/src/commit/?id=6d0001d44490 ("nvme: add support for DIOCGIDENT")
Reviewed by:    bnovkov, imp
Differential Revision:  https://reviews.freebsd.org/D58357
bd30d1ad78e152d0a963bc873643a911321cca6e Dag-Erling Smørgrav 2026-07-21 08:03:05
uvideo: fix use-after-free in mmap buffer lifetime management
The uvideo driver freed the mmap buffer (contigmalloc'd) in several
paths (VIDIOC_STREAMOFF, last close, detach) without coordinating
with the lifetime of existing user-space mmap mappings.  This could
lead to use-after-free when user-space continued to access the
mapped memory after the backing pages had been freed.

Fix this by switching from the simple d_mmap callback to d_mmap_single
with custom cdev_pager_ops, and by attaching the contig buffer to a
single shared vm_object created at REQBUFS time:

- uvideo_reqbufs() allocates a uvideo_mmap_state (independent of the
  softc) and a shared vm_object via cdev_pager_allocate() that spans
  the whole buffer; the softc holds one reference to it.
- uvideo_cdev_mmap_single() simply hands out additional references to
  that shared object; the requested offset selects which buffer is
  mapped.  The VM system tracks mapping lifetime through the object
  reference count, so no per-mapping bookkeeping is needed.
- uvideo_pg_ctor/uvideo_pg_dtor validate the mapping and free the
  contig buffer together with the state when the last reference
  (softc's own or a user mapping) is dropped.
- uvideo_pg_fault installs a fictitious page for the backing physical
  address, following the canonical device-pager pattern: update the
  passed-in page in place when it is already fictitious, otherwise
  allocate a fake page and vm_page_replace() the busy placeholder,
  so that dev_pager_dealloc() does not deadlock.
- uvideo_vs_free_frame() drops the softc's reference instead of
  contigfree()'ing directly; if mappings still exist the buffer stays
  alive until the last uvideo_pg_dtor().
- VIDIOC_STREAMOFF no longer frees the buffer (per V4L2 spec).
- Last close always releases the buffer (deferred if mappings exist).
- The mmap_state outlives the softc, so the pager dtor can safely
  free the buffer even after device detach.

Reported by:    章鱼哥 (@aipyapp) (www.aipyaipy.com)
Reported by:    Chris Jarrett-Davies of the OpenAI Codex Security Team
a5307a57c46f16f5b3c29708f1e528963dea150c Baptiste Daroussin 2026-07-20 13:52:06
hid: u2f: stop interrupts on last-close
This fixes an issue with the Solo2 (and likely some of the Nitrokey
family) where hangs would occur with OpenSSH- it issues a CANCEL prior
to closing the device unconditionally, and without draining the read
endpoint we end up seeing the response to that CANCEL the next time
OpenSSH tries to connect.  This throws the entire command/response
sequence out of whack.

This call used to break Yubikeys in some situations, but the fix that
landed in 28d85db46b48 ("xhci: Do not drop and add bits in xhci") seems
to have addressed that- presumably we sometimes end up stopping the
command and desyncing at the controller level.  This probably implies
that we need a SYNCWRITE HID quirk, but that requires a little more work
in usbhid_sync_xfer() and this doesn't seem to cause any problems in
normal usage.

Reviewed by:    aokblast, wulf
Differential Revision:  https://reviews.freebsd.org/D58199
2e3892671a6fe2bceff6a9d8b439e7acd27dc28a Kyle Evans 2026-07-21 16:57:47
hwpmc: Add EXTERROR diagnostics to the AMD and IBS allocators
Replace bare EINVAL in AMD/IBS allocation and config-validation with
EXTERROR(), so a failed pmc(3) allocation names the check and value.

Register HWPMC_AMD in exterr_cat.h and the generated filenames.h.

Signed-off-by:  Andre Silva <andasilv@amd.com>
Reviewed by:    Ali Mashtizadeh <ali@mashtizadeh.com>, mhorne
Sponsored by:   AMD
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2180
8c4d5701924f8401798265d2175f0b2bc704a222 Andre Silva 2026-06-12 15:38:14
hwpmc: Add EXTERROR diagnostics to the hwpmc syscall path
Annotate validation failures in the PMC syscall handlers (allocate,
attach, read/write) with EXTERROR(), so pmc(3) callers see which
precondition failed, not a bare errno.

Register HWPMC_MOD in exterr_cat.h and the generated filenames.h.

Signed-off-by:  Andre Silva <andasilv@amd.com>
Reviewed by:    Ali Mashtizadeh <ali@mashtizadeh.com>, mhorne
Sponsored by:   AMD
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2180
c185935b0d52f991d7e27fbac277ea8c9bb456a1 Andre Silva 2026-06-12 15:38:57
Commit group #3: vtnet
vtnet: Retry feature negotiation without offloads

A device is permitted to reject an otherwise valid subset of its
offered features by refusing to accept FEATURES_OK (VirtIO v1.3,
2.2.2).  Apple's Virtualization.framework does this in practice;
it treats the offered CSUM/TSO offloads as all-or-nothing, while
vtnet's default request contains only part of that group because
of hw.vtnet.lro_disable that would drop the guest TSO bits, thus
negotiation fails and the device does not attach.

If FEATURES_OK is rejected, retry the negotiation once with every
offload-related feature stripped.  Changing the feature set after
a failed FEATURES_OK requires re-initialising from device reset
(VirtIO v1.3, 3.1.1), so the retry goes through virtio_reinit().

A NIC without offloads is preferable to no NIC at all.  Devices
that accept the initial feature set are unaffected, while those
that also reject the reduced set continue to fail attachment as
before.

Signed-off-by:  Faraz Vahedi <kfv@kfv.io>
Reviewed by:    adrian
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2322
5481c2d3ac1fc7682cdd184c7a797c0583e391c0 Faraz Vahedi 2026-07-12 18:48:36

vtnet: Implement VIRTIO_NET_F_GUEST_ANNOUNCE

When the device sets VIRTIO_NET_S_ANNOUNCE in the config status
field, for example after a VM migrates to a new host, announce
the interface's presence on the network so peers and switches
learn the new attachment point, then acknowledge the request
with the VIRTIO_NET_CTRL_ANNOUNCE_ACK control command, as per
VirtIO v1.3, 5.1.6.5.4.

The announcement raises iflladdr_event: the stack sends gratuitous
ARPs and unsolicited neighbor advertisements for the interface's
addresses, and stacked interfaces such as vlan(4) propagate the
event and announce theirs as well.  The event handlers may sleep,
so the work is deferred from the config change interrupt to a task
on taskqueue_thread; that context also allows the acknowledgement
to be skipped safely if the interface was stopped in the meantime,
in which case the device keeps the bit set and the request is
re-delivered with the next config change interrupt.

Signed-off-by:  Faraz Vahedi <kfv@kfv.io>
Reviewed by:    adrian
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2322
c5caf856453325728155a18d3bb02a9cd651a0a0 Faraz Vahedi 2026-07-12 20:46:20

vtnet: Accept VIRTIO_NET_F_CTRL_RX_EXTRA

Although the driver does not issue the extra receive-mode commands
accepting the feature is harmless and some devices, notably Apple's
Virtualization.framework, offer their control-queue features as a
group and refuse FEATURES_OK unless the whole set is acknowledged.

Signed-off-by:  Faraz Vahedi <kfv@kfv.io>
Reviewed by:    adrian
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2322
d4ddf8eaee9371d1d20bfb753237f25505d6afee Faraz Vahedi 2026-07-12 21:09:06
powerpc64: enable extended error strings in GENERIC64* configs
These kernconfs were missed in the previous commit.

PR:             https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=289236
Reviewed by:    kib
Fixes:          https://cgit.freebsd.org/src/commit/?id=f38cbefef8090f3363e5685c5a3b30ffbf1d3ad0
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
afa048d159f64e1c609475314e19fb030ffd595f Siva Mahadevan 2026-07-22 01:58:58
Commit group #4: uvideo
uvideo: replace contigmalloc with OBJT_PHYS vm_object for mmap buffer

Allocate the mmap buffer via phys_pager_allocate() and map it into
kernel space with vm_map_find()/vm_map_wire(), instead of a custom
cdev_pager backed by contigmalloc.  phys_pager_allocate() is required
over a bare vm_object_allocate(OBJT_PHYS) to initialise un_pager.phys.ops,
otherwise phys_pager_getpages() NULL-derefs during vm_map_wire().

Reviewed by:            markj
Reported by:            markj
Differential Revision:  https://reviews.freebsd.org/D58394
4c94869c37e14dc334e2400d1a26d5ded89576fc Baptiste Daroussin 2026-07-22 11:25:31

uvideo: validate frame size before mmap buffer allocation

dwMaxVideoFrameSize comes from the USB probe/commit response and is not
validated.  reqbufs() computed buf_size_total with signed int arithmetic
and no bound, so a bogus value could wrap the product to a small size
and yield a too-small buffer with a huge sc_mmap_buffer_size, causing
out-of-bounds writes from the USB transfer callbacks.

Bound the frame size against sc_max_fbuf_size and use overflow-checked
size_t arithmetic for the total and per-buffer offsets.

Reported by:    emaste
4b9d794b6aa86a2b205e480928552d3f606d9bcc Baptiste Daroussin 2026-07-22 07:25:52

uvideo: lock the mmap queue and read path

qbuf(), dqbuf() and read() manipulated sc_mmap_q / sc_mmap_cur /
sc_frames_ready without sc_mtx, racing with the USB transfer callbacks
(producer) that run under the mutex.  This could corrupt the queue or
trigger use-after-free.

Take sc_mtx around qbuf(), use mtx_sleep() and protect the queue
operations in dqbuf(), and use mtx_sleep() with a snapshot of sc_fsize
in read().

Also reject S_FMT and S_PARM with EBUSY while streaming: both
re-negotiate the probe/commit controls with the device, which disrupts
the active USB transfers (a second client opening the device would
otherwise freeze the first one's stream).
f12dd1d5f0303fe3bc5030293bda04b04995b72c Baptiste Daroussin 2026-07-22 07:26:18

uvideo: bounds-check frame interval reads against bLength

Frame interval data is read from device-supplied frame descriptors whose
bLength may be shorter than the number of intervals declared by
bFrameIntervalType.  The continuous branch of uvideo_enum_fivals() read
three intervals unconditionally, and the discrete branch checked the
pointer but not the four bytes that UGETDW() reads, so a short or
malformed descriptor could read past bLength and leak adjacent kernel
memory to userspace.  uvideo_vs_parse_desc_frame_max_rate() had the same
class of off-by-up-to-three-bytes read.

Compute the available bytes from bLength and validate before each read.

Reported by:    emaste
cb26bda8ca36e0e421f75d82e1aa46df8f2ff814 Baptiste Daroussin 2026-07-22 07:42:29

uvideo: track streaming ownership per-fd and free buffers on STREAMOFF

The driver shared a single streaming state and buffer pool across all
open file descriptors, so a second client (e.g. another browser tab)
could disrupt the first: its cleanup STREAMOFF would tear down the
active stream, and stale buffers prevented re-acquisition.

Add per-fd state via devfs cdevpriv tracking whether this fd started
streaming.  STREAMOFF and close from a non-streaming fd are no-ops.
STREAMOFF from the streaming fd stops the stream and frees the buffers
so that a new fd can re-acquire the camera.  DQBUF returns EPIPE
immediately when buffers are freed instead of waiting for a timeout.
2120f3e5ec701d92848c259ece4dfbf1aa95f6cb Baptiste Daroussin 2026-07-22 08:14:18

uvideo: fix close/detach race on streaming teardown

detach() stopped streaming and called uvideo_vs_close() before
destroy_dev(), so a concurrent close() could race the teardown and call
uvideo_vs_close() a second time (double usbd_transfer_unsetup), and
mtx_destroy() could race a close still holding sc_mtx.  sc_streaming
was also read without the lock in both paths.

Reorder detach() to call destroy_dev() first so all in-flight cdev
methods drain before any teardown.  Read sc_streaming under sc_mtx in
both detach() and the last-close safety net.
12b4a02bd88117b07f3e142af71b70bade4fd57e Baptiste Daroussin 2026-07-22 08:18:23

uvideo: use size_t for sc_mmap_count and loop index in reqbufs
599a4d6beff07f93f019e0aff9105a8e642a600f Baptiste Daroussin 2026-07-22 11:53:34

uvideo: validate frame descriptors and fix integer overflows in size computation
c141d75430c75d21aa8260287b9e2a05905335b3 Baptiste Daroussin 2026-07-22 12:15:21

uvideo: fix printf type

Reported by:    vishwin
ba567508718a173e74754d1a010de2f94edd5603 Baptiste Daroussin 2026-07-22 16:37:52
hwpstate_intel(4): use CPU_FOREACH instead of an IPI
Reviewed by:  aokblast, kib, olce
Differential Revision:  https://reviews.freebsd.org/D58336
3f521425afcb79a623753c171bf6f3296cd556ec Ryan Libby 2026-07-23 17:40:18
snd_uaudio: Don't let an idle stream reprogram a shared UAC2 clock
Some UAC2 devices expose a single Clock Source entity that is shared
between their playback and capture interfaces (it appears in both the
output and input clock bitmaps).  On such a device uaudio(4) programs
the sample rate for both directions when a stream starts.  If playback
runs at a 44.1 kHz-family rate while the idle capture channel is left
at its 48 kHz-family default, the capture
SET_CUR(UA20_CS_SAM_FREQ_CONTROL) is issued after the playback one and
overwrites the rate on the shared clock.  The device then runs at
~48 kHz while the playback stream carries 44.1 kHz data.  Consuming
samples faster than they arrive, the device repeatedly runs out of
data, loses sync with the playback stream, and re-locks onto it
(audible dropouts, front-panel play/idle flicker).  The 48 kHz family
is unaffected because both directions then agree on the rate.

Fix it in three parts:

- Add a shared-clock guard: before issuing SET_CUR to a clock id, if
  that clock is shared between playback and capture and the other
  direction is already streaming at a different rate, skip it.  The
  first active stream owns the clock; a later one follows it.

- When the recording channel is auto-started only as a source of jitter
  information for asynchronous playback, align its nominal rate to the
  playback rate before starting it, so it neither reprograms the shared
  clock to a conflicting rate nor produces mismatched frame sizes.

- Always submit the explicit-feedback SYNC transfer so
  dev.pcm.%d.feedback_rate stays live as a diagnostic even when a
  capture stream is present.

Reproduced on an OKTO RESEARCH DAC8 STEREO (0x152a:0x88c5), whose
vestigial capture interface never streams; the same device plays the
44.1 kHz family correctly under Linux's snd-usb-audio.

As a side effect, this patch also fixes the sample rate bug mentioned in
the BUGS section of sound(4)'s man page, where a device needs to have
the same sample rate set for both playback and recording in order to
work properly.

PR:             https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=295933
Assisted-By:    Claude Opus 4.8 (claude-opus-4-8)
Signed-off-by:  giacomo <delleceste@gmail.com>
MFC after:      2 weeks
Reviewed by:    christos
Pull-Request:   https://github.com/freebsd/freebsd-src/pull/2323
755685dd665ef209912c59da6a7d0e7f2c9f464b giacomo 2026-07-15 11:34:34
sound: Scale PCM secondary buffers by byte rate
The fixed 128 KiB secondary buffer cap dates from stereo-sized streams.
High channel-count or high sample-width OSS streams can consume most of
that budget in one graph quantum, leaving too little room for capture
catch-up or playback headroom.

Keep 128 KiB as the low-rate floor, but derive the effective soft-ring
cap from the channel byte rate, clamped to 4 MiB. Use that per-channel
cap when resizing the soft buffer and when clamping
SNDCTL_DSP_SETFRAGMENT requests.

Also clamp SNDCTL_DSP_LOW_WATER to the current soft-buffer size so an
impossible readiness threshold cannot make poll/select wait forever.

MFC after:      3 weeks
Reviewed by:    christos
Differential Revision:  https://reviews.freebsd.org/D58064
967e86d1ef2ac8711c0ae7be353a9c08186f4e6f Kevin Bowling 2026-07-24 13:57:27
uvideo: fix step=0 infinite loop and int overflow in fbuf_size
Prevent infinite loop in uvideo_vs_negotiation() when a USB camera reports
step=0 in its continuous frame interval descriptor.
Cast fbuf_size calculation to uint64_t to avoid int overflow for large
width/height/bpp combinations.

Reported by:    emaste
8468152509a0dfd73e69618af2b1d7f9cbd366f7 Baptiste Daroussin 2026-07-24 14:30:07
uvideo: Return actual mtx_sleep error in dqbuf
Don't coerce errors to EINVAL, which isn't correct for mtx_sleep's
failure cases.

Sponsored by:   The FreeBSD Foundation
8a7ab3ed22d9d6b49c5c4799c1468017d691b343 Ed Maste 2026-07-21 18:01:53
xhci: Refactor xhci_generic_setup code
Our USB TRB buildup subroutines were previously difficult to follow. In
setup_generic_chain_sub(), the routine filled TRB packets based on the
characteristics passed by the caller and the current state (for example,
whether the TRB was the last in the TD).

However, most TRB types (except Normal TRBs) cannot be shared across TDs.
To simplify the logic, refactor xhci_setup_generic() so that TRBs are
constructed according to their transfer type, with dedicated helper
functions for each TRB type.

Sponsored by:   The FreeBSD Foundation
Assisted-by:    Claude Code (Opus 4.6, Opus 4.8(1M) and Sonet 5.0)
Differential Revision:  https://reviews.freebsd.org/D57130
e0b235ecd4fa9a67578be68057dbcad797f96397 ShengYi Hung 2026-05-20 09:26:59
ietp: guard iicbus_get_addr with devclass check
When a USB HID device triggers identify,
the grandparent is usbhid on a USB hub.
Calling iicbus_get_addr() on a non-iicbus device
hits a KASSERT panic.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D58432
3fbffbcbec88932d7c7b024aca5a1e26a36f13a4 Abdelkader Boudih 2026-07-25 01:28:44
usb: preserve error when doing request
Currently, USB request not distinguished different error and always return EIO.
However, some error are recoverable or ignorable in userspace.
Therefore, we preserve the meaning of different error to userspace then
allow userspace to decide how to use the return error.

Reviewed by:    adrian
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52244
2cf2d955635abb546e57296e06815dd71f8c16ad ShengYi Hung 2025-08-29 17:23:12
x86/specialreg: Add MSR_AMD_CPUID01 MSR
Reviewed by:    markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56311
b78f8800a7b07f5b0eb0eafabcfa90019b795288 ShengYi Hung 2026-07-25 13:24:59
Commit group #5: e1000
e1000: Defer link-up notification until after TSO reset

em_automask_tso() changes the enabled TSO capabilities when the link
moves between 10/100 and 1000 Mb/s.  A running interface must be
reinitialized to apply the new capability set.  Do not publish
LINK_STATE_UP until the requested iflib reset has completed.

Replace link_active with an explicit state machine that distinguishes
the physical link, its publication to iflib, and an outstanding reset
barrier.  Preserve that barrier across a link flap with
DOWN_RESET_PENDING, and only publish DOWN if UP was previously
published.

Only request a reset for a running interface or for an initialization
while the interface is administratively up.  In other states the next
initialization will apply the capability changes, avoiding a reset
request that iflib's admin task could discard.

Reviewed by:    Faraz Vahedi <kfv@kfv.io>
Fixes:  https://cgit.freebsd.org/src/commit/?id=2ddf24f8f525 ("e1000: Automask TSO on lem(4)/em(4) 10/100 Ethernet")
MFC after:      1 week
0bd6a167c1561f01c227b1c428a3d8adf0e38833 Kevin Bowling 2026-07-25 21:00:10

e1000: fix 82574 MSI-X interrupt throttling

em_newitr() and the per-queue interrupt_rate sysctl both tested
que->msix to decide whether an 82574 is running in MSI-X mode.  0 is a
valid MSI-X vector so queue 0 was misclassified as legacy/MSI.

Test sc->intr_type == IFLIB_INTR_MSIX instead.  While here, index the tx
EITR read by tque->msix rather than tque->me so it matches the register
em_newitr() actually writes; the two differ once tx_num_queues exceeds
rx_num_queues.

Also seed que->itr_setting in em_initialize_receive_unit() with the rate
the hardware was just programmed with.  Otherwise an itr_setting left
over from AIM across an interface re-init makes the change detection in
em_newitr() suppress the write that would restore it, leaving the
hardware at the default rate while software believes otherwise.

Fixes:          https://cgit.freebsd.org/src/commit/?id=3e501ef89667 ("e1000: Re-add AIM")
MFC after:      3 days
941113a0097ea047bd493f7f78b384718249779d Kevin Bowling 2026-07-25 10:43:28

e1000: fix rx accounting for multi-descriptor packets

The receive paths accumulate ri->iri_len across the descriptors making
up a packet, then add that running total to rxr->rx_bytes on every
iteration of the loop.  A packet spanning descriptors of length l1, l2
and l3 thus contributes 3*l1 + 2*l2 + l3 instead of l1 + l2 + l3.

Single descriptor packets, the common case, are accounted correctly,
so this only shows up on jumbo frames.

Add the per descriptor length instead.  iflib memsets the if_rxd_info
before each isc_rxd_pkt_get() call, so summing len gives the same total
as the final iri_len, and the frame error path that returns without
incrementing rx_packets keeps counting bytes exactly as before.

MFC after:      1 week
41a46c2d46aa4078c597ce3a0d19323cab988277 Kevin Bowling 2026-07-25 11:02:36

e1000: make AIM counter sampling coherent

Sample free-running counters by delta instead of clearing them from the
interrupt filter, which can race their producers.  Publish byte and
packet counts together at the TX and RX doorbells so each sample is
coherent.

Aggregate every TX ring assigned to the interrupt vector so unequal RX
and TX queue counts are safe.  Count RX bytes only after a frame is
accepted.

MFC after:      1 week
bc5e7b0cbbb555ffebc7d73b273c421f9ee24c23 Kevin Bowling 2026-07-25 23:48:15

e1000: synchronize interrupt moderation state

Keep the saved EITR and PBA values synchronized with hardware across
reinitialization.  Correct EITR encoding, decoding, and MSI-X register
selection, and reject nonpositive fallback rates.

Treat only sub-gigabit links as sub-gigabit and apply the packet-buffer
fallback without permanently disabling AIM.

MFC after:      1 week
6ef368a29b11ebc769e7929566809b75ae2c1e90 Kevin Bowling 2026-07-25 23:49:03

e1000: restore packet-size AIM

Restore the packet-size calculation introduced in a69ed8dfb381 and used
by igb(4) until the iflib conversion in f2d6ace4a684.  It derives
interrupt holdoff from average packet size, so RSS queue count does not
change its behavior.

The calculation follows the pre-iflib code.  Retain the current normal
and low-latency rate caps, and keep the current setting when an interval
has no usable sample.

Fixes:          https://cgit.freebsd.org/src/commit/?id=3e501ef89667 ("e1000: Re-add AIM")
MFC after:      1 week
dc4a5087b160c1a94d135ab636642defe2c71c20 Kevin Bowling 2026-07-25 23:49:31

e1000: count TSO wire segments in the AIM counters

The transmit paths billed one packet of ipi_len bytes per request.  For
TSO that is the whole unsegmented payload, up to 64KB, so the average
size the moderation calculation sees is not a size that appears on the
wire.

Count the segments the hardware will put on the wire and the header each
of them carries.

Non-TSO accounting is unchanged.

MFC after:      1 week
072e0983d7bce80356740324973993393e77023a Kevin Bowling 2026-07-25 12:33:38
Commit group #6: igc
igc: fix RX accounting for multi-descriptor packets

The receive path adds the running packet length to rx_bytes for every
descriptor.  A packet spanning descriptors of length l1, l2, and l3 is
therefore counted as 3*l1 + 2*l2 + l3.

Add each descriptor length once.  Single-descriptor accounting remains
unchanged.

MFC after:      1 week
bbf0372feeb321a5bfeff7b1e79576ab01240441 Kevin Bowling 2026-07-25 23:56:29

igc: make AIM counter sampling coherent

Sample free-running counters by delta instead of clearing them from the
interrupt filter, which can race their producers.  Publish byte and
packet counts together at the TX and RX doorbells so each sample is
coherent.

Aggregate every TX ring assigned to the interrupt vector so unequal RX
and TX queue counts are safe.  Count RX bytes only after a frame is
accepted.

MFC after:      1 week
2290ea7f4311e899019fe77bf7c7775033af6b24 Kevin Bowling 2026-07-25 23:57:42

igc: synchronize interrupt moderation state

Keep the saved EITR value synchronized with hardware across
reinitialization.  Correct EITR encoding, decoding, and MSI-X register
selection, and reject nonpositive fallback rates.

Apply the packet-buffer fallback without permanently disabling AIM.

MFC after:      1 week
e35533457530bb9db655e6137c2eea790e18b97b Kevin Bowling 2026-07-25 23:58:58

igc: use packet-size AIM

Use the packet-size calculation introduced for igb(4) in a69ed8dfb381
and retained there until the iflib conversion in f2d6ace4a684.  It
derives interrupt holdoff from average packet size, so RSS queue count
does not change its behavior.

The calculation follows the pre-iflib igb code.  Retain igc's normal and
low-latency rate caps, and keep the current setting when an interval has
no usable sample.

MFC after:      1 week
01e7acd38d411c78caba1c4078bb3683f586e1c2 Kevin Bowling 2026-07-26 00:00:22

igc: count TSO wire segments in the AIM counters

The transmit path bills one packet of ipi_len bytes per request.  For
TSO that is the whole unsegmented payload, up to 64 KiB, rather than a
packet size that appears on the wire.

Count the segments the hardware emits and the header carried by each
segment.  Non-TSO accounting is unchanged.

MFC after:      1 week
e389a05164ccb1dd41ee8d7f09203b475322dd72 Kevin Bowling 2026-07-26 00:01:06
sound: Stop using legacy u_int types
No functional change intended.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
95439b803fce86958e1db1927a8405bf939edda4 Christos Margiolis 2026-07-23 21:05:42

Networking

Network-related commands, library, and kernel.

net/if.c: Add fib-aware ifa_ifwithaddr()
Add FIB selection logic by introducing ifa_ifwithaddr_fib() to
support FIB-specific lookups. Then have ifa_ifwithaddr() wrap it
with RT_ALL_FIBS.
Also, do the same for ifa_ifwithaddr_check().

Reviewed by:    glebius, bnovkov
Differential Revision: https://reviews.freebsd.org/D58305
b00d30950cde27eda8f51523a40f2c05a38daac1 Pouria Mousavizadeh Tehrani 2026-07-17 16:11:42
if_geneve: Fix mbuf leak on ip_ecn_egress
Free mbuf and increase IFCOUNTER_IERRORS if ip_ecn_egress() under
geneve_input_inherit() decides to drop the packet.

Reported by: Chris Jarrett-Davies of the OpenAI Codex Security Team
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D58361
e4a457d1357621265265089a5ece71c368dd2e99 Pouria Mousavizadeh Tehrani 2026-07-20 20:33:55
tcp_hostcache: explicitly typecast atomic_load_int to (int) for comparison
Sponsored by:   NetApp, Inc.
MFC after:      1 week
Reviewed By:    tuexen, #transport, markj
Differential Revision: https://reviews.freebsd.org/D58360
f22b08443f6ae3620dd14ade4e2376b8531fd6f3 Richard Scheffenegger 2026-07-21 14:51:02
bind(2): Lookup local address in current FIB if '*.bind_all_fibs' is active
When a protocol-specific 'bind_all_fibs' tunable is set to 0, a
listening socket will only receive traffic originating from the FIB
it was bound to. However, there are no checks to determine whether
an address exists in the target FIB when binding the socket, which can
lead to a situation where a socket and the address it was bound to
belong to different FIBs.

Prevent this footgun by looking up the requested address in the current
FIB if 'bind_all_fibs' is active and returning an error if the address
does not exist.

Sponsored by:   Stormshield
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D58281
Reviewed by:    glebius, pouria, markj
MFC after:      2 weeks
948ad32ae1e0811f45e1d38f26636fefed5051f0 Bojan Novković 2026-07-15 13:47:01
if_geneve: Ensure there is no mbuf leak if EAFNOSUPPORT
In practice, this is not possible, but we are adding it just to be safe.

Reported by:    markj
91f84e661c2377d2265a04c05aabdf51a98cd5c0 Pouria Mousavizadeh Tehrani 2026-07-22 17:00:17
pf: include direction in fragment key
pf(4) currently ignores fragment direction (in vs. out)
in pf_frnode_compare() function.

Issue noticed and reported by Frank Denis

OK @bluhm

Obtained from:  OpenBSD, sashan <sashan@openbsd.org>, eaa2c80721
Sponsored by:   Rubicon Communications, LLC ("Netgate")
850041b025486614243fb2d481b3adb0382b02e7 Kristof Provost 2026-07-22 15:13:51
pf(4) fix NULL pointer dereference in outbound packet path.
Outbound packet which matches rule with source limiter attached,
for example:

    source limiter "crash" id 1 entries 10000 limit 1000
    pass out from any to any source limiter "crash" keep state

triggers a NULL pointer dereference.

The issue was kindly reported and initial version of fix
submitted by SecBuddyF, Tencent KeenLab.

The submitted diff fixed the issue for failing look up by destination
address in outbound packet. dlg@ also pointed out the change should
be further improved so NULL pointer dereference is avoided when rule
uses nat-to/rdr-to option.

OK dlg@

Obtained from:  OpenBSD, sashan <sashan@openbsd.org>, f0f215c11e
Sponsored by:   Rubicon Communications, LLC ("Netgate")
145541d4ed7923dc87e7e1a2e6864d123f81f4d2 Kristof Provost 2026-07-23 09:06:01
tcp: make ghost ACK handling more conformant
The latest version of draft-ietf-tcpm-tcp-ghost-acks changed
a condition. This should make no substantial difference, but makei
it compliant to the latest version of the specification.

Reviewed by:            rscheff, Peter Lei
MFC after:              3 days
Sponsored by:           Netflix, Inc.
Differential Revision:  https://reviews.freebsd.org/D58411
fa2ad70a4511e7b379e81de82c9e51b2e0994295 Michael Tuexen 2026-07-23 16:03:39
icmp: Verify redirect gateway with fib-aware ifa selection
During call to `icmp_verify_redirect_gateway()` ensure using
fib-aware source address selection function.

Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D58409
daf57eb115053613d01e338b9022db16c045f033 Pouria Mousavizadeh Tehrani 2026-07-23 09:10:32
netinet6/nd6: Sprinkle missing prefix refcounting
When we drop the prefix lock to call nd6_prefix_offlink() or
nd6_prefix_onlink(), make sure to keep the correpsonding prefix
structure alive.  It is possible for a concurrent nd6_timer() to expire
the prefix while the lock is dropped.

Reported by:    Maik Muench of Secfault Security
Reviewed by:    pouria, zlei
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58423
76ca489e0f147e9bd90408ea562087e84ed6f479 Mark Johnston 2026-07-24 20:05:06

System administration

Stuff in man section 8 (other than networking).

Commit group #7: hwpmc: add regression tests for counting-PMC counter wraparound
hwpmc: add regression tests for counting-PMC counter wraparound

Exercise a process-mode counting PMC whose accumulated count crosses,
or already exceeds, the range of the underlying hardware counter.
Before the previous commit, the first context switch after the
hardware counter wrapped panicked INVARIANTS kernels with "negative
increment" and silently corrupted the accumulated count on other
kernels.

The tests need a hardware counting event backed by a counter narrower
than 64 bits and skip where none is available (hwpmc(4) not loaded,
or a VM without a vPMU).

Reviewed by:            adrian
MFC after:              2 weeks
Assisted-by:            Claude Code (Fable 5)
Differential Revision:  https://reviews.freebsd.org/D58341
2cfd82f747c04f68f679824ba627460e87ab3848 Alexander Leidinger 2026-07-19 08:08:48

tests/sys/pmc: only build if MK_PMC != no

This unbreaks the build when pmc support is explicitly disabled via the
aforementioned build knob.

MFC after:      10 days
Fixes:          https://cgit.freebsd.org/src/commit/?id=2cfd82f74 ("hwpmc: add regression tests for ...")
Differential Revision:  https://reviews.freebsd.org/D58401
a18e773d2776a65c1a2a0418cbec9cf5ef526b53 Enji Cooper 2026-07-22 19:53:31
vidcontrol: Disallow -i mode with vt(4)
vt(4) does not (currently) support changing the video mode.  Report that
-i mode is not supported rather than printing an empty list.

PR:             https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=207411
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58163
c3e38c0093f2dbfafdfcc585a2f06b0313e7f6b1 Ed Maste 2026-03-10 21:13:31
bhyve: check upper bounds for value from qsz
The max_qentries in pci_nvme_softc is uint16_t and
too large int may get truncated to invalid value.
While there, use local declarations for val.

Suggested by: Bill Sommerfeld
Reviewed by:    chuck
Differential Revision:  https://reviews.freebsd.org/D58293
a0486017c2a453ce5e8b6e678a14e7d5577c1300 Toomas Soome 2026-07-21 06:33:38
loader: Allocate trampoline as EfiLoaderCode, not Data
Firmware on a test machine applied NX to non-code allocations, which
resulted in a fault when jumping to the trampoline.

Reviewed by:    kib
Tested by:      Jim Huang Chen <jim.chen.1827@gmail.com>
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58383
2b1df6149e8a2d50a09d13c64d1574dad91e10b1 Ed Maste 2026-07-21 19:19:40
loader: Fix error handling after an allocation failure
MFC after:    1 week
5001af647b3b263aeb3d4fa7a6c2690399265202 Mark Johnston 2026-07-22 00:17:56
Fix namespace listing for old NVMe devices
Commit 9e1db51d4b5fc made nvmecontrol devlist get list of active
namespaces from the device instead of iterating through all possible
IDs.  The problem is that this request is not supported before NVMe
1.1, and in particular by Intel Optane 905P drives.  This change
reintroduces iteration for devices before NVMe 1.2.

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D58010
86182d89020159697391375cf475893d4cd859c0 Alexander Motin 2026-07-23 20:57:07

Libraries

libutil: Reimplement getlocalbase()
* Get rid of the pointless LOCALBASE_CTL_LEN mechanism

* Apply minimal normalization to the paths obtained from the environment
  or sysctl variable

* Turn the manual page into a manual page

* Add tests

MFC after:      1 week
Reviewed by:    se
Differential Revision:  https://reviews.freebsd.org/D58362
c93f3b55e67fe465d93f3f54ae4408f131fec3aa Dag-Erling Smørgrav 2026-07-21 08:31:26
libsysdecode: Recognize NOTE_PDSIGCHLD
MFC after:    1 week
Fixes:          https://cgit.freebsd.org/src/commit/?id=2a5e58c59694 ("procdesc: add NOTE_PDSIGCHLD")
Reviewed by:    kib
Differential Revision:  https://reviews.freebsd.org/D58388
a931431a1deca75079f034b74a63c2774f83be8d Dag-Erling Smørgrav 2026-07-21 21:56:56
libsysdecode: add Netlink attribute decoding infrastructure
Introduce a generic Netlink attribute decoding framework based on
attribute decoder tables. The framework supports decoding primitive
attribute types as well as nested attributes and can be reused by
different Generic Netlink families.

Signed-off-by:  Ishan Agrawal <iagrawal9990@gmail.com>
Sponsored-by:   Google LLC (GSoC 2026)
Reviewed-by:    kp
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2337
26bb78b77231c4b2d80f7d89f39e9e06294151d2 Ishan Agrawal 2026-07-22 15:31:23
libusb: Add LIBUSB_DT_SUPERSPEED_HUB
Sponsored by:   The FreeBSD Foundation
340c6aff67367aaee190e48dc8834a8881a84127 ShengYi Hung 2026-07-25 15:38:42
libusb: Sync interface for libusb_init_option
Sponsored by:   The FreeBSD Foundation
5f346dba4f7b6ca088f2a3f40c5b562ef531adda ShengYi Hung 2026-07-25 15:57:31

Filesystems

tarfs: remove unused 'ino' in mount structure.
Differential Revision:        https://reviews.freebsd.org/D57898
54e6dec44b6dd264b19e50439a58b33cab4c10c3 Philippe Michaud-Boudreault 2026-07-22 08:39:30
cuse: Fix server reference leak in cuse_client_open()
If the server is closing (or the device node is going away), or if
devfs_set_cdevpriv() fails, cuse_client_open() returns with the server
reference taken at the top of the function still held and the newly
allocated client still linked on pcs->hcli.  Since cuse_client_free()
has not been registered as the cdevpriv destructor at that point,
nothing ever undoes this work: every open() that races the is_closing
window permanently leaks one server reference and one cuse_client.

A leaked reference is fatal on server exit: cuse_server_free()
busy-waits in an uninterruptible pause("W", hz) loop until pcs->refs
drops to 1, which now never happens, so the exiting server process
(e.g. virtual_oss(8)) is left wedged in state "D", immune to SIGKILL,
cuse.ko is pinned (kldunload hangs too), and only a reboot recovers.

Before 634e578ac7b0 the is_closing error path dropped the reference by
calling devfs_clear_cdevpriv(), which ran the cuse_client_free()
destructor.  That commit moved devfs_set_cdevpriv() after the
is_closing check to fix the panic paths, but left both error returns
without any cleanup.

Fix by calling cuse_client_free() directly on both error paths.  The
client is fully constructed and linked on pcs->hcli at these points,
which is exactly the state cuse_client_free() expects.

PR:             https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296291
Fixes:          https://cgit.freebsd.org/src/commit/?id=634e578ac7b0 ("cuse: Fix cdevpriv bugs in cuse_client_open()")
Assisted-By:    Claude Opus 4.8 (claude-opus-4-8)
Signed-off-by:  giacomo <delleceste@gmail.com>
MFC after:      2 weeks
Reviewed by:    christos
Pull-Request:   https://github.com/freebsd/freebsd-src/pull/2324
d83e42234f76504a1ff7f4309ad629b6644bfb16 giacomo 2026-07-15 12:10:54

Kernel

Kernel stuff (other than networking, filesystems, and drivers).

Commit group #8: procdesc: report NOTE_PDSIGCHLD for traced and stopped process
procdesc: report NOTE_PDSIGCHLD for traced and stopped process

on attach of the knote.  It is same as for NOTE_EXIT when attaching to
the exiting process.

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58327
b328975b9d7c475cd99107ca407df04366cc38af Konstantin Belousov 2026-07-18 17:31:31

kqueue: Fix delivery of unwanted events

In both procdesc_kqops_event() and filt_proc(), the event variable can
have more than one bit set.  This means that:

* We cannot compare it directly with NOTE_EXIT; we must binary-and them
  instead.

* We cannot binary-or it with the report mask; we must binary-and it
  with the request mask first.

MFC after:      1 week
Fixes:          https://cgit.freebsd.org/src/commit/?id=2a5e58c59694 ("procdesc: add NOTE_PDSIGCHLD")
Fixes:          https://cgit.freebsd.org/src/commit/?id=b328975b9d7c ("procdesc: report NOTE_PDSIGCHLD for traced and stopped process")
Reviewed by:    kib, markj
Differential Revision:  https://reviews.freebsd.org/D58395
4627fe9e5afc0dce4469f5964f5d4b0e49a24274 Dag-Erling Smørgrav 2026-07-23 06:06:32
sched_ule: Fix selecting lowest priority thread early in corner case
When transferring a thread with near 100% CPU statistics (but not 100%;
up to 57.5/59≈97.46%) to a CPU where the enqueue offset is ahead of at
least 2 from the dequeue one, which requires peculiar conditions to
happen (transfer triggered by a bind request or cpuset change, or during
balancing if a thread or more existed from a brief amount of time on the
origin CPU), the transferred thread can get placed after the dequeue
offset, effectively making it appear as a high priority one unduly,
causing latency increase for other threads.

The change here was missed when changing the enqueue and dequeue offsets
update mechanism to recover pre-256-queue-runqueue ULE anti-starvation
and fairness behavior.  That change opened up the possibility that these
two offsets are apart by more than one.

Reviewed by:    markj
Discussed with: Minsoo Choo <minsoo@minsoo.io>
Fixes:          https://cgit.freebsd.org/src/commit/?id=6792f3411f6d ("sched_ule: Recover previous nice and anti-starvation behaviors")
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57829
a6587ae0f46dba4e47fa92c831f55288ec181734 Olivier Certner 2026-06-16 21:06:36
nda: Tag the command set used for devctl errors
Different command sets have different encoding for op codes, etc. While
one can normally puzzle out which is which, it's better to explicitly
tag the command set used.

Sponsored by:           Netflix
6671bbf2f9bb130129a4896bca7edb9e0a638e9f Warner Losh 2026-07-20 12:36:43
Commit group #9: ptrace(2): add PT_GET_CHILDREN
ptrace(2): add PT_GET_CHILDREN

Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58315
d3b7bbee9275d5a3c58a9e75d1fffc60a9333352 Konstantin Belousov 2026-07-17 14:57:04

kern/sys_ptrace: do not skip P2_PTRACEREQ wait for PT_CLEARSTEP/PT_GET_CHILDREN

Reported and reviewed by:       markj
Fixes:  https://cgit.freebsd.org/src/commit/?id=d3b7bbee9275 ("ptrace(2): add PT_GET_CHILDREN")
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58364
eca7b25c101a240472c4c274e725bc294284c827 Konstantin Belousov 2026-07-20 22:09:59
Commit group #10: amd64: FRED support
amd64: FRED support

FRED support as defined starting from the SDM rev. 90, requires a new
'events' entry point to receive user and kernel mode exceptions and
interrupts notifications from the hardware.  A minimal asm trampoline is
enough, rest can be implemented in C due to the clean FRED organization
of the event reporting.

The syscall entry is handled by a microptimized assembly path, directly
calling into the amd64_syscall() handler, instead of the generic events
entry point.

Tested by:      emaste
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D55829
6e93f5e4d6932c423b89dff8fc08d86f8bdeb7b9 Konstantin Belousov 2026-02-13 11:24:40

amd64: Fix an off-by-one in the fred_ipi_handlers definition

Fixes:          https://cgit.freebsd.org/src/commit/?id=6e93f5e4d693 ("amd64: FRED support")
Reviewed by:    kib
Differential Revision:  https://reviews.freebsd.org/D58378
55c240eada966b4595cbf93bf0641073713c5b99 Mark Johnston 2026-07-21 15:29:33

amd64: Remove a prototype for an unimplemented function

Fixes:          https://cgit.freebsd.org/src/commit/?id=6e93f5e4d693 ("amd64: FRED support")
Reviewed by:    kib
Differential Revision:  https://reviews.freebsd.org/D58379
f42c68291d6803abc404fa8d6915a9f5de3a3448 Mark Johnston 2026-07-21 15:30:56
lookup: do not return vp_crossmp as dvp for mount over the reg file
Return the covered vnode instead.

Tested by:      pho
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D58191
29d1a3248a6da1ed9f1a46d7d525fb779306a90f Konstantin Belousov 2026-07-12 11:56:13
sched_4bsd: Fix conflating priority of differently-niced CPU-bound threads
We introduced (PRI_MAX_TIMESHARE - PRI_MIN_TIMESHARE) as part of
ESTCPULIM() in commit eebc148f25c3 ("sched_4bsd: ESTCPULIM(): Allow any
value in the timeshare range") in order to use more than a fixed number
(40) of all the available priority levels in the timeshare range (136
before the 256-queue runqueue work, 224 now) to take into account the
number of ticks a thread has run ('ts_estcpu').

In the computation of a new thread's priority (resetpriority()), in
addition to the "ticks running" contribution, the final priority also
includes a "nice" value contribution.  The final value is clamped into
the [PRI_MIN_TIMESHARE; PRI_MAX_TRIMESHARE] range.

Problem is that the new "ticks running" contribution now can lead to
a computed priority value that exceeds PRI_MAX_TRIMESHARE, and is thus
finally clamped to PRI_MAX_TIMESHARE, which becomes an alias for all
out-of-bound values.  In particular, this can conflate CPU-hungry
threads.  With at least two of them competing on the same CPU, with an
increase of 'ts_estcpu' of ~64 per second (stathz being 127) and the
minimal decay of 4/5 (load average 2 or more), both threads will easily
reach the current clamping of 224 (+ PRI_MIN_TIMESHARE), and be
considered indifferently by the scheduler.

Fix this problem by ensuring that the maximum contribution of
'ts_estcpu' (via ESTCPULIM()) cannot exceed the timeshare range of
priorities when the nice contribution is added to it, so the nice
contribution continues to have an effect on CPU-bound threads.

Introduction of the nice term in ESTCPULIM() (then NICE_WEIGHT *
PRIO_MAX) has been done in commit bdf423572ee3 ("Scheduler fixes
equivalent to the ones logged in the following NetBSD commit...") and
does not appear to have made any real sense even then.

Fixes:          https://cgit.freebsd.org/src/commit/?id=bdf423572ee3 ("Scheduler fixes equivalent to the ones logged in the following NetBSD commit...")
Fixes:          https://cgit.freebsd.org/src/commit/?id=eebc148f25c3 ("sched_4bsd: ESTCPULIM(): Allow any value in the timeshare range")
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57826
e8dec0038bd95f6d940afa19b4d101f466280fd6 Olivier Certner 2026-06-13 13:09:42
sched_4bsd: Remove obsolete SMP scaling for ticks per priority level
The INVERSE_ESTCPU_WEIGHT scaling had been introduced by commit
b698380f33ef ("Quick fix for scaling of statclock ticks in the SMP
case. ...") to leave more discrimination room for multiple CPUs possibly
adding their ticks to the same 'struct ksegrp' (but also slightly
changing how CPU hogs are penalized).

Then, commit 8460a577a4b4 ("Make KSE a kernel option, ...") introduced
the current thread-based code, where tick accounting is only done on the
current thread, which renders this trick obsolete on !KSE.

Finally, when KSE was removed, the trick became generally obsolete.

The trick is actually even harmful because it changes the intended
behavior of priorizing more the CPUs that use the less ticks (and so,
impairs boosting "interactive" processes).

Remove it now.  Clamping of 'ts_estcpu' and its relation to the
load-average-based decay may be re-examined later.

Fixes:          https://cgit.freebsd.org/src/commit/?id=8460a577a4b4 ("Make KSE a kernel option, ...")
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57827
5217b4a728dc9fd72bc844c2a6bb30a2a28119c4 Olivier Certner 2026-06-13 14:19:18
sched_4bsd: Rename the global runqueue
In an upcoming change whose purpose is to stop having 4BSD always
allocate MAXCPU runqueues, wasting space on most machines, 'struct
td_sched' will store the CPU ID to which a thread is bound/pinned
instead of a pointer to the corresponding runqueue.  As a consequence,
existing functions manipulating a thread's runqueue will need to point
to the inferred runqueue through a local variable.  The name 'runq' is
the ideal one for these local variables, but before this change it
designated the global runqueue, also causing unnecessary ambiguity.

Thus, rename the global runqueue to the more explicit 'runq_global'.
Arguably, this should have been performed as part of commit e17c57b14ba9
("- Implement cpu pinning and binding. (...)").

No functional change (intended).

[olce: Massaged the commit message.  Tested with source builds.]

Suggested by:   olce
Reviewed by:    olce
Tested by:      olce
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D58065
26ef6665344823f405c7fafba5baaacd9baacf72 Minsoo Choo 2026-07-20 02:34:13
sched_4bsd: Allocate runqueues only for present CPUs
4BSD has been allocating an array of MAXCPU runqueues, runq_pcpu[],
instead of one runqueue per actually present CPU.  On amd64, MAXCPU is
1024 and 'struct runq' is 4128 bytes, causing runq_pcpu[] to take more
than 4 MiB of memory.  On the vast majority of current systems, which
have at most 32 cores with SMT, this is a waste of memory.

Besides providing per-CPU runqueues, runq_pcpu[] has also been used to
determine the CPU ID of a given thread's associated runqueue through
pointer arithmetic.

Since per-CPU structures are only allocated for present CPUs, in order
to save space, move the runqueues to per-CPU fields and, for each thread
('struct ts_sched'), replace its runqueue pointer by the CPU ID of the
runqueue it is in (new 'ts_rqcpu' field).  Set the thread's CPU ID to
the special NOCPU value when it is running on the global runqueue.

Drop the SKE_RUNQ_PCPU() macro as it is now simply equivalent to
'ts_rqcpu != NOCPU'.  Introduce the TS_RUNQ_PTR() macro to get a pointer
to the thread's runqueue, which must be passed to runq_add() and
runq_remove().

[olce: Massaged the commit message.  Fixed an inverted KASSERT().
Tested with source builds.]

Reviewed by:    olce
Tested by:      olce
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D58000
deddfa3db956ebed584a859010a10b6d9a4e2e5d Minsoo Choo 2026-07-20 02:37:56
LinuxKPI: 802.11: always lock around (*set_{frag,rts}_threshold)
We would lock the downcalls during normal operation but not during
vap (vif) creation as there was no need for locking.
Add the missing locking there as drivers seem to always expect it
(by assertion) and cannot distinguish between state.
Add the assertions to the downcalls as we need both of them locked
and both of them can sleep.

PR:             https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296185 ("rtwhttps://bugs.freebsd.org/bugzilla/show_bug.cgi?id=89(https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=4) freezes the system with INVARIANTS kernel")
Debugged by:    Artem Bunichev (temcbun gmail.com)
Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
5d479b75a8944faeabb367d1234a9fc3fefa8df1 Bjoern A. Zeeb 2026-07-21 19:54:04
exterror: advertise error strings via kern.features.exterr_strings
Allow userland, in particular test cases for EXTERROR conversions,
to detect at run time whether extended errors include the
descriptive message strings, which depends on the EXTERR_STRINGS
kernel option and cannot be probed in any other way.

Reviewed by:            kib
MFC after:              1 week
Assisted-by:            Claude Code (Fable 5)
Differential Revision:  https://reviews.freebsd.org/D58321
c8db6d4b63f18c81557628ad0d3f715bea46cc99 Alexander Leidinger 2026-07-21 20:39:56
exec: Avoid overflow when computing the size of the exec map
On a test system with 1024 cores the size of exec map exceeds 4GB, and
all of the operands in the size calculation are 32-bit integers.

Tested by:      Jim Huang Chen <jim.chen.1827@gmail.com>
MFC after:      1 week
Sponsored by:   AMD (hardware)
2efe148a2a321d4c9ed46bdb166f710b2cb21529 Mark Johnston 2026-07-21 22:30:53
getpgrp(2), getsid(2): allow to call on zombies
Also be more protective in getsid().

Reported by:    arrowd
Reviewed by:    markj
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differrential revision: https://reviews.freebsd.org/D58393
8f320c2bc473a775ea9a55d17fa61f729e593867 Konstantin Belousov 2026-07-22 09:36:17
Commit group #11: LinuxKPI
LinuxKPI: pci: fix dma handle type in match function

dma_addr_t is a vm_paddr_t which is a uint of some width.  Rather than
passing pointers of it around pass the value.

Comparing the addresses of different storage for the same dma handle
(the actual bug here) will not work when passed to the devres match
function.

Sponsored by:   The FreeBSD Foundation
Fixes:          https://cgit.freebsd.org/src/commit/?id=0a575891211ef ("implement dmam_free_coherent()")
MFC after:      3 days
Differential Revision: https://reviews.freebsd.org/D58285
2099bf27126f6fef10128c3cd0ea8476c88b28c5 Bjoern A. Zeeb 2026-05-27 01:26:02

LinuxKPI: sg_page() remove superfluous ()

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    emaste
Differential Revision: https://reviews.freebsd.org/D58295
fe1784004d6e43b3080ab7b7115ee0ea3ba317f2 Bjoern A. Zeeb 2026-07-17 12:26:13

LinuxKPI: move clear_page() within the linux/page.h file

clear_page() would normally live in asm/page.h but adding the file
and fixing the dependencies would be too much for a single line.

Move the function to the end of the file with a clear separator
and make it clear that it does not operate on a 'struct page'
but on a page address by changing the argument name and leaving
a comment.

The function is currently used by at least mthca(4) as the only
in-tree consumer, and drm-kmod ttm_pool.c.

No functional changes.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    emaste
Differential Revision: https://reviews.freebsd.org/D58296
0845efe88b355547b103dca90e69e46a3ebdd016 Bjoern A. Zeeb 2026-07-17 12:53:16

LinuxKPI: prefer struct page [*] over struct vm_page[_t]

LinuxKPI is based on Linux 'struct page' which is currently aliased
to struct vm_page.  Upcoming changes may change that so start using
'struct page *' instead vm_page_t to make future changes transparent.

This is a continuation of 9e9c682ff3a1 and should be a NOP.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    emaste (no objections)
Differential Revision: https://reviews.freebsd.org/D58297
ac4b43b7b9dd2dac5d7caf5d4c7aa0d670d38aec Bjoern A. Zeeb 2026-07-17 12:58:32

LinuxKPI: page.h: use atop() and ptoa() instead of PAGE_SHIFT

With upcoming changes to 'struct page' this will make the lines
easier to read by using the predefined macros from param.h.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    markj, kib
Differential Revision: https://reviews.freebsd.org/D58298
f45506c6a6f4742cd5129d636902b61045c4754b Bjoern A. Zeeb 2026-07-17 13:09:01

LinuxKPI: page.h: resort lines

Two of the "page macros" can be abstracted elsewhere in the upcoming
struct page work, so sort them away from the four which are here to
stay.

No functional change.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Reviewed by:    emaste
Differential Revision: https://reviews.freebsd.org/D58299
0b8d22019dcf708a8d047817963658783cd53c46 Bjoern A. Zeeb 2026-07-17 13:12:56

LinuxKPI: page pool updates and add to the build

Split implementation out from the header files.

This "page pool" is the very minimalistic version we need in order to
support packets on mt76.
We allocate the page pool in order to have the meta data available of
which we only make limited use.
This implementation does no pooling, it does no page fragments for now,
it always hands out a full page and frees it upon return.

It is written in a way that it can be in the tree before the 'struct page'
work it depends on has landed in order to reduce friction for people who
want to try mt7921 (or others later) upfront.  We use the same #ifdef
as in the struct page work for that reason so one knob will turn everything
on or off.

Once the struct page work has landed and settled we can start filling this
with more complexity.

In the unlikely event that in the mean time any other consumer would start
showing up they will have to be aware that the current code as-is
essentially is a NOP without the 'struct page' work.  A WARN_ONCE() will
notify them.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
e591a76621430d6d29f2580e2dec8991e450ed5e Bjoern A. Zeeb 2026-07-18 11:54:42
kthread: Fix a thread leak
Fixes:                https://cgit.freebsd.org/src/commit/?id=963629923308 ("kthread_add(): do not allow to attach the thread to a dead or dying process")
Reviewed by:    kib
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58433
c7917e72fe80e2e168b3812718b5fcd497c0e3b8 Mark Johnston 2026-07-24 20:04:45
procdesc: Disallow pddupfd() of non-passable files
Reported by:  Maik Muench of Secfault Security
Reviewed by:    kib
Fixes:          https://cgit.freebsd.org/src/commit/?id=1ad21a652182 ("kern: add pddupfd(2)")
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58403
91e11c8f2b38eb1d1f3a1d57b27378fb2c6ab3c1 Mark Johnston 2026-07-24 20:05:26
unix: Preserve FD_RESOLVE_BENEATH when passing an fd
The FD_RESOLVE_BENEATH flag is supposed to be sticky.  It's set when you
receive an fd from a different jail and preserved by openat(<dfd>) etc..
However, if you send the fd to yourself, the flag is stripped since
SCM_RIGHTS message don't preserve file descriptor flags.

Fix this by preserving those flags and checking for UF_RESOLVE_BENEATH
in restrict_rights().

Fixes:          https://cgit.freebsd.org/src/commit/?id=350ba9672a7f ("unix: Set O_RESOLVE_BENEATH on fds transferred between jails")
Reviewed by:    kib
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58317
586e2b3d89d6e70ab7e4a88497b5f36d78719423 Mark Johnston 2026-07-24 20:06:05
procdesc: Remove dead code
As far as I can see, it is impossible for procdesc_exit() to observe
pd->pd_fpcount == 0: if procdesc_close() decrements that counter to
zero, then it will clean up the procdesc structure too, and this is
atomic with respect to the proctree lock.

No functional change intended.

Reviewed by:    kib
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58396
9a7bd3309bec08802e8c18c03669812ec3352534 Mark Johnston 2026-07-24 20:06:16
kqueue: Allocate marker knotes on the stack
The scan marker was originally stack-allocated.  In commit
1c0f9af5b5224, it became heap-allocated since the marker is visible to
other threads and a scanning thread's stack may be swapped out.  Now
that kernel stacks can no longer be swapped out, we can avoid these heap
allocations.

Reviewed by:    kib
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58402
bb933b1d1846b3a984670b8cd65450c3333188f6 Mark Johnston 2026-07-24 20:06:40
Commit group #12: uma
uma: Factor out the implementations of uma_zfree_{arg,smr}()

The two function both free an item to a UMA zone, but uma_zfree_arg()
does so in such as way as to ensure that the item will be the first one
returned by a subsequent allocation, while uma_zfree_smr() must defer
reuse of the item and therefore never frees to the per-CPU alloc bucket.

When KASAN is enabled, we actually want uma_zfree_arg() to behave like
uma_zfree_smr(): to improve the reliability of use-after-free detection,
reuse of the newly freed item should be deferred for some time.

Refactor a bit to make it easier to improve KASAN along these lines:
introduce two helper functions, cache_free_item() and cache_free_smr(),
which handle most of the work of interacting with the per-CPU caches.
A subsequent commit will let uma_zfree_arg() use cache_free_smr() when
KASAN is enabled.

No functional change intended.

Reviewed by:    rlibby
MFC after:      1 month
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58268
6337ca19a3637aa72eddf4d62a2eaf7d8df51638 Mark Johnston 2026-07-24 21:11:58

uma: Make an effort to defer reuse of items when KASAN is enabled

When KASAN is configured, make uma_zfree_arg() free items to the per-CPU
free bucket, rather than to the alloc bucket.  This means that the item
won't be recycled immediately the next time a thread goes to allocate an
item from that zone on the same CPU.  In other words, the item will stay
in a quarantine state longer, which helps make KASAN's use-after-free
detection more reliable.

Reviewed by:    rlibby
MFC after:      1 month
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58269
990989c31b4637a23e64598a3d9929079bb9a8de Mark Johnston 2026-07-24 21:12:10

uma: Avoid allocating from free buckets when KASAN is enabled

When uma_zalloc_arg() hits an empty alloc bucket in the per-CPU cache,
it tries swapping the alloc and free buckets in the hope that the free
bucket has some items available.  If not, it has to lock the zone.

Disable this behaviour when KASAN is configured in order to further
defer reuse of freed items.  This forces a free item to go to the
per-domain full bucket cache before it becomes accessible to the
allocator.

Reviewed by:    rlibby
MFC after:      1 month
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58270
666eab3afc52bf20d57c24e98a6aa667433fb7c2 Mark Johnston 2026-07-24 21:12:21

uma: Enqueue full buckets in FIFO order when KASAN is configured

We want to defer reuse of free objects, and this is a trivial way to
promote that.

Suggested by:   rlibby
Reviewed by:    rlibby, alc
MFC after:      1 month
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58312
492cfbe9e2f831fff290e019dae66345146978bd Mark Johnston 2026-07-24 21:12:33
linux_firmware: reformat error print-out
This makes it easier to grep for the error message to better understand
the call stack when loading firmware modules fails.

Fix a cosmetic-only style(9) bug while here in the same function related
to another logging message.

MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D58380
a594783bac906ecc4f6528d7d576215f85a21bda Enji Cooper 2026-07-21 16:08:44
cam/cd: avoid integer divide fault in cdstart()
If something goes very badly (e.g. forcibly removing a medium while
the OS tries to start it), this could end up in params.blksize being 0
(and params.disksize 1).  Avoid an integer divide fault, panicking the
kernel, by bailing out before.

MFC after:      3 days
34ae0f7834d1bd6bb765d1c12e57e01e32b3e060 Joerg Wunsch 2026-07-26 20:54:01

Build system

wpa: Define CONFIG_DEBUG_FILE globally
We defined CONFIG_DEBUG_FILE only in libwpautils, not in wpa_supplicant,
so all it did was enable code that never got called.  Enable it at the
top level so it also applies to wpa_supplicant(8), and the -f option
mentioned in the manual page now actually works.

PR:             https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281617
MFC after:      1 week
Reviewed by:    cy
Differential Revision:  https://reviews.freebsd.org/D57723
67518c9f565b61bc5eebe33b6a956e2cc9b3f223 Dag-Erling Smørgrav 2026-07-21 07:59:43
Only build secure/libexec/ssh-sk-helper if MK_USB == no
The ssh-sk-helper utility only functions if/when MK_USB == yes.
Installing it on systems where MK_USB == no doesn't make sense.

Differential Revision:  https://reviews.freebsd.org/D58246
4db3872aabc33088cf180599c5eaa23b6f58e6d1 Enji Cooper 2026-07-22 19:33:44

Internal organizational stuff

Commit group #13: git-mfc
git-mfc: Slightly relax the regex used to search for reverts

Prompted by commit 9dfaf1cb37f8ac89cf in FreeBSD src.

Reported by:    des
4c1c2b9dab020624a1400644f98af7af4b7af68d Mark Johnston 2026-07-24 21:09:42

git-mfc: Let the upstream for PRERELEASE branches be main

Such branches are in code slush but are the same as stable branches for
the purpose of MFCs.
7392dc9d26830fe9d19e035d2e08f19dcca96591 Mark Johnston 2026-07-24 21:09:48

git-mfc: Improve handling of remotes

If we can't figure out which remote to use, print a useful error instead
of assuming that "freebsd" is the right remote to use.
b86e36493469ded108ad616ebc094886b33851c4 Mark Johnston 2026-07-24 21:10:26

Testing

hwpmc: add regression tests for detaching a live process-mode PMC
Attach a process-mode counting PMC to the current process, start it,
then detach and release it while it is still loaded on the hardware -
the case that previously leaked the PMC's runcount reference and
wedged pmc_wait_for_pmc_idle() at release.  A second case does the same
from a multi-threaded process so the sibling threads' references have
to be drained too.

The tests need an allocatable process-mode counting event and skip
where none is available (hwpmc(4) not loaded, or a VM without a vPMU).

Reviewed by:            adrian
MFC after:              2 weeks
Assisted-by:            Claude Code (Fable 5)
Differential Revision:  https://reviews.freebsd.org/D58343
3c3f886e4bc7619f7847ad0d0f996088ddf5915a Alexander Leidinger 2026-07-19 12:15:20
Commit group #14: stress2
stress2: Updated the exclude file
b11a605ebecc913ce23b90d2a0c619d262368f5b Peter Holm 2026-07-21 07:52:24

stress2: Added a comment
4dc01fe70d9204d1cb635c76d59623c9e7c7776e Peter Holm 2026-07-21 07:52:57

stress2: Added a regression test
ff6574d2508d6bc72247993787963dd84c4ff9dd Peter Holm 2026-07-21 07:53:24
exterror tests: harden the checks
Skip the message-content check on kernels that do not advertise the
exterr_strings feature, and pin the output format by clearing
EXTERROR_VERBOSE.

Reviewed by:            kib
MFC after:              1 week
Assisted-by:            Claude Code (Fable 5)
Differential Revision:  https://reviews.freebsd.org/D58322
1092aba1260ce5efb0d718352aa22158605c7506 Alexander Leidinger 2026-07-21 20:39:57
tests/netpfil: start ipfilter for ipfnat firewall type
This requested fix[0] was not complete before the change
was committed.

Cleans up this error message when running tests[1]:
"Cannot 'start' ipfilter. Set ipfilter_enable to YES in
/etc/rc.conf or use 'onestart' instead of 'start'."

[0] https://reviews.freebsd.org/D21065?id=60288#inline-131488
[1] https://ci.freebsd.org/job/FreeBSD-main-amd64-test/28917/testReport/sys.netpfil.common/rdr/ipfnat_local_redirect/

Fixes:          https://cgit.freebsd.org/src/commit/?id=f97a8a36153a9
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
afbb7dc0a51e4d4c227bdf00770d1ad821cf9889 Siva Mahadevan 2026-06-30 16:40:00
tests/exterr_test: use ATF_REQUIRE_FEATURE to check exterr_strings
This keeps the skipped test message consistent with others.

Reviewed by:    netchild
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
3e946566c134e039f9c777eaa1232a32e383692c Siva Mahadevan 2026-07-22 01:27:11
pwait: Don't use init as a target
The time_unit test case uses PID 1 as a target for pwait.  This doesn't
work in a jail.  Since all we need is a process that we know won't die
while the test is running, we may as well use ourselves.

MFC after:      1 week
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
Reviewed by:    ngie
Differential Revision:  https://reviews.freebsd.org/D58418
5922e9d7e72bfa8a85b0f37bcfd1a8b5d866ec3b Dag-Erling Smørgrav 2026-07-25 12:44:35
libc: tests: add static to resolve -Wmissing-prototypes
The function create_staticobj() is only used inside this translation unit.
Clang produces a -Wmissing-prototypes warning during standard buildworld.
This warning will become a fatal compile error if MK_WERROR is enabled for hardened builds.

PR: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285870
Fixes: https://cgit.freebsd.org/src/commit/?id=ee9ce1078 ("libc: tests: add some tests for __cxa_atexit...")
Signed-off-by: Zhang Qiyue <peter-open-source.probing805@aleeas.com>
Reviewed-by: ngie
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2321
64038db825d64fb4827fc8ee264ea0fa1a046d82 Zhang Qiyue 2026-07-12 06:26:36
[test] libatexit: leverage __{BEGIN,END}_DECLS
This change converts the longhand form of `extern "C" {` and its
corresponding `}` into `__BEGIN_DECLS` and `__END_DECLS`, respectively.

The new form is much easier to grep for and is a best practice to use in
the FreeBSD tree.

This is meant to be a non-functional change.

MFC after:      1 week
bc81728c00b200297ac556974b5373c804077a17 Enji Cooper 2026-07-25 16:51:53

Style, typos, and comments

These could go in other categories, but it's more clear if they're here instead.

authpf(8) read_config() should chop off trailing white space
if administrator mistakenly types into configuration file

anchor=authpf_test

where 'authpf_test' is followed by white space, the authpf(8)
is going to use anchor 'authpf_test ' instead of the 'authpf_test'
which is defined in pf.conf(5) as 'anchor authpf_test/*'

issue kindly reported and patch submitted by

Avinash Duduskar <avinash.duduskar (_at_) gmail (_dot_) com>

OK sashan@

PR:             https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=296958
MFC after:      1 week
Obtained from:  OpenBSD, sashan <sashan@openbsd.org>, 2d12a8e44d
Sponsored by:   Rubicon Communications, LLC ("Netgate")
04f25ef716f74d6bb7941750091c6cb4b51d0b4d Kristof Provost 2026-07-21 13:10:16

Contrib code

contrib/libucl: Import libucl 0.9.4
Differential Revision: https://reviews.freebsd.org/D58333
Approved by: ivy
MFC after:  3 days

Changelog: https://github.com/vstakhov/libucl/releases/tag/0.9.4
6433ec43c802d56ef615b44c435f8dd229d55695 Muhammad Moinur Rahman 2026-07-22 01:49:53
kyua-debug: Add -P option
Add -P as shorthand for --pause-before-cleanup.

MFC after:      1 week
Reviewed by:    ngie
Differential Revision:  https://reviews.freebsd.org/D56613
7c51da13ae55dc98e9cc1b794e1fe6fc001d7f42 Dag-Erling Smørgrav 2026-07-22 08:37:56
unbound: Update to 1.25.2
Release notes at
        https://community.nlnetlabs.nl/t/unbound-1-25-2-released

Merge commit 'c68e7bcd81d62e9f5364c6da22fd9917976acf85'

Security:       CVE-2026-14586
Security:       CVE-2026-32665
Security:       CVE-2026-40691
Security:       CVE-2026-41637
Security:       CVE-2026-42955
Security:       CVE-2026-44621
Security:       CVE-2026-44687
Security:       CVE-2026-44690
Security:       CVE-2026-46582
Security:       CVE-2026-50045
Security:       CVE-2026-50046
Security:       CVE-2026-50243
Security:       CVE-2026-50248
Security:       CVE-2026-50251
Security:       CVE-2026-50252
Security:       CVE-2026-52863
Security:       CVE-2026-54478
Security:       CVE-2026-55708
Security:       CVE-2026-55717
Security:       CVE-2026-55973
Security:       CVE-2026-55990
Security:       CVE-2026-55991
Security:       CVE-2026-56416
Security:       CVE-2026-56444
e27b1cae848219d07f0a12a48990af0558b4cced Dag-Erling Smørgrav 2026-07-22 12:23:53

Reverted commits

-- no commits in this category this week --

Unclassified commits

Not classified automatically, and waiting for manual attention.

-- no commits in this category this week --

Technical notes

Dates:

Automatic grouping:

Automatic categories:

Source code:


Generated with commits-periodical 0.20 at 2026-08-04 17:42:40+00:00.

This work is supported by Tarsnap Backup Inc.

Alternate version: 2026-07-20 (debug) (contains info about the classification)