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
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]
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
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
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
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)
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)
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
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)
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)
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)
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
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
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
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]
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)
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
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]
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]
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]
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)
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]
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)
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]
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)