FreeBSD/src 515fa5fsys/geom geom_vfs.c

geom/geom_vfs.c: use EXTERROR_KE() in g_vfs_strategy for ENXIOs

As an example of use for the bp_exterr infrastructure.

Reviewed by:    mckusick
Sponsored by:   The FreeBSD Foundation
Differential revision:  https://reviews.freebsd.org/D53351
DeltaFile
+2-0sys/geom/geom_vfs.c
+2-01 files

FreeBSD/src 6c406b5sys/geom geom_subr.c geom_disk.c, sys/kern vfs_bio.c

exterror(9): add infra for bufs and bios

The extended error can be stored in either struct bio or struct buf,
indicated by BIO_EXTERR bio_flag.  At some strategic places, it is
copied into the current thread extended error.

This structure is required because io request from the top might pass
down through several io threads and the context that can report meaningful
extended error does not belong to the thread that initiated the io.

Sizes before the change, on amd64 nodebug:
sizeof(struct buf) =  456
sizeof(struct bio) = 376

after:
sizeof(struct buf) =  496
sizeof(struct bio) = 408

WIP: more geom providers should handle BIO_EXTERR when passing cloned

    [5 lines not shown]
DeltaFile
+11-4sys/kern/vfs_bio.c
+8-2sys/geom/geom_subr.c
+9-1sys/sys/buf.h
+8-2sys/geom/geom_disk.c
+6-1sys/geom/geom_vfs.c
+6-1sys/sys/bio.h
+48-112 files not shown
+54-118 files

FreeBSD/src 069e2fbsys/kern sys_generic.c, sys/sys exterrvar.h

exterror(9): add two helpers

The exterr_set_from() function sets current thread extended error from
the pre-filled struct kexterr.

The exterr_clear() function clears some struct kexterr.

Reviewed by:    mckusick
Sponsored by:   The FreeBSD Foundation
Differential revision:  https://reviews.freebsd.org/D53351
DeltaFile
+19-0sys/kern/sys_generic.c
+2-0sys/sys/exterrvar.h
+21-02 files

FreeBSD/src 7746b51sys/sys exterrvar.h

exterror(9): add SETEXTERROR_KE() macro

It fills the extended error data into explicitly passed pointer to the
struct kexterr instead of td_kexterr for current thread.

Reviewed by:    mckusick
Sponsored by:   The FreeBSD Foundation
Differential revision:  https://reviews.freebsd.org/D53351
DeltaFile
+20-0sys/sys/exterrvar.h
+20-01 files

FreeBSD/src 58e5f3bsys/dev/mmc mmcsd.c, sys/dev/nvme nvme_ns.c

sys/: rename bio_error variable to abio_error

to prevent future name collision with some buf/bio macros

Reviewed by:    mckusick
Sponsored by:   The FreeBSD Foundation
Differential revision:  https://reviews.freebsd.org/D53351
DeltaFile
+7-7sys/dev/nvme/nvme_ns.c
+5-5sys/kern/vfs_aio.c
+4-4sys/dev/mmc/mmcsd.c
+16-163 files

FreeBSD/src fe2e534sbin/ifconfig ifbridge.c

ifconfig: Fix invalid free() in ifbridge

parse_vlans() does 's = strdup(str)', then calls strsep(&s, ...), then
attempts to free(s) at the end of the function.  For the success case,
this is fine (s is NULL, so it's a trivial memory leak), but in the
error case, we will attempt to free an invalid pointer.

Fix this by storing the original return value from strdup() and freeing
that instead.

MFC after:      3 seconds
Reported by:    David Gwynne <dlg at openbsd.org>
Reviewed by:    zlei, kevans
Sponsored by:   https://www.patreon.com/bsdivy
Differential Revision:  https://reviews.freebsd.org/D53545

(cherry picked from commit 0899f7a3b791ed4878e7cb3859636ec980c76832)
DeltaFile
+5-3sbin/ifconfig/ifbridge.c
+5-31 files

FreeBSD/src 92a081blib/libpam/static_libpam Makefile

static_libpam: Don't install pam.d.5 twice

static_libpam's Makefile includes libpam's Makefile after setting some
variables (like MAN) to empty to avoid installing the manpages twice.
After commit 031e711647c3, it neglected to do this for MANNODEVLINKS,
causing pam.d.5.gz to be installed twice.  This is harmless for
installworld, but breaks some things that rely on METALOG (NO_ROOT
installs) since it causes two METALOG entries to be generated for
the same file.

Fixes:  031e711647c3 ("packages: Install development manpages in the -dev package")
MFC after:      3 days
PR:             290708
Reported by:    emaste
Reviewed by:    emaste
Sponsored by:   https://www.patreon.com/bsdivy
Differential Revision:  https://reviews.freebsd.org/D53512

(cherry picked from commit a1806e6ff37a606277ab9657b951e918164e9f63)
DeltaFile
+1-0lib/libpam/static_libpam/Makefile
+1-01 files

FreeBSD/src 0899f7asbin/ifconfig ifbridge.c

ifconfig: Fix invalid free() in ifbridge

parse_vlans() does 's = strdup(str)', then calls strsep(&s, ...), then
attempts to free(s) at the end of the function.  For the success case,
this is fine (s is NULL, so it's a trivial memory leak), but in the
error case, we will attempt to free an invalid pointer.

Fix this by storing the original return value from strdup() and freeing
that instead.

MFC after:      3 seconds
Reported by:    David Gwynne <dlg at openbsd.org>
Reviewed by:    zlei, kevans
Sponsored by:   https://www.patreon.com/bsdivy
Differential Revision:  https://reviews.freebsd.org/D53545
DeltaFile
+5-3sbin/ifconfig/ifbridge.c
+5-31 files

FreeBSD/src deb684fsys/netpfil/ipfw/pmod tcpmod.c

ipfw: pmod: avoid further rule processing after tcp-mod failures

m_pullup() here will have freed the mbuf chain, but we pass back an
IP_FW_DENY without any signal that the outer loop should finish.  Thus,
rule processing continues without an mbuf and there's a chance that we
conclude that the packet may pass (but there's no mbuf remaining)
depending on the rules that follow it.

PR:             284606
Reviewed by:    ae

(cherry picked from commit c0382512bfce872102d213b9bc2550de0bc30b67)
DeltaFile
+16-9sys/netpfil/ipfw/pmod/tcpmod.c
+16-91 files

FreeBSD/src 9436058sys/netpfil/ipfw/pmod tcpmod.c

ipfw: pmod: avoid further rule processing after tcp-mod failures

m_pullup() here will have freed the mbuf chain, but we pass back an
IP_FW_DENY without any signal that the outer loop should finish.  Thus,
rule processing continues without an mbuf and there's a chance that we
conclude that the packet may pass (but there's no mbuf remaining)
depending on the rules that follow it.

PR:             284606
Reviewed by:    ae

(cherry picked from commit c0382512bfce872102d213b9bc2550de0bc30b67)
DeltaFile
+16-9sys/netpfil/ipfw/pmod/tcpmod.c
+16-91 files

FreeBSD/src 21d55aesys/netpfil/ipfw/pmod tcpmod.c

ipfw: pmod: avoid further rule processing after tcp-mod failures

m_pullup() here will have freed the mbuf chain, but we pass back an
IP_FW_DENY without any signal that the outer loop should finish.  Thus,
rule processing continues without an mbuf and there's a chance that we
conclude that the packet may pass (but there's no mbuf remaining)
depending on the rules that follow it.

PR:             284606
Reviewed by:    ae

(cherry picked from commit c0382512bfce872102d213b9bc2550de0bc30b67)
DeltaFile
+16-9sys/netpfil/ipfw/pmod/tcpmod.c
+16-91 files

FreeBSD/src 8234c18release/tools gce.conf

release: Make fetch happen in GCE images

We want to fetch distfiles, regardless of whether they contain known
vulnerabilities or we're building images for a different version of
FreeBSD.

Reviewed by:    ivy
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D53569
DeltaFile
+3-2release/tools/gce.conf
+3-21 files

FreeBSD/src 05b3a45release/tools gce.conf

release: Don't try to fetch distfiles for pkgbase

In order to comply with the require that GCE images must include their
source code, we fetch distfiles for all of the packages installed into
GCE images.  This fails for obvious reasons for packages with an origin
of base/*; filter those out to generate the list to fetch.

Reviewed by:    ivy
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D53568
DeltaFile
+1-1release/tools/gce.conf
+1-11 files

FreeBSD/src 7f536b1release Makefile.vm

release: GCE builds depend on ftp

GCE images are required by Google to include their source code; we do
this by extracting {src,ports}.txz into the images, from the (legacy)
distribution sets.

Make sure those distribution sets actually exist.

Reviewed by:    ivy
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D53567
DeltaFile
+7-0release/Makefile.vm
+7-01 files

FreeBSD/src 1445291sys/dev/nvme nvme_pci.c nvme_ctrlr.c

nvme: Add handling for bar5

The NVMe spec allows the Table BIR (TBIR) and PBA DIR (PBIR) to
be 0, 4, or 5. The existing NVMe driver basically only has support
for 4, perhaps under the assumption that BAR4 is 64-bit and also
occupies BAR5.

This change adds support for BAR5, covering the case where BAR4
and BAR5 might both be present and 32-bit, where the Table BIR
might be 4 and the PBA BIR might be 5, or vice versa.

The NVMe spec (in the SR-IOV section) also permits VFs to use BIR=2,
so I haven't added stricter checks on which BIR will be permitted
by the driver.

This enables FreeBSD on Google Compute Engine C4 Machines.

Approved by:    re (cperciva)
MFC after:              3 days

    [8 lines not shown]
DeltaFile
+37-11sys/dev/nvme/nvme_pci.c
+7-2sys/dev/nvme/nvme_ctrlr.c
+4-2sys/dev/nvme/nvme_private.h
+48-153 files

FreeBSD/src e2a87c0sbin/ifconfig ifconfig.8

ifconfig.8: Mention max name length

PR:             289113
MFC after:      3 days

(cherry picked from commit 832cd05905980d0f6547bf02745b054c1f4af1eb)
DeltaFile
+3-0sbin/ifconfig/ifconfig.8
+3-01 files

FreeBSD/src 6d6132dlib/geom/shsec gshsec.8

gshsec.8: Fix list alignment, tag spdx

MFC after:      3 days

(cherry picked from commit 05d48584607221922539bb6917c9c118236d78d5)
DeltaFile
+5-2lib/geom/shsec/gshsec.8
+5-21 files

FreeBSD/src 772837cusr.sbin/bhyve bhyve.8

bhyve.8: Correct description for -c flag, tag spdx

The examples only show the usage of `-c <numcpus>`, as did the flag
description, however the -c flag supports more complex cpu topology
specifiers. These were documented correctly in SYNOPSIS, add them to
the body of the DESCRIPTION as well. Someone could go further and do
and example with using them.

MFC after:      3 days (there was a merge conflict with the date)
Event:          OpenZFS Developer Summit '25
Reported by:    Levi Worley <levi at gainframe.com>

(cherry picked from commit 205af037e302fbd50dabc485a89e2222cd063b9e)
DeltaFile
+5-2usr.sbin/bhyve/bhyve.8
+5-21 files

FreeBSD/src 16f37d9usr.bin/cut cut.1

cut.1: Align option list and tag spdx

MFC after:      3 days
DeltaFile
+4-1usr.bin/cut/cut.1
+4-11 files

FreeBSD/src c174f51sbin/geom/core geom.c

Refinements to the --libxo support for geom status and list sub commands.

Changes based on comments in D53110: tags should be lowercase; rename a
few containers so that the JSON/XML output says "DISK" or "MULTIPATH"
(depending on class) instead of a generic "Geom"; adds {t:} to trim
extra whitespaces that sometimes appeared in the value fields of
JSON/XML output.

Submitted-by: Johan Söllvander
MFC-after:    1 week
Differential Revision: https://reviews.freebsd.org/D53313
DeltaFile
+70-55sbin/geom/core/geom.c
+70-551 files

FreeBSD/src 6c321dcsys/dev/nvme nvme_pci.c nvme_ctrlr.c

nvme: Add handling for bar5

The NVMe spec allows the Table BIR (TBIR) and PBA DIR (PBIR) to
be 0, 4, or 5. The existing NVMe driver basically only has support
for 4, perhaps under the assumption that BAR4 is 64-bit and also
occupies BAR5.

This change adds support for BAR5, covering the case where BAR4
and BAR5 might both be present and 32-bit, where the Table BIR
might be 4 and the PBA BIR might be 5, or vice versa.

The NVMe spec (in the SR-IOV section) also permits VFs to use BIR=2,
so I haven't added stricter checks on which BIR will be permitted
by the driver.

This enables FreeBSD on Google Compute Engine C4 Machines.

MFC after:              3 days
Reviewed by:            imp

    [6 lines not shown]
DeltaFile
+37-11sys/dev/nvme/nvme_pci.c
+7-2sys/dev/nvme/nvme_ctrlr.c
+4-2sys/dev/nvme/nvme_private.h
+48-153 files

FreeBSD/src 6a13aearelease/tools vmimage.subr

vmimage.subr: pkg autoremove after pkg install

A bug in pkg, which somehow only surfaced as a consequence of pkgbase,
results in pkg install sometimes pulling in false dependencies.  This
problem might be limited to cases when the lib32 pkgbase packages are
not installed.  In the case of EC2 "small" images, installing the
ebsnvme-id package results in binutils, gcc12-devel, gmp, indexinfo,
liblz4, mpc, mpfr, and zstd packages being installed.

These false dependencies are however not recorded as dependencies --
at some level pkg does understand that they're not needed -- so running
pkg autoremove immediately after pkg install cleans them up.

Note: This does not remove lines from METALOG corresponding to these
packages, and makefs emits an error when it attempts to create the
filesystem but cannot find the files listed in METALOG -- but makefs
does seem to complete normally despite the error messages.

This change should be reverted once the pkg issue has been located and

    [6 lines not shown]
DeltaFile
+9-0release/tools/vmimage.subr
+9-01 files

FreeBSD/src c63166ashare/mk bsd.prog.mk

bsd.prog.mk: Skip warnings if compiler.mk was not included

We emit a warning if src.conf options WITH_RETPOLINE or INIT_ALL are
in use, and the compiler or linker does not support the feature.

For targets like `cleandir` we skip including bsd.compiler.mk, which
leaves COMPILER_FEATURES unset and spurious warnings were emitted in
early buildworld stages, if these options are in use.

Commit 0837b2ebd570 ("pkg: Die if make -V BRANCH fails") added -W to
usr.sbin/pkg's make flags, causing it to exit on warnings.  As a result
buildworld failed when these src.conf options were in use.

Clean this up by omitting the warning if the magic
_NO_INCLUDE_COMPILERMK flag is set, which indicates that
COMPILER_FEATURES is not set.

Reviewed by:    imp
Sponsored by:   The FreeBSD Foundation

    [4 lines not shown]
DeltaFile
+6-0share/mk/bsd.prog.mk
+6-01 files

FreeBSD/src 83a23cesys/dev/ice ice_drv_info.h

ice(4): Add support for E835-XXV-4 adapter

Add subdevice ID and branding string for E835-XXV-4
adapter.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka at intel.com>

Approved by:    re (cperciva)
Approved by:    kbowling (mentor), erj (mentor)
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D53319

(cherry picked from commit 09b48f811b4bf3a17485680b4720d1c0a81bbe07)
(cherry picked from commit b59a9230a6a824e9e63864677784deccf2b676c6)
DeltaFile
+3-0sys/dev/ice/ice_drv_info.h
+3-01 files

FreeBSD/src 99fdcacsys/dev/ice ice_drv_info.h ice_devids.h

ice(4): Add PCI IDs for E835 devices

Add device IDs and branding strings for E835 adapters.
This is a follow up for E830 adapters with Security Protocol
and Data Model (SPDM) support and RDMA support available
on 100 and 200Gbps links.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka at intel.com>

Approved by:    re (cperciva)
Approved by:    kbowling (mentor), erj (mentor)
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D52782

(cherry picked from commit b202176dc76d862f886778439b96dd1243d8b999)
(cherry picked from commit 16004d2a9eee3bac4a4552d66e30e1089e08d518)
DeltaFile
+39-0sys/dev/ice/ice_drv_info.h
+18-0sys/dev/ice/ice_devids.h
+9-0sys/dev/ice/ice_common.c
+66-03 files

FreeBSD/src 97fa2bfsys/dev/ixl ixl_pf_main.c if_ixl.c

ixl(4): fix multicast promiscuous mode state tracking and filter management

This change reapplies the improvements from commit 89e7335 and adds
additional fixes and code optimizations on top of it.

The ixl driver supports up to 128 multicast filters in hardware. When this
limit is exceeded, the driver should enable multicast promiscuous mode.
When the count drops below 128, it should disable promiscuous mode and
restore individual filters.

The driver previously had problems that could corrupt multicast filters list.
The main issue was that ixl_dis_multi_promisc() would attempt to disable
promiscuous mode without checking if it was actually enabled, potentially
corrupting existing filters. There was also no state tracking across driver
functions, leading to redundant operations.

This change adds an IXL_FLAGS_MC_PROMISC flag to track the multicast
promiscuous mode state. The flag is set when enabling promiscuous mode and
cleared when disabling it. Early return checks prevent redundant operations

    [14 lines not shown]
DeltaFile
+94-16sys/dev/ixl/ixl_pf_main.c
+25-2sys/dev/ixl/if_ixl.c
+1-0sys/dev/ixl/ixl.h
+120-183 files

FreeBSD/src 1d4a308sys/dev/e1000 if_em.c e1000_osdep.h

igb(4): Fix out-of-bounds register access on VFs

Virtual Functions have access to a limited number of registers,
and their bus space size is lower. Use KASSERT to detect out-of-bounds
access and eliminate them to avoid kernel panics in production
environment.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka at intel.com>

Approved by:    re (cperciva)
Reviewed by:    jmg
Tested by:      mateusz.moga_intel.com
Approved by:    kbowling (mentor), erj (mentor)
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D52976

(cherry picked from commit 2c02e6ca7154593d214b62578f67d9fe7db23d70)
(cherry picked from commit 9d84e9cba12dad082e0b4bc8dace80a0f09dc950)
DeltaFile
+47-36sys/dev/e1000/if_em.c
+33-13sys/dev/e1000/e1000_osdep.h
+80-492 files

FreeBSD/src 6bbf1d2share/mk bsd.prog.mk

bsd.prog.mk: Skip warnings if compiler.mk was not included

We emit a warning if src.conf options WITH_RETPOLINE or INIT_ALL are
in use, and the compiler or linker does not support the feature.

For targets like `cleandir` we skip including bsd.compiler.mk, which
leaves COMPILER_FEATURES unset and spurious warnings were emitted in
early buildworld stages, if these options are in use.

Commit 0837b2ebd570 ("pkg: Die if make -V BRANCH fails") added -W to
usr.sbin/pkg's make flags, causing it to exit on warnings.  As a result
buildworld failed when these src.conf options were in use.

Clean this up by omitting the warning if the magic
_NO_INCLUDE_COMPILERMK flag is set, which indicates that
COMPILER_FEATURES is not set.

Approved by:    re (cperciva)
Reviewed by:    imp

    [5 lines not shown]
DeltaFile
+4-0share/mk/bsd.prog.mk
+4-01 files

FreeBSD/src 258cc34share/man/man9 bus_attach_children.9

bus_attach_children.9: fix typo

s/DEVICE_ATTACH/DEVICE_DETACH

Approved by:    re (cperciva)
Reviewed by:    ziaee
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D53449

(cherry picked from commit 9b9c726df1e214afa122873395a3ac32dd80ae6b)
(cherry picked from commit c14f97c16b59422ddfd43d9a677f9360004bc23b)
DeltaFile
+1-1share/man/man9/bus_attach_children.9
+1-11 files

FreeBSD/src c3f3b96sys/fs/fuse fuse_device.c, tests/sys/fs/fusefs notify.cc mockfs.hh

fusefs: fix page fault triggered by async notification when unmounted

A FUSE daemon can send asynchronous notification to the kernel in order
to, for example, invalidate an inode's cache.  Fix a page fault that can
happen if the file system isn't yet mounted, or is already unmounted,
when that notification arrives.

Approved by:    re (cperciva)
PR:             290519
Reviewed by:    emaste
Differential Revision: https://reviews.freebsd.org/D53356

(cherry picked from commit 5d42c8813976af484fd3e9a896c7839ba27ca764)
(cherry picked from commit 25e368c4dad3df37184258eac5809ad7791e71c4)
DeltaFile
+56-0tests/sys/fs/fusefs/notify.cc
+7-0sys/fs/fuse/fuse_device.c
+3-1tests/sys/fs/fusefs/mockfs.hh
+3-1tests/sys/fs/fusefs/mockfs.cc
+69-24 files