FreeBSD git weekly: 2026-11-30 to 2026-12-06

Introduction

This is a display of mostly-automatically-classified git commits from 2026-11-30 to 2026-12-06.

This report is still in progress.

DEBUG: This version of the report is primarily for checking the classifiers, and therefore contains extra information (in this colour).

Table of contents and commits per category:

(0) Highlighted commits (these are copies, not in stats)
1 2.4% Userland programs
1 2.4% Documentation
12 29.3% Hardware support
3 7.3% Networking
1 2.4% System administration
0 0.0% Libraries
1 2.4% Filesystems
15 36.6% Kernel
0 0.0% Build system
0 0.0% Internal organizational stuff
7 17.1% Testing
0 0.0% Style, typos, and comments
0 0.0% Contrib code
0 0.0% Reverted commits
0 0.0% Unclassified commits
41 100% total
Technical notes about this page

debug: info about the automatic classification

num % num changed stage
1 2.4% 0 02-filenames_wildcards
7 17.1% 0 02b-filenames_wildcards2
16 39.0% 0 03-filenames_plain1
17 41.5% 0 04-filenames_plain2
0 0.0% 0 Manually-classified commits
0 0.0% 0 Unclassified commits

debug: more stats

num % stage
0 0.0% Misclassified commits
41 100.0% Classified commits, no corrections

debug: groups

0 0.0% num in revert
0 0.0% num in fixes
5 12.2% num in consecutive
5 12.2% Commits in groups

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.

-- no commits in this category this week --

Userland programs

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

procfdcat(1): utility to read content of a file opened by process
It reads the content of a regular file opened by another process, or of
its executable, using pddupfd(2) and pread(2).

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61314
ec8ee3f70c2f27287a00b66da0e246f8ebedb3a1 Konstantin Belousov 2026-10-24 05:35:36

debug: classified in 04-filenames_plain2 by 'usr.bin/'

Documentation

Man pages, release notes, etc.

pdfork.2: document PD_DUPFD_ME and PD_DUPFD_EXECUTABLE
Sponsored by: The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61314
1ba902d56e4c06e226e2ba3fec81fd111ddacdc8 Konstantin Belousov 2026-10-23 13:49:06

debug: classified in 02-filenames_wildcards by '.*\.[1-9]'

Hardware support

Hardware drivers and architecture-specific code.

amd64: Avoid redundant CR0 writes on switches to kernel threads
fpu_activate_sw() sets CR0.TS whenever it switches to a kernel thread,
or to a thread inside fpu_kern_enter().  The bit is clear only while a
thread owns the FPU, and at a context switch the only possible owner is
the old thread.  When fpcurthread is NULL the bit is already set and
the write to CR0, which is serializing, changes nothing.  That is the
common case for switches between kernel threads, such as the idle
thread and interrupt threads on a router.

Write CR0 only when fpcurthread was set, as cpu_switch() did before
the eager FPU switch became the default in d1a07e31e5cc, and assert
that TS is set otherwise.

Reviewed by:            kib
MFC after:              1 week
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D62206
8a8a527296ca5a7245b7cb2093e813aeca0e0ef8 R. Christian McDonald 2026-11-30 00:51:15

debug: classified in 03-filenames_plain1 by 'sys/amd64/'

rtwn: fix the build without RTWN_DEBUG
RTWN_DPRINTF() compiles to nothing without RTWN_DEBUG, which leaves four
of the IQK result copies in r92f_iq_calib() set but never read.  Kernels
with "device rtwn" in their config, LINT among them, then fail with
-Werror,-Wunused-but-set-variable.  The module build does not hit this
because its generated opt_rtwn.h always defines RTWN_DEBUG.

Print the result array directly and drop the four locals.

Fixes:          https://cgit.freebsd.org/src/commit/?id=1f0e186e1832 ("rtwn: added support for Realtek RTL8192FU...")
Sponsored by:   Rubicon Communications, LLC ("Netgate")
3343e51ada5b9fddda32aa21b82cae437c67423e R. Christian McDonald 2026-11-30 02:10:25

debug: classified in 03-filenames_plain1 by 'sys/dev/'

cpufreq_dt: Use all the OPPs when the hardware version is unknown
An OPP with opp-supported-hw is only used if the hardware version, given
by the vendor specific code, matches it.  When no vendor class handles
the OPP table, for example the ones of the TI and i.MX SoCs, the version
is unknown, so every OPP that has the property was dropped and the table
ended up empty.  The driver still attached and cpufreq_dt_find_opp()
returned a pointer to an entry that does not exist, using an
uninitialised index.

Use all the OPPs when the hardware version is unknown, as if the
property was not there, which is what the driver did before the
property was honored.  Also make cpufreq_dt_find_opp() return NULL for
an empty table, as its callers already expect.

Fixes:  https://cgit.freebsd.org/src/commit/?id=7178a47a4ffd ("cpufreq_dt: Honor opp-supported-hw and opp-microvolt-<name>")
Reported by:    llm-postcr
c54c8a5b564fab2aa4d8beacca94635d162f9eef Emmanuel Vadot 2026-11-30 07:52:17

debug: classified in 03-filenames_plain1 by 'sys/dev/'

cpufreq_dt: Do not use an uninitialised OPP when restoring the state
cpufreq_dt_set() only looks up the current OPP (copp) when the voltage
cannot be read from the regulator.  When it can, which is the usual
case, copp is never set but the two error paths that restore the
previous state still use it: a failure to set the clock reads the
voltage limits of copp and a failure to lower the voltage reads its
frequency.

Restore the frequency with the one that was read from the clock before
the change, and look up the current OPP when the voltage has to be
restored, skipping it if there is none.

Fixes:  https://cgit.freebsd.org/src/commit/?id=a701764e9c50 ("Improve cpufreq_dt.")
Reported by:    llm-postcr
34b0e01a4e844573cc3b0b1dc2078237d16f7f68 Emmanuel Vadot 2026-11-30 07:52:27

debug: classified in 03-filenames_plain1 by 'sys/dev/'

nvme: do not submit Abort commands with the qpair lock held
The Abort for a timed-out admin command is submitted to the queue
whose lock the watchdog holds. For an I/O command, a failed admin
queue completes the Abort during submission, and nvme_abort_complete()
takes the I/O takes the I/O qpair lock again.
Either way the thread recurses on a non-recursive mutex.

Abort command: NVM Express Base Specification 2.4, section 5.2.1.

Fixes:  https://cgit.freebsd.org/src/commit/?id=2a6b7055a980 ("nvme: Timeout expired transactions")

Reviewed by:    rz_fabmicro.ru, ngie
Differential Revision:  https://reviews.freebsd.org/D61625
cd6143bafbd828ac506ef728fd492f2a12634051 Abdelkader Boudih 2026-11-30 13:29:51

debug: classified in 03-filenames_plain1 by 'sys/dev/'

mgb: Add PCI11010 support
The Microchip PCI11010 is a PCIe switch with embedded multi-Gigabit
Ethernet controller.  Only a new PCI ID is needed, as commit
da8a529bc01f ("mgb: support for PCI11414.") added required new
functionality.

Reviewed by:    br
Sponsored by:   The FreeBSD Foundation
Sponsored by:   Microchip (hardware)
Differential Revision: https://reviews.freebsd.org/D62208
0b2cc30c8d0257d4e5c9c963405b709caf6f54f5 Ed Maste 2026-11-29 21:50:36

debug: classified in 03-filenames_plain1 by 'sys/dev/'

rge(4): Implement RTL8125 UDP hardware workaround
Directly quoting Kevin Lo <kevlo@openbsd.org>
"The RTL8125/RTL8125B parses short udp frames for ptp messages.
If a frame shorter than 175 bytes reads port 319 or 320 where the chip
expects the udp destination port and fewer than 47 bytes of udp data follow,
the transmitter stops for good."

Separately, the hw doesn't checksum frames shorter than 60 bytes
properly.

We get around both by padding and computing the checksums for these frames.

Both OpenBSD and Linux have implemented a similar workaround [1][2].

[1] https://marc.info/?l=openbsd-tech&m=179358733449818&w=2
[2] https://github.com/torvalds/linux/commit/8d520b4de3edca4f4fb242b5ddc659b6a9b9e65e

Signed-off-by: Aaron Espinoza <acesp25@freebsd.org>

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D62076
e3ded948ad4153349ffc4c4a490fee58486dcdef Aaron Espinoza 2026-11-30 16:55:14

debug: classified in 03-filenames_plain1 by 'sys/dev/'

rge: Make the TX watchdog reset the chip
If the cable is pulled, and re-inserted, the driver does not
re-establish any connections, inet nor inet6. rge_init_locked() returns
too early when IFF_DRV_RUNNING is set, so the watchdog's reset doesn't
help, only a full ifconfig rge0 down/up is sufficient.

Clearing the flag & calling rge_init_locked() addresses this, but it
takes around 5 seconds to completely recover.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D62221
a9067a537fb2f664ac96d33bcb1b6d424a7116ed Dave Cottlehuber 2026-11-30 16:55:25

debug: classified in 03-filenames_plain1 by 'sys/dev/'

x86: Restore CR0.TS in the Skylake MDS handlers
The Skylake variants of the MDS software sequence save CR0 in %rax
(%eax on i386) and then reuse %eax for the clflushopt loop and the
stosb fill byte.  The final test of CR0_TS always sees zero and CR0 is
never restored, so the return to user mode leaves TS clear even when
the thread does not own the FPU.  The thread then takes no trap to load
its own FPU state, runs with whatever the registers hold, and its FPU
state is not saved on the next context switch.  Only hw.mds_disable=2,
or 3 on a CPU without MD_CLEAR, selects these handlers.

Keep the saved CR0 in %rsi on amd64 and in %esi on i386, which the
handlers do not otherwise use.

Reported by:            llm-postcr
Reviewed by:            kib
Fixes:                  https://cgit.freebsd.org/src/commit/?id=7355a02bdd81 ("Mitigations for Microarchitectural...")
MFC after:              3 days
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D62238
8c516175d61188a2c56c93186935c69842e3b3c5 R. Christian McDonald 2026-11-30 20:02:25

debug: classified in 03-filenames_plain1 by '['sys/amd64/', 'sys/i386/']'

snp(4): a wakeup from snp_getc_capture() can be lost
snp_poll() checks ttyoutq_bytesused() while holding the tty lock.
It then calls tty_unlock(), and only after that calls selrecord().
snp_getc_capture() can run in that window, queue data and call
selwakeup() before the poller is on si_tdlist.  If that happens, the
poller sleeps even though data is already queued.

Call selrecord() under the tty lock.

Reported by:    llm-postcr
Fixes:  https://cgit.freebsd.org/src/commit/?id=932ef5b5cdfd ("Reintroduce the snp(4) driver")
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61973
30224686d611ab8c2fa30bce527805df56acbf79 Konstantin Belousov 2026-11-24 04:15:33

debug: classified in 03-filenames_plain1 by 'sys/dev/'

snp(4): drain the users of the tty before detaching it
Since SNPSTTY can detach the tty, snp_tty can change while other
threads use the snoop device.  snp_read(), snp_write(), snp_poll(),
and the FIONREAD, SNPGTTY and SNPGTYY_32DEV ioctls read snp_tty
without snp_register_lock and then used the tty.  The detach
unregisters the hook, and if the tty is already gone, tty_rel_free()
schedules tty_dealloc(), which frees the tty without waiting for the
snp threads.  snp_read() is exposed for as long as it sleeps for data
or copies out with the tty unlocked, and the detach also freed the
output queue under it.  The attach path sized the queue after
dropping snp_register_lock, with the same exposure.

Hold snp_register_lock in the paths that use the tty only briefly:
snp_poll(), the ioctls, and the queue sizing on attach.  snp_read()
and snp_write(), which sleep or drop the tty lock, take a use
reference counted in snp_busy under the tty lock.  The new
snp_detach(), used by SNPSTTY and snp_dtor(), clears snp_tty and
wakes up the readers under the tty lock, waits for the references to
drain, and only then frees the queue and unregisters the hook.  A
reader that sleeps for data when the tty is detached now gets EIO.

Holding snp_register_lock in snp_poll() also closes the window where
an attach and the first capture happen between reading snp_tty as
NULL and selrecord().

Reported by:    llm-postcr
Fixes:  https://cgit.freebsd.org/src/commit/?id=550e01c55247 ("snp(4): implement detach")
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61973
d6b896e70983eb518891d55619f14db823fd95e6 Konstantin Belousov 2026-11-24 04:47:31

debug: classified in 03-filenames_plain1 by 'sys/dev/'

snp(4): wake up the readers and pollers when the tty is gone
snp(4) did not register th_close, and snp_poll() only reported queued
data.  When the snooped tty went away, nothing woke up a thread
sleeping in select(2) or poll(2) on the snoop device, and a rescan
would not report the gone tty anyway.  watch(8) waits in select(2)
and only then asks FIONREAD, which returns SNP_TTYCLOSE, so it hung
once the tty stopped producing output.

Register th_close, which also runs when the tty is gone, to wake up
the readers and the pollers, and return POLLHUP from snp_poll() for a
gone tty.  select(2) treats POLLHUP as readable.

Fixes:  https://cgit.freebsd.org/src/commit/?id=932ef5b5cdfd ("Reintroduce the snp(4) driver")
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61973
d8569724dc0d04b9fd64419c71676a3803e6b4ea Konstantin Belousov 2026-11-24 06:17:09

debug: classified in 03-filenames_plain1 by 'sys/dev/'

Networking

Network-related commands, library, and kernel.

pfsync: account for second tickover in bulk updates
When one peer requests a bulk update it keeps track of when it sent this
request. The exporting peer includes 'endtime', indicating how long it
took to send the entire update along with its final message.

That allows the receiving peer to verify that the entire update was done
in response to its most recent request. However, due to different second
tickovers this calculation might be off by one.

Use milliseconds internally. This does not change the wire protocol,
'endtime' is still expressed in seconds. When the exporting peer
computes this value it will implicitly round down.

PR:             https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300824
Sponsored by:   Rubicon Communications, LLC ("Netgate")
f3cb62f798070570db00b51138873474c31bbc6a Kristof Provost 2026-11-26 16:44:36

debug: classified in 03-filenames_plain1 by 'sys/netpfil/'

pf: fix error handling in pf_ioctl_addrule()
If we bail out of pf_ioctl_addrule() before the pf_addr_setup() calls
the subsequent pf_free_rule() will end up dereferencing a NULL pointer.

Check for NULL before freeing dynaddr or tables.

PR:             https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=301184
Submitted by:   laamalif@proton.me
Reviewed by:    kp
Sponsored by:   Rubicon Communications, LLC ("Netgate")
b65057a684eefbf5e60ed27783e273ceee5fde59 Kristof Provost 2026-11-28 15:01:43

debug: classified in 03-filenames_plain1 by 'sys/netpfil/'

dummynet: mark sysctls as CTLFLAG_VNET
sysctl_hash_size() and sysctl_limits() read and write V_dn_cfg, the current
VNET's dummynet configuration, but their sysctls lack CTLFLAG_VNET, so a VNET
jail reads its own values (100 slots, 64 buckets) and cannot set them: a queue
longer than 100 packets cannot be configured in a jail, and the host's setting

Reviewed by:    kp
Sponsored by:   Rubicon Communications, LLC ("Netgate")
cec350375d607a0a8fcfe0853419bf88d29ec3da Jim Thompson 2026-11-30 08:33:37

debug: classified in 03-filenames_plain1 by 'sys/netpfil/'

System administration

Stuff in man section 8 (other than networking).

watch(8): detach the gone tty before attaching again
snp(4) keeps a gone tty attached until it is detached or the snoop
device is closed.  On SNP_TTYCLOSE, watch(8) asked for a new device,
or reconnected with -c, without detaching the old tty first.  SNPSTTY
then failed with EBUSY, and watch exited with "cannot attach to tty".

Detach the gone tty before attaching again.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61973
ff4bc075ed40f9713a50f44b8046262e384741a2 Konstantin Belousov 2026-11-24 06:20:47

debug: classified in 04-filenames_plain2 by 'usr.sbin/'

Libraries

-- no commits in this category this week --

Filesystems

tmpfs: VOP_OPEN() should be allowed on unlinked files
There is no reason for such restriction, and other file systems do not
impose it.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61314
e87aab104b02b89c5a0eb602c08d779200cb111d Konstantin Belousov 2026-10-23 17:05:04

debug: classified in 03-filenames_plain1 by 'sys/fs/'

Kernel

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

nfsclrdma: Fix a few things in the RDMA client module
This patch fixes a few things in the nfsclrdma module:
- A typo that caused _rpcrdma_get_srcaddr() to return 0
  when it should have returned 1.
- Don't consider a server returning RPC_SYSTEMERROR or
  RPC_FAILED as needing a new connection, to be compatible
  with clnt_vc.c for TCP.
- Fix off by one checks in the KASSERT()s for the RPC index.

Reported by:    llm-postcr
MFC after:      1 month
Fixes:  https://cgit.freebsd.org/src/commit/?id=80bee4d83637 ("nfsclrdma: Add code to support client side NFS over RDMA")
b75ceca567d4914e2de71783ae749bd9860008d4 Rick Macklem 2026-11-30 00:11:58

debug: classified in 04-filenames_plain2 by 'sys/'

unr(9): fix iterator with trivial unit allocations
Hoist the check that we've scanned all the unrs to the top of the
loop since none might have been allocated e.g., if we've only used
allocated units in order with alloc_unr() and never freed any.

Add a test of the trivial case.

Reviewed by:    kib, markj
Sponsored by:   Innovate UK
Fixes:          https://cgit.freebsd.org/src/commit/?id=a014e0a3987a ("unr(9): add iterator interface")
Differential Revision:  https://reviews.freebsd.org/D62139
3d35051f2901802ff8c3385b262ac541ba670a9c Brooks Davis 2026-11-30 11:14:15

debug: classified in 04-filenames_plain2 by 'sys/'

Commit group #0: sglist
sglist: Avoid an out-of-bounds access in sglist_append_sglist

If the destination sglist is empty, then the first matching segment
from the source sglist should be added as the first segment in the
destination list.  This happened to work by accident when sg_nseg was
a u_short as ss pointed to the sglist header which never had a
matching paddr so _sglist_append_range fell through to appending a new
range, but that was still buggy.  After sg_nseg changed to an unsigned
int, the initial ss now points way out of range on 64-bit platforms
resulting in reading from a random (possibly unmapped) kernel address.

Reported by:    llm-postcr
Reviewed by:    markj
Fixes:          https://cgit.freebsd.org/src/commit/?id=00f6cd3f5682 ("Add sglist_append_sglist().")
Differential Revision:  https://reviews.freebsd.org/D62003
a4ccfb23fa9bc1c256d93ef943df2e51cc16bca3 John Baldwin 2026-11-30 15:29:55

debug: classified in 04-filenames_plain2 by 'sys/'


sglist: Correct order of operands to bcopy in sglist_join

This was trashing the second list with uninitialized garbage from the
first list.

Reviewed by:    markj
Fixes:          https://cgit.freebsd.org/src/commit/?id=b36cfff75df4 ("Add a simple API to manage scatter/gather...")
Differential Revision:  https://reviews.freebsd.org/D62004
7b8f10e05891a33fca78c05a6aea46c996601a91 John Baldwin 2026-11-30 15:30:14

debug: classified in 04-filenames_plain2 by 'sys/'


sglist: Cosmetic cleanups to sglist_join

- Don't create an out-of-bounds pointer in flast.  Instead, use NULL
  for the case that first is empty for a more deterministic failure.

- Use a helper variable to de-duplicate an expression

Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D62005
371926987733adeef1135a23adce574f27a0e56b John Baldwin 2026-11-30 15:30:30

debug: classified in 04-filenames_plain2 by 'sys/'

epoch: Zero the drain count under the drain mutex
epoch_drain_cb() decrements e_drain_count with an atomic and only then
takes e_drain_mtx to wake the drainer.  epoch_drain_callbacks() holds
that mutex while it schedules the drain callbacks and checks the count
before it sleeps.  If the last callback of the final pass runs in that
window, the drainer sees zero, does not sleep, and returns before the
callback has locked and unlocked the mutex.  epoch_free() then destroys
the mutex and zeroes the epoch under it.  Its epoch_wait(global_epoch)
does not help, since epoch_call_task() runs the callbacks after leaving
the global epoch.

Each CPU's drain callback drops the count once, so the one that finds
it at one is the last.  Have that callback take the mutex before it
drops the count to zero.  The drainer reads the count only with the
mutex held, so it cannot see zero until that callback has dropped the
mutex, and the callback does not touch the epoch after that.

Use refcount(9) for the count, so that the other callbacks still drop
it without the mutex, now with release semantics that the plain atomic
lacked.  Taking the mutex for every decrement instead made each drain
30-50 us slower on an idle 8-CPU VM.

Only epoch_free() is affected, and its only in-tree caller is the
epoch_test module.  For other callers of epoch_drain_callbacks() the
epoch stays valid, and a late wakeup is harmless.

Reviewed by:            markj
Fixes:                  https://cgit.freebsd.org/src/commit/?id=131b2b7658d7 ("Implement API for draining EPOCH(9)...")
MFC after:              1 week
Sponsored by:           Rubicon Communications, LLC ("Netgate")
Differential Revision:  https://reviews.freebsd.org/D62140
3b0b9eba0422c9606c0c6fee7116daca037c7873 R. Christian McDonald 2026-11-30 18:05:16

debug: classified in 04-filenames_plain2 by 'sys/'

Commit group #1: nlm_prot_impl.c: Fix a crash caused by a bogus file handle
nlm_prot_impl.c: Fix a crash caused by a bogus file handle

This patch adds sanity checking to the file handle, so that
a bogus one will not cause a crash.

Reported by:    Laam Alif at Ibteda Digital Library, J. David
Discussed with: secteam
4bc351e3635bd5cd734cf76b397a0520888aceb0 Rick Macklem 2026-11-30 19:08:02

debug: classified in 04-filenames_plain2 by 'sys/'


nlm_prot_impl.c: Fix commit 4bc351e3635b for NFSv2

Commit 4bc351e3635b broke NFSv2 support, since NFSv2 uses a
32 byte file handle and sizeof(fhandle_t) == 28.

This patch fixes this.

Reported by:    llm-postcr
MFC after:      2 weeks
Fixes:  https://cgit.freebsd.org/src/commit/?id=4bc351e3635b ("nlm_prot_impl.c: Fix a crash caused by a bogus file handle")
a7dcbd213f9fda578c45d380a0eccfcd3c3c5ff7 Rick Macklem 2026-11-30 20:35:21

debug: classified in 04-filenames_plain2 by 'sys/'

kern: fix kenv_read_allowed without MAC
`error` is not initialized for KENV_DUMP* when MAC isn't enabled, which
is obviously wrong.  Our current policy is default-allow but may soon
switch to default-deny, so initialize it in this `else` branch as a
reminder that it may need switched.

Reviewed by:    markj, rmoeller
MFC after:      3 days
Fixes:  https://cgit.freebsd.org/src/commit/?id=4fd518fcb2 ("kern: add a security knob to disable [...]")
Sponsored by:   NetApp, Inc.
Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D62232
71249b5f850fde4124ad2e47a9ce799994841c38 Kyle Evans 2026-11-30 19:39:32

debug: classified in 04-filenames_plain2 by 'sys/'

tty: call the close hook when the TTY is gone
tty_rel_gone() wakes up the threads that wait on the TTY itself, but
does not notify the hook, which only hears about the last close from
ttydisc_close().  The TTY often becomes gone after its last close,
e.g. when the master side of a pts is closed after the slave, so a
hook consumer has no way to learn that the TTY went away.

Call th_close from tty_rel_gone() too.  A consumer may now see
th_close twice, on the last close and when the TTY is gone, in either
order.  There are no in-tree consumers of th_close yet.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61973
e6d8f695774290bc6bb1aa18bf9250165725f899 Konstantin Belousov 2026-11-24 06:17:09

debug: classified in 04-filenames_plain2 by 'sys/'

exit1(): clear P_TRACED before reparenting a traced child
When the exiting process traced a child, exit1() handed the child to
its real parent or to its reaper with P_TRACED still set, and cleared
the flag only afterwards.  proc_reparent() does not re-enable
waitpid(2) for a traced child.  A PD_NOWAITPID child whose last
process descriptor was closed while it was traced has no other zombie
reference, so after the SIGKILL that follows, nobody could reap it,
and with init as the reaper, the zombie and its pid leaked for good.
The tracer's own exit is enough to close the descriptor, since
fdescfree() runs before the children are reparented.

Clear P_TRACED before calling proc_reparent(), as PT_DETACH does.
This also keeps proc_reparent() from linking the child onto the orphan
list of the exiting process, so the explicit proc_clear_orphan() is no
longer needed.

Reported by:    llm-postcr
Fixes:  https://cgit.freebsd.org/src/commit/?id=bcdb6ba94d08 ("processes: add zombie references, each of them prevents reap")
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D62051
8b57cd4d41a00c17cfc616b3934774ab4dcf604e Konstantin Belousov 2026-11-25 11:09:35

debug: classified in 04-filenames_plain2 by 'sys/'

proc_to_reap(): let the debugger wait for its exited tracee
exit1() clears P_TRACED of the exiting process, while proc_to_reap()
accepts a child without the PZOMBIEREF_PARENT reference only if the
waiter traces it.  A PD_NOWAITPID process whose last process
descriptor was closed while it was traced has no zombie references at
all, so once it exited, its debugger got ECHILD from waitpid(2), and
the zombie stayed with the debugger until the debugger exited.  Before
the zombie references, the debugger's wait collected the status and
gave the zombie back to the real parent, which proc_reap() still does.

For a zombie, recognize the debugger as the parent which is not the
real parent, and let it wait.  The debugger holds none of the child's
zombie references, so proc_reap() now gives the child back without
dropping any.  Otherwise a reference held elsewhere, e.g. by a process
descriptor, would leave the zombie on the debugger's children list,
and every later waitpid(2) would collect it again.  For a child that
can be waited for, PZOMBIEREF_PARENT is now kept over the give-back
instead of being dropped.

Reported by:    llm-postcr
Fixes:  https://cgit.freebsd.org/src/commit/?id=bcdb6ba94d08 ("processes: add zombie references, each of them prevents reap")
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D62051
e41e771cd2abae45f5d70e6d59024157f1f0f789 Konstantin Belousov 2026-11-25 11:17:16

debug: classified in 04-filenames_plain2 by 'sys/'

sys: un-staticise finit_open()
Sponsored by: The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61314
e590e2f3570b8fed91c916c93f51733cfc85c851 Konstantin Belousov 2026-10-23 13:05:15

debug: classified in 04-filenames_plain2 by 'sys/'

pddupfd(2): add a designator for the current process
Sponsored by: The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61314
c6d75f9996dfa21cd2584c41eb200bde309ea185 Konstantin Belousov 2026-10-23 12:32:31

debug: classified in 04-filenames_plain2 by 'sys/'

pddupfd(2): allow to open the executable
One of the common uses for sysctl kern.proc.<pid>.pathname is to
immediately open(2) the returned path to parse the image, e.g. to read
the symbols.  This operation was made more reliable since introduction
of p_textdvp, but still rename or unlink of the binary cause unnecessary
failures for that.

Introduce pddupfd(pfd, PD_DUPFD_EXECUTABLE) special case that returns
read-only file descriptor to the process executable image.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61314
efc319ce5a9b17b4414e454941e00b02160eddf5 Konstantin Belousov 2026-10-23 13:04:42

debug: classified in 04-filenames_plain2 by 'sys/'

Build system

-- no commits in this category this week --

Internal organizational stuff

-- no commits in this category this week --

Testing

tests/pfsync_upd_c: only import necessary scapy modules
This test currently fails in Jenkins CI[0] because the runner
does not have an /etc/resolv.conf file while scapy expects one[1].

Instead, avoid the full scapy.all import path (which calls
read_nameservers(...)) and only import the modules we need.

[0] https://ci.freebsd.org/job/FreeBSD-main-amd64-test/30046/testReport/sys.netpfil.pf/pfsync/stale_upd_c/
[1] https://github.com/secdev/scapy/blob/123e241/scapy/arch/common.py#L176

Fixes:          https://cgit.freebsd.org/src/commit/?id=4a97b40891f0 ("pfsync: don't apply a stale dst peer...")
MFC after:      3 days
Reviewed by:    ngie
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D62141
efda1295090df76a765af445f977e550eba3d4ed Siva Mahadevan 2026-11-30 15:04:33

debug: classified in 02b-filenames_wildcards2 by 'tests\/.*'

tests/sys/kern/procdesc: test exit of a non-reaper tracer
Check that the reaper can waitpid(2) for a PD_NOWAITPID child, after
the child's parent traced it and exited with the descriptor open.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D62051
96ac9c1cf05b16faf639d267eb1593268f62a4cc Konstantin Belousov 2026-11-25 11:09:35

debug: classified in 02b-filenames_wildcards2 by 'tests\/.*'

tests/sys/kern/procdesc: test the debugger's wait for its tracee
Check that a debugger, which is not the reaper, can waitpid(2) for its
killed PD_NOWAITPID tracee after closing the last process descriptor,
and that the reaper collects the child afterwards.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D62051
2da2fc3e3d7131c97014f046d82950c746ed6c16 Konstantin Belousov 2026-11-25 11:19:34

debug: classified in 02b-filenames_wildcards2 by 'tests\/.*'

ptrace_test: use PD_NOWAITPID in procdesc_reparent_wait_child
The test expects that, after a debugger collected the exit status of
a child created by pdfork(2), the parent cannot collect the child with
wait(2).  With the zombie references, a child created without
PD_NOWAITPID is waitable by its parent, and the test only passed
because the debugger's waitpid(2) dropped the parent's reference.
proc_reap() no longer lets the debugger take the exit status away
from the parent, so the parent's wait(2) now collects the child.

Create the child with PD_NOWAITPID, which is what hides it from
wait(2) now.  Since waitpid(2) does not see it either, wait for its
stop with pdwait(2).  The debugger's waitpid(2) in the test then also
covers collecting a tracee that has no waitpid reference.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D62051
d1e3d977c1daa5c188c07d4703c6f424eb89d2e9 Konstantin Belousov 2026-11-25 11:45:31

debug: classified in 02b-filenames_wildcards2 by 'tests\/.*'

ptrace_test: test that the debugger does not steal a pdfork child
Add ptrace__procdesc_reparent_wait_child_waitable, the counterpart of
ptrace__procdesc_reparent_wait_child for a child that pdfork(2)
created without PD_NOWAITPID.  After the debugger collected the exit
status, the child must be back with its parent, which must still be
able to collect the status with wait(2).

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D62051
ea161c3e6d8efb94f32ba5c743b057be1d7d583f Konstantin Belousov 2026-11-25 16:09:52

debug: classified in 02b-filenames_wildcards2 by 'tests\/.*'

tests/sys/kern/procdesc: test pddupfd(PD_DUPFD_ME)
Check that the descriptor of the calling process is duplicated with
O_CLOEXEC set and the file shared, and that a closed descriptor
gives EBADF.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61314
46019d494d7a5ceeb274963105a44931378f10de Konstantin Belousov 2026-10-23 15:56:42

debug: classified in 02b-filenames_wildcards2 by 'tests\/.*'

tests/sys/kern/procdesc: test pddupfd(PD_DUPFD_EXECUTABLE)
Check that the returned file descriptor references the process binary,
both for the calling process and for a child whose binary was unlinked
after exec, and that it is close-on-exec, readable and lacks the write
capability right.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D61314
60fa25d01fc46edb0528396c90826c7769988321 Konstantin Belousov 2026-10-23 15:56:43

debug: classified in 02b-filenames_wildcards2 by 'tests\/.*'

Style, typos, and comments

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

-- no commits in this category this week --

Contrib code

-- no commits in this category this week --

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.21 at 2026-11-30 21:18:31+00:00.

This work is supported by Tarsnap Backup Inc.

Alternate version: 2026-11-30 (release)