FreeBSD/src 3ccccd8sys/net iflib.c

iflib: Initialize the VFLR task unconditionally

The VFLR task was initialized only from drivers MSI-X interrupt
assignment paths.  ixl's legacy interrupt handler can nevertheless defer
VFLR work, leaving an uninitialized task.  Even with MSI-X, the admin
interrupt was established before the task was initialized.

Initialize it alongside the other private tasks.  The existing detach
check and private-taskqueue drains then cover its lifecycle for every
interrupt mode and registration failure.

Sponsored by:   BBOX.io

(cherry picked from commit b4208a67edc2eb7898a9ff2a6f3990c6852910e4)
DeltaFile
+1-1sys/net/iflib.c
+1-11 files

FreeBSD/src 375892cshare/man/man4 iflib.4, sys/net iflib.c

iflib: Add an admin task detach fail point

Add an exact-device fail point immediately after the admin task checks
IFC_IN_DETACH. This makes the detach race reproducible without affecting
another interface.

Use a bounded delay to keep the task active while detach enters the
taskqueue drain.  Mark the point nonsleepable as a safety backstop, and
document a one-shot test for verifying that deregistration drains an
already-running task before ether_ifdetach().

Reviewed by:    gallatin, kgalazka
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D58720

(cherry picked from commit ac56d36007a5a1a01fe69df370f272060e852e0b)
DeltaFile
+19-0share/man/man4/iflib.4
+11-0sys/net/iflib.c
+30-02 files

FreeBSD/src 546e2c0sys/net iflib.c

iflib: Drain configuration tasks before interface detach

iflib_device_deregister() sets IFC_IN_DETACH before removing the
interface, but a task which already passed its detach check can still
report a link change.  This can re-arm if_linktask after
ether_ifdetach() has drained it and leave work pending across queue
teardown.

Drain the entire private taskqueue before ether_ifdetach().  Drivers
may register their own link-related configuration tasks there, so
draining only the framework admin task leaves the same race for those
drivers.

Differential Revision:  https://reviews.freebsd.org/D58452

Co-authored-by: Andrew Gallatin <gallatin at FreeBSD.org>
Co-authored-by: Kevin Bowling <kbowling at FreeBSD.org>
(cherry picked from commit ba353c8950d575f9d15b82c92658e660935fba25)
DeltaFile
+7-0sys/net/iflib.c
+7-01 files

FreeBSD/src 794a87cshare/man/man4 iflib.4, sys/net iflib.c

iflib: Add registration failure injection points

Add six device-scoped fail(9) points at the registration milestones
needed to exercise each unwind path. An exact, runtime-only device
selector prevents unrelated iflib devices from consuming an armed point.

Mark the points non-sleepable because registration holds the ifnet and
context locks. Document one-shot operation and bus-address reprobe so a
failed attach can be recovered without another kernel build.

Reviewed by:    gallatin
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D58722

(cherry picked from commit 90e7dbe5e2ca47baff4e4c6d9e892a0554eec4db)
DeltaFile
+46-0sys/net/iflib.c
+40-0share/man/man4/iflib.4
+86-02 files

FreeBSD/src ead5f24sys/dev/bnxt/bnxt_en if_bnxt.c, sys/dev/enetc if_enetc.c

iflib: Complete registration failure cleanup

Pre-attach sysctls contain pointers into the iflib context. Any later
registration failure that frees the context must first remove that
sysctl tree.

Failures after a successful IFDI_ATTACH_PRE also did not consistently
call IFDI_DETACH or free the private taskqueue. In particular, routing
a taskqueue creation failure through the context cleanup could free the
driver softc while resources allocated by attach_pre remained live.

Track successful interrupt and queue setup and use one common unwind
path. Invoke IFDI_DETACH with IFNET_WLOCK dropped and release only
resources whose setup completed. Leave a failed IFDI_ATTACH_PRE to
unwind its own partial state, as required by the existing driver
contract.

A failed post-attach can follow driver registration of an SR-IOV
schema. Remove that registration before detaching the interface and

    [30 lines not shown]
DeltaFile
+114-37sys/net/iflib.c
+7-3sys/dev/enetc/if_enetc.c
+7-2sys/dev/bnxt/bnxt_en/if_bnxt.c
+5-3sys/dev/vmware/vmxnet3/if_vmx.c
+3-2sys/dev/igc/if_igc.c
+2-0sys/dev/ixgbe/if_sriov.c
+138-471 files not shown
+139-477 files

FreeBSD/src 18c03a9sys/net iflib.c

iflib: drain admin task and fix teardown order on register failure

When IFDI_ATTACH_POST() fails (or netmap attach fails), iflib tears down with
ether_ifdetach(), taskqueue_free(ifc_tq), and IFDI_DETACH(). CTX_LOCK is still
held after ether_ifattach. ether_ifdetach() and taskqueue_drain(admin) must not
run under CTX_LOCK.

Teardown ordering (match iflib_device_deregister):

- Free the per-interface admin taskqueue after IFDI_DETACH / IFDI_QUEUES_FREE, not before.
- Drop IFNET_WLOCK() across IFDI_DETACH / IFDI_QUEUES_FREE so driver detach can sleep in
LinuxKPI workqueue drain, then retake IFNET_WLOCK() before iflib_free_intr_mem and fail_unlock.

Reviewed by:    gallatin, kgalazka, #iflib
Differential Revision: https://reviews.freebsd.org/D56316

(cherry picked from commit 439132310ae1f623f6c0a3dc241d0a34e98e040b)
DeltaFile
+18-1sys/net/iflib.c
+18-11 files

FreeBSD/src b5fa891sys/net iflib.c

iflib: Fix panic observed while doing sysctl -a with if_bnxt unload

Observed below kernel panic calltrace while performing sysctl -a
operation while unloading the if_bnxt driver,

Fatal trap 9: general protection fault while in kernel mode

KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe02a7569940
vpanic() at vpanic+0x136/frame 0xfffffe02a7569a70
panic() at panic+0x43/frame 0xfffffe02a7569ad0
trap_fatal() at trap_fatal+0x68/frame 0xfffffe02a7569af0
calltrap() at calltrap+0x8/frame 0xfffffe02a7569af0

trap 0x9, rip = 0xffffffff80c0b411, rsp = 0xfffffe02a7569bc0, rbp = 0xfffffe02a7569be0 ---
sysctl_handle_counter_u64() at sysctl_handle_counter_u64+0x61/frame 0xfffffe02a7569be0
sysctl_root_handler_locked() at sysctl_root_handler_locked+0x9c/frame 0xfffffe02a7569c30
sysctl_root() at sysctl_root+0x22f/frame 0xfffffe02a7569cb0
userland_sysctl() at userland_sysctl+0x196/frame 0xfffffe02a7569d50

    [23 lines not shown]
DeltaFile
+23-20sys/net/iflib.c
+23-201 files

FreeBSD/src 5012a18sys/net iflib.c

iflib: Initialize the VFLR task unconditionally

The VFLR task was initialized only from drivers MSI-X interrupt
assignment paths.  ixl's legacy interrupt handler can nevertheless defer
VFLR work, leaving an uninitialized task.  Even with MSI-X, the admin
interrupt was established before the task was initialized.

Initialize it alongside the other private tasks.  The existing detach
check and private-taskqueue drains then cover its lifecycle for every
interrupt mode and registration failure.

Sponsored by:   BBOX.io

(cherry picked from commit b4208a67edc2eb7898a9ff2a6f3990c6852910e4)
DeltaFile
+1-1sys/net/iflib.c
+1-11 files

FreeBSD/src be587e6share/man/man4 iflib.4, sys/net iflib.c

iflib: Add an admin task detach fail point

Add an exact-device fail point immediately after the admin task checks
IFC_IN_DETACH. This makes the detach race reproducible without affecting
another interface.

Use a bounded delay to keep the task active while detach enters the
taskqueue drain.  Mark the point nonsleepable as a safety backstop, and
document a one-shot test for verifying that deregistration drains an
already-running task before ether_ifdetach().

Reviewed by:    gallatin, kgalazka
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D58720

(cherry picked from commit ac56d36007a5a1a01fe69df370f272060e852e0b)
DeltaFile
+19-0share/man/man4/iflib.4
+11-0sys/net/iflib.c
+30-02 files

FreeBSD/src 92b8516sys/net iflib.c

iflib: Drain configuration tasks before interface detach

iflib_device_deregister() sets IFC_IN_DETACH before removing the
interface, but a task which already passed its detach check can still
report a link change.  This can re-arm if_linktask after
ether_ifdetach() has drained it and leave work pending across queue
teardown.

Drain the entire private taskqueue before ether_ifdetach().  Drivers
may register their own link-related configuration tasks there, so
draining only the framework admin task leaves the same race for those
drivers.

Differential Revision:  https://reviews.freebsd.org/D58452

Co-authored-by: Andrew Gallatin <gallatin at FreeBSD.org>
Co-authored-by: Kevin Bowling <kbowling at FreeBSD.org>
(cherry picked from commit ba353c8950d575f9d15b82c92658e660935fba25)
DeltaFile
+7-0sys/net/iflib.c
+7-01 files

FreeBSD/src 1a13e21share/man/man4 iflib.4, sys/net iflib.c

iflib: Add registration failure injection points

Add six device-scoped fail(9) points at the registration milestones
needed to exercise each unwind path. An exact, runtime-only device
selector prevents unrelated iflib devices from consuming an armed point.

Mark the points non-sleepable because registration holds the ifnet and
context locks. Document one-shot operation and bus-address reprobe so a
failed attach can be recovered without another kernel build.

Reviewed by:    gallatin
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D58722

(cherry picked from commit 90e7dbe5e2ca47baff4e4c6d9e892a0554eec4db)
DeltaFile
+46-0sys/net/iflib.c
+40-0share/man/man4/iflib.4
+86-02 files

FreeBSD/src 4a9daa0sys/dev/bnxt/bnxt_en if_bnxt.c, sys/dev/enetc if_enetc.c

iflib: Complete registration failure cleanup

Pre-attach sysctls contain pointers into the iflib context. Any later
registration failure that frees the context must first remove that
sysctl tree.

Failures after a successful IFDI_ATTACH_PRE also did not consistently
call IFDI_DETACH or free the private taskqueue. In particular, routing
a taskqueue creation failure through the context cleanup could free the
driver softc while resources allocated by attach_pre remained live.

Track successful interrupt and queue setup and use one common unwind
path. Invoke IFDI_DETACH with IFNET_WLOCK dropped and release only
resources whose setup completed. Leave a failed IFDI_ATTACH_PRE to
unwind its own partial state, as required by the existing driver
contract.

A failed post-attach can follow driver registration of an SR-IOV
schema. Remove that registration before detaching the interface and

    [30 lines not shown]
DeltaFile
+114-37sys/net/iflib.c
+7-3sys/dev/enetc/if_enetc.c
+7-2sys/dev/bnxt/bnxt_en/if_bnxt.c
+5-3sys/dev/vmware/vmxnet3/if_vmx.c
+3-2sys/dev/igc/if_igc.c
+2-0sys/dev/ixgbe/if_sriov.c
+138-471 files not shown
+139-477 files

FreeBSD/src 4fba783sys/net iflib.c

iflib: drain admin task and fix teardown order on register failure

When IFDI_ATTACH_POST() fails (or netmap attach fails), iflib tears down with
ether_ifdetach(), taskqueue_free(ifc_tq), and IFDI_DETACH(). CTX_LOCK is still
held after ether_ifattach. ether_ifdetach() and taskqueue_drain(admin) must not
run under CTX_LOCK.

Teardown ordering (match iflib_device_deregister):

- Free the per-interface admin taskqueue after IFDI_DETACH / IFDI_QUEUES_FREE, not before.
- Drop IFNET_WLOCK() across IFDI_DETACH / IFDI_QUEUES_FREE so driver detach can sleep in
LinuxKPI workqueue drain, then retake IFNET_WLOCK() before iflib_free_intr_mem and fail_unlock.

Reviewed by:    gallatin, kgalazka, #iflib
Differential Revision: https://reviews.freebsd.org/D56316

(cherry picked from commit 439132310ae1f623f6c0a3dc241d0a34e98e040b)
DeltaFile
+18-1sys/net/iflib.c
+18-11 files

FreeBSD/src 0fdbbfbsys/net iflib.c

iflib: Fix panic observed while doing sysctl -a with if_bnxt unload

Observed below kernel panic calltrace while performing sysctl -a
operation while unloading the if_bnxt driver,

Fatal trap 9: general protection fault while in kernel mode

KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe02a7569940
vpanic() at vpanic+0x136/frame 0xfffffe02a7569a70
panic() at panic+0x43/frame 0xfffffe02a7569ad0
trap_fatal() at trap_fatal+0x68/frame 0xfffffe02a7569af0
calltrap() at calltrap+0x8/frame 0xfffffe02a7569af0

trap 0x9, rip = 0xffffffff80c0b411, rsp = 0xfffffe02a7569bc0, rbp = 0xfffffe02a7569be0 ---
sysctl_handle_counter_u64() at sysctl_handle_counter_u64+0x61/frame 0xfffffe02a7569be0
sysctl_root_handler_locked() at sysctl_root_handler_locked+0x9c/frame 0xfffffe02a7569c30
sysctl_root() at sysctl_root+0x22f/frame 0xfffffe02a7569cb0
userland_sysctl() at userland_sysctl+0x196/frame 0xfffffe02a7569d50

    [23 lines not shown]
DeltaFile
+24-21sys/net/iflib.c
+24-211 files

FreeBSD/src c869a36sys/kern kern_rangelock.c

rangelock: Fix format strings for 32-bit kernels

Reported by:    Jenkins
Fixes:          f1f58bdf7b5f ("acpi_pci: Honor device proximity for DMA tags")
DeltaFile
+4-4sys/kern/kern_rangelock.c
+4-41 files

FreeBSD/src 14df6e1usr.bin/fortune/fortune fortune.6 fortune.c

fortune: fall back to all databases if fortunes is missing

With no file argument, fortune looks for a database named fortunes
in FORTDIR. The base system has not shipped that file since
0538d7bbe620 (FreeBSD 12), only freebsd-tips, so the default
invocation failed even though a valid database remained. Callers
such as xlockmore's marquee and nose modes (fortune -s) then
displayed the error as the epigram.

If the named fortunes file is absent, scan every database in the
existing search path. /usr/local/share/games/fortune stays on that
path so fortune-mod-* packages keep working; when
fortune-mod-freebsd-classic restores the fortunes file, it is still
preferred. fortune -f with no arguments lists the same files that
would be searched.

MFC after:      1 week

Reviewed by:    ziaee, fuz
Differential Revision:  https://reviews.freebsd.org/D59057
DeltaFile
+20-26usr.bin/fortune/fortune/fortune.c
+13-3usr.bin/fortune/fortune/fortune.6
+33-292 files

FreeBSD/src 151d7a8sys/conf newvers.sh

14.5: Update to RC1

Approved by:    re (implicit)
Sponsored by:   OpenSats Initiative
DeltaFile
+1-1sys/conf/newvers.sh
+1-11 files

FreeBSD/src b503d9erelease/pkg_repos release-dvd.conf

Switch from "quarterly" to "release" pkgs on DVD

Approved by:    re (implicit)
Sponsored by:   OpenSats Initiative
DeltaFile
+1-1release/pkg_repos/release-dvd.conf
+1-11 files

FreeBSD/src 2e376ccsys/kern uipc_shm.c kern_rangelock.c

rangelock: Reimplement _rangelock_cookie_assert()

After rangelocks were reimplemented, _rangelock_cookie_assert() became a
stub.  Re-provide an implementation.

Reviewed by:    kib
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D59222
DeltaFile
+52-0sys/kern/kern_rangelock.c
+3-3sys/kern/uipc_shm.c
+55-32 files

FreeBSD/src 1f20ac6usr.sbin/pkg FreeBSD.conf.quarterly-release

Revert "Remove minor version from kmods repo"

We now have kmod repositories built on releng/14.5 for amd64, arm64,
and i386.

This reverts commit 19a1025e1c0cbd6b1cd57d78826d42eeafbdaed0.

Approved by:    re (cperciva)
DeltaFile
+1-1usr.sbin/pkg/FreeBSD.conf.quarterly-release
+1-11 files

FreeBSD/src 5805e0eusr.bin/xinstall xinstall.c, usr.bin/xinstall/tests install_test.sh

install: Fix two bugs in stdin code

* Fix case where the source is - and the target exists.

* Only call chflags() (to remove flags that might prevent us from
  replacing an existing target) in the exists case; otherwise,
  to_sb.st_flags is uninitialized.

* Rename the source file in the stdin test case.

* Extend null and stdin test cases to cover the case where the
  target already exists.

Approved by:    re (cperciva)
PR:             297681
MFC after:      1 week
Fixes:          d34870708db9 ("install: Allow installing stdin")
Reviewed by:    markj
Differential Revision:  https://reviews.freebsd.org/D59144

    [3 lines not shown]
DeltaFile
+17-7usr.bin/xinstall/tests/install_test.sh
+3-3usr.bin/xinstall/xinstall.c
+20-102 files

FreeBSD/src f1f58bdsys/dev/acpica acpi_pci.c

acpi_pci: Honor device proximity for DMA tags

A PCI function with its own _PXM still inherits a DMA tag carrying
the upstream bridge's proximity domain. Resolving an SR-IOV VF's
locality through its PF therefore does not affect the domain used for
DMA allocations.

Create and cache a private child tag when the function, or a VF's
owning PF, has an explicit _PXM. Parent it to the existing PCI or IOMMU
tag so its constraints remain intact, then apply the function's domain
without mutating a shared tag.

pci_get_dma_tag() already performs the IOMMU lookup, so remove the
duplicated lookup in the ACPI subclass while here.

Reviewed by:    jhb
MFC after:      2 weeks
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59063
DeltaFile
+36-20sys/dev/acpica/acpi_pci.c
+36-201 files

FreeBSD/src 5f78d02sys/dev/acpica acpivar.h acpi.c

acpi_pci: Cache PCI proximity domains

A PCI function's _PXM is stable for the lifetime of its device
instance, but CPU and DMA locality queries may evaluate it repeatedly.
SR-IOV amplifies this because every VF resolves locality through the
same PF.

Cache successful mappings and the stable absence of _PXM on the
locality source device, and share that result between CPU and domain
queries. Continue to retry generic evaluation or mapping errors rather
than making a potentially transient failure permanent.

Reviewed by:    jhb
MFC after:      2 weeks
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59207
DeltaFile
+32-5sys/dev/acpica/acpi_pci.c
+15-7sys/dev/acpica/acpi.c
+3-0sys/dev/acpica/acpivar.h
+50-123 files

FreeBSD/src dc4f80dsys/dev/acpica acpi_pci.c

acpi_pci: Preserve CPU locality queries for descendants

bus_generic_get_cpus() preserves the original leaf device while
forwarding a request through the bus hierarchy. Consequently,
acpi_pci_get_cpus() may receive a descendant below a PCI function
rather than one of the PCI bus's direct children.

Only apply the SR-IOV PF-locality mapping to direct PCI children.
Preserve the previous ACPI CPU-locality lookup for descendants so their
unrelated bus ivars are not interpreted as PCI device information.

Reviewed by:    jhb
MFC after:      2 weeks
Sponsored by:   BBOX.io
Differential Revision:  https://reviews.freebsd.org/D59206
DeltaFile
+3-0sys/dev/acpica/acpi_pci.c
+3-01 files

FreeBSD/src d5016a8sys/sys videoio.h

video: add V4L2 cropping, control menu and overlay symbols

Adds missing structs symbols for V4L2.

video(4) capture devices do not crop, expose menu controls or support
overlay, and return ENOTTY for the new ioctls.
Applications enumerate these unconditionally and degrade gracefully
at run time, but fail to build when the declarations are missing.

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D59203
DeltaFile
+73-0sys/sys/videoio.h
+73-01 files

FreeBSD/src 51c3018. UPDATING, sys/sys param.h

video: bump __FreeBSD_version for V4L2 cropping and overlay symbols

Reviewed by:    adrian
Differential Revision:  https://reviews.freebsd.org/D59208
DeltaFile
+5-0UPDATING
+1-1sys/sys/param.h
+6-12 files

FreeBSD/src fef9077sys/netipsec keysock.c

netipsec: Implement pr_disconnect for PF_KEY sockets

Otherwise close() fails.

PR:             297977
Reviewed by:    glebius
Fixes:          ea7be1293b48 ("keysock: do not use raw socket code")
MFC after:      1 week
DeltaFile
+7-0sys/netipsec/keysock.c
+7-01 files

FreeBSD/src 8f0789btests/sys/pmc Makefile pmc_log_test.c

hwpmc tests: the sampling log file

Nine ATF cases covering PMC_OP_CONFIGURELOG and the descriptor-less
log operations: which descriptors are accepted, when a log is required
in the first place, and what the log operations do without one.

MFC after:      1 month
MFC to:         stable/15
MFC to:         stable/14
Assisted-by:    Claude Code (Opus 5)
DeltaFile
+453-0tests/sys/pmc/pmc_log_test.c
+1-0tests/sys/pmc/Makefile
+454-02 files

FreeBSD/src bea7b93tests/sys/pmc Makefile pmc_credexec_test.c

hwpmc: add credential-transition exec tests (keep and drop)

The companion to pmc_exec_test.c, which covers only the drop side of a
credential-changing exec.  Three cases cover what the drop must not
overreach into: an exec that changes no credentials keeps the PMC, a
set-id exec whose credential change the kernel suppresses for a traced
target keeps it too, and a set-id fexecve(2) drops it.  They exercise
the permission logic FreeBSD-SA-26:56.hwpmc reworked, not the defect
it fixed.

All three pass on a debug (INVARIANTS+WITNESS) kernel.  The two
keep-cases were each observed to fail on a kernel mutated to detach
unconditionally.

MFC after:      1 month
MFC to:         stable/15
MFC to:         stable/14
Assisted-by:    Claude Code (Opus 4.8)
DeltaFile
+348-0tests/sys/pmc/pmc_credexec_test.c
+1-0tests/sys/pmc/Makefile
+349-02 files

FreeBSD/src d00da14tests/sys/pmc Makefile pmc_lifecycle_test.c

hwpmc tests: process-attachment lifecycle and ownership cases

Seven ATF cases covering process-attachment teardown orderings: a
target that exits before it is detached, the owner that exits before
its target (hwpmc's other unlink path), releasing a still-running
attached PMC, row exhaustion with out-of-order release, and
PMC_F_DESCENDANTS inheritance including a fork storm.

All pass on a debug (INVARIANTS+WITNESS) and a KASAN kernel.

MFC after:      1 month
MFC to:         stable/15
MFC to:         stable/14
Assisted-by:    Claude Code (Opus 5)
DeltaFile
+436-0tests/sys/pmc/pmc_lifecycle_test.c
+1-0tests/sys/pmc/Makefile
+437-02 files