Commit graph

2335 commits

Author SHA1 Message Date
Bjoern A. Zeeb
d55b73ac4e iwlwifi: compile in ACPI support
Now that LinuxKPI supports the lower case Linux ACPI spellings under
LINUXKPI_WANT_LINUX_ACPI we only need to provide the debug macro to
allow us to compile in ACPI support.

This ties into regulatory and will be used, e.g., for 11ax, 11be,
and Per Platform Antenna Gain (PPAG) settings.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 228b43c258)
2025-07-16 08:34:34 +02:00
Bjoern A. Zeeb
43bd8bf721 rtw89: enable ACPI support on FreeBSD
Now that LinuxKPI supports the lower case Linux ACPI spellings under
LINUXKPI_WANT_LINUX_ACPI remove the #ifdef around the code and compile in
ACPI support.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 8c97c46418)
2025-07-16 08:34:33 +02:00
Gordon Tetlow
5ee703c5d9 Fix corruption in ZFS replication streams from encrypted datasets.
From the upstream pull request merges:
 #17340 b144b160b Fix 2 bugs in non-raw send with encryption

Obtained from:	OpenZFS
Approved by:	so
Security:	FreeBSD-EN-25:10.zfs
2025-07-10 09:40:58 +02:00
Hareshx Sankar Raj
6f3c8060d5 qat: add disable safe dc mode for QAT SPR devices
Build and sysctl configuration modes are introduced for QAT SPR
devices to disable safe dc mode. A new QAT driver build option
‘QAT_DISABLE_SAFE_DC_MODE’ is required to build the QAT driver
with code that allows a request to be sent to FW to override the
‘History Buffer’ mitigation. Default QAT driver builds do not
include this ‘QAT_DISABLE_SAFE_DC_MODE’ build option. Even if the
QAT driver was built with code that allows a request to be sent to
FW to override the ‘History Buffer’ mitigation, the QAT driver must
still be configured using sysctl to request an override of the
‘History Buffer’ mitigation if desired. The default QAT driver
configuration option sysctl dev.qat.X.disable_safe_dc_mode does not
allow override of the mitigation. The new sysctl attribute
disable_safe_dc_mode is to be set to 1 for overriding the history
buffer mitigation. Firmware for qat_4xxx is updated for this change.
If this mode is enabled, decompression throughput increases but may
result in a data leak if num_user_processes is more than 1.
This option is to be enabled only if your system is not prone to
user data leaks.

Reviewed by:	markj, ziaee
MFC after:	2 weeks
Sponsored by:   Intel Corporation
Differential Revision:  https://reviews.freebsd.org/D50379

(cherry picked from commit 5a8e5215ce)
2025-07-09 10:05:45 +02:00
Bjoern A. Zeeb
6130192db0 fwget / mt76: update script to extra firmware and update fget(8)
Update the script to support all the sub-drivers we compile now.
Some minor polishing as well.

Update fwget(8) as more IDs were added.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 91f53f4e06)
2025-07-09 10:05:43 +02:00
Bjoern A. Zeeb
6298b56637 rtw89: prevent a NULL pointer deref in rtw89_swap_chanctx()
It is currently unclear if this is a result of the driver itself already
or the way LinuxKPI drives channels and the driver simply accepting and
acting on things it no longer should.
For now put the bandaid into place to make the driver work and pass
packets.  For better resilience the check does not hurt anyway.

The moment we enter rtw89_chanctx_ops_add() the first time,
entity_map 0x00000001 has the lowest bit set and find_next_zero_bit()
will return 1. As a result the driver will try to swap chanctxs and
trip over a NULL pointer in rtw89_swap_chanctx().  See comment there
for how to (likely) trigger it.

Sponsored by:	The FreeBSD Foundation
Reported by:	Axel Rau (Axel.Rau Chaos1.DE) with 8852CE

(cherry picked from commit 3a427b8320)
2025-07-09 10:05:43 +02:00
Bjoern A. Zeeb
a6124ca219 iwlwifi: add message how to install firmware on FreeBSD
While it is too late for 14.3-R point people at fwget(8) to install
firmware if the driver cannot find any.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	emaste, ziaee
Differential Revision: https://reviews.freebsd.org/D50777

(cherry picked from commit 8ac82ba19e)
2025-07-09 10:05:43 +02:00
Olivier Certner
de6a4418ee
sysctl(9): Ease exporting struct sizes; Discourage doing that
Introduce two helpers, the more general SYSCTL_SIZEOF() and
a struct-specific one SYSCTL_SIZEOF_STRUCT() which prepends 'struct' in
the description and in the use of sizeof() but uses the raw structure
name as the knob's name.  The size of the object/structure is exported
under 'debug.sizeof'.

Existing knobs under 'debug.sizeof' were all converted to use the
helpers.

Add a note before the helpers discouraging the introduction of new
leaves for ad-hoc reasons.  List alternative means for developers to
obtain the size of arbitrary kernel structures easily (thanks to markj@
for providing these).

No functional change (intended).

Reviewed by:    kib, markj
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D50121

(cherry picked from commit 713abc9880)
(cherry picked from commit efce9f8a510b60736994e50288b78fc7b32b5d90)

Approved by:    re (cperciva)
2025-05-13 14:41:33 +02:00
Bjoern A. Zeeb
8ef4424517 rtw88: merge Realtek's rtw88 driver based on Linux v6.14
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
38fec10eb60d687e30c8c6b5420d86e8149f7557 ( tag: v6.14 ).

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a0ccc12f68)
2025-04-29 22:29:51 +00:00
Bjoern A. Zeeb
b6e8b845ae rtw89: merge Realtek's rtw89 driver based on Linux v6.14
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
38fec10eb60d687e30c8c6b5420d86e8149f7557 ( tag: v6.14 ).

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit df279a26d3)
2025-04-29 22:29:51 +00:00
Bjoern A. Zeeb
92a74b3bce LinuxKPI: 802.11: updates to headers for driver update
Move some structs into the appropriate header to be visible.
Add new fields to structs and enums.

Remove arguments from two functions (one function currently unused
by drivers in the tree, for the other the argument was unused).
Adjust the iwlwifi accordingly.  This is in preparation for new
driver versions to allow a smooth transition.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit e6010da639)
2025-04-29 10:49:32 +00:00
Bjoern A. Zeeb
1be235fcc4 rtw89: make wow.c compile
So far we have not compiled wow.c given we do not enable CONFIG_PM
yet.
Make the necessary file local adjustments to make the file compile
once further changes in LinuxKPI 802.11 code are comitted.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 848fdcae03)
2025-04-29 10:49:27 +00:00
Bjoern A. Zeeb
e569281114 iwlwifi: make mvm/d3.c compile again
Given we currently do not ompile the file by default make it compile
again after the last vendor import.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 52a43041d2)
2025-04-29 10:49:27 +00:00
Bjoern A. Zeeb
42be6050ce iwlwififw: remove Intel iwlwifi firmware from src.git
Following the example of rtw88 and rtw89 only ship iwlwifi firmware
from ports/packages.  Users are asked to run fwget(8) to install the
firmware needed for their system or build it from ports
(see also UPDATING).

This is the end of a long story adding wireless support to fwget(8),
migrating the firmware for multiple branches into ports, splitting them
up into flavors, and updating some install media and the installer to
provide firmware.

The overall amount for new firmware amongst all drivers would have
added more than 100M of binary blobs to src.git for the first import,
ignoring future updates which (along with some duplication between
multiple drivers) was considered too much.

While maintenance within the src tree certainly would have been
easier in the longer term this seems to be the better solution and
I would like to thank everyone who helped along the path to get there.

The iwlwififw.4 man page is to stay (for now) and will likely point
at the appropriate firmware package flavor in the future as well
so people may find it easier to transition.  In the long term this
information is likely not needed anymore.

Sponsored by:	The FreeBSD Foundation
Requested by:	core (Oct 2022)
Reviewed by:	thj, jrm (earlier)
Differential Revision: https://reviews.freebsd.org/D49713

(cherry picked from commit 558d638896)
(cherry picked from commit 918783b75a)
2025-04-18 14:36:03 +00:00
Bjoern A. Zeeb
241fb17574 iwlwifi: fix iwl_uefi_get_uats_table() if not compiled with ACPI
Apply a temporary fix to FreeBSD only to allow AX101 to proceed
further.  While this fix results in a debug error message if
firmware debugging is on we currently take this for the version
we have.  A proper fix will eventually show up in future versions
of iwlwifi.

Sponsored by:	The FreeBSD Foundation
Reported by:	bapt
Tested by:	bapt

(cherry picked from commit 97ddb6371b)
2025-04-18 14:35:59 +00:00
Piotr Kubaj
54a94356c9 zfs: remove inclusion of machine/pcpu.h
It was necessary in the beginning for a definition of curthread,
but in the later versions of the patch turned out to be not needed.

Fixes:	5b02365ac6
Reported by:	mav

(cherry picked from commit a440b544d5)
2025-04-04 22:58:18 +02:00
Piotr Kubaj
1962f96311 zfs: enable FPU on powerpc*
Differential Revision: https://reviews.freebsd.org/D49538

(cherry picked from commit 5b02365ac6)
2025-04-04 22:57:57 +02:00
Bjoern A. Zeeb
84ca9ab010 iwlwifi: adjust a debug comment referring to a PR
A FreeBSD specific comment asked people to report to a PR if they see
this.  By now we got enough feedback and also left this in a release.
Simply point to the PR so people can check the status but not longer
ask to submit a report to the PR.

Sponsored by:	The FreeBSD Foundation
PR:		274382

(cherry picked from commit 4a4eee5533)
2025-03-19 22:22:15 +00:00
Bjoern A. Zeeb
8e406d580c iwlwifi: bring in some of the rs code
Bring in code to call into rs-fw.c functionality for firmware
supported rate select.

Anything before AX200 (firmware matching iwlwiif-[0-9]*.ucode) will
still need further implementation, and so does iwl_mvm_rs_tx_status().
These bits marked with compat.linuxkpi.80211.debug TODO()s for now.

Implement some lindebugfs bits to gather more statistical information.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 3f8cfb8a3a)
2025-02-27 21:03:21 +00:00
Bjoern A. Zeeb
0735e8ddc3 rtw88/rtw89: avoid duplicate top-level directory with debugfs
If people like me having multiple cards in the same system
creating the debugfs dirctory leads to a panic upon attaching
the 2nd card due to the duplicate name.
Rather than using the hard coded driver name, use the device name
(e.g., rtw880, rtw881, rtw882).
This solves two issues: it avoids the duplicate name and we get
individual debugging/statistic information for each card.

Sponsored by:	The FreeBSD Foundation
X-Note:		ath1[01]k and mt76 likely will need a similar change

(cherry picked from commit b4886c4ece)
2025-02-10 14:52:11 +00:00
Bjoern A. Zeeb
9689622f98 rtw88/rtw89: add module_param to enable/disable HT/VHT and EHT
In order to better test HT and VHT support with LinuxKPI add (tunable)
options disabled by default to on-demand enable HT/VHT
and for rtw89 also EHT.

It is expected that we will remove this FreeBSD-specific code again in
the future.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7a5b55e3b4)
2025-02-10 14:52:11 +00:00
Bjoern A. Zeeb
bd42a25673 LinuxKPI: 802.11: turn on debugfs for iwlwifi and rtw88
Make iwlwifi compile with debugfs after the last updates and turn it on
for both iwlwifi and rtw88 in order to be able to get at least some
useful information on driver/firwmare state.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 07f6575585)
2025-02-10 14:52:11 +00:00
Bjoern A. Zeeb
e6698f0614 rtw89: update Realtek's rtw89 driver.
This adds support for the Realtek 8922AE PCI
wireless network (Wi-Fi 7) adapter.

This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
98f7e32f20d28ec452afb208f9cffc08448a2652 ( tag: v6.11 ).

Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 6d67aabd63)
2025-02-10 14:52:07 +00:00
Bjoern A. Zeeb
3de0d1929d rtw88: update Realtek's rtw88 driver.
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
98f7e32f20d28ec452afb208f9cffc08448a2652 ( tag: v6.11 ).

Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 11c53278a8)
2025-02-10 14:52:07 +00:00
Bjoern A. Zeeb
1ff77e61c6 iwlwifi: avoid (hard) hang on loading module
For certain users or chipsets (reports were for CNVi devices but
we are not sure if this is limited or specific to them) loading
if_iwlwifi hangs.

The reason for this is that a SYSINIT (module_load_order()) has not
yet run in this case and the Linux driver tries to load the
chipsets-specific module.  On FreeBSD all supported sub-modules are
part of if_iwlwifi so we do not have to load them separately but
calling into kern_kldload via LinuxKPI request_module while loading
the module gives us a hard hang.

iwlwifi calls request_module_nowait() so we can simply skip over this
and continue and the SYSINIT will do the job later if no other
dependencies fail.

Sponsored by:	The FreeBSD Foundation
PR:		282789
Tested by:	Ruslan Makhmatkhanov, Pete Wright
Differential Revision: https://reviews.freebsd.org/D47994

(cherry picked from commit 87e140a5c6)
(cherry picked from commit 5d09d10707)
2025-02-10 14:52:07 +00:00
Bjoern A. Zeeb
f4e352ef16 iwlwifi: update Intel's iwlwifi/mvm driver.
This version is based on
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
98f7e32f20d28ec452afb208f9cffc08448a2652 ( tag: v6.11 ).

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit a4128aad85)
2025-02-10 14:52:07 +00:00
Martin Matuska
2ec8b69480 zfs: merge openzfs/zfs@e269af1b3 (zfs-2.2-release) into stable/14
OpenZFS release 2.2.7

Notable upstream pull request merges:
 #15457 022bf8637 Increase L2ARC write rate and headroom
 #15527 1ba5b2ef8 freebsd: remove __FBSDID macro use
 #15792 9e7af55e8 Add custom debug printing for your asserts
 #15793 a1ea40af8 libzfs: use zfs_strerror() in place of strerror()
 #16181 -multiple zdb/ztest: improve and harmonise crash output
 #16208 e5e4957a5 Allow block cloning to be interrupted by a signal
 #16210 ba4e582a6 FreeBSD: Add const qualifier to members of struct
                  opensolaris_utsname
 #16225 a6198f34b Simplify issig()
 #16335 25ec9a903 zdb: fix BRT dump
 #16364 cf80a803d zvol: ensure device minors are properly cleaned up
 #16404 384b53be8 FreeBSD: Add missing memory reclamation accounting
 #16492 -multiple Split "shared" userspace & kernel code into separate files
 #16496 f1694496a zfs_file: rename zfs_file_fallocate to zfs_file_deallocate
 #16511 bc0d89bfc Fix an uninitialized data access
 #16529 2dc8529d9 Fix handling of DNS names with '-' in them for sharenfs
 #16539 30ea44296 zfs_log: add flex array fields to log record structs
 #16546 098789216 Evicting too many bytes from MFU metadata
 #16551 54278533a Reduce and handle EAGAIN errors on AIO label reads
 #16554 84ad1d536 FreeBSD: restore zfs_znode_update_vfs()
 #16565 21c40e6d9 FreeBSD: Sync taskq_cancel_id() returns with Linux
 #16567 48482bb2f Properly release key in spa_keystore_dsl_key_hold_dd()
 #16584 e8f4592a1 Avoid computing strlen() inside loops
 #16605 acc8a3186 ARC: Cache arc_c value during arc_evict()
 #16650 fc60e0c6e freebsd: Use compiler.h from FreeBSD's base's linuxkpi
 #16667 b32b35cea zdb: show bp in uberblock dump
 #16684 1f5e1b919 Pack dmu_buf_impl_t by 16 bytes
 #16688 73b3e8ace Fix gcc uninitialized warning in FreeBSD zio_crypt.c
 #16690 727506c94 On the first vdev open ignore impossible ashift hints
 #16692 d83cd5307 zdb: add extra -T flag to show histograms of BRT refcounts
 #16693 82ab837a0 Fix gcc unused value warning in FreeBSD simd.h
 #16740 2bba6e3c5 BRT: Don't call brt_pending_remove() on holes/embedded
 #16801 299da6ace Fix race in libzfs_run_process_impl

Obtained from:	OpenZFS
OpenZFS commit: e269af1b3c
OpenZFS tag:	zfs-2.2.7
2024-12-12 13:22:56 +01:00
Bjoern A. Zeeb
7ff7410037 iwlwifi: script to extract firmware details
When having to find a firmware image with a lower version number
we must only break the inner but not also the outer loop so we
keep looking at any possibly remaining firmware details.

While here also try to find a version from max..1 and not from 1..max.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 52f8e99e7e)
2024-11-14 01:53:12 +00:00
Osama Abboud
699706f80b ena: Upgrade ena-com to freebsd v2.8.0
Merge commit '0fd934a2fd12fa74ae409d3de1313e449be5d97e'

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit f5f8d7c9cd)
2024-10-31 14:54:10 +00:00
Bjoern A. Zeeb
3ed00f3920 LinuxKPI based WiFi drivers: scripts to extract fwget(8) and port details
Add a "zzz_fw_ports_fwget.sh" script to each LinuxKPI based wireless
driver which in essential are all the same and in detail all different.
They extract information for fwget(8), wifi-firmware-* ports, man pages
and for iwlwififw also for the wiki.

Sponsored by:	The FreeBSD Foundation
Suggested by:	imp (to have automation in D44918)

(cherry picked from commit 96190b4fef)
2024-10-31 14:33:56 +00:00
Bjoern A. Zeeb
64517ad54a iwlwifi: FreeBSD specific sysctl export update
Update the sysctl export (also adding a mapping function) to also
print (1) for all lines the "flavor" (device_family) name and (2)
also print lines where we only have the trans cfg and not iwl cfg
as with the flavor we can match PCI IDs to firmware package and so
we can have an increased number of matches.
A side effect is that we can also have fwget(8) PCI ID matches for
firmware (flavors) not yet (publicly) existing.  That will allow
us to add them at a later point while a previous release already
supports the chipsets and knows how to get the firmware for them.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit b4c8f251d6)
2024-10-31 14:33:56 +00:00
Eric Joyner
a9d78bb714
ice_ddp: Update to 1.3.41.0
Primarily adds support for E830 devices, unlocking all of their
functionality.

As well, update the README and remove the non-FreeBSD sections
from it.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Sponsored by:	Intel Corporation

(cherry picked from commit f9a039060e)
2024-10-30 13:51:47 -07:00
Dimitry Andric
b426202aaf Fix gcc uninitialized warning in FreeBSD zio_crypt.c
With gcc we are seeing the following -Werror warning:

    In file included from /workspace/src/sys/contrib/openzfs/include/os/freebsd/spl/sys/sunddi.h:28,
                     from /workspace/src/sys/contrib/openzfs/include/sys/zfs_context.h:69:
    In function 'zfs_uio_init',
        inlined from 'zio_do_crypt_data' at /workspace/src/sys/contrib/openzfs/module/os/freebsd/zfs/zio_crypt.c:1690:2:
    /workspace/src/sys/contrib/openzfs/include/os/freebsd/spl/sys/uio.h:102:45: error: 'puio_s.uio_offset' is used uninitialized [-Werror=uninitialized]
      102 |                 zfs_uio_soffset(uio) = uio_s->uio_offset;
          |                                        ~~~~~^~~~~~~~~~~~
    /workspace/src/sys/contrib/openzfs/module/os/freebsd/zfs/zio_crypt.c: In function 'zio_do_crypt_data':
    /workspace/src/sys/contrib/openzfs/module/os/freebsd/zfs/zio_crypt.c:1683:20: note: 'puio_s' declared here
     1683 |         struct uio puio_s, cuio_s;
          |                    ^~~~~~
    In function 'zfs_uio_init',
        inlined from 'zio_do_crypt_data' at /workspace/src/sys/contrib/openzfs/module/os/freebsd/zfs/zio_crypt.c:1691:2:
    /workspace/src/sys/contrib/openzfs/include/os/freebsd/spl/sys/uio.h:102:45: error: 'cuio_s.uio_offset' is used uninitialized [-Werror=uninitialized]
      102 |                 zfs_uio_soffset(uio) = uio_s->uio_offset;
          |                                        ~~~~~^~~~~~~~~~~~
    /workspace/src/sys/contrib/openzfs/module/os/freebsd/zfs/zio_crypt.c: In function 'zio_do_crypt_data':
    /workspace/src/sys/contrib/openzfs/module/os/freebsd/zfs/zio_crypt.c:1683:28: note: 'cuio_s' declared here
     1683 |         struct uio puio_s, cuio_s;
          |                            ^~~~~~

Indeed, `zfs_uio_init()` does:

    static __inline void
    zfs_uio_init(zfs_uio_t *uio, struct uio *uio_s)
    {
            memset(uio, 0, sizeof (zfs_uio_t));
            if (uio_s != NULL) {
                    GET_UIO_STRUCT(uio) = uio_s;
                    zfs_uio_soffset(uio) = uio_s->uio_offset;
            }
    }

while the code in `zio_crypt.c` has:

    /*
     * Primary encryption / decryption entrypoint for zio data.
     */
    int
    zio_do_crypt_data(boolean_t encrypt, zio_crypt_key_t *key,
        dmu_object_type_t ot, boolean_t byteswap, uint8_t *salt, uint8_t *iv,
        uint8_t *mac, uint_t datalen, uint8_t *plainbuf, uint8_t *cipherbuf,
        boolean_t *no_crypt)
    {
            int ret;
            boolean_t locked = B_FALSE;
            uint64_t crypt = key->zk_crypt;
            uint_t keydata_len = zio_crypt_table[crypt].ci_keylen;
            uint_t enc_len, auth_len;
            zfs_uio_t puio, cuio;
            struct uio puio_s, cuio_s;
            uint8_t enc_keydata[MASTER_KEY_MAX_LEN];
            crypto_key_t tmp_ckey, *ckey = NULL;
            freebsd_crypt_session_t *tmpl = NULL;
            uint8_t *authbuf = NULL;

            zfs_uio_init(&puio, &puio_s);
            zfs_uio_init(&cuio, &cuio_s);
            memset(GET_UIO_STRUCT(&puio), 0, sizeof (struct uio));
            memset(GET_UIO_STRUCT(&cuio), 0, sizeof (struct uio));

So between the declaration of `puio_s` and `cuio_s`, there is no
initialization of these variables before `zfs_uio_init()` gets called.

Similar to the Linux variant of zio_crypt.c, I think it would be better
to memset the structs `puio_s` and `cuis_s` _before_ calling
`zfs_uio_init()`.

Reviewed by:    tsoome
MFC after:      3 days
Differential Revision: https://reviews.freebsd.org/D47281

(cherry picked from commit 3ceba58a75)
2024-10-29 22:49:16 +01:00
Bjoern A. Zeeb
71f81398f7 rtw89fw: remove module build dirs and firmware
rtw89 firmware files were removed from main a year ago after core members
asked to not import more biinary blobs into main.
Also remove the module build framework for them on stable/14 to
avoid any confusion (it was never attached to the build).

People are asked to use fwget(8) to automatically install firmware
from ports according to the man page.  A solution for the install
media is still pending.

X-MFC after:	rtw89 only
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit cf94672363)
(cherry picked from commit 7ff12dd25a)
2024-10-16 22:01:56 +00:00
Bjoern A. Zeeb
9bb9bfc769 rtw89: add missing bsddriver.name assignments for two chipsets
On FreeBSDs we locally set bsddriver.name in struct pci_driver to have
the same name for all chipsets.  This helps with, e.g., device
enumeration.  For two chipsets the manual entry was missing.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit ce15215bef)
2024-10-16 21:46:27 +00:00
Bjoern A. Zeeb
dd4d05b25f mt76: add mt7615 to the pile of buildable drivers
Ignoring page_pools with the few needed adjustments and ignoring 7622
mt7615 seems to build as well.  Add it so once we can connect it to
the build people can start testing and debugging.
(The actual work was done on a newer version of the mt76 drivers but
it seems the to-build-changes equally apply here already).

Requested by:	Radu-Cristian Fotescu (freebsd-wireless, 2024-07-31)
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 7728586800)
2024-10-09 19:18:49 +00:00
Zhenlei Huang
40015f1c11 vchiq(4): Stop checking for failures from malloc(M_WAITOK)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45852

(cherry picked from commit 778ea7ed5a)
2024-09-30 12:44:27 +08:00
Zhenlei Huang
905d5420ee krping: Stop checking for failures from malloc(M_WAITOK)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45852

(cherry picked from commit 66c35a6675)
2024-09-30 12:44:17 +08:00
Jamie Gritton
80c5d78d90 MFC jail: unbreak the zfs.mount_snapshot option
The change of its description from integer to boolean didn't actually
change it to a boolean, but only made it impossible to set as either
a boolean or an integer.

Rather than make it work as a boolean parameter should, just revert
to the old (working) integer parameter, and change the documentation
to match.

PR:		274263
Reported by:	andrew.hotlab at hotmail

(cherry picked from commit ae1a0648b0)
2024-09-24 10:14:22 -07:00
Zhenlei Huang
611d52a196 zfs: cherry-pick change from openzfs
Vendor PR:
  #16210 FreeBSD: Add const qualifier to members of struct
         opensolaris_utsname

Obtained from:	OpenZFS
OpenZFS commit:	e2357561b9

Note: this is required by the following up MFC [1]. No functional change.

1. 356be1348d kernel: Make some compile time constant variables const
2024-09-20 18:03:36 +08:00
Mariusz Zaborski
056c50c48b libnv: correct the calculation of the structure's size
Reported by:	Milosz Kaniewski <milosz.kaniewski@gmail.com>

(cherry picked from commit 7f4731ab67)
2024-09-15 10:59:15 -04:00
Gleb Smirnoff
4fe752ccb3 zfs: fix build without MAC
(cherry picked from commit b458ddf27f)
2024-09-12 00:01:40 -07:00
Martin Matuska
755e773877 zfs: merge openzfs/zfs@33174af15 (zfs-2.2-release) into stable/14
OpenZFS release 2.2.6

Notable upstream pull request merges:
 #15557 bce36e21c module/icp/asm-arm/sha2: auto detect __ARM_ARCH
 #15623 2ca151537 module/icp/asm-arm/sha2: enable non-SIMD asm kernels on
                  armv5/6
 #16308 ac6500389 zfs: add bounds checking to zil_parse
 #16316 859f906a4 Fix null ptr deref when renaming a zvol with snaps and
                  snapdev=visible
 #16343 cd42e992b Enable L2 cache of all (MRU+MFU) metadata but MFU data
                  only
 #16382 3a36797ad FreeBSD: Fix RLIMIT_FSIZE handling for block cloning

Obtained from:	OpenZFS
OpenZFS commit:	33174af151
OpenZFS tag:	zfs-2.2.6
2024-09-09 22:41:36 +02:00
Mariusz Zaborski
9c2ef10216 libnv: verify that string is null terminated
During unpacking, we ensure that we do not read beyond the
declared size. However, unpack uses a function that copies
null-terminated strings. Prior to this commit, if the last string
was not null-terminated, it could result in copying data into a
buffer smaller than the allocated size.

Security:       FreeBSD-24:09.libnv
Security:       CVE-2024-45288
Security:       CAP-03
Reported by:    Synacktiv
Sponsored by:   The Alpha-Omega Project
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46138

(cherry picked from commit 3aaaca1b51)
2024-09-04 14:26:05 +02:00
Mariusz Zaborski
371af89975 libnv: allocate buffer in a safe way
Ensure that the calculation of size of array doesn't
overflow.

Security:	FreeBSD-24:09.libnv
Security:	CVE-2024-45287
Security:	CAP-02
Reported by:	Synacktiv
Reported by:	Taylor R Campbell (NetBSD)
Sponsored by:	The Alpha-Omega Project
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D46131

(cherry picked from commit 36fa90dbde)
2024-09-04 14:26:05 +02:00
Mark Johnston
b5ce60dffd zdb: Fix printf formatting of a uint64_t
This fixes the build on 32-bit platforms.

Fixes:	dc91e74524 ("zdb: dump ZAP_FLAG_UINT64_KEY ZAPs properly (#16334)")
(cherry picked from commit f029f62779)
2024-08-15 16:44:48 +02:00
Dimitry Andric
ae3598b7a1 Fix enum warnings in ath_hal's ar9300
This fixes a number of clang 19 warnings:

    sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c:709:25: error: comparison of different enumeration types ('HAL_BOOL' and 'HAL_FREQ_BAND') [-Werror,-Wenum-compare]
      709 |         freq_array[i] = FBIN2FREQ(p_freq_bin[i], is_2ghz);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h:148:11: note: expanded from macro 'FBIN2FREQ'
      148 |     (((y) == HAL_FREQ_BAND_2GHZ) ? (2300 + x) : (4800 + 5 * x))
          |       ~~~ ^  ~~~~~~~~~~~~~~~~~~
    sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c:745:25: error: comparison of different enumeration types ('HAL_BOOL' and 'HAL_FREQ_BAND') [-Werror,-Wenum-compare]
      745 |         freq_array[i] = FBIN2FREQ(p_freq_bin[i], is_2ghz);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h:148:11: note: expanded from macro 'FBIN2FREQ'
      148 |     (((y) == HAL_FREQ_BAND_2GHZ) ? (2300 + x) : (4800 + 5 * x))
          |       ~~~ ^  ~~~~~~~~~~~~~~~~~~
    sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c:781:25: error: comparison of different enumeration types ('HAL_BOOL' and 'HAL_FREQ_BAND') [-Werror,-Wenum-compare]
      781 |         freq_array[i] = FBIN2FREQ(p_freq_bin[i], is_2ghz);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h:148:11: note: expanded from macro 'FBIN2FREQ'
      148 |     (((y) == HAL_FREQ_BAND_2GHZ) ? (2300 + x) : (4800 + 5 * x))
          |       ~~~ ^  ~~~~~~~~~~~~~~~~~~

The `FBIN2FREQ()` and `FREQ2FBIN()` macros in `ar9300eep.h` are invoked
in most places around the `ath_hal` code with a (effectively) boolean
second argument, corresponding to "is this 2GHz?". But in the code that
is warned about, the value `HAL_FREQ_BAND_2GHZ` is of a different
non-boolean type, `HAL_FREQ_BAND`.

Update the `FBIN2FREQ()` and `FREQ2FBIN()` macros to interpret the
second argument as boolean value, and rename the macro parameter names
to better describe their meaning.

Reviewed by:	adrian, bz
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D46201

(cherry picked from commit 82246ac5d8)
2024-08-13 11:24:12 +02:00
Martin Matuska
d27c973264 zfs: merge openzfs/zfs@33174af15 (zfs-2.2-release) into stable/14
OpenZFS release 2.2.5

Notable upstream pull request merges:
 #15609 566841171 Only provide execvpe(3) when needed
 #15940 9edf6af4a Replace P2ALIGN with P2ALIGN_TYPED and delete P2ALIGN
 #16038 0f1e8ba2f L2ARC: Cleanup buffer re-compression
 #16104 b474dfad0 Refactor dbuf_read() for safer decryption
 #16118 938d1588e Make more taskq parameters writable
 #16131 672474659 Slightly improve dnode hash
 #16138 4c0fbd8d6 FreeBSD: Add zfs_link_create() error handling
 #16159 fa4b1a404 ZAP: Fix leaf references on zap_expand_leaf() errors
 #16162 41f2a9c81 Fix scn_queue races on very old pools
 #16165 4c484d66b Fix ZIL clone records for legacy holes
 #16206 27cc6df76 Use memset to zero stack allocations containing unions
 #16207 2eab4f7b3 Fix assertion in Persistent L2ARC
 #16214 13ccbbb47 Some improvements to metaslabs eviction
 #16216 ba3c7692c Destroy ARC buffer in case of fill error
 #16258 4d2f7f983 vdev_open: clear async fault flag after reopen
 #16264 ef08cb26d Fix long_free_dirty accounting for small files
 #16273 54ef0fdf6 head_errlog: fix use-after-free
 #16284 14cce09a6 FreeBSD: Use a statement expression to implement
                  SET_ERROR()
 #16406 6f27c4cad Make 'rmmod zfs' work after zfs-2.2.4

Obtained from:	OpenZFS
OpenZFS commit:	33174af151
OpenZFS tag:	zfs-2.2.5
2024-08-13 09:52:28 +02:00
Jamie Gritton
c8f147943d MFC zfs/jail: Mark the zfs.mount_snapshot jail parameter as boolean.
PR:		274263
Differential Revision:	https://reviews.freebsd.org/D45647

(cherry picked from commit 9cbf1de7e3)
2024-06-28 12:44:56 -07:00
Alexander Motin
1c27279ed2 Destroy ARC buffer in case of fill error
In case of error dmu_buf_fill_done() returns the buffer back into
DB_UNCACHED state.  Since during transition from DB_UNCACHED into
DB_FILL state dbuf_noread() allocates an ARC buffer, we must free
it here, otherwise it will be leaked.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Jorgen Lundman <lundman@lundman.net>
Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Sponsored by: iXsystems, Inc.
Closes #15665
Closes #15802
Closes #16216

PR:	276341

(cherry picked from commit 02c5aa9b09)
2024-06-17 10:25:59 -04:00