]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 months agoFix intermittency in the sys.fs.fusefs.mknod.main test
Alan Somers [Fri, 6 Oct 2023 19:46:42 +0000 (13:46 -0600)]
Fix intermittency in the sys.fs.fusefs.mknod.main test

In the Mknod.parent_inode test case, the kernel sends an extra
FUSE_FORGET message.  But because it gets sent asynchronously with the
failing syscall, it doesn't always get received before the test ends.
So we never setup an expectation for it.  And 90+% of the time the test
would exit successfully.

Fix the intermittency by always waiting to receive the FUSE_FORGET
message.

Sponsored by: Axcient

(cherry picked from commit 86885b18689889e9b9142fd31d8c67f21334ba32)

Fix intermittency in the sys.fs.fusefs.symlink.main test

This change is identical to 86885b18689 but for symlink instead of
mknod.  The kernel sends a FUSE_FORGET asynchronously with the final
syscall.  The lack of an expectation caused this test to occasionally
fail.

Also, remove a sleep that accidentally snuck into a different test.

Sponsored by: Axcient

(cherry picked from commit 8399d764c929a4b2fa98dbfae0ca7359810e4668)

7 months agofusefs: add more readdir tests for misbehaving servers
Alan Somers [Thu, 5 Oct 2023 16:13:05 +0000 (10:13 -0600)]
fusefs: add more readdir tests for misbehaving servers

Inspired by PR 274268

Sponsored by: Axcient

(cherry picked from commit 6a773a0582ba936cc19734b21ee5a7bed49cfdec)

7 months agoTag zfs-2.1.14
Tony Hutter [Tue, 28 Nov 2023 22:20:56 +0000 (14:20 -0800)]
Tag zfs-2.1.14

META file and changelog updated.

Signed-off-by: Tony Hutter <hutter2@llnl.gov>
7 months agocopy-builtin: add hooks with sed/>>
наб [Tue, 5 Apr 2022 23:34:25 +0000 (01:34 +0200)]
copy-builtin: add hooks with sed/>>

The order in fs/Makefile doesn't matter,
the order in fs/Kconfig is preserved (ext2 is included as the first
thing in the first if BUILD block, and only once), but I don't think it
matters much either, realistically

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13316

7 months agonfsd: Fix NFS access to .zfs/snapshot snapshots
Rick Macklem [Thu, 23 Nov 2023 15:23:33 +0000 (07:23 -0800)]
nfsd: Fix NFS access to .zfs/snapshot snapshots

When a process attempts to access a snapshot under
/<dataset>/.zfs/snapshot, the snapshot is automounted.
However, without this patch, the automount does not
set mnt_exjail, which results in the snapshot not being
accessible over NFS.

This patch defines a new function called vfs_exjail_clone()
which sets mnt_exjail from another mount point and
then uses that function to set mnt_exjail in the snapshot
automount.  A separate patch that is currently a pull request
for OpenZFS, calls this function to fix the problem.

PR: 275200

(cherry picked from commit f5f277728adec4c5b3e840a1fb16bd16f8cc956d)

7 months agoZpool can start allocating from metaslab before TRIMs have completed
Jason King [Thu, 12 Oct 2023 18:01:54 +0000 (13:01 -0500)]
Zpool can start allocating from metaslab before TRIMs have completed

When doing a manual TRIM on a zpool, the metaslab being TRIMmed is
potentially re-enabled before all queued TRIM zios for that metaslab
have completed. Since TRIM zios have the lowest priority, it is
possible to get into a situation where allocations occur from the
just re-enabled metaslab and cut ahead of queued TRIMs to the same
metaslab.  If the ranges overlap, this will cause corruption.

We were able to trigger this pretty consistently with a small single
top-level vdev zpool (i.e. small number of metaslabs) with heavy
parallel write activity while performing a manual TRIM against a
somewhat 'slow' device (so TRIMs took a bit of time to complete).
With the patch, we've not been able to recreate it since. It was on
illumos, but inspection of the OpenZFS trim code looks like the
relevant pieces are largely unchanged and so it appears it would be
vulnerable to the same issue.

Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jason King <jking@racktopsystems.com>
Illumos-issue: https://www.illumos.org/issues/15939
Closes #15395

7 months agonet80211: migrate ic_vhtcaps, ic_vht_mcsinfo, ic_flags_vht
Bjoern A. Zeeb [Fri, 27 Oct 2023 18:44:02 +0000 (18:44 +0000)]
net80211: migrate ic_vhtcaps, ic_vht_mcsinfo, ic_flags_vht

Like for the VAP rename ic_flags_vht to ic_vht_flags for consistency to
keep "VHT" fields together and merge ic_vhtcaps and ic_vht_mcsinfo
into struct ieee80211_vht_cap ic_vht_cap.

While the structure layout changes no other functional changes intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 562adbe1d354377a260e66eedb6072b720a606dc)

7 months agonet80211: combine iv_vhtcaps and iv_vht_mcsinfo
Bjoern A. Zeeb [Fri, 27 Oct 2023 18:33:22 +0000 (18:33 +0000)]
net80211: combine iv_vhtcaps and iv_vht_mcsinfo

The iv_vhtcaps and iv_vht_mcsinfo fields together form
struct ieee80211_vht_cap so combine them into one field in the VAP
and keep the information together.

While the structure layout changes no other functional changes intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit fbba0d6b636492505dc5878b9ed2c1bbdcd88b91)

7 months agonet80211: rename iv_flags_vht to iv_vht_flags
Bjoern A. Zeeb [Fri, 27 Oct 2023 18:18:24 +0000 (18:18 +0000)]
net80211: rename iv_flags_vht to iv_vht_flags

While the flag field is internal start naming it as well as "iv_vht*"
so we keep all "VHT" fields together.  This breaks with what was done
done for HT but with HE, EHT, .. coming one day seems the more logic
choice.

No functional changes intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit ef48d4fa122d863db11e41608ceea641eec54704)

7 months agonet80211: add ieee80211_add_vhtcap_ch()
Bjoern A. Zeeb [Thu, 26 Oct 2023 20:55:59 +0000 (20:55 +0000)]
net80211: add ieee80211_add_vhtcap_ch()

Add an implementation of ieee80211_add_vhtcap() which works based on
information derived from the vap (and possibly channel/band but we do
not support that yet in net80211).  This is needed for scans request
information in LinuxKPI at times before we have a BSS.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6c3ae01cc75afdd575f54289b2879a7c98d55bf6)

7 months agoLinuxKPI: 802.11: zero-pad debug flags
Bjoern A. Zeeb [Sat, 28 Oct 2023 18:43:43 +0000 (18:43 +0000)]
LinuxKPI: 802.11: zero-pad debug flags

Write the debug flags as full 32bit hex numbers to have a better
view on them.

No functional changes.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8895b47638ea4d7a13fba97afe8cd9faacfdda83)

7 months agoLinuxKPI: 802.11: deal with scan_ie_len
Bjoern A. Zeeb [Fri, 27 Oct 2023 20:41:43 +0000 (20:41 +0000)]
LinuxKPI: 802.11: deal with scan_ie_len

We only need to reserve the extra space for DSSS if
NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES is set, so add the conditional.
Also add checks in case scan_ie_len will grow beyond the maximum.
Given this is currently unlikely, leave the cleanup for later as
some other restructuring should be done first.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 78ca45df310563ca46448a124674e0542aab2e31)

7 months agoLinuxKPI: 802.11: fix ieee80211_add_channel_cbw() argument
Bjoern A. Zeeb [Thu, 26 Oct 2023 00:11:43 +0000 (00:11 +0000)]
LinuxKPI: 802.11: fix ieee80211_add_channel_cbw() argument

Fix the last argument passed to ieee80211_add_channel_cbw() in
lkpi_ic_getradiocaps() for both 2Ghz and 5Ghz bands.
We passed in the unmodified version rather than the adjusted version
based on the per-band channel information possibly leaving
ieee80211_channel_flags enabled which should not be.

So far this should not have made a difference given we did not enable
HT or VHT.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5856761fd5f675c3871a82effdbf714a1d1bcc5e)

7 months agoLinuxKPI: 802.11: error on state transition failure
Bjoern A. Zeeb [Wed, 25 Oct 2023 22:29:35 +0000 (22:29 +0000)]
LinuxKPI: 802.11: error on state transition failure

The state transition failures we were seeing in the early days are
solved.  If we now experience one stop processing before passing
over to net80211 (sta_newstate()) and before updating iv_state on
the vap.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42423

(cherry picked from commit 45c27ad5241f5491234afd0b47d13b8005fdb4de)

7 months agoiwlwifi: re-enable "Invalid TXQ id" logging
Bjoern A. Zeeb [Mon, 9 Oct 2023 19:47:39 +0000 (19:47 +0000)]
iwlwifi: re-enable "Invalid TXQ id" logging

Various reports recently hit the "Invalid TXQ id" in iwlwifi again.
Unconditionally enable logging and add a note to report to a specific
PR in the log message for now.
Along with 018d93ece16b this will hopefully help us to understand what
is going on.

Sponsored by: The FreeBSD Foundation
PR: 274382

(cherry picked from commit ad134f8ab768e3b1d2db203f1cc963bdf0eea857)

7 months agoLinuxKPI: 802.11: add unconditional error reporting
Bjoern A. Zeeb [Mon, 9 Oct 2023 19:11:50 +0000 (19:11 +0000)]
LinuxKPI: 802.11: add unconditional error reporting

Multiple reports have shown missed state transitions in net80211 without
major cause obvious (or with a txq warning in iwlwifi).
In order to better track down potential problems add unconditional
ic_printf calls to any case in the lkpi state machine compat code which
would let us return with an error in the hope that it helps us to catch
the actual problems.
Also remove the debug conditions from ieee80211_{beacon,connection}_loss
which can also cause state transitions to have the ic_printf all the time
there too.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 018d93ece16bd33077021383940d0da5121f0691)

7 months agonet80211: make ieee80211_alloc_node() private
Bjoern A. Zeeb [Mon, 2 Oct 2023 13:57:45 +0000 (13:57 +0000)]
net80211: make ieee80211_alloc_node() private

Looking through the allocation/free and reference cycle of nodes we have
a few (publicly) (almost) unused macros and functions.
Start making them private and reducing the amount of entry paths to the
same/similar functionality.
First is to make ieee80211_alloc_node() static as it is nowhere used
in the tree outside this file.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit db195a523f9bbeb111b621d2c2c7a46d8b921631)

7 months agonet80211: pass __func__, __LINE__ also to ieee80211_alloc_node()
Bjoern A. Zeeb [Fri, 6 Oct 2023 10:38:22 +0000 (10:38 +0000)]
net80211: pass __func__, __LINE__ also to ieee80211_alloc_node()

Pass caller information to ieee80211_alloc_node() so that in case
IEEE80211_DEBUG_REFCNT is compiled in we can (better) track references,
in this case the initial ieee80211_node_initref().

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 3a11944bca0f07079a61f10468b704589c52a76f)

7 months agonet80211: MFC _debrefcnt_used
Bjoern A. Zeeb [Wed, 29 Nov 2023 01:05:49 +0000 (01:05 +0000)]
net80211: MFC _debrefcnt_used

While 4a8e4d15465cbf6f1bc4c6a09f50f97ae2d5bd7d (fix IEEE80211_DEBUG_REFCNT
builds) covers more parts, we cannot MFC all due to KPI/KBI stability.
We only pick the conditional define of __debrefcnt_used in order to allow
commits following the original one to be MFCed more easily.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4a8e4d15465cbf6f1bc4c6a09f50f97ae2d5bd7d)

7 months agoLinuxKPI: 802.11: hide txq debugging behind checks
Bjoern A. Zeeb [Wed, 4 Oct 2023 20:30:00 +0000 (20:30 +0000)]
LinuxKPI: 802.11: hide txq debugging behind checks

Two txq debug messages were left unconditionally.  Hide them behind
ifdef/if() condition checks for selective debugging only.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 0d2cb6a6ecde3b271ede59d77801cb43a8804688)

7 months agortw88: Use RF_CFGCH instead of hard coded 0x18
Bjoern A. Zeeb [Thu, 5 Oct 2023 14:01:48 +0000 (14:01 +0000)]
rtw88: Use RF_CFGCH instead of hard coded 0x18

While debugging some funky register reads of 0xaeaea from RF_CFGCH
resulting in "rtw880: [TXGAPK] unknown channel 234!!" more of these
reads came to my attention hidden by using the register index rather
than the defined value.  Make this more grep-able.

(cherry picked from commit 4f3b2bba240b6e0603b5cbb47155fd8215bcbcb3)

7 months agoLinuxKPI: 802.11: fix re-creation of VAP
Bjoern A. Zeeb [Tue, 3 Oct 2023 21:14:55 +0000 (21:14 +0000)]
LinuxKPI: 802.11: fix re-creation of VAP

After dbf7691999abe (as indicated in that commit message) EEXISTS
errors may be seen.  From current investigation that is due to the
single-VAP support in LinuxKPI 802.11 and the related calls to
mo_start() and mo_stop() and them being disabled in ic_parent()
currently.  Calling mo_stop() in lkpi_ic_vap_delete() seems to
fix the problem and new VAPs (wlan interfaces) can be created again
after being destroyed.

Fixes: dbf7691999abe ("improve lkpi_ic_vap_delete()")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6c38c6b1b917957d420902213f318bf0153214f2)

7 months agonet80211 / drivers: remove public use of ieee80211_node_incref()
Bjoern A. Zeeb [Mon, 2 Oct 2023 14:44:29 +0000 (14:44 +0000)]
net80211 / drivers: remove public use of ieee80211_node_incref()

ieee80211_node_incref() is the FreeBSD implementation of
ieee80211_ref_node().  Not being interested in the node returned
it was used as a shortcut in 3 drivers (ath, uath, wpi).
Replace the call with the public KPI of ieee80211_ref_node() and
ignore the result.
This leaves us with the single internal call going
ieee80211_ref_node() -> ieee80211_node_incref() and that should
help increasing portability but also limiting the places to trace
for node reference operations.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit f156cd892b55c04a39fa06d1899e6e316de77f03)

7 months agonet80211: improve ddb output for sta and rate
Bjoern A. Zeeb [Mon, 2 Oct 2023 13:53:33 +0000 (13:53 +0000)]
net80211: improve ddb output for sta and rate

Add more missing fields to the ddb output of sta (including spares so
people will notice if they use them to adjust ddb as well).
There are still more missing fields (some left as reminder in an
uncompiled __notyet__ block).

Add _db_show_rate() to print iv_rate as well optionally including
function pointers.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4ed35b7d1eb5dddfd04f574ac122651d532d2df9)

7 months agoLinuxKPI: 802.11: improve lkpi_ic_vap_delete()
Bjoern A. Zeeb [Sat, 30 Sep 2023 15:20:53 +0000 (15:20 +0000)]
LinuxKPI: 802.11: improve lkpi_ic_vap_delete()

Changing the order of cleanup in lkpi_ic_vap_delete() will avoid
firmware crashes or a direct panic as observed as ieee80211_vap_detach()
will do most cleanup for us and get us into the correct state.

The solution is not fully developed yet and one may not be able
to create a new vap (lkpi_ic_vap_create may fail with error 17)
afterwards.  It is supposed to be a step towards more stability
for now.

Sponsored by: The FreeBSD Foundation
PR:  269842

(cherry picked from commit dbf7691999abe501e0ebc0fe4d8d9e97718d3890)

7 months agoLinuxKPI: 802.11: fix problem removing sta
Bjoern A. Zeeb [Sat, 30 Sep 2023 07:59:48 +0000 (07:59 +0000)]
LinuxKPI: 802.11: fix problem removing sta

Move the call to lkpi_disassoc() before the state change to
IEEE80211_STA_NOTEXIST which will remove the sta (from firmware).
Based on a comment it seems that originally we had to do it the
other way round.
iwlwifi(4) has a check and will silently not remove the sta from
the firmware when vif->cfg.assoc is still set (see iwl_mvm_sta_del()).
This leads to the LinuxKPI 802.11 code thinking the sta is gone as
downward state changes by the mac80211 op (*sta_state)() may not fail.
Once we try to assoc with a newly added station later, iwlwifi firmware
will run into an assert having two ap_sta set on the same vif.
We can observe that problem in iwlwifi(4) having __le32 sta_id = 1
instead of sta_id = 0 in iwl_mvm_sta_cfg_cmd{} on the HCMD.

This should fix one of the most seen problems with iwlwifi(4), e.g.,
when running service netif restart wlan0 or
service wpa_supplicant restart wlan0.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 16e688b2a403a3dbc05de3b9f8a3132838613790)

7 months agoLinuxKPI: 802.11: fill regulatory_hint() with some life
Bjoern A. Zeeb [Mon, 25 Sep 2023 17:54:20 +0000 (17:54 +0000)]
LinuxKPI: 802.11: fill regulatory_hint() with some life

Start implementing regulatory_hint() using a .c file based allocation
helper function so we could change structures in the future with
better chances to keep compatibility.
This sets wiphy->regd needed by various LinuxKPI based WiFi drivers.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 673d62fc359b0cb7a70af42c36d2fa54fb29452a)

7 months agoLiunxKPI: 802.11: move ieee80211_chanctx_conf into lkpi private struct
Bjoern A. Zeeb [Mon, 25 Sep 2023 16:57:23 +0000 (16:57 +0000)]
LiunxKPI: 802.11: move ieee80211_chanctx_conf into lkpi private struct

Factor out ieee80211_chanctx_conf into struct lkpi_chanctx in order to
keep local state as well.  In first instance that is added_to_drv
only.  For now we stay single-chanctx only but this paves the path
to make it a list.
Use the new information to implement ieee80211_iter_chan_contexts_atomic().

Sponsored by: The FreeBSD Foundation

(cherry picked from commit c5e257985085bd987b1dddffd0455c2230df2d1d)

7 months agoLinuxKPI: 802.11: avoid symbol clash on UP to AC mapping
Bjoern A. Zeeb [Sun, 24 Sep 2023 11:55:11 +0000 (11:55 +0000)]
LinuxKPI: 802.11: avoid symbol clash on UP to AC mapping

tid_to_mac80211_ac is an exported symbol in and likely based on iwlwifi,
which leads to a symbol clash in NetBSD.  Rename our local LinuxKPI copy
to a better name and add a comment where to find a copy of the mapping
table.

Sponsored by: The FreeBSD Foundation
Reported by: Phil Nelson (phil netbsd org)

(cherry picked from commit fb3c249ed93c834d70f8361215bc40a9e9004d3b)

7 months agoiwlwifi: local namespace change for sysctl
Bjoern A. Zeeb [Thu, 21 Sep 2023 22:05:02 +0000 (22:05 +0000)]
iwlwifi: local namespace change for sysctl

In order for the FreeBSD-specific sysctl (which gives us a full list of
PCI device IDs/names/and firmware prefixes) to be in the proper namespace
add a LINUXKPI_PARAM_PREFIX definition to the file as well.

The sysctl can now be used as:
sysctl -n compat.linuxkpi.iwlwifi_pci_ids_name

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 0a22677bce28bc9ad39f219b726b5791852d84ba)

7 months agoiwlwifi: Update iwlwifi.4 and iwlwififw.4 device list
Bjoern A. Zeeb [Thu, 21 Sep 2023 21:47:18 +0000 (21:47 +0000)]
iwlwifi: Update iwlwifi.4 and iwlwififw.4 device list

Update the man pages for iwlwifi.4 and iwlwififw.4 to list the
current state of devices supported and which firmware they need.
The list is automatically generated based on a sysctl added to the
iwlwifi driver (so this is the driver's view).  The reader should
not be surprised by the larger number of any/any/any/any entries
for PCI vendor and devices in the firmware table for which other
matching logic happens.  The reader should also not be confused
about "TBD" (to be done) entries for chipsets which the driver
already supports but have no (public) product yet.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 242f314842767c36eaaacca9f433c80d34def39c)

7 months agonet80211: introduce two extra ieee80211_notify_scan_done()
Bjoern A. Zeeb [Thu, 21 Sep 2023 11:51:23 +0000 (11:51 +0000)]
net80211: introduce two extra ieee80211_notify_scan_done()

We have multiple problems with scanning currently, one being that
an initial scan restarts itself and we are unable to start another
scan.  wpa_supplicant in that case never shows scan results.
Starting wpa_cli you may see: <3>CTRL-EVENT-SCAN-FAILED ret=-1 retry=1
messages.
Add two extra calls to ieee80211_notify_scan_done() at the end of scans
(before possible restarts).  That will get wpa_supplicant to get
scan results and possibly start associating to a BSSID and get us out
of scan.  This is kind-of a bandaid but on short notice may help to
improve the situation for some.

Based on analysis by: enweiwu
Submitted by: enweiwu (initial version)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 3f382eb23b9fee75d05276a44feb5351d956238e)

7 months agoiwlwifi/rtw88: re-attach to build after updates
Bjoern A. Zeeb [Thu, 21 Sep 2023 17:12:01 +0000 (17:12 +0000)]
iwlwifi/rtw88: re-attach to build after updates

While the build-breaking changes were only in the window of
the two commits, further updates were easier to merge and
restored some functionality as well.  Now that we are done,
add iwlwifi/rtw88 back to the build.

This reverts commit b75d1ce6c10652fc4bfbf509deeae0e05c3d1356.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit af6aaa90057d75644c41527acc903082104e4114)

7 months agoLinuxKPI: 802.11: setup a default link[0] and adjust related needs
Bjoern A. Zeeb [Thu, 21 Sep 2023 12:49:15 +0000 (12:49 +0000)]
LinuxKPI: 802.11: setup a default link[0] and adjust related needs

Setup more link_conf/deflink fields for vif/sta as are needed to allow
us to work with the KPI bits in a non-MLO configuration.
In lkpi_sta_scan_to_auth() set the bss_conf values before calling into
the driver for chanctx setup/updates as certain values (e.g., beacon_int)
need to be set before; we still call the MO function for the updates
after to keep the expected workflow.
Deal with the (to be dealt with otherwise later) net80211 ni swaps and
update the addresses on the deflink as well as otherwise firmware will
hit asserts or things will not work (e.g. indicating the peer is us).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6ffb7bd469b26f2ff6cc62cedca6ffe884076196)

7 months agoLinuxKPI: 802.11: inialize tx queue params
Bjoern A. Zeeb [Thu, 21 Sep 2023 12:36:38 +0000 (12:36 +0000)]
LinuxKPI: 802.11: inialize tx queue params

When adding a VAP (vif) initialize its tx queue parameters calling
mo_conf_tx().
I could not spot net80211 providing some of the values needed before
having a node so currrently we use hard-coded values with a comment
with a reference on how to properly calculate the values in the future
(e.g., in case of 11b or other cases).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit a6042e17c8999c4965bd4d762c4564b322f1ae7b)

7 months agoLinuxKPI: 802.11: change ic_parent() to not call mo_stop()/mo_start()
Bjoern A. Zeeb [Thu, 21 Sep 2023 12:25:20 +0000 (12:25 +0000)]
LinuxKPI: 802.11: change ic_parent() to not call mo_stop()/mo_start()

Driven by net80211 we may call mac80211 ops stop() and start() mostly
when toggling a first VAP.  While this is FreeBSD behaviour the firmware
based LinuxKPI drivers seem to possibly clear state in the case of stop()
triggering further errors down the line.
We call mo_start() when starting the VAP and mo_stop() when destroying
it now only.  In the future (e.g., in multi-VAP setups) we may need to
re-address some of this so keep the code under #ifdef.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8d58a0578635dc7dd1025ab08b0479f2b383e1a4)

7 months agoLinuxKPI: 802.11: adjust code to new structure layout
Bjoern A. Zeeb [Thu, 21 Sep 2023 12:19:54 +0000 (12:19 +0000)]
LinuxKPI: 802.11: adjust code to new structure layout

With past commits new structures were added.  Now switch over some
bss_conf fields into vif->cfg where they got moved to and remove the
old fields.  This allows drivers to find the expected values in the
now expected places and work better.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 616e13301bcf274b007f84ef99ea857a55bef46d)

7 months agoLinuxKPI: 802.11: mac80211 ops: distinguish between {bss,link}_info_changed
Bjoern A. Zeeb [Thu, 21 Sep 2023 11:58:17 +0000 (11:58 +0000)]
LinuxKPI: 802.11: mac80211 ops: distinguish between {bss,link}_info_changed

With MLO and multi-link setups if avail we want to call link_info_changed
whereas for legacy drivers we still need to call bss_info_changed.
While we currently do not (yet) support multi-link configurations
we still need to drive the correct commands to satisfy firmware
requirements.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 727f88f2617acaff4ada0f3dda6ca23c6679310d)

7 months agoLinuxKPI: 802.11: pass non-0/NULL arguments to MO functions
Bjoern A. Zeeb [Sat, 16 Sep 2023 13:10:57 +0000 (13:10 +0000)]
LinuxKPI: 802.11: pass non-0/NULL arguments to MO functions

In [1] we updated the KPI for various mac80211 ops functions to deal
with MLD code.  Newer iwlwifi driver and firmware supports these
functions so we need to pass non-dummy (0, NULL) arguments to them.
Start extending the internel MO functions by these arguments and
pass down values from LinuxKPI 802.11 code.
It is assumed that further work will be needed to have all the
right fields available to at least work in the lgeacy way of a
single link.

Sponsored by: The FreeBSD Foundation
Improves: 549198b1ab95 (update mac80211 KPI) [1]

(cherry picked from commit 6854154638a2c04ab59da43aedbe2c0ee8ef71a5)

7 months agoiwlwifi firmware: update up-to -83 / updated -77 for others
Bjoern A. Zeeb [Sun, 11 Jun 2023 00:45:37 +0000 (00:45 +0000)]
iwlwifi firmware: update up-to -83 / updated -77 for others

Firmware was obtained from linux-firmware at
dfa11466cf000120d1551146fd5bf78c44941eda.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 027768a21217499dd85aba8608715a5bf66a7857)

7 months agoiwlwifi: update driver from upstream
Bjoern A. Zeeb [Tue, 16 May 2023 21:56:20 +0000 (21:56 +0000)]
iwlwifi: update driver from upstream

This is a combined versions of updates of the iwlwifi driver based
on wireless-testing
(wt-2023-05-11) 711dca0ca3d77414f8f346e564e9c8640147f40d (after v6.4-rc1).
(wt-2023-06-09) 7bd20e011626ccc3ad53e57873452b1716fcfaaa (after v6.4-rc5).
(wt-2023-07-24) 62e409149b62a285e89018e49b2e115757fb9022 (after v6.5-rc3).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 9af1bba44e1ce9b0296ae56760b564d67ab7a1cf)

7 months agoLinuxKPI: 802.11: prepare for iwlwifi driver updates
Bjoern A. Zeeb [Thu, 14 Sep 2023 17:31:11 +0000 (17:31 +0000)]
LinuxKPI: 802.11: prepare for iwlwifi driver updates

Unconditionally enable the changes for newer drivers, as needed by
iwlwifi (and others).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 3e1f5cc9a81a6065ddc371eea5755b4e207d72f8)

7 months agoLinuxKPI: 802.11: fix counting the number of supbands
Bjoern A. Zeeb [Thu, 14 Sep 2023 17:57:53 +0000 (17:57 +0000)]
LinuxKPI: 802.11: fix counting the number of supbands

While the main purpose was to assign an(y) early chandef with the
loop, later additions made use of it to also count supbands as well
as to initialise max_rates.
Due to the main goal we can exit the loop early and not properly
count and initialise supbands and max_rates.
Move the terminating condition into the loop and make it a continue
rather than ending the loop.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit f454a4a10dc027474a85269cb4a3f50bbbf90528)

7 months agoiwlwifi: fix a bug in iwl_ssid_exist()
Bjoern A. Zeeb [Thu, 14 Sep 2023 17:22:04 +0000 (17:22 +0000)]
iwlwifi: fix a bug in iwl_ssid_exist()

Rather than always comparing a given SSID to the first SSID of the
IE list, compare it to the the iterator one.  That way duplicates can
be found.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit ee7077f24f5b02bde8cf5c202848128f18733398)

7 months agoLinuxKPI: 802.11: make sure bssid for scans (probe_req) is set
Bjoern A. Zeeb [Thu, 14 Sep 2023 17:48:19 +0000 (17:48 +0000)]
LinuxKPI: 802.11: make sure bssid for scans (probe_req) is set

In b0f73768220e9 we added bssid[] to struct cfg80211_scan_request
likely while working on mt76 and did not need it (yet) back then.
iwlwifi started to use the field in Linux f1fec51cda70f (April 2023).
Without it set firmware crashes when trying to send probe requests
((empty) SSID also given to hw_scan).
For now always set the field to the wildcard BSSID.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit e1e90be05017c335862c938fd9d577e56f02af30)

7 months agonet80211: mark argument to scan_curchan_task() __unused
Bjoern A. Zeeb [Thu, 14 Sep 2023 17:34:01 +0000 (17:34 +0000)]
net80211: mark argument to scan_curchan_task() __unused

Mostly as documentation mark an unused argument to scan_curchan_task()
as __unused.  We may possibly want to check all callers in the future
and see if the argument was supposed to be useful or should be entirely
removed.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 778da03b1271f52051620ec9b053524727961c9e)

7 months agonet80211: improve scan debugging
Bjoern A. Zeeb [Thu, 14 Sep 2023 17:36:29 +0000 (17:36 +0000)]
net80211: improve scan debugging

While debugging other problems I ran into the case where net80211
was thinking a scan was ongoing and new scans could not be started
but given other logging there was clearly no more scan running.
It was hard after the fact to quickly determine enough state to
reconstruct or validate assumptions.

Improve a MSG_SCAN debug logging and implement _db_show_scan() ddb
output which can be printed along with show com /S or /a.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 33396ec29f1daae31f4738f0da98dce168ca73c6)

7 months agoLinuxKPI: skbuff: remove assumption about mac_header
Bjoern A. Zeeb [Fri, 8 Sep 2023 12:47:03 +0000 (12:47 +0000)]
LinuxKPI: skbuff: remove assumption about mac_header

It seems the mac_header can be set to offset 0 for frames received.
Remove the warning splattering messages to the console for each packet.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit f0e59b6903c881859d7f4eaf269b2336b774c7bc)

7 months agonet80211: fix ddb print alignment
Bjoern A. Zeeb [Mon, 11 Sep 2023 14:23:20 +0000 (14:23 +0000)]
net80211: fix ddb print alignment

Add missing \ts after new lines to properly align output of ddb show
commands.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit c45d05b71817e478953d6f235d921c2b4acc82de)

7 months agoiwlwifi/LinuxKPI: 802.11: update ieee80211_request_smps()
Bjoern A. Zeeb [Tue, 5 Sep 2023 18:02:02 +0000 (18:02 +0000)]
iwlwifi/LinuxKPI: 802.11: update ieee80211_request_smps()

Update ieee80211_request_smps() to the new number of arguments in
LinuxKPI (which was already prepared) and update the one call in the
older iwlwifi driver version.
This will allow iwlwifi as-is now and rtw88 to compile in case someone
else wants to work on the latter in parallel to predominant efforts on
the former.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 815b7436a7c6302365b6514194d27d41cb736227)

7 months agortw88: update driver from upstream
Bjoern A. Zeeb [Tue, 16 May 2023 23:19:34 +0000 (23:19 +0000)]
rtw88: update driver from upstream

This is a combined version of updates of the rtw88 driver based
on wireless-testing
(wt-2023-05-11) 711dca0ca3d77414f8f346e564e9c8640147f40d (after v6.4-rc1),
(wt-2023-06-09) 7bd20e011626ccc3ad53e57873452b1716fcfaaa (after v6.4-rc5),
(wt-2023-07-24) 62e409149b62a285e89018e49b2e115757fb9022 (after v6.5-rc3),
(wt-2023-08-06) 2a220a15be657a24868368892e3e2caba2115283 (after v6.5-rc4).

This update follows other currently disconnected LinuxKPI based wireless
drivers to lift them all to a same version in case someone else wants to
work on this driver in parallel to predominant iwlwifi efforts.

MFC after: 20 days

(cherry picked from commit 90aac0d83bc9645f51ef0c2aeae6f9c0540bb031)

7 months agoLinuxKPI: 802.11: update compat code for updated drivers
Bjoern A. Zeeb [Tue, 16 May 2023 22:07:53 +0000 (22:07 +0000)]
LinuxKPI: 802.11: update compat code for updated drivers

Adjust and add structs, fields, functions to make more modern versions
of LinuxKPI based wireless drivers (based on wireless-testing (
wt-2023-06-09, wt-2023-07-24, and later)) compile.

Some of these changes can only be applied once all drivers get
updated to not break the old versions currently in the tree.
Mark those changes with __FOR_LATER_DRV_UPDATE for now and flip the
switch at a later point.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit adff403fe7a870c5b7a2d7e003d445c3b409bc0c)

7 months agoiwlwifi/rtw88: temporary disable build for updates
Bjoern A. Zeeb [Thu, 21 Sep 2023 17:04:29 +0000 (17:04 +0000)]
iwlwifi/rtw88: temporary disable build for updates

Disconnect iwlwifi/rtw88 from the build for a few commits which, due to
incompatible LinuxKPI 802.11 changes would break the build for a
revision.  It will be re-enabled "instantly".

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b75d1ce6c10652fc4bfbf509deeae0e05c3d1356)

7 months agoLinuxKPI: skbuff: add skb_cow_head()
Bjoern A. Zeeb [Thu, 10 Aug 2023 02:07:41 +0000 (02:07 +0000)]
LinuxKPI: skbuff: add skb_cow_head()

Add dummy implementation of skb_cow_head().

Sponsored by: The FreeBSD Foundation

(cherry picked from commit e039b38d4652b6a68567f8d632c3dfa4f15c40f6)

7 months agolinuxkpi: Fix __sg_alloc_table_from_pages loop
Austin Shafer [Fri, 21 Apr 2023 07:56:50 +0000 (09:56 +0200)]
linuxkpi: Fix __sg_alloc_table_from_pages loop

Commit 3e0856b63fe0e375a0951e05c2ef98bb2ebd9421 updated
__sg_alloc_table_from_pages to use the same API as linux, but modified
the loop condition when going over the pages in a sg list. Part of the
change included moving the sg_next call out of the for loop and into the
body, which causes an off by one error when traversing the list. Since
sg_next is called before the loop body it will skip the first element
and read one past the last element.

This caused panics when running PRIME with nvidia-drm as the off-by-one
issue causes a NULL dereference.

(cherry picked from commit 3f686532c9b4fd603d4ad2d3392232cff24188f4)

Commit 3f686532c9b4 tried to fix an issue with not properly starting
at the first page in the sg list to prevent a panic. This worked but
with the side effect of incrementing "s" during the final iteration
causing it to be NULL since the list had ended.
In cases non-DEBUG kernels this causes a panic with drm-5.15, since
"s" is NULL when we later pass it to sg_mark_end().
This change decouples the iteration sg from the return value so that
it is never incremented past the final page in the chain.

(cherry picked from commit 09b0401e91a92bcb58ea1873857b42f8211f660f)

7 months agoLinuxKPI: skbuff: fix tracing
Bjoern A. Zeeb [Sat, 19 Aug 2023 04:50:03 +0000 (04:50 +0000)]
LinuxKPI: skbuff: fix tracing

Fix arguments to a trace line and remove another trace line until we
actually will have the skb to trace along with a future implementation.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 149c457de14a06a40e0419d7a4249b1a3b01ae7a)

7 months agoLinuxKPI: implement mul_u64_u64_div_u64()
Bjoern A. Zeeb [Tue, 16 May 2023 20:55:00 +0000 (20:55 +0000)]
LinuxKPI: implement mul_u64_u64_div_u64()

Implement mul_u64_u64_div_u64() for an updated iwlwifi driver (though
we do not yet use it there; it is used for in-kernel ptp on wifi).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b80ea452375f52a3ab7d82a9aef10da0d89985d9)

Unbalanced parentheses broke the build; re-balance.

Fixes: b80ea452375f ("LinuxKPI: implement mul_u64_u64_div_u64()")
(cherry picked from commit dabbbebcb0f5ced163454cd08b78e551b4a365b5)

linuxkpi math: fix kassert in math64.h

Include <sys/systm.h> in math64.h, so that KASSERT and bool are
defined, to allow compilation to succeed after
b80ea452375f52a3ab7d82a9aef10da0d89985d9 and dabbbebcb0f5...

(cherry picked from commit b6a61d6836d90ff2756d804eb981a02b0828f496)

7 months agoLinuxKPI: add page pool skeleton
Bjoern A. Zeeb [Tue, 23 May 2023 23:15:57 +0000 (23:15 +0000)]
LinuxKPI: add page pool skeleton

Add the page pool skeleton based on a wireless driver.  We have to
sort out some struct page problems first before we can start
implementing this but that should happen independent of all other
changes.

(cherry picked from commit 517e0978db1ff92d9f2b86fe735aba24bca72038)

7 months agonet80211: Radiotap: add two more EHT defines
Bjoern A. Zeeb [Wed, 26 Jul 2023 02:57:17 +0000 (02:57 +0000)]
net80211: Radiotap: add two more EHT defines

An updated iwlwifi needs further radiotap updates for EHT.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit d73de457431943526cad7bd74e60f6264032d3c0)

7 months agoLinuxKPI: replace vtophys+PHYS_TO_VM_PAGE with virt_to_page
Bjoern A. Zeeb [Mon, 31 Jul 2023 05:28:42 +0000 (05:28 +0000)]
LinuxKPI: replace vtophys+PHYS_TO_VM_PAGE with virt_to_page

Rather than using the FreeBSD internal calls vtophys() and
PHYS_TO_VM_PAGE() use the already existing LinuxKPI abstraction for
this called virt_to_page().  This reduces the amount of compat code
to maintain and will allow further work on struct [vm_]page.

This should be a NOP.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit dcb0c54968db10d3c7619f16c4bcfa9284d50ea2)

7 months agoLinuxKPI: cleanup internal calls to VM_PAGE_TO_PHYS
Bjoern A. Zeeb [Mon, 31 Jul 2023 03:15:29 +0000 (03:15 +0000)]
LinuxKPI: cleanup internal calls to VM_PAGE_TO_PHYS

Replace FreeBSD native VM_PAGE_TO_PHYS() calls with page_to_phys()
allowing us to work on a struct page in the future using the one
single public Linux KPI interface to map to a native FreeBSD vm_page.

This should be a NOP.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit d1ea07642c47e26effec58f53b7369bf5f797252)

7 months agoLinuxKPI: reduce usage of struct vm_page and vm_page_t
Bjoern A. Zeeb [Mon, 31 Jul 2023 02:03:39 +0000 (02:03 +0000)]
LinuxKPI: reduce usage of struct vm_page and vm_page_t

We currently define (Linux) page to (FreeBSD) vm_page.
Cleanup some of the direct struct vm_page and vm_page_t declarations
and usages in the Linux KPI and make them 'struct page' or
'struct page *' to prepare for more upcoming work.

This should be a NOP.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 9e9c682ff3a1aec20a7e5f5b1dd88ceaec7c3950)

7 months agoLinuxKPI: pci.h add more constants
Bjoern A. Zeeb [Wed, 26 Jul 2023 02:58:35 +0000 (02:58 +0000)]
LinuxKPI: pci.h add more constants

Add two more PCI_EXP_LNKSTA_CLS constants to the compat defines
needed by wireless drivers.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit f74c09f3ec69a6cdba46aa821ab665d2f87142f7)

7 months agoLinuxKPI: implement get_random_u32_inclusive()
Bjoern A. Zeeb [Tue, 16 May 2023 21:03:30 +0000 (21:03 +0000)]
LinuxKPI: implement get_random_u32_inclusive()

Implementation of get_random_u32_inclusive().
This is needed by an update for wireless drivers.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1dcd1a539275fe69173bfc4dfc32c963fc7dcdbe)

7 months agoLinuxKPI: list.h add list_count_nodes()
Bjoern A. Zeeb [Mon, 26 Jun 2023 08:45:17 +0000 (08:45 +0000)]
LinuxKPI: list.h add list_count_nodes()

Implement list_count_nodes() using a simple loop.  This is needed by
an updated wireless driver.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1b18fb7faa75cc6dfa2e253190b41e63a997ca9d)

7 months agoLinuxKPI: cast jiffies_to_msecs() result
Bjoern A. Zeeb [Sat, 10 Jun 2023 22:57:27 +0000 (22:57 +0000)]
LinuxKPI: cast jiffies_to_msecs() result

jiffies_to_msecs() is expected to return an uint_t.  In order to avoid
changing printf format strings, properly cast the result to the
expected type.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 08bc2cc4c4d8e94ad1db63f97d923dee18bee668)

7 months agonet80211: ieee80211_swscan_bg_scan() track return variable under lock
Bjoern A. Zeeb [Sat, 18 Feb 2023 01:15:21 +0000 (01:15 +0000)]
net80211: ieee80211_swscan_bg_scan() track return variable under lock

As the comment says it probably does not matter but use a local
variable to track state under lock so we can return the last known
good state of what we thought we were operating under after unlocking.

Likely no functional changes.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit c9ba91435a01a80632a5b68144d75b38241fc8be)

7 months agoLinuxKPI: add DMA_MAPPING_ERROR
Bjoern A. Zeeb [Fri, 23 Sep 2022 22:13:19 +0000 (22:13 +0000)]
LinuxKPI: add DMA_MAPPING_ERROR

While we deal with 0 returned, some drivers directly use and check for
DMA_MAPPING_ERROR.  Add the case and check for both in dma_mapping_error().

(cherry picked from commit 0b9bc97342f98a911985ace5527aef97863dfd23)

7 months agonet80211: improve error handling from ieee80211_parse_beacon()
Bjoern A. Zeeb [Thu, 7 Apr 2022 20:50:39 +0000 (20:50 +0000)]
net80211: improve error handling from ieee80211_parse_beacon()

Following up on fb8c87b4f3bfdfac014f9d894fe75fbad0391b24, which was
supposed to go into all supported branches, increase ieee80211_scanparams
status field from 8bit to 32bit (enum size) and add a dedicated error
code for Mesh ID.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7354782698f1cf5d6b368a9b1e65cfe3ee7f235c)

7 months agotools/wlanstats: fix -Wunused-but-set-variable
Bjoern A. Zeeb [Mon, 11 Sep 2023 14:11:52 +0000 (14:11 +0000)]
tools/wlanstats: fix -Wunused-but-set-variable

The "allnodes" code is currently #if 0 so also #if 0 the setting of the
command line option and variable in order to keep wlanstats compiling.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 530c13c5401c1f29f8325cf851d96778852a1ba3)

7 months agong_ipfw: allow use of 32 bits wide cookies
Eugene Grosbein [Tue, 14 Nov 2023 09:36:08 +0000 (16:36 +0700)]
ng_ipfw: allow use of 32 bits wide cookies

There is no reason in truncating 32 bits cookie value to 16 bits.

Reviewed by: glebius

(cherry picked from commit 20e1f207cc789a28783344614d6d1d1c639c5797)

7 months agoUpdate leap-seconds to leap-seconds.3676924800
Xin LI [Sun, 26 Nov 2023 01:13:23 +0000 (17:13 -0800)]
Update leap-seconds to leap-seconds.3676924800

Obtained from:  ftp://ftp.boulder.nist.gov/pub/time/leap-seconds.3676924800
(cherry picked from commit 832c63f5e07e6f960d051747ccb4358695a393ec)

7 months agozfs: cherry-pick commit from master
Rob N [Tue, 28 Nov 2023 17:07:57 +0000 (04:07 +1100)]
zfs: cherry-pick commit from master

 #15571 30d581121 dnode_is_dirty: check dnode and its data for dirtiness

Obtained from: OpenZFS

(cherry picked from commit 30d581121bb122c90959658e7b28b1672d342897)

7 months agodnode_is_dirty: check dnode and its data for dirtiness
Rob N [Tue, 28 Nov 2023 17:16:49 +0000 (04:16 +1100)]
dnode_is_dirty: check dnode and its data for dirtiness

Over its history this the dirty dnode test has been changed between
checking for a dnodes being on `os_dirty_dnodes` (`dn_dirty_link`) and
`dn_dirty_record`.

  de198f2d9 Fix lseek(SEEK_DATA/SEEK_HOLE) mmap consistency
  2531ce372 Revert "Report holes when there are only metadata changes"
  ec4f9b8f3 Report holes when there are only metadata changes
  454365bba Fix dirty check in dmu_offset_next()
  66aca2473 SEEK_HOLE should not block on txg_wait_synced()

Also illumos/illumos-gate@c543ec060d illumos/illumos-gate@2bcf0248e9

It turns out both are actually required.

In the case of appending data to a newly created file, the dnode proper
is dirtied (at least to change the blocksize) and dirty records are
added.  Thus, a single logical operation is represented by separate
dirty indicators, and must not be separated.

The incorrect dirty check becomes a problem when the first block of a
file is being appended to while another process is calling lseek to skip
holes. There is a small window where the dnode part is undirtied while
there are still dirty records. In this case, `lseek(fd, 0, SEEK_DATA)`
would not know that the file is dirty, and would go to
`dnode_next_offset()`. Since the object has no data blocks yet, it
returns `ESRCH`, indicating no data found, which results in `ENXIO`
being returned to `lseek()`'s caller.

Since coreutils 9.2, `cp` performs sparse copies by default, that is, it
uses `SEEK_DATA` and `SEEK_HOLE` against the source file and attempts to
replicate the holes in the target. When it hits the bug, its initial
search for data fails, and it goes on to call `fallocate()` to create a
hole over the entire destination file.

This has come up more recently as users upgrade their systems, getting
OpenZFS 2.2 as well as a newer coreutils. However, this problem has been
reproduced against 2.1, as well as on FreeBSD 13 and 14.

This change simply updates the dirty check to check both types of dirty.
If there's anything dirty at all, we immediately go to the "wait for
sync" stage, It doesn't really matter after that; both changes are on
disk, so the dirty fields should be correct.

Sponsored-by: Klara, Inc.
Sponsored-by: Wasabi Technology, Inc.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Rob Norris <rob.norris@klarasystems.com>
Closes #15571
Closes #15526

7 months agolibevent: Import libevent 2.1.12
Cy Schubert [Tue, 14 Nov 2023 23:04:28 +0000 (15:04 -0800)]
libevent: Import libevent 2.1.12

Merge commit '5223d1d95fddcef6f9a36e264a5800bd907ade8b' into main

(cherry picked from commit b50261e21f39a6c7249a49e7b60aa878c98512a8)

7 months agoUnbound: Manually update version strings
Cy Schubert [Tue, 14 Nov 2023 00:39:10 +0000 (16:39 -0800)]
Unbound: Manually update version strings

This was missed earlier today.

Reported by: "Herbert J. Skuhra" <herbert@gojira.at>
Fixes: 16fd0b249104

(cherry picked from commit 67267734315c6a48db31697f0a0669fa1f985969)

7 months agoUnbound: Remove backup file brought in from upstream
Cy Schubert [Tue, 14 Nov 2023 00:36:24 +0000 (16:36 -0800)]
Unbound: Remove backup file brought in from upstream

Upstream tarball included config.h~.

This was previously manually removed from vendor where in fact it
should not have been as it would have caused a merge conflict.

Reported by: "Herbert J. Skuhra" <herbert@gojira.at>

(cherry picked from commit 5aab39b24ce7437265b94461ffdd9b12c0723658)

7 months agounbound: Vendor import 1.19.0
Cy Schubert [Mon, 13 Nov 2023 21:38:45 +0000 (13:38 -0800)]
unbound: Vendor import 1.19.0

Release notes at
    https://www.nlnetlabs.nl/news/2023/Aug/30/unbound-1.19.0-released/

Merge commit '16fd0b24910488e59ca1941387b9ac7fb646a837' into unbound

(cherry picked from commit 103ba509e72e3949d22485666949e9705d4af8cd)

7 months agosqlite3: Vendor import of sqlite3 3.44.0
Cy Schubert [Mon, 13 Nov 2023 16:50:36 +0000 (08:50 -0800)]
sqlite3: Vendor import of sqlite3 3.44.0

Release notes at https://www.sqlite.org/releaselog/3_44_0.html.

Obtained from:  https://www.sqlite.org/2023/sqlite-autoconf-3440000.tar.gz

Merge commit '3a88fe13354325b9f56f07927e654de4f5398707'

(cherry picked from commit 7963e4115453c0aa003023386cbbc635de242150)

7 months agoldconfig: filter out non-existing directories from default path
Konstantin Belousov [Thu, 16 Nov 2023 05:38:00 +0000 (07:38 +0200)]
ldconfig: filter out non-existing directories from default path

(cherry picked from commit 806e4e3273bee2e3a12ffc2e74db5c912fbd7aa9)

7 months agorc.d/ldconfig: Prepend rtld stdlib paths to ldconfig(32)_paths
John W. O'Brien [Sun, 12 Nov 2023 22:45:27 +0000 (17:45 -0500)]
rc.d/ldconfig: Prepend rtld stdlib paths to ldconfig(32)_paths

PR: 275031

(cherry picked from commit 99132daf6f70cb0cc969c555d3612547fa3cf1db)

7 months agohmt(4): Do not require input report HID usages to be a member of TLC
Vladimir Kondratyev [Thu, 2 Nov 2023 06:20:20 +0000 (09:20 +0300)]
hmt(4): Do not require input report HID usages to be a member of TLC

Some touchpads places button usages (in HID report descriptor) in to
the 2-nd level collection rather than in to the top level one. That
confuses current code. Remove collection level check in HID report
descriptor parser to fix device detection.

Reported by: Peter Much <pmc@citylink.dinoex.sub.org>
PR: 267094

(cherry picked from commit 1d46c8e5c2702c141c6be982b3ca44e74d1cb8f1)

7 months agoevdev: Sync event codes with Linux kernel 6.5
Vladimir Kondratyev [Thu, 2 Nov 2023 06:20:20 +0000 (09:20 +0300)]
evdev: Sync event codes with Linux kernel 6.5

(cherry picked from commit 87a53bef41fe769920f925e74fedddafd5187b93)

7 months agolibcasper: Fix a typo in a source code comment
Gordon Bergling [Thu, 23 Nov 2023 08:58:15 +0000 (09:58 +0100)]
libcasper: Fix a typo in a source code comment

- s/mutiple/multiple/

(cherry picked from commit 637e4ef1a6bcd8677dabd8c08916df3091be5f64)

7 months agoath(4): Fix a typo in a source code comment
Gordon Bergling [Thu, 23 Nov 2023 08:57:28 +0000 (09:57 +0100)]
ath(4): Fix a typo in a source code comment

- s/mutiple/multiple/

(cherry picked from commit 4e36d081f377ecfa8375e5fe3d0763099f4a780d)

7 months agocrunchgen: fix "keep" for an ELF world, break it out
Kyle Evans [Fri, 10 Nov 2023 04:33:58 +0000 (22:33 -0600)]
crunchgen: fix "keep" for an ELF world, break it out

"keep" currently adds a leading underscore, which hasn't been useful or
accurate since a.out days.  Preserve the symbol name as it's given
rather than mangle it to match ELF-style symbol names.

This was partially fixed back in
6cd35234a092d ("Assume ELF-style symbol names now.") for crunchgen, but
the keeplist wasn't changed to match it.

While we're here, break it out to bsd.crunchgen.mk for later use in
bsdbox.

Reviewed by: adrian, imp

(cherry picked from commit 8f2848eafa682f1af629f8ee5e32fec607ab0ba1)

7 months agogrep: don't rely on implementation-defined malloc(0) behavior
Kyle Evans [Sun, 5 Nov 2023 02:08:36 +0000 (21:08 -0500)]
grep: don't rely on implementation-defined malloc(0) behavior

The very few places that rely on malloc/calloc of a zero-size region
won't attempt to dereference it, so just return NULL rather than rolling
the dice with the underlying malloc implementation.

Reported by: brooks, Shawn Webb

(cherry picked from commit e116e040f3091eca914a06dcd0bdd9f1aea23add)

7 months agoinstall: handle -m +X more accurately
Kyle Evans [Thu, 19 Oct 2023 02:43:06 +0000 (21:43 -0500)]
install: handle -m +X more accurately

As described by chmod(1), +X in the mode may be used to optionally set
the +x bit if the file is a directory if any of the execute/search bits
are set in the original mode.  The latter is not applicable because we
assume -m is a fresh mask, but a functional +X could be useful in the
former case if we're passing along a common INSTALL_MODE that's designed
to install either 0644 or 0755 depending simply on whether it's a
directory or not.

Reviewed by: des
Sponsored by: Klara, Inc.

(cherry picked from commit 767c97c501ae72eb3d74bc23ddf5a1d570d8f841)

7 months agousb: add necessary quirks for the NOREL Systems NS1081 SD reader
Mazin Fadl [Wed, 11 Oct 2023 03:12:22 +0000 (22:12 -0500)]
usb: add necessary quirks for the NOREL Systems NS1081 SD reader

Without these, the Norelsys NS1081 is completely defunct.

PR: 263868
Fixes: 7520b88860d7a79 ("usb(4): Automagically apply all quirks [...]")
(cherry picked from commit b332adfa96218148dfbb936a9c09d00484c868e3)

7 months agousb: add quirks for the Genesys GL3220 card reader
Mazin Fadl [Wed, 11 Oct 2023 03:22:12 +0000 (22:22 -0500)]
usb: add quirks for the Genesys GL3220 card reader

Without these, card hotplugging does not work on the GL3220.

PR: 263868
Fixes: 7520b88860d7a79 ("usb(4): Automagically apply all quirks [...]")
(cherry picked from commit 94efe9f91be7f3aa501983716db5a4378282a734)

7 months agore(4): Add support for 8168FP HW rev
Brad Smith [Thu, 23 Nov 2023 20:13:00 +0000 (12:13 -0800)]
re(4): Add support for 8168FP HW rev

(cherry picked from commit 88d2b69c719a20da9eb53f1c58adf6ecb005f8ce)
Differential Revision: https://reviews.freebsd.org/D42671

7 months agocompiler-rt: avoid segfaults when re-exec'ing with ASLR
Dimitry Andric [Wed, 22 Nov 2023 18:23:06 +0000 (19:23 +0100)]
compiler-rt: avoid segfaults when re-exec'ing with ASLR

After 930a7c2ac67e ("compiler-rt: re-exec with ASLR disabled when
necessary") and 96fe7c8ab0f6 ("compiler-rt: support ReExec() on
FreeBSD"), binaries linked against the sanitizer libraries may segfault
due to procctl(2) being intercepted. Instead, the non-intercepted
internal_procctl() should be called.

Similarly, the ReExec() function that re-executes the binary after
turning off ASLR should not call elf_aux_info(3) and realpath(3), since
these will also be intercepted. Instead, loop directly over the elf aux
info vector to find the executable path, and avoid calling realpath(3)
since it is actually unwanted for this use case.

Fixes: 930a7c2ac67e96fe7c8ab0f6
MFC after: 3 days

(cherry picked from commit 4c9a0adad18263ec8725d9bfc5f560c6ad1da8bd)

7 months agoAdd a HISTORY section for memcpy(3) and mempcpy(3)
Gordon Bergling [Sat, 18 Nov 2023 09:09:40 +0000 (10:09 +0100)]
Add a HISTORY section for memcpy(3) and mempcpy(3)

The memcpy() function first appeared in AT&T System V UNIX and was
reimplemented for 4.3BSD-Tahoe. The mempcpy() function first appeared in
FreeBSD 13.1.

PR: 272227
Differential Revision: https://reviews.freebsd.org/D42630

(cherry picked from commit 8c8ffe541eabb23e21ddffb534ecda7ac6d7e04a)

7 months agopseudofs: fix off by one in hash iteration in pfs_purge
Alvin Chen [Mon, 20 Nov 2023 05:55:35 +0000 (05:55 +0000)]
pseudofs: fix off by one in hash iteration in pfs_purge

Sponsored by: Dell Technologies
Differential Revision: https://reviews.freebsd.org/D42628

(cherry picked from commit e0d0f0930ee22af7bf38d28d8590d4e6c822871d)

7 months agopf: sctp heartbeats confirm a connection
Kristof Provost [Fri, 17 Nov 2023 12:52:34 +0000 (13:52 +0100)]
pf: sctp heartbeats confirm a connection

When we create a new state for multihomed sctp connections (i.e.
based on INIT/INIT_ACK or ASCONF parameters) the new connection will
never see a COOKIE/COOKIE_ACK exchange. We should consider HEARTBEAT_ACK
to be a confirmation that the connection is established.

This ensures that such connections do not time out earlier than
expected.

MFC after: 1 week
Sponsored by: Orange Business Services

(cherry picked from commit 7093414c63b08864dd9348f63e67b39a70c8b1be)

7 months agopf: skip urpf check for sctp multihomed states
Kristof Provost [Thu, 16 Nov 2023 19:55:02 +0000 (20:55 +0100)]
pf: skip urpf check for sctp multihomed states

When we create a new state for multihomed sctp connections (i.e.
based on INIT/INIT_ACK or ASCONF parameters) we cannot know what
interfaces we'll be seeing that traffic on. These states are floating
states, i.e. on "all" interfaces. We cannot do reverse path filtering
for these states, so do not do so.

MFC after: 1 week
Sponsored by: Orange Business Services

(cherry picked from commit a8dbbeb1c71b6f302818b8e041a2b50486b90180)

7 months agopf: always create multihomed states as floating
Kristof Provost [Thu, 16 Nov 2023 16:06:29 +0000 (17:06 +0100)]
pf: always create multihomed states as floating

When we create a new state for multihomed sctp connections (i.e.
based on INIT/INIT_ACK or ASCONF parameters) we cannot know what
interfaces we'll be seeing that traffic on. Make those states floating,
irrespective of state policy.

MFC after: 1 week
Sponsored by: Orange Business Services

(cherry picked from commit 0fe663b2a815dcb41431543940ec51408f418392)

7 months agolibpfctl: handle pfctl_do_ioctl() failures better
Kristof Provost [Fri, 17 Nov 2023 09:19:38 +0000 (10:19 +0100)]
libpfctl: handle pfctl_do_ioctl() failures better

Ensure that we free nvlists and other allocations if pfctl_do_ioctl()
fails.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 498934c5ff51e6b0d3199db5d27ed11b1e8b9582)

7 months agolibpfctl: handle allocation failure
Kristof Provost [Fri, 17 Nov 2023 09:14:59 +0000 (10:14 +0100)]
libpfctl: handle allocation failure

While it's unlikely for userspace to fail to allocate memory it is still
possible. Handle malloc() returning NULL.

Reported by: Bill Meeks <bill@themeeks.net>
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 33d55d0d0f33787e9e2796b5000be73af42573bc)

7 months agokernel: add missed FEATUREs compat_freebsd 8-14
Konstantin Belousov [Thu, 16 Nov 2023 20:47:18 +0000 (22:47 +0200)]
kernel: add missed FEATUREs compat_freebsd 8-14

(cherry picked from commit e256f71389fbf0ef6cf8f547342d5f789e69f918)