FreeBSD/src 0053a4bsys/netinet tcp_var.h

tcp: fix TF_BITS

Add missing TF_DISCONNECTED bit.

Reported by:    Hannes Elfert
Fixes:          40dbb06fa73c ("inpcb: retire INP_DROPPED and in_pcbdrop()")
DeltaFile
+1-1sys/netinet/tcp_var.h
+1-11 files

FreeBSD/src 435cde9sys/dev/ixgbe if_ix.c

ixgbe: Report the management packet drop counter

The management_pkts_drpd sysctl was wired to MNGPTC, making it an
alias of management_pkts_txd, instead of MNGPDC.

MFC after:      3 days
DeltaFile
+1-1sys/dev/ixgbe/if_ix.c
+1-11 files

FreeBSD/src 392f0afsys/dev/ixgbe ixgbe_phy.c

ixgbe: Recognize production X550 PHY IDs

According to Linux 5f1c3589b0f0, the X550 PHY classifier still matches
an alpha silicon ID, while the shared definitions contain the two
production IDs.  This can leave production hardware on the generic
probing path and issue unnecessary PHY queries.

MFC after:      2 weeks
DeltaFile
+2-0sys/dev/ixgbe/ixgbe_phy.c
+2-01 files

FreeBSD/src 4f87828sys/riscv/include atomic.h

riscv/atomic: Provide some additional aliases

These are already available and having them defined helps keep the KASAN
atomic(9) interceptors uniform.

Reviewed by:    mhorne
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58680
DeltaFile
+3-0sys/riscv/include/atomic.h
+3-01 files

FreeBSD/src 46dc4af. RELNOTES

RELNOTES: Add an entry for a new unix socket feature
DeltaFile
+4-0RELNOTES
+4-01 files

FreeBSD/src ce3750bshare/man/man4 unix.4, sys/kern uipc_usrreq.c

unix: allow listening on an unbound socket, and binding after listen

`uipc_listen()` refused a socket that had not been bound, with
`EDESTADDRREQ`.  That made sense while a pathname was the only way to
name a peer: an unbound listener could never be reached, so allowing it
would only have created sockets nothing could connect to.  Now that
`connectat(2)` can name a peer socket by descriptor, an unbound listener
*is* reachable, and the restriction only stands in the way.  It also left
stream sockets oddly stricter than datagram ones, which could already
reach an unbound peer.

Dropping the check additionally permits `bind(2)` after `listen(2)`:
`uipc_bindat()` already allows this, as it only rejects re-binding a
socket that has a name.  That ordering closes a window listeners
otherwise have to leave open.  Today the socket file must exist before
the socket may listen, so a client connecting in between is refused;
binding afterwards publishes the name only once the socket is ready to
accept.


    [9 lines not shown]
DeltaFile
+106-4tests/sys/kern/unix_connectat.c
+14-3share/man/man4/unix.4
+6-2sys/kern/uipc_usrreq.c
+5-2tests/sys/kern/unix_seqpacket_test.c
+131-114 files

FreeBSD/src 6563dcblib/libsys connectat.2, share/man/man4 unix.4

unix: allow connectat(2) to name the peer socket by descriptor

Accept an empty `sun_path` when `fd` is not `AT_FDCWD`: the descriptor
then names the peer unix socket directly, instead of being the starting
directory for a pathname lookup.  The held file reference keeps the peer
PCB stable, playing the role `unp_vp_mtxpool` plays in the pathname
path.

The descriptor must carry `CAP_CONNECTAT` and refer to an `AF_UNIX`
socket (`EPROTOTYPE` otherwise, `ENOTSOCK` for non-sockets).  As with a
pathname, a stream/seqpacket peer must be listening.  No filesystem
permission or MAC vnode check applies on this path: possession of the
descriptor is the authorization, as with descriptor passing.

Note this makes it possible to connect a datagram socket to an unbound
peer, which no pathname could previously name.

`connect(2)` and the implicit-connect send path pass `AT_FDCWD` and
still reject an empty path with `EINVAL`.

    [22 lines not shown]
DeltaFile
+137-35sys/kern/uipc_usrreq.c
+93-1share/man/man4/unix.4
+51-1lib/libsys/connectat.2
+281-373 files

FreeBSD/src e181e23tests/sys/kern Makefile unix_connectat.c

tests: exercise unix connectat(2) with a socket peer descriptor

Cover the new fd-direct connect path: stream connect and data passing,
the peer address reported by `getpeername(2)`, datagram to an unbound
peer, the `EINVAL`/`ENOTSOCK`/`EPROTOTYPE`/`ECONNREFUSED` error matrix,
and the Capsicum token semantics — a descriptor limited to
`CAP_CONNECTAT` can be connected to but not listened on, accepted from,
or read, and one lacking `CAP_CONNECTAT` cannot be a connect target.

Stream listeners are always bound: `uipc_listen()` refuses unbound
sockets with `EDESTADDRREQ`, so an unbound fd-direct listener is not
reachable even with this feature.

Signed-off-by: John Ericson <John.Ericson at Obsidian.Systems>
Assisted-by: Claude Code (Claude Opus 4.8 and Fable 5)

Reviewed by:    markj
MFC after:      2 months
Differential Revision:  https://reviews.freebsd.org/D58406
DeltaFile
+669-0tests/sys/kern/unix_connectat.c
+2-0tests/sys/kern/Makefile
+671-02 files

FreeBSD/src 7977edbsys/kern uipc_usrreq.c

unix: split unp_connectat() in two

Factor the second half — connecting to an already-resolved peer PCB —
out into a new `unp_connect_peer()`, leaving `unp_connectat()` with the
connection state machine and pathname resolution.  No functional change.

The helper's contract: the caller guarantees stability of the peer PCB
(vnode lock plus `unp_vp_mtxpool` lock for peers found via
`VOP_UNP_CONNECT()`), has set `UNP_CONNECTING` on the connecting socket,
and clears it again on error; the helper clears it on success.

This prepares for connecting to a peer named by something other than a
pathname.

Signed-off-by: John Ericson <John.Ericson at Obsidian.Systems>

Reviewed by:    markj
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D58404
DeltaFile
+61-41sys/kern/uipc_usrreq.c
+61-411 files

FreeBSD/src e27d36esys/kern uipc_usrreq.c

unix: Simplify uipc_detach()

uipc_close() handles detaching a unix socket from the vnode to which
it's bound, if any, so doing the same in uipc_detach() is redundant.
Moreover, it's conceptually wrong that uipc_detach() might need to
handle this: detach happens when there are no remaining references to
the socket, and that should include the vnode's reference, even though
it's not explicitly counted.

No functional change intended.

Reviewed by:    John Ericson <inquire at JohnEricson.me>, glebius
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58675
DeltaFile
+3-25sys/kern/uipc_usrreq.c
+3-251 files

FreeBSD/src 9b27a22sys/kern uipc_usrreq.c

unix: factor unp_connectat_peer() out of unp_connectat()

Move the "resolve a connectat(2) target to a referenced peer socket"
half of `unp_connectat()` -- the `namei()` lookup and `unp_vnode_peer()`
call -- into a helper, leaving `unp_connectat()` with the connection state
machine plus a single `unp_connect_peer()`.

This is where the next change grows the ways a peer can be named; keeping
it a helper up front keeps that change focused on the new resolution
logic.

No functional change intended.

Signed-off-by: John Ericson <John.Ericson at Obsidian.Systems>
Assisted-by: Claude Code (Claude Opus 4.8 and Fable 5)

Reviewed by:    markj
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D58462
DeltaFile
+35-18sys/kern/uipc_usrreq.c
+35-181 files

FreeBSD/src 26147c5sys/kern uipc_usrreq.c

unix: pin the pathname peer by reference across the connect

In the pathname path of `unp_connectat()`, take a reference on the peer
socket under the per-vnode `unp_vp_mtxpool` lock, drop that lock, and
`vput()` the vnode *before* calling `unp_connect_peer()`, rather than
holding the vnode lock across the connect.

`unp_connect_peer()` already accepts "a reference on the peer socket" as
a stability guarantee (it is exactly what the descriptor path relies on),
so this is behaviour-preserving.  The payoff is that no vnode lock is held
across the connect, which removes the delicate `MPASS(!(return_locked &&
connreq))` "vput() must not sleep while the peer is locked" invariant on
the datagram fast path.

That reference then has to be released, and for the reasons described in
the code, this can only safely happen *after* the PCB is unlocked. The
boolean flag is replaced with a nullable out pointer to return the
reference to the caller so that it can carry out this responsibility.


    [8 lines not shown]
DeltaFile
+55-29sys/kern/uipc_usrreq.c
+55-291 files

FreeBSD/src 44e99b6sys/kern uipc_usrreq.c

unix: factor unp_sun_path() out of bind and connect

Extract the AF_UNIX validation plus sun_path/length lookup shared by
`uipc_bindat()`, `unp_connect()`, and `unp_connectat()` into a helper that
hands back the path pointer and its length.  Each caller keeps its own
empty-path policy and, where needed, its own copy of the path.

Signed-off-by: John Ericson <John.Ericson at Obsidian.Systems>
Assisted-by: Claude Code (Claude Opus 4.8 and Fable 5)

Reviewed by:    markj
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D58459
DeltaFile
+39-19sys/kern/uipc_usrreq.c
+39-191 files

FreeBSD/src 3b93d35sys/kern uipc_usrreq.c, sys/sys mbuf.h

unix: Fix some bugs in the SOCK_STREAM receive path

The main problem is with the handling of errors from unp_externalize().
It turns out that this was quite broken, and unfortunately it's easy to
trigger such errors (e.g., by setting a low per-process fd limit with
setrlimit()).

In non-peek mode, uipc_soreceive_stream_or_seqpacket() cuts a bunch of
mbufs from the head of the socket buffer,  to be consumed by userspace.
When unp_externalize() returns an error, we splice the removed mbuf
chain back onto the head of the socket buffer.  This is expensive, but
that's ok since such errors are rare.

The problem is that this cutting is not correctly implemented: it does
not clear the "next" pointer for the last mbuf in the chain, so it
still points to the first mbuf still resident in the socket buffer.
This means that mc_init_m() creates a chain that still includes the rest
of the socket buffer, so splicing the chain back into the socket buffer
does not work properly.

    [14 lines not shown]
DeltaFile
+120-0tests/sys/kern/unix_passfd_test.c
+35-4sys/kern/uipc_usrreq.c
+7-0sys/sys/mbuf.h
+162-43 files

FreeBSD/src 2c01d10sys/kern uipc_usrreq.c

unix: factor unp_vnode_peer() out of unp_connectat()

Move the "resolve a locked vnode to the referenced peer socket it names"
block into a helper.  Pure code motion: the caller now calls
`unp_vnode_peer()` and keeps the `vput()`/connect/`sorele()` sequence.

No functional change intended.

Note: This refactor isn't really necessary as `unp_vnode_peer()` will
only be called once throughout this entire patch series. I am just
including it out of my personal preferences for decomposing tasks into
smaller functions --- we can skip this patch if the reviewers don't like
this.

Signed-off-by: John Ericson <John.Ericson at Obsidian.Systems>
Assisted-by: Claude Code (Claude Opus 4.8 and Fable 5)

Reviewed by:    markj
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D58461
DeltaFile
+51-34sys/kern/uipc_usrreq.c
+51-341 files

FreeBSD/src ba47678tools/tools/git git-arc.sh

git-arc: Use full names in reviewed-by lines

Phabricator user names are not useful identifiers outside of
phabricator, don't use them if we can avoid it.
DeltaFile
+34-8tools/tools/git/git-arc.sh
+34-81 files

FreeBSD/src 6dfd710sys/kern uipc_usrreq.c

unix: Fix a missing initialization in uipc_sosend_stream_or_seqpacket()

This could be triggered by an in-kernel sender, of which I can't find
any examples.

Fixes:          d15792780760 ("unix: new implementation of unix/stream & unix/seqpacket")
Reviewed by:    glebius
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58673
DeltaFile
+3-1sys/kern/uipc_usrreq.c
+3-11 files

FreeBSD/src 8b668bcsys/dev/ixgbe if_ix.c

ixgbe: Preserve the full VF RSS domain in the shared RETA

The 82599 and X540 share the global RSS redirection table between the
PF and its VFs.  Programming that table from the PF queue count
prevents a VF from using queue indices absent from the PF layout.  A
one-queue PF consequently directs every flow for a two- or four-queue
VF to queue zero.

Program at least four queue indices while SR-IOV is active.  Each pool
PSRTYPE.RQPL field masks the shared table to the queue subset available
to that function, so the PF can continue using fewer queues.

MFC after:      2 weeks
DeltaFile
+17-5sys/dev/ixgbe/if_ix.c
+17-51 files

FreeBSD/src f9ce33bsys/dev/ixgbe ixgbe_x550.c ixgbe_type.h

ixgbe: Add 10GBase-BX BiDi SFP+ module support

10G-BX optics use paired wavelengths to carry 10 Gb/s Ethernet over a
single strand of single-mode fiber.  Their 10G compliance byte is
empty, so identify them from the SFF-8472 nominal signaling rate and
single-mode reach fields.

When an EEPROM also advertises 1G BASE-BX10, give the complete 10G
bitrate and reach signature precedence.  Otherwise retain FreeBSD's
permissive 1G-BX identification rather than requiring a nominal
1.3 GBd rate.

MFC after:      2 weeks
Relnotes:       yes
DeltaFile
+56-5sys/dev/ixgbe/ixgbe_phy.c
+10-0sys/dev/ixgbe/if_ix.c
+7-0sys/dev/ixgbe/ixgbe_82599.c
+3-0sys/dev/ixgbe/ixgbe_type.h
+3-0sys/dev/ixgbe/ixgbe_phy.h
+2-0sys/dev/ixgbe/ixgbe_x550.c
+81-56 files

FreeBSD/src 4220b52sys/net if_media.h

net: Add ifmedia support for 10GBase-BX BiDi

10GBase-BX uses paired wavelengths to carry both directions over a
single strand of single-mode fiber.  The optics must be paired so that
the transmit and receive wavelengths cross over.

MFC after:      2 weeks
DeltaFile
+3-0sys/net/if_media.h
+3-01 files

FreeBSD/src be3e106sys/dev/ixgbe ixgbe_common.c

ixgbe: Validate EEPROM checksum section bounds

The generic checksum walker trusts NVM section pointers and lengths and
iterates with a 16-bit index.  A corrupt section that crosses the end of
the EEPROM can wrap the index and leave the driver in an effectively
unbounded read loop during attach.

Validate each non-empty section against the discovered EEPROM word size
before reading it, and use widened arithmetic for the inclusive end and
iterator.

MFC after:      2 weeks
DeltaFile
+13-3sys/dev/ixgbe/ixgbe_common.c
+13-31 files

FreeBSD/src 660099csys/dev/ixgbe if_ix.c

ixgbe: Restore missed packet accounting

missed_rx and total_missed_rx are never populated.  As a result, the
GPRC erratum workaround does not remove missed packets and iqdrops
always remains zero.  The rx_missed_packets sysctl and input-error total
also expose only MPC bank zero.

Read and accumulate all eight MPC banks.  Use the interval total to
correct GPRC and the cumulative total for iqdrops, input errors, and the
aggregate sysctl.  This matches DPDK's coverage of the hardware banks.

MFC after:      2 weeks
DeltaFile
+10-4sys/dev/ixgbe/if_ix.c
+10-41 files

FreeBSD/src 877f0eesys/dev/ixgbe if_ix.c if_sriov.c

ixgbe: Preserve VF jumbo frame size across PF resets

sc->max_frame_size represents the largest frame requested by the PF or
an active VF.  The MTU callback replaces it with the PF frame size, so
a subsequent reinitialization can program MHADD below an active VF's
jumbo-frame request.

Recompute the aggregate before hardware initialization and use it when
programming MHADD.  Recompute after each VF LPE request as well, so a
reduced request can lower the hardware limit when no other function
needs the previous value.

MFC after:      2 weeks
DeltaFile
+4-3sys/dev/ixgbe/if_sriov.c
+5-1sys/dev/ixgbe/if_ix.c
+9-42 files

FreeBSD/src ff86fd4share/man/man4 ix.4, sys/dev/ixgbe ixgbe_type.h if_ix.c

ixgbe: Expose EEE LPI event counters

X550-family devices provide clear-on-read counters for transmit and
receive Low Power Idle events.  Accumulate each register once in the
normal statistics poll and expose the monotonic totals below the eee
sysctl node.  Document the counters together with the existing EEE
control.

Obtained from:  Intel ix 3.4.39
MFC after:      2 weeks
DeltaFile
+18-0sys/dev/ixgbe/if_ix.c
+7-1share/man/man4/ix.4
+2-0sys/dev/ixgbe/ixgbe_type.h
+27-13 files

FreeBSD/src c410551sys/dev/ixgbe if_ix.c

ixgbe: Compare flow control against requested mode

The flow-control sysctl represents the configured policy, while
current_mode is the mode negotiated with the link partner.  Comparing a
new request with current_mode can needlessly reprogram an unchanged
policy or skip a requested policy change that happens to match the
current negotiation result.

Compare with requested_mode before deciding that no update is needed.

MFC after:      2 weeks
DeltaFile
+1-1sys/dev/ixgbe/if_ix.c
+1-11 files

FreeBSD/src a884921sys/dev/ixgbe if_ixv.c

ixv: Report multigigabit link speeds

The VF link-status path can receive 2.5 and 5 Gb/s speed bits from
X550-family PFs, but media reporting has no cases for them.  The
bootverbose message also assumes every non-10-Gb/s link is 1 Gb/s.

Expose the corresponding ifmedia subtypes and derive the diagnostic
speed through the shared link-speed conversion helper.

MFC after:      2 weeks
DeltaFile
+14-4sys/dev/ixgbe/if_ixv.c
+14-41 files

FreeBSD/src dd532adinclude fts.h, lib/libc/gen fts.c fts.3

fts: reduce fd usage by storing fts_dirfd on directory entries only

Previously fts_build() called _dup(_dirfd(dirp)) for every child
entry, holding N simultaneous fds for a directory with N children.

Redefine fts_dirfd: instead of a fd for the entry's parent
directory, it is now a fd for the entry itself, set only for
directory entries. One dup per directory in fts_build() instead
of one per child.  Close fts_dirfd during the directory post-order
visit, before advancing to its sibling.

To access a file using fd-relative operations, callers should use
openat(ent->fts_parent->fts_dirfd, ent->fts_name, ...) instead of
openat(ent->fts_dirfd, ent->fts_name, ...).  The fd is valid until the
directory's post-order visit (FTS_DP).

Reported by:    Mark Johnston <markj at FreeBSD.org>
Fixes:          4bd01d6ae016 (fts: refactor to use fd-relative operations)
Sponsored by:   Google LLC (GSoC 2026)

    [2 lines not shown]
DeltaFile
+19-13lib/libc/gen/fts.3
+14-9lib/libc/gen/fts.c
+1-1include/fts.h
+34-233 files

FreeBSD/src a8c598dlib/libc/db/mpool mpool.c

mpool/mpool_get.c: Avoid clobbering 'errno' when handling 'pread' errors

POSIX.1-2024 states that the 'free' function "shall not modify errno if
ptr is a null pointer or a pointer previously returned as if by malloc()
and not yet deallocated". However this is a fairly recent addition
and non-compliant allocators might still clobber 'errno', causing
'mpool_get' to return the wrong error code. Fix this by saving
and restoring 'errno' after calling 'free'.

Sponsored by:   Klara, Inc.
Reviewed by:    obiwac
Differential Revision:  https://reviews.freebsd.org/D55463
MFC after:      1 week

(cherry picked from commit bce0c14fe19defeef4f02cfebc018e9adf979783)
DeltaFile
+4-0lib/libc/db/mpool/mpool.c
+4-01 files

FreeBSD/src 8038879lib/libc/db/hash extern.h hash_func.c

libc/db: Remove unused hash functions in hash_func.c

Prune unused code hidden behind 'notdef', bringing us in sync with
the changes in OpenBSD. Despite the `__default_hash` function pointer
having external linkage, no ABI change is expected since it was
never exported.

Sponsored by:   Klara, Inc.
Differential Revision:  https://reviews.freebsd.org/D55842
Reviewed by:    allanjude, des
MFC after:      2 weeks

(cherry picked from commit c09ccfc2665bef0d81d1db4e3713e4f2a0b5a064)
DeltaFile
+1-106lib/libc/db/hash/hash_func.c
+1-1lib/libc/db/hash/extern.h
+2-1072 files

FreeBSD/src 429e2c5usr.sbin/bhyve block_if.c

bhyve: Fix some leaks in usr.sbin/bhyve/block_if.c

Modify `blockif_open` to properly release a partially initialized
`blockif_ctxt` structure on error.

Differential Revision:  https://reviews.freebsd.org/D57887
Reviewed by:    novel, bnovkov, glebius
Tested by:      bnovkov
MFC after:      2 weeks

(cherry picked from commit 0228338fc9c6d2243fe4fd3259286d2fbc6df786)
DeltaFile
+39-9usr.sbin/bhyve/block_if.c
+39-91 files