]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoffs_snapshot: do not assert that um_devvp is locked
Konstantin Belousov [Mon, 1 Nov 2021 23:47:43 +0000 (01:47 +0200)]
ffs_snapshot: do not assert that um_devvp is locked

(cherry picked from commit eede22d66d0043bf46e0aeac9496bec0a52f87a1)

2 years agog_vfs_close(): vp is unused
Konstantin Belousov [Thu, 18 Nov 2021 03:02:59 +0000 (05:02 +0200)]
g_vfs_close(): vp is unused

(cherry picked from commit 4fdc5b8494b46007549b1932c64e11cf634599a1)

2 years agoffs: fix newly introduced LOR between mntfs vnode lock and topology lock
Konstantin Belousov [Tue, 16 Nov 2021 17:31:11 +0000 (19:31 +0200)]
ffs: fix newly introduced LOR between mntfs vnode lock and topology lock

(cherry picked from commit c34a5148e8f21e9be28330c4ae4884b6f31193dd)

2 years agomntfs: lock mntfs pseudo devfs vnode properly
Konstantin Belousov [Mon, 1 Nov 2021 12:28:32 +0000 (14:28 +0200)]
mntfs: lock mntfs pseudo devfs vnode properly

(cherry picked from commit 25809a018db3c9f3be838c10576d2bb070cc055a)

2 years agoffs: Remove assertions about locked um_devvp in several places
Konstantin Belousov [Mon, 1 Nov 2021 08:04:27 +0000 (10:04 +0200)]
ffs: Remove assertions about locked um_devvp in several places

(cherry picked from commit 76b05e3e399133b59fc3e740cab9ae362358c9d6)

2 years agogetblk(): do not require devvp vnodes to be locked
Konstantin Belousov [Mon, 1 Nov 2021 07:14:01 +0000 (09:14 +0200)]
getblk(): do not require devvp vnodes to be locked

(cherry picked from commit a7b4a54d2c02822d36bb51b1e4450e1bc14ba73a)

2 years agogeom_vfs: lock devvp in g_vfs_close()
Konstantin Belousov [Mon, 1 Nov 2021 05:46:52 +0000 (07:46 +0200)]
geom_vfs: lock devvp in g_vfs_close()

(cherry picked from commit 8db7d16526debbca6bc7a32a57fd0378e48e37de)

2 years agoldd: also use exec mode for -a
Konstantin Belousov [Mon, 15 Nov 2021 20:45:51 +0000 (22:45 +0200)]
ldd: also use exec mode for -a

PR: 259069

(cherry picked from commit 7d20a08076b4c9d4513585a01fc57c39be654edf)

2 years agoprocstat auxv: print out FXRNG
Konstantin Belousov [Sat, 13 Nov 2021 20:55:52 +0000 (22:55 +0200)]
procstat auxv: print out FXRNG

(cherry picked from commit 0864ab3d3235f22c45f3790b2eb94974a51af062)

2 years agortld dump_auxv: be pedantic and distiguish between auxv union members based on format
Konstantin Belousov [Sat, 13 Nov 2021 19:04:51 +0000 (21:04 +0200)]
rtld dump_auxv: be pedantic and distiguish between auxv union members based on format

(cherry picked from commit b61bce17f346d79cecfd8f195a64b10f77be43b1)

2 years agortld dump_auxv: consistently use long modifier for non-pointer auxv vals
Konstantin Belousov [Sat, 13 Nov 2021 19:03:48 +0000 (21:03 +0200)]
rtld dump_auxv: consistently use long modifier for non-pointer auxv vals

(cherry picked from commit 3a902ef253853e367bd755222ed8fe4f101fbf2c)

2 years agortld: Implement LD_SHOW_AUXV
Konstantin Belousov [Sat, 13 Nov 2021 01:18:13 +0000 (03:18 +0200)]
rtld: Implement LD_SHOW_AUXV

(cherry picked from commit 64ba1f4cf3a6847a1dacf4bab0409d94898fa168)

2 years agortld: add rtld_fdprintfx()
Konstantin Belousov [Sat, 13 Nov 2021 01:49:22 +0000 (03:49 +0200)]
rtld: add rtld_fdprintfx()

(cherry picked from commit 77c088ab2109a376b71decce80e89d4f20ef8223)

2 years agonet: Allow binding of unspecified address without address existance
Roy Marples [Wed, 20 Oct 2021 15:47:29 +0000 (11:47 -0400)]
net: Allow binding of unspecified address without address existance

Previously in_pcbbind_setup returned EADDRNOTAVAIL for empty
V_in_ifaddrhead (i.e., no IPv4 addresses configured) and in6_pcbbind
did the same for empty V_in6_ifaddrhead (no IPv6 addresses).

An equivalent test has existed since 4.4-Lite.  It was presumably done
to avoid extra work (assuming the address isn't going to be found
later).

In normal system operation *_ifaddrhead will not be empty: they will
at least have the loopback address(es).  In practice no work will be
avoided.

Further, this case caused net/dhcpd to fail when run early in boot
before assignment of any addresses.  It should be possible to bind the
unspecified address even if no addresses have been configured yet, so
just remove the tests.

The now-removed "XXX broken" comments were added in 59562606b9d3,
which converted the ifaddr lists to TAILQs.  As far as I (emaste) can
tell the brokenness is the issue described above, not some aspect of
the TAILQ conversion.

PR: 253166
Reviewed by: ae, bz, donner, emaste, glebius
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D32563

(cherry picked from commit 5c5340108e9c2e384ca646720e17d037c69acc4c)

2 years agoBump __FreeBSD_version to 1300521.
Bjoern A. Zeeb [Fri, 19 Nov 2021 00:09:37 +0000 (00:09 +0000)]
Bump __FreeBSD_version to 1300521.

Bump __FreeBSD_version to 1300521 after merging LinuxKPI and net80211
changes.

2 years agoepair: remove "All rights reserved"
Bjoern A. Zeeb [Tue, 2 Nov 2021 16:48:07 +0000 (16:48 +0000)]
epair: remove "All rights reserved"

Remove "All rights reserved" from The FreeBSD Foundation owned
copyrights on epair code and documentation.

Approved by: emaste (FreeBSD Foundation)

(cherry picked from commit 1a8f198fa66518e6d249fa8aa765ec6e50a4fbab)

2 years agomii: update URL for OUIs
Bjoern A. Zeeb [Tue, 9 Nov 2021 21:35:45 +0000 (21:35 +0000)]
mii: update URL for OUIs

Update the URL for OUIs as the old one is 404 not even 301 anymore.

(cherry picked from commit 8e902c1d21a74c82ffef9f104eb31b213f79f1db)

2 years agoarm64/gicv3: improve a panic message
Bjoern A. Zeeb [Tue, 9 Nov 2021 22:11:15 +0000 (22:11 +0000)]
arm64/gicv3: improve a panic message

Print the device/unit in the panic message for which we cannot get
the MSI device ID to have a clue where to start looking.
While here use __func__ instead of hardcoding the function name.

(cherry picked from commit fad51d34f21359c5b94ca94842381c3e000f475e)

2 years agoParse named nodes from IORT ACPI on arm64
Dmitry Salychev [Sat, 7 Aug 2021 17:17:57 +0000 (17:17 +0000)]
Parse named nodes from IORT ACPI on arm64

Add the ability to map named components from IORT to their
SMMU or ITS node in order to setup interrupts.
It is now possible to find a node by its name (substring) and
resource ID similar to PCI nodes.
This is needed by work on a driver for NXP's Second Generation
Data Path Acceleration Architecture (DPAA2).

Reviewed by: andrew

(cherry picked from commit d178b1f878ae5b1b4e574bcf34d21b60855bf5a0)

2 years agobhyve: net_backends, automatically IFF_UP tap devices
Bjoern A. Zeeb [Wed, 28 Jul 2021 22:53:25 +0000 (22:53 +0000)]
bhyve: net_backends, automatically IFF_UP tap devices

If you want communications with the outside world and tell bhyve to
create an interfaces then it should be usable as well.
Rather than relying on the sysctl net.link.tap.up_on_open automatically
try to IFF_UP the opened tap device.

(cherry picked from commit 56be282bc999cc05dcd1ccb163b108d54f3ff448)

2 years agonet80211: add a driver-private pointer to struct ieee80211_node
Bjoern A. Zeeb [Sun, 31 Oct 2021 19:08:28 +0000 (19:08 +0000)]
net80211: add a driver-private pointer to struct ieee80211_node

Add a void *ni_drv_data field to struct ieee80211_node that drivers
can use to backtrack to their internal state from a net80211 node.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 917181dddf66a02958cf0a28e0c7c69e13e21af0)

2 years agoLinuxKPI: add strreplace() to string.h
Bjoern A. Zeeb [Fri, 22 Oct 2021 11:00:36 +0000 (11:00 +0000)]
LinuxKPI: add strreplace() to string.h

Add strreplace() needed by a driver.

(cherry picked from commit a5e2a27dca4bd5f4795b42ac598d4fff1c3a6eae)

2 years agoLinuxKPI: add kstrtou8() and kstrtou8_from_user() to kernel.h
Bjoern A. Zeeb [Fri, 22 Oct 2021 11:04:36 +0000 (11:04 +0000)]
LinuxKPI: add kstrtou8() and kstrtou8_from_user() to kernel.h

Analogous to the other sized version of kstrto[u]<type>() and
kstrtobool_from_user() add the "u8" versions needed by a driver.

(cherry picked from commit b382b78503b56ad6b787b995b46418db27adaa61)

2 years agoLinuxKPI: add simple_open() to fs.h
Bjoern A. Zeeb [Mon, 25 Oct 2021 16:44:18 +0000 (16:44 +0000)]
LinuxKPI: add simple_open() to fs.h

Add a dummy simple_open() to fs.h as we have for other
(unsupported) functions.
This is needed by a wireless driver.

(cherry picked from commit 41dee251ee9ead2e5c7a33b1457db5742c584354)

2 years agoLinuxKPI: module.h add MODULE_SUPPORTED_DEVICE()
Bjoern A. Zeeb [Mon, 25 Oct 2021 16:39:56 +0000 (16:39 +0000)]
LinuxKPI: module.h add MODULE_SUPPORTED_DEVICE()

Add a dummy MODULE_SUPPORTED_DEVICE define as we do for other
MODULE_* macros.  This is needed by a wireless driver.

(cherry picked from commit c5eec7b57c39b1dc4a63fea115a93d8d1628ff08)

2 years agomlx4: rename conflicting netdev_priv() to mlx4_netdev_priv()
Bjoern A. Zeeb [Mon, 25 Oct 2021 16:18:11 +0000 (16:18 +0000)]
mlx4: rename conflicting netdev_priv() to mlx4_netdev_priv()

netdev_priv() is a LinuxKPI function which was used with the old ifnet
linux/netdevice.h implementation which was not adaptable to modern
Linux drviers unless rewriting them for ifnet in first place which
defeats the purpose.
Rename the netdev_priv() calls in mlx4 to mlx4_netdev_priv()
returning the ifnet softc to avoid conflicting symbol names
with different implementations in the future.

(cherry picked from commit 9d593d5a76f22a315d7c6ab99e5e76003ec2b3f5)

2 years agoLinuxKPI: pci.h make pci_dev argument const for pci_{read,write}_config*()
Bjoern A. Zeeb [Mon, 25 Oct 2021 17:06:09 +0000 (17:06 +0000)]
LinuxKPI: pci.h make pci_dev argument const for pci_{read,write}_config*()

Make the struct pci_dev argument to the pci_{read,write}_config*()
functions "const" to match the Linux definition as some drivers
try to pass in a const argument which we currently fail to honor.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit ed5600f5329fad8b167bed0a5ae8a5f60d12258e)

2 years agoLinuxKPI: pci.h / linux_pci.c rename pci_driver field
Bjoern A. Zeeb [Mon, 25 Oct 2021 17:15:01 +0000 (17:15 +0000)]
LinuxKPI: pci.h / linux_pci.c rename pci_driver field

Rename the struct pci_driver {} field to the list_head from links
to node as a driver is actually initialsing this to {} which seems
questionable but it will at least make us match the Linux structure
field name.

Reviewed by: manu, hselasky

(cherry picked from commit cf899348420ce8839e32ddc30247b5d1c2b384f4)

2 years agoLinuxKPI: add netdev_features.h
Bjoern A. Zeeb [Mon, 25 Oct 2021 16:50:27 +0000 (16:50 +0000)]
LinuxKPI: add netdev_features.h

Add netdev_features.h as a spearate file from the future netdevice.h
implementation to avoid include problems with a future skbuff.h.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 490f9d8f0e7ce8c5b268fcd0806c5e00214eb5a7)

2 years agonet80211/drivers: improve ieee80211_rx_stats for band
Bjoern A. Zeeb [Sun, 6 Jun 2021 21:14:28 +0000 (21:14 +0000)]
net80211/drivers: improve ieee80211_rx_stats for band

While IEEE80211_R_BAND was defined, there was no place to store the
band.  Add a field for that, adjust ieee80211_lookup_channel_rxstatus()
to require it, and update drivers passing "R_{FREQ|IEEE}" in already to
provide the band as well.  For the moment keep the fall-back code
requiring all three fields.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 9a6695532b3997e4e2bc3fe57481cc49be5e9e93)

2 years agonet80211: correct input_sta length checks and control frame handling
Bjoern A. Zeeb [Thu, 30 Sep 2021 16:41:19 +0000 (16:41 +0000)]
net80211: correct input_sta length checks and control frame handling

Correct input_sta "assertion" checks.  CTS/ACK CTRL frames are shorter
then sizeof(struct ieee80211_frame_min) and were thus running into the
is_rx_tooshort error case.
Use ieee80211_anyhdrsize() to handle this better but make sure we do
at least have the first 2 octets needed for that.
While here move the safety checks before any code which may not obey
them later, just for good style.

The non-scanning check further down assumes a frame format also not
matching control frames.  For now skip the checks for control frames
which allows us to deal with some of them at least now.

Sponsored by: The FreeBSD Foundation
Obtained from: 20210906 wireless v0.91 code drop

(cherry picked from commit 3dc7a1897e0bb9e4b529c01cb3f88e1c387af5e8)

2 years agonet80211: correct length check in ieee80211_ies_expand()
Bjoern A. Zeeb [Wed, 6 Oct 2021 18:09:39 +0000 (18:09 +0000)]
net80211: correct length check in ieee80211_ies_expand()

In ieee80211_ies_expand() we are looping over Elements
(also known as Information Elements or IEs).
The comment suggests that we assume well-formedness of
the IEs themselves.
Checking the buffer length being least 2 (1 byte Element ID and
1 byte Length fields) rather than just 1 before accessing ie[1]
is still good practise and can prevent and out-of-bounds read in
case the input is not behaving according to the comment.

Reported by: (coypu sdf.org)
admbugs: 857

(cherry picked from commit 09dd08f167812a5fdb516fc98f14dbb43221432f)

2 years agonet80211: proper ssid length check in setmlme_assoc_adhoc()
Bjoern A. Zeeb [Wed, 6 Oct 2021 18:41:37 +0000 (18:41 +0000)]
net80211: proper ssid length check in setmlme_assoc_adhoc()

A user supplied SSID length is used without proper checks in
setmlme_assoc_adhoc() which can lead to copies beyond the end
of the user supplied buffer.
The ssid is a fixed size array for the ioctl and the argument
to setmlme_assoc_adhoc().
In addition to an ssid_len check of 0 also error in case the
ssid_len is larger than the size of the ssid array to prevent
problems.

PR: 254737
Reported by: Tommaso (cutesmilee.research protonmail.com)

(cherry picked from commit 526370fb85db4b659cff4625eb2f379acaa4a1a8)
(cherry picked from commit 0525ece3554edce14fa68a7fb61078ae2110c44b)

2 years agonet80211: prevent plaintext injection by A-MSDU RFC1042/EAPOL frames
Mathy Vanhoef [Sun, 6 Jun 2021 22:10:56 +0000 (22:10 +0000)]
net80211: prevent plaintext injection by A-MSDU RFC1042/EAPOL frames

No longer accept plaintext A-MSDU frames that start with an RFC1042
header with EtherType EAPOL.  This is done by only accepting EAPOL
packets that are included in non-aggregated 802.11 frames.

Note that before this patch, FreeBSD also only accepted EAPOL frames
that are sent in a non-aggregated 802.11 frame due to bugs in
processing EAPOL packets inside A-MSDUs. In other words,
compatibility with legitimate devices remains the same.

This relates to section 6.5 in the 2021 Usenix "FragAttacks" (Fragment
and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation)
paper.

Submitted by: Mathy Vanhoef (Mathy.Vanhoef kuleuven.be)
Security: CVE-2020-26144
PR: 256120

(cherry picked from commit ffc19cf52da5546973965f78cf32aa0f2c9657f8)

2 years agonet80211: mitigation against A-MSDU design flaw
Mathy Vanhoef [Sun, 6 Jun 2021 22:10:52 +0000 (22:10 +0000)]
net80211: mitigation against A-MSDU design flaw

Mitigate A-MSDU injection attacks by detecting if the destination address
of a subframe equals an RFC1042 (i.e., LLC/SNAP) header, and if so
dropping the complete A-MSDU frame.  This mitigates known attacks,
although new (unknown) aggregation-based attacks may remain possible.

This defense works because in A-MSDU aggregation injection attacks, a
normal encrypted Wi-Fi frame is turned into an A-MSDU frame. This means
the first 6 bytes of the first A-MSDU subframe correspond to an RFC1042
header. In other words, the destination MAC address of the first A-MSDU
subframe contains the start of an RFC1042 header during an aggregation
attack. We can detect this and thereby prevent this specific attack.

This relates to section 7.2 in the 2021 Usenix "FragAttacks" (Fragment
and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation)
paper.

Submitted by: Mathy Vanhoef (Mathy.Vanhoef kuleuven.be)
Security: CVE-2020-24588
PR: 256119

(cherry picked from commit f024bdf1155f36d2d8c4caa533b66e4040c4c469)

2 years agonet80211: reject mixed plaintext/encrypted fragments
Mathy Vanhoef [Sun, 6 Jun 2021 22:10:41 +0000 (22:10 +0000)]
net80211: reject mixed plaintext/encrypted fragments

ieee80211_defrag() accepts fragmented 802.11 frames in a protected Wi-Fi
network even when some of the fragments are not encrypted.
Track whether the fragments are encrypted or not and only accept
successive ones if they match the state of the first fragment.

This relates to section 6.3 in the 2021 Usenix "FragAttacks" (Fragment
and Forge: Breaking Wi-Fi Through Frame Aggregation and Fragmentation)
paper.

Submitted by: Mathy Vanhoef (Mathy.Vanhoef kuleuven.be)
Security: CVE-2020-26147
PR: 256118

(cherry picked from commit 11572d7d7fb9802ceb46ea9dc6cbe3bb95373e55)

2 years agoLinuxKPI: implement dma_set_coherent_mask()
Bjoern A. Zeeb [Mon, 27 Sep 2021 22:50:07 +0000 (22:50 +0000)]
LinuxKPI: implement dma_set_coherent_mask()

Coherent is lower 32bit only by default in Linux and our only default
dma mask is 64bit currently which violates expectations unless
dma_set_coherent_mask() was called explicitly with a different mask.

Implement coherent by creating a second tag, and storing the tags in the
objects and use the tag from the object wherever possible.
This currently does not update the scatterlist or pool (both could be
converted but S/G cannot be MFCed as easily).

There is a 2nd change embedded in the updated logic of
linux_dma_alloc_coherent() to always zero the allocation as
otherwise some drivers get cranky on uninialised garbage.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit c39eefe715b3c835ce3d91a1c1932197c23c1f3c)
(cherry picked from commit 1269873159c7fa0db3b9dbf8dadc54eec5dc0d58)

2 years agoLinuxKPI: dma-mapping.h unify "mask" and "dma_mask"
Bjoern A. Zeeb [Mon, 27 Sep 2021 20:48:02 +0000 (20:48 +0000)]
LinuxKPI: dma-mapping.h unify "mask" and "dma_mask"

In some places we are using "mask" and others "dma_mask" for the
same thing.  Harmonize the various places to "dma_mask" as used in
linux_pci.c.  For the declaration remove the argument names to
avoid the entire problem.

This is in preparation for an upcoming change.
No functional changes intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 72c89ce97ba3f023463930578c6df7f0374cbf17)

2 years agoLinuxKPI: disable device_release_driver()
Bjoern A. Zeeb [Mon, 27 Sep 2021 17:38:41 +0000 (17:38 +0000)]
LinuxKPI: disable device_release_driver()

As reported by multiple people testing iwlwifi, device_release_driver()
can lead to a panic on secondary errors (usually during attach).
Disable device_release_driver() for the short-term to prevent the panic
but leave it in place so it can be re-worked and fixed properly for
the long-term more easily.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 93b14194acaf2c2d80df9c4900a90c6644dcd92b)

2 years agonet80211: add func/line information to IEEE80211_DISCARD* macros
Bjoern A. Zeeb [Sat, 4 Sep 2021 09:24:51 +0000 (09:24 +0000)]
net80211: add func/line information to IEEE80211_DISCARD* macros

While debugging is very good in net80211, some log messages are
repeated in multiple places 1:1.  In order to distinguish where the
discard happened and to speed up analysis, add __func__:__LINE__
information to all these messages.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit cb5c07649aa005abb1e847c2cd5f816d762efb93)

2 years agonet80211: comments and whitespace
Bjoern A. Zeeb [Sat, 4 Sep 2021 09:16:25 +0000 (09:16 +0000)]
net80211: comments and whitespace

Add a missing '.', fix spelling of "failed" and unwrap a closing );
No functional changes.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 49c220b021d5855652ecb2803c969dfa47bdd306)

2 years agoLinuxKPI: add fsleep()
Bjoern A. Zeeb [Tue, 27 Jul 2021 15:22:02 +0000 (15:22 +0000)]
LinuxKPI: add fsleep()

Add fsleep() function now required by rtw88.  This seems to be
making a decision depending on time to sleep on how to sleep.
Given our compat framework already is lenient on how long to sleep,
this is a cut down version.

(cherry picked from commit cc2723370b482b923b2adeac3ad359d485f0bd82)

2 years agoLinuxKPI: add read_poll_timeout()
Bjoern A. Zeeb [Thu, 1 Jul 2021 13:29:49 +0000 (13:29 +0000)]
LinuxKPI: add read_poll_timeout()

Add an implementation of read_poll_timeout() and the atomic variant
which I did at some point last year for rtw88 and now updated based
on feedback.

(cherry picked from commit fed248a6acb33cf6d51880be8d5c774d89e75110)

2 years agoLinuxKPI: add module_pci_driver() and pci_alloc_irq_vectors()
Bjoern A. Zeeb [Thu, 1 Jul 2021 13:33:01 +0000 (13:33 +0000)]
LinuxKPI: add module_pci_driver() and pci_alloc_irq_vectors()

Add the two new functions needed by rtw88 to register the driver and
handle the module bits as well as a version of pci_alloc_irq_vectors()
for what is needed.

(cherry picked from commit 366d68f283793df22392f9fb992c5029dfc293bb)

2 years agoLinuxKPI: add sign_extend32()
Bjoern A. Zeeb [Thu, 1 Jul 2021 13:14:19 +0000 (13:14 +0000)]
LinuxKPI: add sign_extend32()

Add sign_extend32() replicating the 64 version.  This is needed by
the rtw88 driver.

(cherry picked from commit ea4dea83944ac6334d31e0364dd674eda250adde)

2 years agoLinuxKPI: fix bug in le32p_replace_bits()
Bjoern A. Zeeb [Thu, 29 Jul 2021 21:27:21 +0000 (21:27 +0000)]
LinuxKPI: fix bug in le32p_replace_bits()

Fix a bug that slipped in in 90707c4e44de03ea36be183ef2226601c66169cb
using the correct field in le32p_replace_bits().

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 22e20d852ff400a486da24e5d1d92c841a3e39d9)

2 years agoLinuxKPI: bitfield.h cleanup
Bjoern A. Zeeb [Thu, 29 Jul 2021 21:24:35 +0000 (21:24 +0000)]
LinuxKPI: bitfield.h cleanup

Add a missing tab and remove an unnecessary return.
No functional changes.

(cherry picked from commit 4c8af633d10104c793673ee1f6e7b96f113cce5a)

2 years agoLinuxKPI: dmi.h do not rely on implicit includes
Bjoern A. Zeeb [Wed, 28 Jul 2021 13:28:48 +0000 (13:28 +0000)]
LinuxKPI: dmi.h do not rely on implicit includes

Add sys/types.h to dmi.h and do not rely on other files to include
all needed headers in Linux land.  I ran into compile problems with
rtw88 otherwise.

(cherry picked from commit ac134e762e6908dcadd0c7cb7bcb3de0ed967f59)

2 years agoLinuxKPI: add nexthdr definitions for IPv6
Bjoern A. Zeeb [Tue, 27 Jul 2021 13:39:15 +0000 (13:39 +0000)]
LinuxKPI: add nexthdr definitions for IPv6

Add the nexthdr definitions for IPv6 which are used by wireless
drivers and were previously placed in an 80211 header file by
accident.

Obtained from: bz_iwlwifi
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b9d984e2c5dcef277c49a576ccefada6519d9b53)

2 years agobsdinstall: Fix mirror selection
Mateusz Piotrowski [Wed, 10 Nov 2021 15:39:09 +0000 (16:39 +0100)]
bsdinstall: Fix mirror selection

This is a follow-up to 2697622687708bffd4c3dcfc44f0c977a78e506d,
which fixed 2 out of 3 broken uses of the mirrorselect script.

Reviewed by: emaste
Approved by: emaste (src)
MFC after: 7 days
Differential Revision: https://reviews.freebsd.org/D32927

(cherry picked from commit 4042b356a00e12d6888a4e15e2373453804c5121)

2 years agostart_init: use 'p'
Konstantin Belousov [Sun, 14 Nov 2021 20:47:59 +0000 (22:47 +0200)]
start_init: use 'p'

(cherry picked from commit 8660813153d02e9e681ae083edc7f1d574cb62ca)

2 years agokasan: Disable validation of function parameters passed by value
Mark Johnston [Wed, 3 Nov 2021 16:28:48 +0000 (12:28 -0400)]
kasan: Disable validation of function parameters passed by value

It appears that the emitted code in the caller does not update shadow
state for values passed on the stack to the callee, which it seemingly
ought to do after pushing values on the stack and prior to the call
itself.  This leaves open a window where an interrupt handler can cause
regions of the stack containing these values to be poisoned, resulting
in rare false positive reports.  This happens particularly in the amd64
TLB invalidation code, where we liberally pass cpuset_t's around by
value.

LLVM has a flag to disable validation of accesses of function parameters
passed by value.  Such validation is itself a relatively new feature.
Turn it off for now.

Reported by: pho, syzkaller
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 2a519c3b14c29688e42d11f916655318b13c8409)

2 years agonfscl: Fix forced dismount when "nconnect" is specified
Rick Macklem [Wed, 3 Nov 2021 20:26:38 +0000 (13:26 -0700)]
nfscl: Fix forced dismount when "nconnect" is specified

When a forced dismount is done and the "nconnect" mount
option was used, the additional connections must be closed.
This patch does that.

Found during a recent IETF NFSv4 working group testing event.

(cherry picked from commit ae49051c033a2468af2f1f0079ecaf069b993245)

2 years agonfscl: Fix forced dismount from looping on commit
Rick Macklem [Wed, 3 Nov 2021 21:25:44 +0000 (14:25 -0700)]
nfscl: Fix forced dismount from looping on commit

When a forced dismount is in progress, it is possible to
end up looping, retrying commits that fail.
This patch fixes the problem by pretending
that commits succeeded when a forced dismount is in prgress.

(cherry picked from commit 6b67753488cb506f05694c5f6d2e74cf53497c54)

2 years agonfscl: Fix use after free for forced dismount
Rick Macklem [Wed, 3 Nov 2021 19:15:40 +0000 (12:15 -0700)]
nfscl: Fix use after free for forced dismount

When a forced dismount is done and delegations are being
issued by the server (disabled by default for FreeBSD
servers), the delegation structure is free'd before the
loop calling vflush().  This could result in a use after
free of the delegation structure.

This patch changes the code so that the delegation
structures are not free'd until after the vflush()
loop for forced dismounts.

Found during a recent IETF NFSv4 working group testing event.

(cherry picked from commit 441222585968517c595ef7f39e5c71a42d238acd)

2 years agonfscl: Check for a forced dismount in nfscl_getref()
Rick Macklem [Wed, 3 Nov 2021 00:28:13 +0000 (17:28 -0700)]
nfscl: Check for a forced dismount in nfscl_getref()

The nfscl_getref() function is called within nfscl_doiods() when
the NFSv4.1/4.2 pNFS client is doing I/O on a DS.  As such,
nfscl_getref() needs to check for a forced dismount.
This patch adds that check.

Found during a recent IETF NFSv4 working group testing event.

(cherry picked from commit 331883a2f2e9ae5567085e4cd3a7ae3db2a2b022)

2 years agonfscl: Use a smaller initial delay time for NFSERR_DELAY
Rick Macklem [Tue, 2 Nov 2021 00:21:31 +0000 (17:21 -0700)]
nfscl: Use a smaller initial delay time for NFSERR_DELAY

For NFS RPCs that receive a NFSERR_DELAY reply, the delay time
is initially 1sec and then increases exponentially to NFS_TRYLATERDEL.
It was found that this delay time is excessive for some NFSv4
servers, which work well with a 1msec delay.
A 1sec delay resulted in very slow performance for Remove and
Rename when delegations and pNFS were enabled.

This patch decreases the initial delay time to 1msec.

Found during a recent IETF NFSv4 working group testing event.

(cherry picked from commit 5a95a6e8e4d9e947b3bb4b4755a7242e1ddd72e7)

2 years agosnd_uaudio(4): Fix string index computations for iFeature.
Hans Petter Selasky [Tue, 9 Nov 2021 21:07:36 +0000 (22:07 +0100)]
snd_uaudio(4): Fix string index computations for iFeature.

This allows the iFeature strings to be properly read by the snd_uaudio(4) driver,
when parsing the audio feature unit descriptors.

Submitted by: Zhichao1.Li@dell.com
Sponsored by: NVIDIA Networking

(cherry picked from commit 11f09b17fe2cf0b5489601aee548a06486f0b749)

2 years agoamd64/ia32/ia32_signal.c: Use ANSI C functions definitions
Konstantin Belousov [Fri, 12 Nov 2021 17:11:22 +0000 (19:11 +0200)]
amd64/ia32/ia32_signal.c: Use ANSI C functions definitions

(cherry picked from commit c5658876b416c1f8206bd8d269af85239e8467aa)

2 years agobhyve: Fix the WITH_BHYVE_SNAPSHOT build
Mark Johnston [Sat, 16 Oct 2021 17:13:26 +0000 (13:13 -0400)]
bhyve: Fix the WITH_BHYVE_SNAPSHOT build

Note, this breaks compatibility with snapshots generated by older builds
of bhyve(8).

Fixes: 7fa233534736 ("bhyve: Map the MSI-X table unconditionally for passthrough")
Reported by: Greg V <greg@unrelenting.technology>
Reviewed by: grehan, bz
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 77bc75c7abd29de69d3ef35b66c23c7baba95094)

2 years agobhyve: Map the MSI-X table unconditionally for passthrough
Mark Johnston [Sat, 9 Oct 2021 15:36:19 +0000 (11:36 -0400)]
bhyve: Map the MSI-X table unconditionally for passthrough

It is possible for the PBA to reside in the same page as the MSI-X
table.  And, while devices are not supposed to do this, at least some
Intel wifi devices place registers in a page shared with the MSI-X
table.  To handle the first case we currently map the PBA page using
/dev/mem, and the second case is not handled.

Kill two birds with one stone: map the MSI-X table BAR using the
PCIOCBARMMAP ioctl instead of /dev/mem, and map the entire table so that
accesses beyond the bounds of the table can be emulated.  Regions of the
BAR not containing the table are left unmapped.

PR: 251046
Reviewed by: bz, grehan, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7fa2335347362378322a4d27cb40f6e6cd5dd0fb)

2 years agopci: Implement pci_bar_enabled() for SR-IOV VFs
Mark Johnston [Tue, 9 Nov 2021 18:07:57 +0000 (13:07 -0500)]
pci: Implement pci_bar_enabled() for SR-IOV VFs

In a VF's configuration space, "memory space enable" is hard-wired to 0,
so the existing implementation always returns false.  We need to read
the SR-IOV control register from the PF device to get the value of the
MSE bit.

Fix pci_bar_enabled() to read this register instead for VFs.  I don't
see any way to access the PF's config space without a backpointer in the
pci device ivars, so I added one.

This fixes a regression where bhyve(8) fails to map the MSI-X table
after commit 7fa233534736 ("bhyve: Map the MSI-X table unconditionally
for passthrough") when a VF is passed through, since with that commit we
use PCIOCBARMMAP to map the table and that ioctl always fails for VFs
without this change.  As a bonus, pciconf(8) now correctly reports the
enablement of BARs for VFs.

Reported and tested by: Raúl Muñoz <raul.munoz@custos.es>
Reviewed by: rstone, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1f960e646b7280795766fdaa183e3b9bd4cea345)

2 years agohwpmc: initialize arm64 counter/interrupt state
Mitchell Horne [Mon, 8 Nov 2021 19:33:25 +0000 (15:33 -0400)]
hwpmc: initialize arm64 counter/interrupt state

Performance counters and overflow interrupts are assumed to be disabled
by default, but this is not guaranteed. Ensure we disable both during
per-cpu initialization, before enabling the PMU. Otherwise, some systems
(such as the Ampere eMAG) would experience an interrupt storm upon
loading the hwpmc module.

Reviewed by: br
MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32854

(cherry picked from commit b826cc3caf6abc6a5d1926bd478b464938d45697)

2 years agouma: Fix handling of reserves in zone_import()
Mark Johnston [Mon, 1 Nov 2021 13:27:52 +0000 (09:27 -0400)]
uma: Fix handling of reserves in zone_import()

Kegs with no items reserved have uk_reserve = 0.  So the check
keg->uk_reserve >= dom->ud_free_items will be true once all slabs are
depleted.  Then, rather than go and allocate a fresh slab, we return to
the cache layer.

The intent was to do this only when the keg actually has a reserve, so
modify the check to verify this first.  Another approach would be to
make uk_reserve signed and set it to -1 until uma_zone_reserve() is
called, but this requires a few casts elsewhere.

Fixes: 1b2dcc8c54a8 ("uma: Avoid depleting keg reserves when filling a bucket")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 7585c5db25b700d19baebd7afd7a1b2e03c29cda)

2 years agouma: Improve M_USE_RESERVE handling in keg_fetch_slab()
Mark Johnston [Mon, 1 Nov 2021 13:27:35 +0000 (09:27 -0400)]
uma: Improve M_USE_RESERVE handling in keg_fetch_slab()

M_USE_RESERVE is used in a couple of places in the VM to avoid unbounded
recursion when the direct map is not available, as is the case on 32-bit
platforms or when certain kernel sanitizers (KASAN and KMSAN) are
enabled.  For example, to allocate KVA, the kernel might allocate a
kernel map entry, which might require a new slab, which requires KVA.

For these zones, we use uma_prealloc() to populate a reserve of items,
and then in certain serialized contexts M_USE_RESERVE can be used to
guarantee a successful allocation.  uma_prealloc() allocates the
requested number of items, distributing them evenly among NUMA domains.
Thus, in a first-touch zone, to satisfy an M_USE_RESERVE allocation we
might have to check the slab lists of other domains than the current one
to provide the semantics expected by consumers.

So, try harder to find an item if M_USE_RESERVE is specified and the keg
doesn't have anything for current (first-touch) domain.  Specifically,
fall back to a round-robin slab allocation.  This change fixes boot-time
panics on NUMA systems with KASAN or KMSAN enabled.[1]

Alternately we could have uma_prealloc() allocate the requested number
of items for each domain, but for some existing consumers this would be
quite wasteful.  In general I think keg_fetch_slab() should try harder
to find free slabs in other domains before trying to allocate fresh
ones, but let's limit this to M_USE_RESERVE for now.

Also fix a separate problem that I noticed: in a non-round-robin slab
allocation with M_WAITOK, rather than sleeping after a failed slab
allocation we simply try again.  Call vm_wait_domain() before retrying.

Reported by: mjg, tuexen [1]
Reviewed by: alc
Sponsored by: The FreeBSD Foundation

(cherry picked from commit fab343a7168a2f033073bb5f65b5af17d9092c6f)

2 years agomodule(9): Document that evhand can be NULL
Felix Johnson [Thu, 11 Nov 2021 06:28:45 +0000 (01:28 -0500)]
module(9): Document that evhand can be NULL

PR: 192250
Reported by: ngie

(cherry picked from commit c5e0492ae81e4b0d7946ccfbedb434a9c4071256)

2 years agonfscl: Use NFSMNTP_DELEGISSUED in two more functions
Rick Macklem [Sat, 30 Oct 2021 03:35:02 +0000 (20:35 -0700)]
nfscl: Use NFSMNTP_DELEGISSUED in two more functions

Commit 5e5ca4c8fc53 added a NFSMNTP_DELEGISSUED flag to indicate when
a delegation has been issued to the mount.  For the common case
where an NFSv4 server is not issuing delegations, this flag
can be checked to avoid acquisition of the NFSCLSTATEMUTEX.

This patch adds checks for NFSMNTP_DELEGISSUED being set
to two more functions.

This change appears to be performance neutral for a small number
of opens, but should reduce lock contention for a large number of opens
for the common case where server is not issuing delegations.

(cherry picked from commit dc6dd769de63c4eceb8899205a5d780d9f278fd2)

2 years agonfscl: Fix race between Lookup and Setattr of size
Rick Macklem [Sat, 30 Oct 2021 23:35:02 +0000 (16:35 -0700)]
nfscl: Fix race between Lookup and Setattr of size

PR#259071 provides a test program that fails for the NFS client.
Testing with it, there appears to be a race between Lookup
and VOPs like Setattr-of-size, where Lookup ends up loading
stale attributes (including what might be the wrong file size)
into the NFS vnode's attribute cache.

The race occurs when the modifying VOP (which holds a lock
on the vnode), blocks the acquisition of the vnode in Lookup,
after the RPC (with now potentially stale attributes).

Here's what seems to happen:
Child                                Parent

does stat(), which does
VOP_LOOKUP(), doing the Lookup
RPC with the directory vnode
locked, acquiring file attributes
valid at this point in time

blocks waiting for locked file       does ftruncate(), which
vnode                                does VOP_SETATTR() of Size,
                                     changing the file's size
                                     while holding an exclusive
                                     lock on the file's vnode
                                     releases the vnode lock
acquires file vnode and fills in
now stale attributes including
the old wrong Size
                                     does a read() which returns
                                     wrong data size

This patch fixes the problem by saving a timestamp in the NFS vnode
in the VOPs that modify the file (Setattr-of-size, Allocate).
Then lookup/readdirplus compares that timestamp with the time just
before starting the RPC after it has acquired the file's vnode.
If the modifying RPC occurred during the Lookup, the attributes
in the RPC reply are discarded, since they might be stale.

With this patch the test program works as expected.

Note that the test program does not fail on a July stable/12,
although this race is in the NFS client code.  I suspect a
fairly recent change to the name caching code exposed this
bug.

PR: 259071

(cherry picked from commit 2be417843a04f25e631e99d5188eb2652b13d80d)

2 years agonfscl: Add setting n_localmodtime to the Write RPC code
Rick Macklem [Sun, 31 Oct 2021 00:08:28 +0000 (17:08 -0700)]
nfscl: Add setting n_localmodtime to the Write RPC code

Similar to commit 2be417843a, I believe there could be a race between
the NFS client VOP_LOOKUP() and file Writing that could result in stale
file attributes being loaded into the NFS vnode by VOP_LOOKUP().

I have not been able to reproduce a failure due to this race, but
I believe that there are two possibilities:

The Lookup RPC happens while VOP_WRITE() is being executed and loads
stale file attributes after VOP_WRITE() returns when it has already
completed the Write/Commit RPC(s).
--> For this case, setting the local modify timestamp at the end of
  VOP_WRITE() should ensure that stale file attributes are not loaded.

The Lookup RPC occurs after VOP_WRITE() has returned, while
asynchronous Write/Commit RPCs are in progress and then is
blocked by the vnode held by VOP_OPEN/VOP_CLOSE/VOP_FSYNC which
will flush writes via ncl_flush() or ncl_vinvalbuf(), clearing the
NMODIFIED flag (which indicates Writes-in-progress). The VOP_LOOKUP()
then acquires the NFS vnode lock and fills in stale file attributes.
 --> Setting the local modify timestamp in ncl_flsuh() and ncl_vinvalbuf()
   when they clear NMODIFIED should ensure that stale file attributes
   are not loaded.

This patch does the above.

PR: 259071

(cherry picked from commit 50dcff0816e5e4aa94f51ce27da5121e49902996)

2 years agonfscl: Do pNFS layout return_on_close synchronously
Rick Macklem [Sun, 31 Oct 2021 23:31:31 +0000 (16:31 -0700)]
nfscl: Do pNFS layout return_on_close synchronously

For pNFS servers that specify that Layouts are to be returned
upon close, they may expect that LayoutReturn to happen before
the associated Close.

This patch modifies the NFSv4.1/4.2 pNFS client so that this
is done.  This only affects a pNFS mount against a non-FreeBSD
NFSv4.1/4.2 server that specifies return_on_close in LayoutGet
replies.

Found during a recent IETF NFSv4 working group testing event.

(cherry picked from commit d5d2ce1c8550a41e7374893ccd864c172461221f)

2 years agopf tests: test NAT-ed ICMP errors
Kristof Provost [Tue, 19 Oct 2021 11:52:21 +0000 (13:52 +0200)]
pf tests: test NAT-ed ICMP errors

Ensure that the ICMP error is returned with the correct
source and destination addresses.

MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32572

(cherry picked from commit 30276ef12cbb47cdd302741096262041be30ec11)

2 years agopf: ensure we have the correct source/destination IP address in ICMP errors
Luiz Otavio O Souza [Tue, 19 Oct 2021 11:37:54 +0000 (13:37 +0200)]
pf: ensure we have the correct source/destination IP address in ICMP errors

When we route-to a packet that later turns out to not fit in the
outbound interface MTU we generate an ICMP error.
However, if we've already changed those (i.e. we've passed through a NAT
rule) we have to undo the transformation first.

Obtained from: pfSense
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D32571

(cherry picked from commit ab238f14544b2415561c4fed674ee360aa8b5860)

2 years agoRevert "files.arm64: fix sort order for aw_i2s.c"
Andriy Gapon [Sat, 13 Nov 2021 09:15:11 +0000 (11:15 +0200)]
Revert "files.arm64: fix sort order for aw_i2s.c"

This reverts commit 25fb4fb2518f53b9c986367932d7fa6b7b6697ec.

This MFC was done prematurely as aw_i2s is not stable/13 yet.

Strangely, git cherry-pick did not complain when applying the diff,
although the line to be removed was not in the patched file.

2 years agofiles.arm64: fix sort order for aw_i2s.c
Andriy Gapon [Fri, 24 Sep 2021 17:26:07 +0000 (20:26 +0300)]
files.arm64: fix sort order for aw_i2s.c

(cherry picked from commit 24f567bb0e5060adb21bed24b00effec4f37f034)

2 years agogpioled: allow the driver to be disabled via fdt
Andriy Gapon [Fri, 25 Sep 2020 07:32:47 +0000 (10:32 +0300)]
gpioled: allow the driver to be disabled via fdt

(cherry picked from commit 832503063e32a449f8ed6ecf865d01e575559971)

2 years agodriver for MAX44009 I2C illuminance sensor
Andriy Gapon [Thu, 20 Aug 2020 08:11:31 +0000 (11:11 +0300)]
driver for MAX44009 I2C illuminance sensor

(cherry picked from commit ff6fe2983550aeab0852e982e7fe5ac4c672c205)

2 years agopcf8591: driver for adc/dac with i2c interface
Andriy Gapon [Mon, 17 Aug 2020 10:05:11 +0000 (13:05 +0300)]
pcf8591: driver for adc/dac with i2c interface

(cherry picked from commit a60b30469741392e66ec6fd21a8d5c4810a2d407)

2 years agohtu21: allow configuration via hints on FDT-based systems
Andriy Gapon [Thu, 4 Nov 2021 11:56:12 +0000 (13:56 +0200)]
htu21: allow configuration via hints on FDT-based systems

On-board devices should be configured via the FDT and overlays.
Hints are primarily useful for external and temporarily attached devices.
Adding hints is much easier and faster than writing and compiling
an overlay.

(cherry picked from commit a75159eabc90dc35af68c92f7d5eb72e087f6131)

2 years agohtu21: don't needlessly bother hardware when measurements are not needed
Andriy Gapon [Sat, 6 Nov 2021 16:47:32 +0000 (18:47 +0200)]
htu21: don't needlessly bother hardware when measurements are not needed

sysctl(8) first queries a sysctl to get a size of its value even if the
sysctl is of a fixed size, e.g. it has an integer type.
Only after that sysctl(8) queries an actual value of the sysctl.

Previosuly the driver would needlessly read a sensor in the first step.

(cherry picked from commit 43b031a371eb90c15c390c26202f5f58d09300ef)

2 years agosockstat(1): Update Synopsis section
Felix Johnson [Wed, 10 Nov 2021 20:22:06 +0000 (15:22 -0500)]
sockstat(1): Update Synopsis section

Update sockstat(1) manpage so the Synopsis section includes q (silent
mode) and the -j argument name is consistent.

PR: 256795
Reported by: Nick Reilly <nreilly@blackberry.com>

(cherry picked from commit 5504d8394289853e8c065e88a83fb464cb50d934)

2 years agoAdd some of Intel Alder Lake device IDs.
Alexander Motin [Sat, 6 Nov 2021 03:05:15 +0000 (23:05 -0400)]
Add some of Intel Alder Lake device IDs.

MFC after: 1 week

(cherry picked from commit dc238358f9f48ee4c983e2131656edb15636ab9e)

2 years agoigc: Use hardware routine for PHY reset
Peter Grehan [Mon, 1 Nov 2021 13:35:43 +0000 (23:35 +1000)]
igc: Use hardware routine for PHY reset

Summary:
The previously used software reset routine wasn't sufficient
to reset the PHY if the bootloader hadn't left the device in
an initialized state. This was seen with the onboard igc port
on an 11th-gen Intel NUC.

The software reset isn't used in the Linux driver so all related
code has been removed.

Tested on: Netgate 6100 onboard ports, a discrete PCIe I225-LM card,
and an 11th-gen Intel NUC.

Reported by: woodsb02
Tested by: woodsb02 (NUC)
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 561cd74b1704ab76a3286733fb43da53b6892ea4)

2 years agoigc: correctly update RCTL when changing multicast filters.
Peter Grehan [Mon, 11 Oct 2021 17:49:01 +0000 (03:49 +1000)]
igc: correctly update RCTL when changing multicast filters.

Fix clearing of bits in RCTL for the non-bpf/non-allmulti case.
Update RCTL after modifying the multicast filter registers as per
the Linux driver.

This fixes LACP on igc interfaces, where incoming LACP multicasti
control packets were being dropped.

Obtained from: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 5a3eb6207a353c3a18da8abcf00a2d75276dd29e)

2 years agoFactor out flags preserved during mbuf demote into a separate define.
Hans Petter Selasky [Thu, 4 Nov 2021 17:48:23 +0000 (18:48 +0100)]
Factor out flags preserved during mbuf demote into a separate define.

This define will later on be used by coming TLS RX hardware offload patches.

No functional change intended.

Reviewed by: jhb@
Sponsored by: NVIDIA Networking

(cherry picked from commit dd31400c3c2aa941d057e78296c193959a6d9ed3)

2 years agobeep(1): Initial version of utility to create terminal beep via soundcard.
Hans Petter Selasky [Tue, 26 Oct 2021 17:13:00 +0000 (19:13 +0200)]
beep(1): Initial version of utility to create terminal beep via soundcard.

Reviewed by: imp@, emaste@ and pstef@
Differential Revision: https://reviews.freebsd.org/D32672
Sponsored by: NVIDIA Networking

(cherry picked from commit 8abfbe5a79b19bb95430f574d970843607f5809c)

2 years agoLinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's.
Hans Petter Selasky [Tue, 2 Nov 2021 15:52:46 +0000 (16:52 +0100)]
LinuxKPI: Add sysctl(8) knob to control verbosity of WARN_ON's.

The purpose of this change is to reduce the amount of dmesg(8) noise when
VT switching after a panic.

Submitted by: Greg V <greg@unrelenting.technology>
Differential Revision: https://reviews.freebsd.org/D30174
Sponsored by: NVIDIA Networking

(cherry picked from commit 2390a1441effaba0e3d0f2f447f448aaf20428f1)

2 years agoip_divert: calculate delayed checksum for IPv6 adress family
Andrey V. Elsukov [Tue, 2 Nov 2021 16:59:06 +0000 (19:59 +0300)]
ip_divert: calculate delayed checksum for IPv6 adress family

Before passing an IPv6 packet to application apply delayed checksum
calculation. Mbuf flags will be lost when divert listener will return a
packet back, so we will not be able to do delayed checksum calculation
later. Also an application will get a packet with correct checksum.

Reviewed by: donner
Differential Revision: https://reviews.freebsd.org/D32807

(cherry picked from commit 4a9e95286cacce5bf7cd193b43c4a461cf7d69b8)

2 years agoe1000: Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Nov 2021 13:12:23 +0000 (14:12 +0100)]
e1000: Fix a typo in a source code comment

- s/overwritting/overwriting/

(cherry picked from commit e9c7c6f5a021a02c5af2fa446d31cf3756b58d62)

2 years agoefi(8): Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Nov 2021 13:07:24 +0000 (14:07 +0100)]
efi(8): Fix a typo in a source code comment

- s/writting/writing/

(cherry picked from commit 2b0f6ad444c0ec82facf55c0ee4806c2ba217daa)

2 years agousb_audio: Fix a typo in a source code comment
Gordon Bergling [Sun, 7 Nov 2021 13:04:26 +0000 (14:04 +0100)]
usb_audio: Fix a typo in a source code comment

- s/maxium/maximum/

(cherry picked from commit 3d6ed119e3fe123b7e18adf8672c45ab81068527)

2 years agofind(1): Update date format reference and remove cvs(1) references
Felix Johnson [Mon, 8 Nov 2021 06:14:58 +0000 (01:14 -0500)]
find(1): Update date format reference and remove cvs(1) references

cvs(1) is not installed by default. Change the date format reference to
note that find(1) understands ISO8601 and RFC822 date formats. Also
remove references to cvs(1).

PR: 254894
Reported by: danielsh@apache.org

(cherry picked from commit 52dbe1a0f419b8d45b4beed56b90ff48bc12e14c)

2 years agortld: style adjustments
Konstantin Belousov [Sat, 6 Nov 2021 03:20:39 +0000 (05:20 +0200)]
rtld: style adjustments

(cherry picked from commit 74aec9618fd709513ef2d319598dd82801c29726)

2 years agortld: ignore fstatfs(2) errors when checking MNT_NOEXEC flag
Konstantin Belousov [Sat, 6 Nov 2021 03:06:34 +0000 (05:06 +0200)]
rtld: ignore fstatfs(2) errors when checking MNT_NOEXEC flag

(cherry picked from commit c5637b8be8a5b6aaf663a58b0027f7f924d78b04)

2 years agoImplementations of cexpl()
Steve Kargl [Fri, 5 Nov 2021 02:04:01 +0000 (04:04 +0200)]
Implementations of cexpl()

PR: 216862

(cherry picked from commit 046e2d5db1e8afd2d09ea28e5d2a7550535d4b77)

2 years agopowerd(8): Add rc.conf(5) to see also
Felix Johnson [Sun, 7 Nov 2021 02:39:23 +0000 (22:39 -0400)]
powerd(8): Add rc.conf(5) to see also

powerd_flags is mentioned in rc.conf(5) and can be set there and pass to
powerd.

PR: 258320
Reported by: Michael <michael.hmich@gmail.com>

(cherry picked from commit ec071430a7822997619fe6d99853d8f49ea10b20)

2 years agoscsi_cd: Improve TOC access validation
Mark Johnston [Wed, 3 Nov 2021 19:09:17 +0000 (15:09 -0400)]
scsi_cd: Improve TOC access validation

1. During CD probing, we read the TOC header to find the number of
   entries, then read the TOC itself.  The header determines the number
   of entries, which determines the amount of data to read from the
   device into the softc in the CD_STATE_MEDIA_TOC_FULL state.  We
   hard-code a limit of 99 tracks (plus one for the lead-out) in the
   softc, but were not validating that the size reported by the media
   would fit in this hard-coded limit.  Kernel memory corruption could
   occur if not.[1]  Add validation to check this, and refuse to cache
   the TOC if it would not fit.

2. The CDIOCPLAYTRACKS ioctl uses caller provided track numbers to index
   into the TOC, but we only validate the starting index.  Add
   validation of the ending index.

Also, raise the hard-coded limit from 100 tracks to 170, per a
suggestion from Ken.

Reported by: C Turt <ecturt@gmail.com> [1]
Reviewed by: ken, avg
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6afabf00920fb8d41b8f013090f282c17c117efc)

2 years agonfscl: Add a missing delegation lock release
Rick Macklem [Tue, 26 Oct 2021 02:09:14 +0000 (19:09 -0700)]
nfscl: Add a missing delegation lock release

There was a case in nfscl_doiods() where the function would return
without releasing the delegation shared lock, if it was aquired by
the call to nfscl_getstateid().  This patch adds that release.

I have never observed a failure due to this missing release, so I
do not know if it ever happens in practice.  However, since the pNFS
client is not yet heavily used, it might be the case.

Found by code inspection during a recent NFSv4 IETF working group
testing event.

(cherry picked from commit 23024f004a4c5659bfcb0b08fac2211ae925ee58)

2 years agoarm: fix a typo in nvidia/drm2/tegra_bo.c
Mateusz Guzik [Mon, 25 Oct 2021 18:42:10 +0000 (18:42 +0000)]
arm: fix a typo in nvidia/drm2/tegra_bo.c

Unbreaks building TEGRA124

Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit e2493f4912cabd1d04be88fd17139a64bf2a2622)

2 years agortld: fix dangerous_ld_env calculation for ld_dynamic_weak
Konstantin Belousov [Sat, 6 Nov 2021 03:00:52 +0000 (05:00 +0200)]
rtld: fix dangerous_ld_env calculation for ld_dynamic_weak

(cherry picked from commit 8363963a8f3fc8226b1e3aa627e2fdd09688704e)

2 years agossh: move common Makefile boilerplate to a new ssh.mk
Ed Maste [Tue, 2 Nov 2021 18:48:33 +0000 (14:48 -0400)]
ssh: move common Makefile boilerplate to a new ssh.mk

This moves SSHDIR and ssh_namespace.h handling to a common location,
and will simplify future work such as adding U2F support (D32509).

Reviewed by: kevans
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32808

(cherry picked from commit 9d63429fa16352f58037ac2aa6ddc734b25e8331)