FreeBSD/src 4c4bad4sys/kern kern_event.c

kqueue: avoid closing a file under the knlist lock

Killing a knote releases its file reference, and releasing the last one
runs the close path inline.
 panic: _mtx_lock_sleep: recursed on non-recursive mutex ttymtx

Revoking a controlling tty during exit reaches this whenever a knote is
still registered on it.

Released the knlist lock around the drop and restart the walk.
The knote stays valid while the lock is released.

MFC: 1 week

Reviewed by:    kib
Differential Revision:  https://reviews.freebsd.org/D58681
DeltaFile
+8-0sys/kern/kern_event.c
+8-01 files

FreeBSD/src e79f6aasys/contrib/dev/ath/ath_hal/ar9300 ar9300_paprd.c

ath: return error code of HAL_STATUS type

Found with:     clang -Werror=assign-enum
DeltaFile
+1-1sys/contrib/dev/ath/ath_hal/ar9300/ar9300_paprd.c
+1-11 files

FreeBSD/src 2ae8976sys/dev/ocs_fc ocs_hw.c

ocs_fc: return correct error code from ocs_hw_set_persistent_topology()

No functional change, as current callers either don't check the return
value or check it against OCS_HW_RTN_SUCCESS only.

Found with:     clang -Werror=assign-enum
DeltaFile
+3-3sys/dev/ocs_fc/ocs_hw.c
+3-31 files

FreeBSD/src 3d064b7lib/libc/tests/stdlib/libatexit libatexit.cc

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: 285870
Fixes: ee9ce1078 ("libc: tests: add some tests for __cxa_atexit...")
Signed-off-by: Zhang Qiyue <peter-open-source.probing805 at aleeas.com>
Reviewed-by: ngie
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2321
(cherry picked from commit 64038db825d64fb4827fc8ee264ea0fa1a046d82)
DeltaFile
+1-1lib/libc/tests/stdlib/libatexit/libatexit.cc
+1-11 files

FreeBSD/src 891d636lib/libc/tests/stdlib/libatexit libatexit.cc

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: 285870
Fixes: ee9ce1078 ("libc: tests: add some tests for __cxa_atexit...")
Signed-off-by: Zhang Qiyue <peter-open-source.probing805 at aleeas.com>
Reviewed-by: ngie
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2321
(cherry picked from commit 64038db825d64fb4827fc8ee264ea0fa1a046d82)
DeltaFile
+1-1lib/libc/tests/stdlib/libatexit/libatexit.cc
+1-11 files

FreeBSD/src 9d76545sys/dev/usb/wlan if_urtw.c

urtw: return error of usb_error_t

Found with:     clang -Werror=assign-enum
DeltaFile
+1-1sys/dev/usb/wlan/if_urtw.c
+1-11 files

FreeBSD/src 6a15fd9sys/compat/linuxkpi/common/include/linux ieee80211.h

linuxkpi: add WLAN_EID_HT_OPERATION to ieee80211_eid

It matches our IEEE80211_ELEMID_HTINFO, that is already in use.

Found with:     clang -Werror=assign-enum
DeltaFile
+1-0sys/compat/linuxkpi/common/include/linux/ieee80211.h
+1-01 files

FreeBSD/src d2a9eefsys/dev/mpt mpt_raid.h mpt_raid.c

mpt: mpt_map_physdisk() is internal and shall not return cam_status

Found with:     clang -Werror=assign-enum
DeltaFile
+1-1sys/dev/mpt/mpt_raid.h
+1-1sys/dev/mpt/mpt_raid.c
+2-22 files

FreeBSD/src 2e04d98crypto/openssl/exporters openssl.pc libssl.pc

crypto/openssl: correct version numbers for pkg-config files

The files were incorrectly reporting 3.5.1 instead of 3.0.21.

This is a direct commit to stable/14 as stable/15 and later are on
OpenSSL 3.5.

PR:     297144
Fixes:  d03be8cf ("crypto/openssl: make vendor imports easier/less error prone")
DeltaFile
+1-1crypto/openssl/exporters/openssl.pc
+1-1crypto/openssl/exporters/libssl.pc
+1-1crypto/openssl/exporters/libcrypto.pc
+3-33 files

FreeBSD/src 6de8182sys/dev/netmap netmap_freebsd.c

netmap: Fix a race in kqueue registration

We need to acquire the netmap global lock earlier, to avoid racing with
the NETMAP_REQ_REGISTER ioctl handler.

Reported by:    syzkaller
Reviewed by:    vmaffione
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58677
DeltaFile
+6-6sys/dev/netmap/netmap_freebsd.c
+6-61 files

FreeBSD/src 319414asys/dev/netmap netmap_mem2.c

netmap: Handle overflow when computing ring sizes

PR:             297300
Reported by:    Robert Morris
Reported by:    syzkaller
Reviewed by:    vmaffione
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58678
DeltaFile
+18-4sys/dev/netmap/netmap_mem2.c
+18-41 files

FreeBSD/src 800d5b7sys/dev/netmap netmap_kern.h netmap_vale.c

netmap: Fix driver name handling

if_initname() requires the caller to ensure that the lifetime of the
interface's name buffer contains that of the ifnet itself.
netmap_vi_create() wasn't respecting that; we were instead passing the
stack-allocated buffer provided by the ioctl handler.

While here, add a check to avoid assuming that the caller-provided
buffer is nul-terminated.

Reported by:    syzkaller
Reviewed by:    vmaffione
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D58676
DeltaFile
+18-6sys/dev/netmap/netmap_vale.c
+3-0sys/dev/netmap/netmap_kern.h
+21-62 files

FreeBSD/src 51f5623sys/geom/zero g_zero.c

geom_zero(4): reset the uio vector on each uiomove()

PR:     297062

(cherry picked from commit 34ca5a9e7362b0c820fe339daa2b8d06c58b6fea)
DeltaFile
+6-5sys/geom/zero/g_zero.c
+6-51 files

FreeBSD/src f68ca7crelease/pkg_repos release-dvd.conf, release/scripts pkg-stage.sh

Revert "release: Ship firmware from kmods repo on DVD"

This was a good idea, but we don't build metapackages in the kmods
repo so it ends up breaking the release build.  I might resurrect this
change if/when the kmods repo includes the wifi-firmware-kmod
metapackage.

This reverts commit bda8028146694ee490543b35e3349e060936fde4.

MFC after:      1 second
Approved by:    re (cperciva)

(cherry picked from commit ca0cff79320d49d3f10bd3aa3c472fa450a5c494)
(cherry picked from commit daf81f32f834f8619dceca745758983ccc767866)
DeltaFile
+7-18release/scripts/pkg-stage.sh
+0-7release/pkg_repos/release-dvd.conf
+7-252 files

FreeBSD/src daf81f3release/pkg_repos release-dvd.conf, release/scripts pkg-stage.sh

Revert "release: Ship firmware from kmods repo on DVD"

This was a good idea, but we don't build metapackages in the kmods
repo so it ends up breaking the release build.  I might resurrect this
change if/when the kmods repo includes the wifi-firmware-kmod
metapackage.

This reverts commit bda8028146694ee490543b35e3349e060936fde4.

MFC after:      1 second

(cherry picked from commit ca0cff79320d49d3f10bd3aa3c472fa450a5c494)
DeltaFile
+7-18release/scripts/pkg-stage.sh
+0-7release/pkg_repos/release-dvd.conf
+7-252 files

FreeBSD/src fdd93a3release/pkg_repos release-dvd.conf, release/scripts pkg-stage.sh

Revert "release: Ship firmware from kmods repo on DVD"

This was a good idea, but we don't build metapackages in the kmods
repo so it ends up breaking the release build.  I might resurrect this
change if/when the kmods repo includes the wifi-firmware-kmod
metapackage.

This reverts commit bda8028146694ee490543b35e3349e060936fde4.

MFC after:      1 second

(cherry picked from commit ca0cff79320d49d3f10bd3aa3c472fa450a5c494)
DeltaFile
+7-18release/scripts/pkg-stage.sh
+0-7release/pkg_repos/release-dvd.conf
+7-252 files

FreeBSD/src ca0cff7release/pkg_repos release-dvd.conf, release/scripts pkg-stage.sh

Revert "release: Ship firmware from kmods repo on DVD"

This was a good idea, but we don't build metapackages in the kmods
repo so it ends up breaking the release build.  I might resurrect this
change if/when the kmods repo includes the wifi-firmware-kmod
metapackage.

This reverts commit bda8028146694ee490543b35e3349e060936fde4.

MFC after:      1 second
DeltaFile
+7-18release/scripts/pkg-stage.sh
+0-7release/pkg_repos/release-dvd.conf
+7-252 files

FreeBSD/src 2d25276lib/libifconfig libifconfig.c, sys/net rtsock.c

sys/socket.h: Fix AF_MAX

AF_MAX was always intended to be one more than the greatest allocated
value.  Jeff broke this in 2013.  Unfortunately, a bunch of people then
decided to adapt to the mistake instead of correcting it.

Fixes:          863c7e45628d (" - Reserve a special AF for SDP.  The one we were incorrectly using before    was taken by another AF.")
MFC after:      3 days
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
Reviewed by:    kevans, glebius
Differential Revision:  https://reviews.freebsd.org/D58597

(cherry picked from commit ddd850aa7720f77b6605599655df898b16ed74cc)
DeltaFile
+3-3sys/netlink/route/rt.c
+2-2sys/net/rtsock.c
+2-2sys/net/route/route_helpers.c
+2-2lib/libifconfig/libifconfig.c
+3-1sys/sys/socket.h
+1-1sys/net/route/route_ddb.c
+13-113 files not shown
+16-149 files

FreeBSD/src 7d8fc2asys/sys mbuf.h

mbuf: Parenthesize macro arguments

MFC after:      1 week
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.

(cherry picked from commit 744cc514567d33d38986f0ff7de009f786acc180)
DeltaFile
+1-1sys/sys/mbuf.h
+1-11 files

FreeBSD/src c0f8920lib/libifconfig libifconfig.c, sys/net rtsock.c

sys/socket.h: Fix AF_MAX

AF_MAX was always intended to be one more than the greatest allocated
value.  Jeff broke this in 2013.  Unfortunately, a bunch of people then
decided to adapt to the mistake instead of correcting it.

Fixes:          863c7e45628d (" - Reserve a special AF for SDP.  The one we were incorrectly using before    was taken by another AF.")
MFC after:      3 days
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.
Reviewed by:    kevans, glebius
Differential Revision:  https://reviews.freebsd.org/D58597

(cherry picked from commit ddd850aa7720f77b6605599655df898b16ed74cc)
DeltaFile
+3-3sys/netlink/route/rt.c
+2-2sys/net/rtsock.c
+2-2sys/net/route/route_helpers.c
+2-2lib/libifconfig/libifconfig.c
+3-1sys/sys/socket.h
+1-1sys/net/route/route_ddb.c
+13-113 files not shown
+16-149 files

FreeBSD/src bcee81bsys/sys mbuf.h

mbuf: Parenthesize macro arguments

MFC after:      1 week
Sponsored by:   Klara, Inc.
Sponsored by:   NetApp, Inc.

(cherry picked from commit 744cc514567d33d38986f0ff7de009f786acc180)
DeltaFile
+1-1sys/sys/mbuf.h
+1-11 files

FreeBSD/src 8ce50d7lib/libc/stdbit stdc_first_leading_zero.3, lib/libc/stdlib memalignment.3

manuals: Fix more Fx and nearby mechanical typos

Fix compiler warnings related to the Fx macro, as well as all other
mechanical typos that were visible within one screenful of them. These
cause rendering glitches on various toolchains with various of the five
and a half decades of rich output formats and tooling manpages scale to.

The *x macro set specifies operating systems. These macros take the rest
of the line as an argument. Sometimes, a space was not used to separate
the argument of Fx and the trailing period. Others had other parts of
the sentence supplied as an argument to Fx.

While here, fix the other mechanical typos visible on those specific
screenfulls. Correct section typo AUTHOR to AUTHORS, markup utilities
with Sy, and apply line break after the end of a sentence.

PR:             297248
MFC after:      3 days
Reported by:    wosch (are you sure that's all of the broken Fx'es?)

    [7 lines not shown]
DeltaFile
+11-5share/man/man5/pf.conf.5
+2-2lib/libc/stdlib/memalignment.3
+2-1sbin/route/route.8
+1-1lib/libc/stdbit/stdc_first_leading_zero.3
+16-94 files

FreeBSD/src 6e8f4f4lib/libc/stdbit stdc_trailing_zeros.3 stdc_trailing_ones.3, share/man/man3 stdbit.3

manuals: Fix Fx and nearby mechanical typos

Fix compiler warnings related to the Fx macro, as well as all other
mechanical typos that were visible within one screenful of them. These
cause rendering glitches on various toolchains with various of the five
and a half decades of rich output formats and tooling manpages scale to.

The *x macro set specifies operating systems. These macros take the rest
of the line as an argument. Sometimes, a space was not used to separate
the argument of Fx and the trailing period. Another, FreeBSD Foundation
was misrepresented as an operating system version instead of an author.
Two more had other parts of the sentence supplied as an argument to Fx.

While I had those open, fix the other mechancial typos visible on those
specific screenfulls. Fix a list width glitch, correct section typo
AUTHOR to AUTHORS, and switch AUTHORS sections containing prose to
prose-mode so that they wrap freely when rendered.

PR:             297248

    [7 lines not shown]
DeltaFile
+6-3usr.bin/ipcrm/ipcrm.1
+3-2usr.bin/elfctl/elfctl.1
+2-2share/man/man3/stdbit.3
+2-2lib/libc/stdbit/stdc_trailing_zeros.3
+2-2lib/libc/stdbit/stdc_trailing_ones.3
+2-2lib/libc/stdbit/stdc_leading_zeros.3
+17-1317 files not shown
+48-4023 files

FreeBSD/src aea4240sys/dev/ixgbe ixgbe_sriov.h if_ix.c

ixgbe: Quiesce VFs across PF reset

Stop VF transmit and receive in hardware, clear PF-side mailbox CTS,
and notify active VFs before resetting a PF. A PF reset invalidates VF
queue state, so the no-CTS control message makes cooperative VFs
discard stale state and renegotiate after the PF returns.

The hardware queue gates synchronously prevent further VF DMA. Do not
hold the exclusive iflib context lock for a fixed VF-watchdog interval
after the reset. Report the PF link transition directly instead of
dispatching mailbox work from the stop path, which could otherwise
re-enable VF I/O mid-reset.

The CTS, PF-control, and VF queue controls follow the reset mechanisms
used by DPDK.

MFC after:      2 weeks
DeltaFile
+34-0sys/dev/ixgbe/if_sriov.c
+9-2sys/dev/ixgbe/if_ix.c
+2-0sys/dev/ixgbe/ixgbe_sriov.h
+45-23 files

FreeBSD/src 2a803e6sys/dev/ixgbe if_sriov.c

ixgbe: Use PF MTU for 82599 VF jumbo policy

The shared maximum frame size is raised by VF LPE requests, so it
cannot describe the PF MTU when enforcing the 82599 PF/VF jumbo
restriction. Consult the PF ifnet MTU instead.

Also correct the API 1.1 and later comparison so a jumbo VF is enabled
when, and only when, the PF itself uses a jumbo MTU. This matches the
policy implemented by DPDK.

MFC after:      2 weeks
DeltaFile
+9-6sys/dev/ixgbe/if_sriov.c
+9-61 files

FreeBSD/src d025b84sys/dev/ixgbe if_ix.c

ixgbe: Apply the 82599 D3 link workaround only for D3

ixgbe_stop_mac_link_on_d3_82599() implements the workaround for
82599 erratum 33.  It forces incompatible auto-negotiation settings
before the device enters D3, and reset clears them when returning to
D0.

ixgbe_if_stop() is also used for ordinary interface reconfiguration
and recovery.  Those paths do not enter D3 and should not program
this power-management workaround.  They continue to stop the adapter
and disable the transmit laser.

Move the call to ixgbe_setup_low_power_mode(), after
ixgbe_if_stop().  This preserves the required ordering for detach,
shutdown, and suspend while avoiding the D3 settings during ordinary
restarts.

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

FreeBSD/src 2a2867csys/dev/ixgbe if_ixv.c

ixv: Defer reset after mailbox failure

When link polling loses mailbox clear-to-send or times out, request an
iflib reset instead of continuing with stale VF state.

The driver callback runs after iflib samples reset requests, so requeue
the admin task to make iflib consume the request on its next pass
rather than waiting for an unrelated timer or interrupt.

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

FreeBSD/src 545779asys/dev/ixgbe if_ix.c

ixgbe: Re-enable the SFP laser during initialization

ixgbe_if_stop() disables the transmit laser on every 82599 SFP fiber
port, but the iflib initialization path did not re-enable it. Re-enable
the laser before deferred SFP module setup so interface
reinitialization cannot leave either single-speed or multispeed optics
dark.

The hardware wrapper is a no-op when laser control is unavailable. The
placement follows Intel ix-3.4.39; this version deliberately applies to
every SFP port affected by the stop path.

MFC after:      1 week
DeltaFile
+2-0sys/dev/ixgbe/if_ix.c
+2-01 files

FreeBSD/src 31285bdshare/man/man4 ix.4, sys/dev/ixgbe ixgbe.h ixgbe_sriov.h

ixgbe: quarantine repeatedly faulting legacy VFs

A guest can reinitialize after a VF function-level reset and
repeatedly strand an 82599 or X540 PF with invalid descriptor DMA
targets. Count only distinct Received Master Abort events accepted by
the qualified transmit-stall detector and quarantine the VF after five
events.

Preserve quarantine across PF reinitialization, reject reset mailbox
requests, and keep transmit, receive, and clear-to-send disabled.
Recreating SR-IOV clears quarantine. Expose the affected pools through
a read-only bitmap.

After a successful quarantine FLR, leave the function in post-FLR
configuration, explicitly keep decode and bus mastering disabled,
verify the Command register, and refresh its PCI-layer cache so a later
restore cannot re-enable the function.

This addresses CVE-2021-33061 on 82599. Apply the same bounded-failure

    [6 lines not shown]
DeltaFile
+58-14sys/dev/ixgbe/if_sriov.c
+8-0sys/dev/ixgbe/if_ix.c
+7-0share/man/man4/ix.4
+3-1sys/dev/ixgbe/ixgbe_sriov.h
+3-0sys/dev/ixgbe/ixgbe.h
+79-155 files

FreeBSD/src 78547d5sys/dev/pci pci.c

pci: Skip PF SR-IOV state handling for VFs

A VF's pci_devinfo references its PF's pcicfg_iov for resource
bookkeeping, but only the PF implements the SR-IOV capability.
pci_cfg_save() and pci_cfg_restore() treated any non-NULL cfg.iov as
an owned capability and accessed the PF capability offset in VF
configuration space. Saving a VF could therefore replace the shared
PF settings with unrelated VF register values.

Skip SR-IOV capability save and restore for PCICFG_VF children. The
generic PCI and PCIe state of the VF remains preserved. This is also
required by drivers that save VF state around a PF-driven
function-level reset.

MFC after:      2 weeks
DeltaFile
+6-2sys/dev/pci/pci.c
+6-21 files