]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoFix kernel build without INET and INET6
Ed Maste [Sun, 2 Jan 2022 00:53:42 +0000 (19:53 -0500)]
Fix kernel build without INET and INET6

Reviewed by: brooks, melifaro
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33718

(cherry picked from commit a6668e31aa3cc855bfb37d6edc05122514592a47)

2 years agonfsclient: Fix a typos in source code comments
Gordon Bergling [Sun, 27 Mar 2022 17:27:05 +0000 (19:27 +0200)]
nfsclient: Fix a typos in source code comments

- s/ony/only/

Obtained from: NetBSD

(cherry picked from commit c1ad8a39a1c4271be62229cf9f6e93e7f1f569e7)

2 years agoath: Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 17:28:49 +0000 (19:28 +0200)]
ath: Fix a typo in a source code comment

- s/ony/only/

(cherry picked from commit 8eb774fe54c88a5417a287bd811a917fdfe1c2ba)

2 years agomac_veriexec: Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 17:56:15 +0000 (19:56 +0200)]
mac_veriexec: Fix a typo in a source code comment

- s/seach/search/

(cherry picked from commit 1920133d8fb77004c2d312f8b141e653d9a29e91)

2 years agoypbind(8): Fix a typo in the man page
Gordon Bergling [Sun, 27 Mar 2022 18:42:24 +0000 (20:42 +0200)]
ypbind(8): Fix a typo in the man page

- s/ot/or/

(cherry picked from commit 8bcffb86c7d5cff1474b14449c01388cac8cbc3d)

2 years agolibmd: Fix a common typo in the license header
Gordon Bergling [Sun, 27 Mar 2022 17:46:32 +0000 (19:46 +0200)]
libmd: Fix a common typo in the license header

- s/rouines/routines/

Obtained from: NetBSD

(cherry picked from commit 3e5a11d53a757f05ac1b61942f23f5f0cd9de691)

2 years agonetgraph(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 18:08:44 +0000 (20:08 +0200)]
netgraph(4): Fix a typo in a source code comment

- s/shapshot/snapshot/

(cherry picked from commit 1dc2c71ed897e162ad33e09ab3b0015613fa405a)

2 years agopf(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 27 Mar 2022 17:57:49 +0000 (19:57 +0200)]
pf(4): Fix a typo in a source code comment

- s/seaching/searching/

(cherry picked from commit ef88adc5273dea4139fc5693cc34508d492979e7)

2 years agoClear non-x86 compat stat syscall kernel stack memory disclosure
Ed Maste [Tue, 29 Mar 2022 17:55:21 +0000 (13:55 -0400)]
Clear non-x86 compat stat syscall kernel stack memory disclosure

32-bit architectures other than i386 have 64-bit time_t which results
in a struct timespec with 12 bytes for tv_sec and tv_nsec, and 4 bytes
of padding.  Zero the padding holes in struct stat32 and struct
freebsd11_stat32.

i386 has 32-bit time_t; struct timespec is 8 bytes and has no padding.

Found by inspection, prompted by a report by Reno Robert of Trend Micro
Zero Day Initiative.  The originally reported issue (ZDI-CAN-14538) is
already fixed in all supported FreeBSD versions (it was addressed
incidentally as part of the 64-bit inode project).

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34709

(cherry picked from commit f90cd1ae30b5f49e9f6ea58a0628ce1c8d8822bc)

Approved by: re (gjb, early MFC)

2 years agoRemove snd_aureal driver source
Ed Maste [Fri, 18 Mar 2022 20:11:32 +0000 (16:11 -0400)]
Remove snd_aureal driver source

This driver was not finished when it was committed in 1999 and was never
connected to the build.

A version of the driver used to be available in ports as
audio/aureal-kmod, but it has been removed.  It did not build on FreeBSD
10.x or later and the binary objects it required were not available
after Google Code disappeared.

PR: 124343
Reported by: joel
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit ef5dec7cc75b985d9ada767f716e19ec44f5c44a)

2 years agoneta: split fixed and in-band link status configuration
Sebastien Bini [Tue, 22 Mar 2022 15:44:09 +0000 (16:44 +0100)]
neta: split fixed and in-band link status configuration

Fixed-link mode requires different handling than the in-band
managed connection. Update interrupt, link-up/down and
autonegotiation settings for the former.

Reviewed by: mw
MFC after: 1 week
Obtained from: Stormshield
Differential Revision: https://reviews.freebsd.org/D34394

(cherry picked from commit 231237bbb0e803f9047c235cd6b5878f70e6c5eb)

2 years agoExtend device_get_property API
Kornel Duleba [Fri, 28 Jan 2022 09:28:37 +0000 (10:28 +0100)]
Extend device_get_property API

In order to support various types of data stored in device
tree properties or ACPI _DSD packages, create a new enum so
the caller can specify the expected type of a property they
want to read, according to the binding. The bus logic will use
that information to process the underlying data.

For example in DT all integer properties are stored in BE format.
In order to get constant results across different platforms we
need to convert its endianness to match the host.

Another example are ACPI_TYPE_INTEGER properties stored
as uint64_t. Before this patch the ACPI logic would refuse
to read them if the provided buffer was smaller than 8 bytes.
Now this can be handled by using DEVICE_PROP_UINT32 type.

Modify the existing consumers of this API to reflect the changes
and update the man pages accordingly.

Reviewed by: mw
Obtained from: Semihalf
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33457

(cherry picked from commit b344de4d0d163cbd8bf88cb5d226c18fe96f488f)

2 years agobus_if: Add a default implementation of get_property
Kornel Duleba [Tue, 25 Jan 2022 10:10:55 +0000 (11:10 +0100)]
bus_if: Add a default implementation of get_property

There are multiple buses that pretend to be ofw compatible,
e.g ofw_pci, mii_fdt. We now need to provide an implementation
of BUS_GET_PROPERTY for every one of them. Instead of modifying
them one by one it's better to just provide a default
implementation that simply traverses up the device tree.
Remove the now unneeded BUS_GET_PROPERTY implementation in mii_fdt.

Reviewed by: andrew, bz
Obtained from: Semihalf
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34031

(cherry picked from commit 206dc82bc3fc5e1d90200e189ce5f2240dfec874)

2 years agomiibus: Add support for mapping OFW nodes to PHY devices
Kornel Duleba [Mon, 15 Nov 2021 08:55:33 +0000 (09:55 +0100)]
miibus: Add support for mapping OFW nodes to PHY devices

Create a new miibus OFW specific layer leveraging miibus_fdt.c code.
PHY drivers can than read the properties using device_get_property(9) API.
Resource(interrupt) allocation is also supported.
In order to enable this each NIC/switch driver will have to be modified,
because of how miibus is attached to the parent driver.

Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D32812

(cherry picked from commit 9174eab4142c5ed199b1599c1a3eefd5f0573ab7)

2 years agomii_fdt: Add support for switch PHY node lookup
Kornel Duleba [Wed, 27 Oct 2021 08:34:17 +0000 (10:34 +0200)]
mii_fdt: Add support for switch PHY node lookup

Previously we would only search for a PHY xref in node of the miibus
parent.
That didn't work very well with switches.
Fix that by searching through "ports" subnode, checking if any of its
children have a valid PHY xref.
Since switches tend to have multiple ports we also have multiple
candidates.
Use the PHY address read from mii_attach_args to find the right one.

Obtained from: Semihalf
Sponsored by: Alstom Group
Reviewed by: mw
Differential revision: https://reviews.freebsd.org/D32690

(cherry picked from commit 4b843e7f0319867c412070e7752dbb47f195b322)

2 years agosdhci_xenon: add ACPI support
Bartlomiej Grzesik [Wed, 21 Jul 2021 14:36:11 +0000 (16:36 +0200)]
sdhci_xenon: add ACPI support

Add support for ACPI device probing for SDHCI controller found on Marvell chips.

Reviewed by: mw
Sponsored by: Semihalf
Differential revision: https://reviews.freebsd.org/D31600

(cherry picked from commit adbce5ff747b6372b6cda915d06fe52b4a67b4d8)

2 years agosdhci_xenon: split driver file into generic file and fdt parts
Bartlomiej Grzesik [Thu, 15 Jul 2021 12:29:15 +0000 (14:29 +0200)]
sdhci_xenon: split driver file into generic file and fdt parts

This patch splits driver code into two seperate files sdhci_xenon.c
and sdhci_xenon_fdt.c. This will allow future implementation of ACPI
discovery of sdhci on Xenon chips.

Reviewed by: mw
Sponsored by: Semihalf
Differential revision: https://reviews.freebsd.org/D31599

(cherry picked from commit d78e464d23304084be17cb8db8981558f2829d6c)

2 years agommc: switch mmc_helper to device_ api
Bartlomiej Grzesik [Mon, 2 Aug 2021 14:27:23 +0000 (16:27 +0200)]
mmc: switch mmc_helper to device_ api

Add generic mmc_helper which uses newly introduced device_*_property
api. Thanks to this change the sd/mmc drivers will be capable
of parsing both DT and ACPI description.

Ensure backward compatibility for all mmc_fdt_helper users.

Reviewed by: manu, mw
Sponsored by: Semihalf
Differential revision: https://reviews.freebsd.org/D31598

(cherry picked from commit 8a8166e5bcfb50e2b7280581b600d098fa6c9fc7)

mmc: Fix regression in 8a8166e5bcfb breaking Stratix 10 boot

The refactoring in 8a8166e5bcfb introduced a functional change that
breaks booting on the Stratix 10, hanging when it should be attaching
da0. Previously OF_getencprop was called with a pointer to host->f_max,
so if it wasn't present then the existing value was left untouched, but
after that commit it will instead clobber the value with 0. The dwmmc
driver, as used on the Stratix 10, sets a default value before calling
mmc_fdt_parse and so was broken by this functional change. It appears
that aw_mmc also does the same thing, so was presumably also broken on
some boards.

Fixes: 8a8166e5bcfb ("mmc: switch mmc_helper to device_ api")
Reviewed by: manu, mw
Differential Revision: https://reviews.freebsd.org/D32209

(cherry picked from commit 4a331971d2f1083f35b87197da0614fa3e0e53cb)

2 years agodevice: add device_get_property and device_has_property
Bartlomiej Grzesik [Fri, 30 Jul 2021 08:57:06 +0000 (10:57 +0200)]
device: add device_get_property and device_has_property

Generialize bus specific property accessors. Those functions allow driver code
to access device specific information.

Currently there is only support for FDT and ACPI buses.

Reviewed by: manu, mw
Sponsored by: Semihalf
Differential revision: https://reviews.freebsd.org/D31597

(cherry picked from commit 3f9a00e3b577dcca57e331842e0baf2dbdf9325f)

acpi: Fix error code returned in acpi_bus_get_prop

ACPI implementation of device_get_property would return "-1" when
property was found, but it's type wasn't supported.
This causes device_has_property to return false in that scenario, which
arguably could be considered as incorrect.

Fix that by returning "0" in that case.

Reviewed by: bz, mw
Tested by: mw
MFC after: 2 weeks
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D33103

(cherry picked from commit d9ed1dcc5c6894e376e6e4ef6f2554dd056baf4e)

2 years agoacpica: add ACPI_GET_PROPERTY to access Device Specific Data (DSD)
Bartlomiej Grzesik [Tue, 27 Jul 2021 12:39:31 +0000 (14:39 +0200)]
acpica: add ACPI_GET_PROPERTY to access Device Specific Data (DSD)

Add lazy acquiring of DSD package, which allows accessing Device
Specific Data.

Reviewed by: manu, mw
Sponsored by: Semihalf
Differential revision: https://reviews.freebsd.org/D31596

(cherry picked from commit b91fc6c43a81d3b760fb570c8439a922e536d7e6)

2 years agoAdd the Ampere and Fujitsu arm64 implementer IDs
D Scott Phillips [Fri, 25 Mar 2022 16:05:22 +0000 (09:05 -0700)]
Add the Ampere and Fujitsu arm64 implementer IDs

Reviewed By: andrew, emaste
MFC after: 3 days
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D34666

(cherry picked from commit 220c48e2d987360b935f4863ee0436c40a60b46f)

2 years agoarm64: Add explicit barrier after address translation instruction
D Scott Phillips [Fri, 25 Mar 2022 16:04:47 +0000 (09:04 -0700)]
arm64: Add explicit barrier after address translation instruction

Following ARMARM sec D5.2.11, which says:

> Where an instruction results in an update to a System register,
> as is the case with the AT * address translation instructions,
> explicit synchronization must be performed before the result is
> guaranteed to be visible to subsequent direct reads of the
> PAR_EL1.

Reviewed By: andrew
MFC after: 3 weeks
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D34665

(cherry picked from commit 7be7bd67758520ea2f9784a81ad244e99a7632f0)

2 years agoarm64: pmap: Mask VA operand in TLBI instructions
D Scott Phillips [Fri, 25 Mar 2022 16:04:11 +0000 (09:04 -0700)]
arm64: pmap: Mask VA operand in TLBI instructions

Bits 43:0 of the TLBI operand are bits 55:12 of the VA.  Leaving
bits 63:55 of the VA in bits 51:44 of the operand might wind up
setting the TTL field (47:44) and accidentally restricting which
translation levels are flushed in the TLB.

Reviewed By: andrew
MFC after: 3 days
Sponsored by: Ampere Computing
Differential Revision: https://reviews.freebsd.org/D34664

(cherry picked from commit a693a30038278b1ccd3e67b98d76e259ca1b405d)

2 years agoFix arm64 TLB invalidation with non-4k pages
Andrew Turner [Thu, 10 Mar 2022 14:39:03 +0000 (14:39 +0000)]
Fix arm64 TLB invalidation with non-4k pages

When using 16k or 64k pages atop will shift the address by more than
the needed amount for a tlbi instruction. Replace this with a new macro
to shift the address by 12 and use PAGE_SIZE in the for loop to let the
code work with any page size.

Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34516

(cherry picked from commit 813738fabaaea43503724b8371faf5bab73a3047)

2 years agodevd: Add rtw to wireless list
Warner Losh [Mon, 28 Mar 2022 14:16:14 +0000 (08:16 -0600)]
devd: Add rtw to wireless list

rtw88 and rtw89 are coming soon, so add them here now

Sponsored by: Netflix
MFC After: 1 day

(cherry picked from commit dea368bc5e7905e7456b052c545dcfd935341083)

2 years agolibarchive: merge vendor bugfixes
Martin Matuska [Sat, 26 Mar 2022 10:04:36 +0000 (11:04 +0100)]
libarchive: merge vendor bugfixes

Bugfixes:
  IS #1672 and OSS-Fuzz #38766:
    (zip reader) fix possible out-of-bounds read in zipx_lzma_alone_init()
  PR #1676: (mtree reader) remove the unused variable "detected_bytes"
  PR #1674: (doc) fix use of At mdoc(7) macro in cpio.5

(cherry picked from commit 0c9c2eb394b4a5694bc5ea11b326f334c735c813)

2 years agozfs: merge openzfs/zfs@52bad4f23 (zfs-2.1-release) into stable/13
Martin Matuska [Tue, 29 Mar 2022 10:41:53 +0000 (12:41 +0200)]
zfs: merge openzfs/zfs@52bad4f23 (zfs-2.1-release) into stable/13

OpenZFS release 2.1.4

Notable upstream pull request merges:
  #13219 FreeBSD: add missing replay check to an assert in zfs_xvattr_set
  #13220 module: freebsd: avoid a taking a destroyed lock in zfs_zevent bits
  #13221 Fix ACL checks for NFS kernel server

Obtained from: OpenZFS
OpenZFS tag: zfs-2.1.4
OpenZFS commit: 52bad4f23daaa5f827f802c8d05785a27b80275d
Relnotes: yes

2 years agoamd64: bring back asm bcmp, shared with memcmp
Mateusz Guzik [Fri, 25 Mar 2022 15:04:04 +0000 (15:04 +0000)]
amd64: bring back asm bcmp, shared with memcmp

Turns out clang converts "memcmp(foo, bar, len) == 0" and similar to
bcmp calls.

Reviewed by: emaste (previous version), jhb (previous version)
Differential Revision: https://reviews.freebsd.org/D34673

(cherry picked from commit fbc002cb72d2d9bb435cce99630d5d7da9f59390)

2 years agoCTL: Rework 05c3e8e87142 using %zu format.
Alexander Motin [Fri, 25 Feb 2022 16:52:17 +0000 (11:52 -0500)]
CTL: Rework 05c3e8e87142 using %zu format.

MFC after: 2 days

(cherry picked from commit f00ced06da25540c2057e46033d1c38b4ade7c8b)

2 years agoFix 32-bit build after 530d274c15e5.
Alexander Motin [Thu, 24 Feb 2022 23:10:47 +0000 (18:10 -0500)]
Fix 32-bit build after 530d274c15e5.

MFC after: 3 days

(cherry picked from commit 05c3e8e87142a8689503a6731237b48fb43c1bec)

2 years agoCTL: Add length validation for incoming HA messages.
Alexander Motin [Thu, 24 Feb 2022 21:17:34 +0000 (16:17 -0500)]
CTL: Add length validation for incoming HA messages.

This should fix uninitialized memory reads when working with broken
HA peer, like one fixed in 1a8d8a3a909.  Instead print error message
and kill the HA link.

MFC after: 3 days
Sponsored by: iXsystems, Inc.

(cherry picked from commit 530d274c15e5b3f69088b4b53f8dc5b2b849a916)

2 years agomfc jail: handle jailsys parameters in modification permission test
Jamie Gritton [Sat, 26 Mar 2022 02:16:51 +0000 (19:16 -0700)]
mfc jail: handle jailsys parameters in modification permission test

Avoid a null dereference when a value-less jailsys parameter is passed
to "jail -m".  There was already code to handle boolean parameters,
but in reality any parameter could be passed without a value.

PR:             262471
Reported by:    jcaplan at blackberry.com

(cherry picked from commit 8f1543785f77086494c73310ba8f5d09b61ff7eb)

2 years agopf: hoist the unlinked rules lock out of the mass rule removal loop
Mateusz Guzik [Mon, 28 Feb 2022 10:39:02 +0000 (11:39 +0100)]
pf: hoist the unlinked rules lock out of the mass rule removal loop

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

(cherry picked from commit b163dcab27862f90e0108a73185945456cafd2f3)

2 years agopf: add PF_UNLNKDRULES_ASSERT
Mateusz Guzik [Mon, 28 Feb 2022 10:37:30 +0000 (11:37 +0100)]
pf: add PF_UNLNKDRULES_ASSERT

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

(cherry picked from commit f11b6505f14600d350dfa427f61abb8d1c7e1db4)

2 years agopf: remove spurious zeroing from pf_ioctl_addrule
Mateusz Guzik [Fri, 25 Feb 2022 16:18:13 +0000 (17:18 +0100)]
pf: remove spurious zeroing from pf_ioctl_addrule

Newly allocated counters are guaranteed to be 0.

This removes 5 IPIs for each loaded rule.

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

(cherry picked from commit 15ada7514954150e6c07fd6a31ceb686ece76943)

2 years agou3g: Add support Quectel EM12-G modem.
Alexander V. Chernikov [Sat, 29 Jan 2022 09:53:38 +0000 (09:53 +0000)]
u3g: Add support Quectel EM12-G modem.

Submitted by: <tda.77793 at gmail.com>
PR: 260218
MFC after: 2 weeks

(cherry picked from commit 217481a3332783d03366c4512b0b164764aa6c6e)

2 years agoifconfig: remove debug printf introduced in 779fd0534466
Alexander V. Chernikov [Sat, 29 Jan 2022 11:18:13 +0000 (11:18 +0000)]
ifconfig: remove debug printf introduced in 779fd0534466

Reported by: jhb

(cherry picked from commit 656f5031c39108d2418454f12b52931c32514741)

2 years agoifconfig: improve vlan options parsing
Alexander V. Chernikov [Mon, 17 Jan 2022 09:30:26 +0000 (09:30 +0000)]
ifconfig: improve vlan options parsing

PR: 261136
Reported by: Daniel O'Connor
MFC after: 2 weeks

(cherry picked from commit 779fd05344662aeec79c29470258bf657318eab3)

2 years agolinux: add sysctl to pass untranslated interface names
Alexander V. Chernikov [Sat, 8 Jan 2022 15:41:53 +0000 (15:41 +0000)]
linux: add sysctl to pass untranslated interface names

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D33792

(cherry picked from commit 1f70a85b4cbc3ad19cec4a390e8754e54815be85)

2 years agolinux: fix linux_recvmsg() MSG_PEEK flag handling
Alexander V. Chernikov [Sat, 8 Jan 2022 13:44:17 +0000 (13:44 +0000)]
linux: fix linux_recvmsg() MSG_PEEK flag handling

Reviewed by: kib
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D33790

(cherry picked from commit 96c524d8b2c9abe3927abf948fbbd73a7cb42c4a)

2 years agorouting: Add unified level-based logging support for the routing subsystem.
Alexander V. Chernikov [Sun, 26 Dec 2021 18:42:12 +0000 (18:42 +0000)]
routing: Add unified level-based logging support for the routing subsystem.

Summary: MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D33664

(cherry picked from commit 63f7f3921bdc468a9b564a530f63480cc82ebd7c)

2 years agonhops: split nh_family into nh_upper_family and nh_neigh_family.
Alexander V. Chernikov [Sun, 26 Dec 2021 18:07:37 +0000 (18:07 +0000)]
nhops: split nh_family into nh_upper_family and nh_neigh_family.

With IPv4 over IPv6 nexthops and IP->MPLS support, there is a need
 to distingush "upper" e.g. traffic family and "neighbor" e.g. LLE/gateway
 address family. Store them explicitly in the private part of the nexthop data.

While here, store nhop fibnum in nhop_prip datastructure to make it self-contained.

MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D33663

(cherry picked from commit 823a08d7403c475fea0ecbbfff021fa8db274879)

2 years ago[lltable] Add per-family lltable getters.
Alexander V. Chernikov [Sun, 26 Dec 2021 12:39:26 +0000 (12:39 +0000)]
[lltable] Add per-family lltable getters.

Introduce a new function, lltable_get(), to retrieve lltable pointer
 for the specified interface and family.
Use it to avoid all-iftable list traversal when adding or deleting
 ARP/ND records.

Differential Revision: https://reviews.freebsd.org/D33660
MFC after: 2 weeks

(cherry picked from commit ff3a85d32411cdd7894f932b1d3d7ce01ec7a648)

2 years agonetstat: fix nhop prepend printing.
Alexander V. Chernikov [Sun, 26 Dec 2021 15:02:06 +0000 (15:02 +0000)]
netstat: fix nhop prepend printing.

If present, print nexthop L2 prepend data in hex.

MFC after: 1 week

(cherry picked from commit 731bfa9f180388e4081b64afb94c357643600238)

2 years agotcp: virtualise net.inet.tcp.msl sysctl.
Alexander V. Chernikov [Sat, 4 Dec 2021 22:02:44 +0000 (22:02 +0000)]
tcp: virtualise net.inet.tcp.msl sysctl.

VNET teardown waits 2*MSL (60 seconds by default) before expiring
 tcp PCBs. These PCBs holds references to nexthops, which, in turn,
 reference ifnets. This chain results in VNET interfaces being destroyed
 and moved to default VNET only after 60 seconds.
Allow tcp_msl to be set in jail by virtualising net.inet.tcp.msl sysctl,
 permitting more predictable VNET tests outcomes.

MFC after: 1 week
Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D33270

(cherry picked from commit c2c8e360d8c0b8712158d334686d88f052aef819)

2 years agoBump __FreeBSD_version to 1301501 after LinuxKPI and net80211
Bjoern A. Zeeb [Sun, 27 Mar 2022 20:12:03 +0000 (20:12 +0000)]
Bump __FreeBSD_version to 1301501 after LinuxKPI and net80211
merges in order to help out-of-tree consumers to deal accordingly.

Sponsored by: The FreeBSD Foundation

2 years agoLinuxKPI: 802.11: cleanup debugging
Bjoern A. Zeeb [Thu, 24 Mar 2022 19:09:04 +0000 (19:09 +0000)]
LinuxKPI: 802.11: cleanup debugging

Cleanup some debugging.  Rename the global variable to be less
generic.  Hide all debugging behind #ifdef for now and turn off.
Rename the debugging sysctl so we can start adding more to the
subtree.

There is a need to change that wildly grown infrastructure into
something more homogenic soon but this should do for 13.1.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 9d9ba2b79b3196935431879efd9094eb9bfedd95)

2 years agoLinuxKPI: 802.11: improve hw_scan fallback to sw_scan
Bjoern A. Zeeb [Thu, 24 Mar 2022 17:49:59 +0000 (17:49 +0000)]
LinuxKPI: 802.11: improve hw_scan fallback to sw_scan

Extending what was started in d3ef7fb459ff924911e5276db0c04b13cd8074d9,
when a driver signals that hw_scan is not possible and expects a sw_scan
to be preformed we triggered a sw_scan towards the driver but did not
let net80211 know.
Cancel the initial scan towards net80211.  If we we defer to sw_scan
then clear IEEE80211_FEXT_SCAN_OFFLOAD so net80211 will send probe
requests, and actively start a new scan with net80211.
This may have to be further refined in the future but seems to work
for the moment.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 196cfd0b2eb640a63d007a7e9c3a74e4256255f3)

2 years agoLinuxKPI: 802.11: remove special handling for (*ic_scan_curchan)
Bjoern A. Zeeb [Thu, 24 Mar 2022 17:32:07 +0000 (17:32 +0000)]
LinuxKPI: 802.11: remove special handling for (*ic_scan_curchan)

Remove the originally disabling of (*ic_scan_curchan), which for iwlwifi
was not needed.  The condition always only was approximate.

A set IEEE80211_FEXT_SCAN_OFFLOAD will still prevent net80211 from sending
probe_reqs if handled by driver/firmware.
ic_scan_curchan will re-arm the timer to switch channels for drivers which
need it (e.g., rtw88, but that again is a NOP for iwlwifi).

So enabling ic_scan_curchan should not have further side effects for iwlwifi
but allow other drivers to work better.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 321735f451d1eaa710a768d9e35ff87acb089d35)

2 years agoLinuxKPI: 802.11: check IEEE80211_FEXT_SCAN_OFFLOAD on vap
Bjoern A. Zeeb [Thu, 24 Mar 2022 17:24:47 +0000 (17:24 +0000)]
LinuxKPI: 802.11: check IEEE80211_FEXT_SCAN_OFFLOAD on vap

When checking for IEEE80211_FEXT_SCAN_OFFLOAD, do so on the vap rather
than ic.  This brings us in line with what net80211 does.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 768dd32a164b35fb2f66fc8a0250cee84c79471e)

2 years agoLinuxKPI: 802.11: make lkpi_ic_set_channel() unconditional
Bjoern A. Zeeb [Thu, 24 Mar 2022 16:51:02 +0000 (16:51 +0000)]
LinuxKPI: 802.11: make lkpi_ic_set_channel() unconditional

For (*config)() based drivers not using chanctx we need to use
ic_set_channel() to switch channels.  So far this was disabled
based on scanning flags (as swscan is one of the initial use cases
for this function).  Now make it only dependent on (*config)()
for the moment to save us the work if (*config)() is not supported.

For iwlwifi (*config)() is a NOP so no functional changes there
but for other drivers such as rtw88 this will allow us to scan and
set the channel (which helps to receive on channels other than 1).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b2cf3c2125bf6f34cb01296e7eda93f73bc4b715)

2 years agoLinuxKPI: 802.11: use cfg80211_chandef_create()
Bjoern A. Zeeb [Thu, 24 Mar 2022 15:43:22 +0000 (15:43 +0000)]
LinuxKPI: 802.11: use cfg80211_chandef_create()

Rather than manually setting up a chandef and then effectively forcing
a memcpy, use cfg80211_chandef_create() to do the work for us entirely.
This works here as we do not store the resulting chandef separately
for other use.

While here remove a duplicate assignment in cfg80211_chandef_create().

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4a07abdeb8ce5271996d85f648832e3d7bc741a7)

2 years agoLinuxKPI: 802.11: improve lkpi_80211_mo_sta_state() for non (*sta_state)
Bjoern A. Zeeb [Thu, 24 Mar 2022 15:34:57 +0000 (15:34 +0000)]
LinuxKPI: 802.11: improve lkpi_80211_mo_sta_state() for non (*sta_state)

If a driver does not support (*sta_state)() we internally in
lkpi_80211_mo_sta_state() fall back to using (*sta_add/*sta_remove)().
In that case add tracking of both added_to_drv and state fields for the
lsta so that our state machine keeps working and assertions do not fire.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 878fb1e5754cc5bfbec57bc24859b07936f82a41)

2 years agoLinuxKPI: 802.11: rework sta state machine compatibility
Bjoern A. Zeeb [Tue, 22 Mar 2022 18:34:13 +0000 (18:34 +0000)]
LinuxKPI: 802.11: rework sta state machine compatibility

Rework the state machine parts for various reasons:
(1) to add sta tracing to be able to better follow ni and lsta state
(2) factor out/implement lkpi_lsta_remove() to unlink the lsta and
    free the ni reference.
(3) avoid calling lkpi_disassoc() when you would think you should as
    changing BSS_CHANGED_ASSOC setting vif->bss_conf.assoc to false
    triggers a sta removal from firmware in iwlwifi which then triggers
    follow-up errors.  I do not understand why they use flags and state
    and ?? in parallel (too many options and ways to do things?).
(4) when "roaming" (or being disassoc/deauth) from an AP both net80211
    and apparently so mac80211 re-start with a new node/sta.  This
    results in us losing one or the other state in the compat layer
    or not updating firmware appropriately.  To resolve this make use
    of (a) the newly introduced (*iv_update_bss)() and (b) always tear
    a station down to "State 1" (INIT/SCAN/pre-AUTH) and only if needed
    re-create the new one (if we go to AUTH).
    A slightly earlier version has survived a night of wpa_supplicant
    and hostapd fighting each other over disassoc and deauth and
    re-associating/authorizing.

While there update a few comments and typos and do a few minor auxiliary
changes which are hard or not worth to extract.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit d9f59799fc3e7940c47aa674c25994e640eae45e)
(cherry picked from commit 67674c1cb11512f09873c6d8e463af31548ef87f)

2 years agoLinuxKPI: 802.11: factor out dtim/tsf updates
Bjoern A. Zeeb [Tue, 22 Mar 2022 18:16:56 +0000 (18:16 +0000)]
LinuxKPI: 802.11: factor out dtim/tsf updates

Factor out dtim/tsf setting/updates into lkpi_update_dtim_tsf()
with tracing and add an extra update call.
This avoids some code duplication and puts maintainance into a
single place.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit fa8f007de913623c066bf8f09213f92ee8cbca3a)

2 years agoLinuxKPI: 802.11: factor out lkpi_lsta_alloc() from lkpi_ic_node_alloc()
Bjoern A. Zeeb [Tue, 22 Mar 2022 15:14:31 +0000 (15:14 +0000)]
LinuxKPI: 802.11: factor out lkpi_lsta_alloc() from lkpi_ic_node_alloc()

Split lkpi_ic_node_alloc() into two functions to make the code simpler
and to allow lkpi_lsta_alloc() to be re-used from another part of the
code related to (*iv_update_bss)().

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4f61ef8b78b25761b1b859ce39213f92fcbb24ce)

2 years agoLinuxKPI: 802.11: implement ieee80211_beacon_loss()
Bjoern A. Zeeb [Tue, 22 Mar 2022 15:02:45 +0000 (15:02 +0000)]
LinuxKPI: 802.11: implement ieee80211_beacon_loss()

Implement ieee80211_beacon_loss() similar to
ieee80211_connection_loss() with different state handling.
While here leave a comment in connection_loss() about the state
change argument.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit bb81db90f7e00f56df9ea14132a54ee983e7177f)

2 years agoLinuxKPI: skbuff: fix skb_queue_splice_init()
Bjoern A. Zeeb [Wed, 23 Mar 2022 17:05:43 +0000 (17:05 +0000)]
LinuxKPI: skbuff: fix skb_queue_splice_init()

In skb_queue_splice_init() we set a next value and then used that new
value to further update the remaining linking rather than the original
value.  Introduce another temporary variable 'n' to hold the original
value and use that.
While here rename q and h to from and to as otherwise it was too
confusing to read.

Also initialize skb->prev and skb->next to point to skb itself if
for nothing else at least to aid debugging.

Reported by: phk (panic in iwl_txq_reclaim)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 6a8973c3324c0c6c270ae4ad371e50c0ec5761da)

2 years agoLinuxKPI: allow bsddriver name to be set for PCI
Bjoern A. Zeeb [Thu, 24 Mar 2022 01:45:36 +0000 (01:45 +0000)]
LinuxKPI: allow bsddriver name to be set for PCI

Allow a driver to overwrite the bsddriver name (we use for pci and
for wlan parent devices).  This allows us to to set
.bsddriver.name in struct pci_driver passed to module_pci_driver()
and with that set the BSD driver name while retaining the Linux .name
one.

This is helpful for divers which have different parts depending on
chipset and with that would change driver names which is highly
confusing especially for configuration.   One example is an upcoming
rtw88 driver which would be rtw_8822be or rtw_8822ce depending on
chipset.

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

(cherry picked from commit 81d058df6d255b7f551564f6d29a03692b51fe5a)

2 years agoLinuxKPI: pci: implement pci_upstream_bridge()
Bjoern A. Zeeb [Wed, 16 Feb 2022 18:04:08 +0000 (18:04 +0000)]
LinuxKPI: pci: implement pci_upstream_bridge()

Allow drivers to query the "upstream PCI bridge".
Currently we point back to ourselves on pdev->bus->self rather than
to the parent PCI bridge.
We keep this as status-quo with an extra comment and only on-demand
allocate a pci_dev for the parent bridge if we are asked for in
pci_upstream_bridge().
When releasing the pci_dev we check if pdev->bus->self has changed
and call pci_dev_put() to release the reference count on the parent
bridge as well.

This code moves pci_is_root_bus() higher up in pci.h but no functional
change there.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky, (jhb some earlier)
Thanks to: wulf for handling drm-kmod
Differential Revision: https://reviews.freebsd.org/D34305

(cherry picked from commit b3b836251f9fefa817d158784189f6d336917f7a)

2 years agoiwlwifi: update man pages
Bjoern A. Zeeb [Fri, 4 Mar 2022 00:27:00 +0000 (00:27 +0000)]
iwlwifi: update man pages

Update man pages given auto-loading is now enabled by default and
no user configuration is needed to load the driver.
Also note that the iwlwifi driver will appear the first time in 13.1-R.

Sponsored by: The FreeBSD Foundation
Relnotes: yes

(cherry picked from commit abf6e1a49e944f9fb635a6aed55f01af832da06c)

2 years agoLinuxKPI: pci.h MODULE_DEVICE_TABLE to MODULE_PNP_INFO
Bjoern A. Zeeb [Fri, 4 Mar 2022 00:06:34 +0000 (00:06 +0000)]
LinuxKPI: pci.h MODULE_DEVICE_TABLE to MODULE_PNP_INFO

Implement MODULE_PNP_INFO() support in LinuxKPI for the Linux
MODULE_DEVICE_TABLE.

This will allow us to auto-load LinuxKPI PCI drivers (drm-kmod do
not currently as they attach to vgapci0 which in turn grabs the PCI
to my understanding) and make any loading from loader or kld_list in
rc.conf unnecessary; see devmatch(8) for more information.

We need to ensure there is a DRIVER_MODULE() (or probably just
a DECLARE_MODULE but that makes not much difference) before the
MODULE_PNP_INFO (which we otherwise would not need).

Sponsored by: The FreeBSD Foundation
Reviewed by: imp, hselasky, manu
Differential Revision: https://reviews.freebsd.org/D26651

(cherry picked from commit 5493c6277a264e91ea4bdc7e2d4ee69fe4210918)

2 years agoiwlwifi: adjust the LinuxKPI pci return for now
Bjoern A. Zeeb [Thu, 3 Mar 2022 22:24:13 +0000 (22:24 +0000)]
iwlwifi: adjust the LinuxKPI pci return for now

Rather than having LinuxKPI return BUS_PROBE_DEFAULT, return
"one less" so that on conflict of IDs others would be preferred.

This means that iwm(4) will attach instead of iwlwifi(4) for the
chipsets iwm(4) supports and iwlwifi(4) only for the other--in iwm(4)
unsupported--chipsets.  This is done so that we can enable auto-loading
of drivers but for the upcoming 13.1-Release people with working iwm(4)
will not yet be affected by iwlwifi(4).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 3d248a914d923b444f72fb27ba621c0ab2ef464e)

2 years agoLinuxKPI: allow a driver to override the default pci probe result
Bjoern A. Zeeb [Fri, 18 Feb 2022 21:58:01 +0000 (21:58 +0000)]
LinuxKPI: allow a driver to override the default pci probe result

Add bsd_probe_return which a driver can set in their 'struct pci_driver'
definition to set a driver-sepcific LinuxKPI pci return value.
This is helpful in case of multiple drivers with overlapping IDs,
such as iwlwifi(4) and iwm(4).

Contrary to an earlier version we now assume 0 is not BUS_PROBE_SPECIFIC
(which no driver should really return these days) but the bss initialized
value (bsd_probe_return unset) and we will return BUS_PROBE_DEFAULT.

Suggested by: jhb
Reviewed by: jhb
Reviewed by: hselasky, imp (earlier versions)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33915

(cherry picked from commit b91dd79ba32122e6adb28073c534224bc78a7b58)

2 years agoLinuxKPI: remove duplicate include
Bjoern A. Zeeb [Fri, 4 Mar 2022 00:04:19 +0000 (00:04 +0000)]
LinuxKPI: remove duplicate include

Remove a duplicate bus.h include from pci.h.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit fbedd9d708d06e3cc064d9e6f053649c0cf30c9c)

2 years agonet80211: introduce (*iv_update_bss)()
Bjoern A. Zeeb [Tue, 22 Mar 2022 14:46:51 +0000 (14:46 +0000)]
net80211: introduce (*iv_update_bss)()

Introduce (*iv_update_bss)() with a default implementation to allow
drivers to overload/intercept the time when we swap iv_bss.

This helps firmware based drivers to synchronize state with firmware.
Otherwise, for some state changes, we begin with one ni (and in
LinuxKPI lsta) and try to finish with another ni (and a new lsta
in different state) and may no longer have access to the previous state.
This also saves us from constantly checking for ni changes complicating
code.

No functional changes intended.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 91b4225aa1d81155668db6deed22084abf2ce23c)

2 years agonet80211: improve one debug logging
Bjoern A. Zeeb [Tue, 22 Mar 2022 14:40:12 +0000 (14:40 +0000)]
net80211: improve one debug logging

When forcing DEUATH in ieee80211_sta_join1() log the current state
we are coming from as well.  Note this isn't always the state we
are expecting as iv_state was updated already, so contrary to the
comment we usually do not see RUN there.
Leave a comment earlier with regards to this as well.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 453d1a90f8f46637404adc0278d6f3f068542733)

2 years agobhyve: Do not remove guest physical addresses from IOMMU host domain
Bjoern A. Zeeb [Fri, 18 Mar 2022 20:39:06 +0000 (20:39 +0000)]
bhyve: Do not remove guest physical addresses from IOMMU host domain

This permits I/O devices on the host to directly access wired memory
dedicated to guests using passthru devices.  Note that wired memory
belonging to guests that do not use passthru devices has always been
accessible by I/O devices on the host.

bhyve maps guest physical addresses into the user address space of
the bhyve process by mmap'ing /dev/vmm/<vmname>.  Device models pass
pointers derived from this mapping directly to system calls such as
preadv() to minimize copies when emulating DMA.  If the backing store
for a device model is a raw host device (e.g. when exporting a raw disk
device such as /dev/ada<n> as a drive in the guest), the host device
driver (e.g. ahci for /dev/ada<n>) can itself use DMA on the host
directly to the guest's memory.  However, if the guest's memory is
not present in the host IOMMU domain, these DMA requests by the host
device will fail without raising an error visible to the host device
driver or to the guest resulting in non-working I/O in the guest.

It is unclear why guest addresses were removed from the IOMMU host domain
initially, especially only for VM's with a passthru device as the
host IOMMU domain does not affect the permissions of passthru devices,
only devices on the host.

A considered alternative was using bounce buffers instead (D34535
is a proof of concept), but that adds additional overhead for unclear
benefit.

This solves a long-standing problem when using passthru devices and
physical disks in the same VM.

Thanks to: grehan (patience and help)
Thanks to: jhb (for improving the commit message)
PR: 260178, 215740
Reviewed by: grehan, jhb
Differential Revision: https://reviews.freebsd.org/D34607

(cherry picked from commit 246c398145674e4a9337fd933a6e6da7f160118e)

2 years agovfs: add missing bits to vdropl_impl
Mateusz Guzik [Sun, 27 Mar 2022 14:00:09 +0000 (14:00 +0000)]
vfs: add missing bits to vdropl_impl

This completes the patch which was originally meant to go in.

Spotted by: mhorne
Fixes: c35ec1efdcb2978b ("vfs: [1/2] fix stalls in vnode reclaim by not
requeieing from vnlru")

(cherry picked from commit 2533b5dc82701ac5e31d0f98dd15362397b2478e)

2 years agoriscv: actually enable sanitizers
Piotr Kubaj [Sun, 13 Mar 2022 03:31:35 +0000 (04:31 +0100)]
riscv: actually enable sanitizers

1. Backport https://github.com/llvm/llvm-project/commit/b475ce39e8b1de3a70ea242473f136a567be46e3.
2. Enable libclang_rt for riscv.

Previous commit missed it.

MFC after: 3 days
Reviewed by: dim
Differential Revision: https://reviews.freebsd.org/D34543

(cherry picked from commit 3781e77995e9b81afcbf7b3dc84b33b864c48794)

2 years agoMerge LLVM commit c03fdd340356 to fix lang/rust on powerpc
Piotr Kubaj [Thu, 24 Mar 2022 00:30:44 +0000 (01:30 +0100)]
Merge LLVM commit c03fdd340356 to fix lang/rust on powerpc

Summary:
Without it building rust fails with:
ld: error: CallSiteSplitting.cpp:(function llvm::SmallVectorImpl<std::__1::pair<llvm::BasicBlock*, llvm::SmallVector<std::__1::pair<llvm::ICmpInst*, unsigned int>, 2u> > >::operator=(llvm::SmallVectorImpl<std::__1::pair<llvm::BasicBlock*, llvm::SmallVector<std::__1::pair<llvm::ICmpInst*, unsigned int>, 2u> > >&&): .text._ZN4llvm15SmallVectorImplINSt3__14pairIPNS_10BasicBlockENS_11SmallVectorINS2_IPNS_8ICmpInstEjEELj2EEEEEEaSEOSB_+0xB0): relocation R_PPC_PLTREL24 out of range: -33582208 is not in [-3355443233554431]

Reviewed by: dim
Differential Revision: https://reviews.freebsd.org/D34652
MFC after: 3 days

(cherry picked from commit 9b597132aea7d75810ca90258022f81d07971444)

2 years agoriscv: fix riscv64sf build
Piotr Kubaj [Thu, 24 Mar 2022 14:24:21 +0000 (15:24 +0100)]
riscv: fix riscv64sf build

The library needs to have sf suffix cut off.

MFC after: 3 days
X-MFC with: 3781e77995e9b81afcbf7b3dc84b33b864c48794
Differential revision: https://reviews.freebsd.org/D34561
Reviewed by: dim

(cherry picked from commit 18f71c9b2779999a9492b42c325524651a1b6909)

2 years agoMention kern.timecounter.alloweddeviation in nanosleep.2
Piotr Pawel Stefaniak [Thu, 7 Oct 2021 19:14:27 +0000 (21:14 +0200)]
Mention kern.timecounter.alloweddeviation in nanosleep.2

PR: 224837
Reported by: Aleksander Derevianko

(cherry picked from commit bf8f6ffcb66a27f498a18e520758ea0d18a6d2de)
(cherry picked from commit 4f556830dec19ec8821b2ff939ab181192ea4dfc)

2 years agols(1): Allow LSCOLORS to specify an underline
Cameron Katri [Sun, 19 Sep 2021 11:36:41 +0000 (13:36 +0200)]
ls(1): Allow LSCOLORS to specify an underline

Allows capitalizing the background color character to enable an
underline instead of bold, capitalizing the foreground color char will
still do bold.

Differential Revision: https://reviews.freebsd.org/D30547

(cherry picked from commit 97c31821eb0b1180778ad2da660a1778c2cb4b62)

2 years agopowerpcspe: fix PCI enumeration on ppce500
Alfredo Dal'Ava Junior [Mon, 21 Mar 2022 10:57:07 +0000 (07:57 -0300)]
powerpcspe: fix PCI enumeration on ppce500

This fixes PCI devices not being found on QEMU ppce500. This
generic board used to have its first PCI slot at 0x11, like the
mpc8544dsi and some real HW. After commit [1], it was changed to
0x1 and our driver wasn't prepared for that.

[1] https://gitlab.com/qemu-project/qemu/-/commit/3bb7e02a9725a24e5bf915b35f914f82f5b07a1f

Reviewed by: jhibbits, bdragon
MFC after: 2 days
Sponsored by: Institudo de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D34621

(cherry picked from commit 27f56d337be39a3f493febb585f3484c4cb6c3b6)

2 years agosnd_hda.4: correct typos
Ed Maste [Fri, 18 Mar 2022 00:11:26 +0000 (20:11 -0400)]
snd_hda.4: correct typos

MFC after: 1 week

(cherry picked from commit 24cf089ab4882f482d5355c1bcdeaa6787a551bf)

2 years agoAllow kern.ipc.maxsockets to be set to current value without error
Allan Jude [Thu, 4 Nov 2021 12:55:33 +0000 (12:55 +0000)]
Allow kern.ipc.maxsockets to be set to current value without error

Normally setting kern.ipc.maxsockets returns EINVAL if the new value
is not greater than the previous value. This can cause spurious
error messages when sysctl.conf is processed multiple times, or when
automation systems try to ensure the sysctl is set to the correct
value. If the value is unchanged, then just do nothing.

PR: 243532
Reviewed by: markj
Sponsored by: Modirum MDPay
Sponsored by: Klara Inc.

(cherry picked from commit c441592a0e1591591665cd037a8a5e9b54675f99)

2 years agoclock_gettime: Fix CLOCK_THREAD_CPUTIME_ID race
firk [Tue, 15 Mar 2022 22:22:21 +0000 (18:22 -0400)]
clock_gettime: Fix CLOCK_THREAD_CPUTIME_ID race

Use a spinlock section instead of a critical section to synchronize with
statclock().  Otherwise the CLOCK_THREAD_CPUTIME_ID clock can appear to
go backwards.

PR: 262273
Reviewed by: markj

(cherry picked from commit 28d08dc7d051a4e058cc0004cf4dd884f87037a2)

2 years agohdac: Handle interrupts racing with device suspend
Mark Johnston [Wed, 16 Mar 2022 16:09:17 +0000 (12:09 -0400)]
hdac: Handle interrupts racing with device suspend

- Avoid looping forever if a concurrent reset causes a read of the
  interrupt status register to return all ones.
- Lock the softc before reading the interrupt status, so as to avoid a
  similar infinite loop in hdac_one_intr().

This fixes suspend-to-S3 on some laptops.

PR: 261207
Reviewed by: mav, imp
Tested by: uqs
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 077564cfdb7285ff7d256424715e563cbac36f8b)

2 years agohda: add patch for Framework laptop headphone jack
Ed Maste [Thu, 17 Mar 2022 19:47:55 +0000 (15:47 -0400)]
hda: add patch for Framework laptop headphone jack

For Framework laptops built after Oct 2021 (like mine) that have a Tempo
Semiconductor 92HD95B codec rather than Realtek ALC295 (see
https://frame.work/ca/en/blog/solving-for-silicon-shortages).

As we do for many other laptops, put the headphone jack and speakers in
the same association by default so that the generic sound device
automatically switches between them.  Also specify the jack colour and
location.

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

(cherry picked from commit 06731139ca5222a6790163ed427758769696e5ab)

2 years agosound: add patch for Lenovo Legion 5 AMD
Philippe Michaud-Boudreault [Wed, 19 May 2021 14:38:34 +0000 (10:38 -0400)]
sound: add patch for Lenovo Legion 5 AMD

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30333

(cherry picked from commit 45f0e5710509c510955c56a1b3e7d0e392407b0d)

2 years agosnd_hda: restore pin patch for headphones on Lenovo X1 7th Gen
Ed Maste [Fri, 14 Jan 2022 19:40:47 +0000 (14:40 -0500)]
snd_hda: restore pin patch for headphones on Lenovo X1 7th Gen

Fixes: ef790cc7407e ("hdaa: update pin patch configurations")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33900

(cherry picked from commit 301b2b02dfcfddbb5da34dcc20136de1ab2f36af)

2 years agosnd_hda(4): Fix sound on headset jack for ThinkPad T51.
Xin LI [Mon, 12 Jul 2021 05:43:56 +0000 (22:43 -0700)]
snd_hda(4): Fix sound on headset jack for ThinkPad T51.

sys/dev/sound/pci/hda/hdaa_patches.c:
 match_pin_patches: Use HDA_DEV_MATCH instead of regular ==

sys/dev/sound/pci/hda/pin_patch_realtek.h:
 Add quirk for Lenovo laptops when ALC298 is used.

(cherry picked from commit c43bf3f59161ac697a1c3a0a3f9326d4d15216c9)

2 years agohdaa: update pin patch configurations
K Staring [Sat, 3 Jul 2021 06:15:49 +0000 (00:15 -0600)]
hdaa: update pin patch configurations

A number of structural changes:
  - Use decimal nid numbers instead of hex
  - updated the branch to incoorporate the suggestions made in the
    ALC280 pull request github thread
  - Convert magic pin values into strings.
  - Also update hdaa_patches to use clearer enums..
  - made pin patch type enum clearer, add macro for 'string' type
    patches
  - Added pin_patch structures to separate data from logic.
  - Integrated Realtek patches into new structure.

These incorporate fixes for ALC255, ALC256, ALC260, ALC262, ALC268,
ALC269, ALC280, ALC282, ALC283, ALC286, ALC290, ALC293, ALC296, ALC2880

And have definitions for a number of Dell and HP laptops.

Much of this data has been mined fromt he tables in the Linux driver.

imp squashed these into one commit because the changes from the github
pull requests no longer cleanly apply individually and made light style
changes after feedback from jhb.

Pull Request: https://github.com/freebsd/freebsd-src/pull/139
Pull Request: https://github.com/freebsd/freebsd-src/pull/140
Pull Request: https://github.com/freebsd/freebsd-src/pull/141
Pull Request: https://github.com/freebsd/freebsd-src/pull/142
Pull Request: https://github.com/freebsd/freebsd-src/pull/143
Pull Request: https://github.com/freebsd/freebsd-src/pull/144
Pull Request: https://github.com/freebsd/freebsd-src/pull/145
Pull Request: https://github.com/freebsd/freebsd-src/pull/146
Pull Request: https://github.com/freebsd/freebsd-src/pull/147
Pull Request: https://github.com/freebsd/freebsd-src/pull/148
Pull Request: https://github.com/freebsd/freebsd-src/pull/149
Pull Request: https://github.com/freebsd/freebsd-src/pull/150
Differential Revision: https://reviews.freebsd.org/D30619

(cherry picked from commit ef790cc7407e827db9563d08a52a71ab36436986)
(cherry picked from commit 29b4fa787621cbfb070323ecf2ea2da4d372bd94)
(cherry picked from commit a10c85e0f90c8739863f670d490b35d38a37648f)
(cherry picked from commit 86d69de88d1c7e8c7ed906590652008fc6f44d05)

2 years agonetinet tests: only log critical errors from scapy
Kristof Provost [Thu, 17 Mar 2022 22:32:23 +0000 (23:32 +0100)]
netinet tests: only log critical errors from scapy

See also a26e895f3d.

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

(cherry picked from commit d234b011a8f1cf90acbda2e3cd166459736c7ed2)

2 years agopf tests: Test retrieving nested nat-anchors
Kristof Provost [Thu, 17 Mar 2022 17:33:50 +0000 (18:33 +0100)]
pf tests: Test retrieving nested nat-anchors

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

(cherry picked from commit 3c3a19d1f42af049e798b193d4fd2a872c7c8fec)

2 years agopfctl: fix retrieving nested nat-anchors
Kristof Provost [Thu, 17 Mar 2022 17:31:37 +0000 (18:31 +0100)]
pfctl: fix retrieving nested nat-anchors

When retrieving nat rules in anchors we need to set the path just like
we do for regular rules.

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

(cherry picked from commit a632d9e3601272c0157dce6633fc9a23ad6ae45b)

2 years agopf tests: Test setting and retrieving nested anchors
Kristof Provost [Thu, 17 Mar 2022 18:49:09 +0000 (19:49 +0100)]
pf tests: Test setting and retrieving nested anchors

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

(cherry picked from commit d58d2e403db48acac7c8459652e9cb19546ab15b)

2 years agopfctl: fix retrieving nested anchors
Matteo Riondato [Thu, 17 Mar 2022 18:48:28 +0000 (19:48 +0100)]
pfctl: fix retrieving nested anchors

PR: 262622
MFC after: 1 week
Reviewed by: kp

(cherry picked from commit cd8438e5a3a425ea44b261758e17fe62ebb45fce)

2 years agoipmi: Make all sysctls also tunables.
Alexander Motin [Thu, 17 Mar 2022 17:32:46 +0000 (13:32 -0400)]
ipmi: Make all sysctls also tunables.

MFC after: 1 week

(cherry picked from commit 016d18229c6bd81891f47086bf4eec366a7c3cea)

2 years agoMerge libcxxrt commit f2e55091e2e878386c9f7974d4922bbdc4faed84
Dimitry Andric [Sun, 20 Mar 2022 21:21:28 +0000 (22:21 +0100)]
Merge libcxxrt commit f2e55091e2e878386c9f7974d4922bbdc4faed84

  Fix unlock in two-word version and add missing comment.

  Fixes #15
  Fixes #16

This should fix the hangs in __cxa_guard_acquire() reported on i386 (and
possibly other 32-bit platforms).

Obtained from: https://github.com/libcxxrt/libcxxrt/commit/f2e5509
Fixes: 56aaed388b0a
MFC after: 2 weeks

(cherry picked from commit 7819a911ff5132b34996c8b09b2a024cd10fd4fb)

2 years agoReapply libcxxrt atomics cleanup commit, preparing for upstream fix
Dimitry Andric [Sun, 20 Mar 2022 21:19:27 +0000 (22:19 +0100)]
Reapply libcxxrt atomics cleanup commit, preparing for upstream fix

This reapplies upstream commit fd484be, as there is a follow-up fix for
the possible hangs in __cxa_guard_acquire() on i386:

  Atomics cleanup (#11)

  We need to test exception specifiers but they're gone in C++17 so
  compile the tests with an older version of the standard.

  Rewrite the guard logic to be more idiomatic C++ and more
  comprehensible and make sure that atomics are used where necessary.

Obtained from: https://github.com/libcxxrt/libcxxrt/commit/fd484be
Fixes: 56aaed388b0a
MFC after: 2 weeks

(cherry picked from commit bfffb66e7f3cf9766e45a23080200c18535c2b85)

2 years agoRevert upstream libcxxrt commit which can cause hangs on i386
Dimitry Andric [Sat, 19 Mar 2022 19:46:28 +0000 (20:46 +0100)]
Revert upstream libcxxrt commit which can cause hangs on i386

This reverts upstream commit fd484be:

  Atomics cleanup (#11)

  We need to test exception specifiers but they're gone in C++17 so
  compile the tests with an older version of the standard.

  Rewrite the guard logic to be more idiomatic C++ and more
  comprehensible and make sure that atomics are used where necessary.

It looks like there are some corner cases in the i386 and/or 32-bit
atomics handling, which can make __cxa_guard_acquire() hang in certain
situations.

Reported by: antoine
Obtained from: https://github.com/libcxxrt/libcxxrt/commit/fd484be
Fixes: 56aaed388b0a
MFC after: 2 weeks

(cherry picked from commit 2548237983c47c61601b883bb9d6c9a803ef8ce4)

2 years agoMerge libcxxrt master fd484be8d1e94a1fcf6bc5c67e5c07b65ada19b6
Dimitry Andric [Wed, 9 Mar 2022 19:45:01 +0000 (20:45 +0100)]
Merge libcxxrt master fd484be8d1e94a1fcf6bc5c67e5c07b65ada19b6

Interesting fixes:
47661d0 Match libc++abi/libsupc++ when demangling array types
e44a05c Fix unitialized variable in __cxa_demangle_gnu3 after #6 (#8)
5088b05 Remove some code duplication.
fd484be Atomics cleanup (#11)

MFC after: 2 weeks

(cherry picked from commit 56aaed388b0a177b9defb4e6ecb8a716abb3cf33)

2 years agoFix llvm build after 1b3bef43e3cb, due to API change
Dimitry Andric [Sat, 19 Mar 2022 23:12:58 +0000 (00:12 +0100)]
Fix llvm build after 1b3bef43e3cb, due to API change

After merging llvm commit b9ca73e1a8fd for PR 262608, it would fail to
compile with:

/usr/src/contrib/llvm-project/llvm/lib/IR/Operator.cpp:197:22: error: no member named 'isZero' in 'llvm::APInt'
   if (!IndexedSize.isZero()) {
        ~~~~~~~~~~~ ^

Upstream refactored their APInt class, and isZero() was one of the newer
methods which did not yet exist in llvm 13.0.0. Fix this by using the
older but equivalent isNullValue() method instead.

Fixes: 1b3bef43e3cb
MFC after: 3 days

(cherry picked from commit 8e72f458c6d389870730ae0e95d28a0d8609a018)

2 years agoApply llvm fix for assertion compiling certain versions of Wine
Dimitry Andric [Sat, 19 Mar 2022 19:59:04 +0000 (20:59 +0100)]
Apply llvm fix for assertion compiling certain versions of Wine

Merge commit b9ca73e1a8fd from llvm git (by Stephen Tozer):

  [DebugInfo] Correctly handle arrays with 0-width elements in GEP salvaging

  Fixes an issue where GEP salvaging did not properly account for GEP
  instructions which stepped over array elements of width 0 (effectively a
  no-op). This unnecessarily produced long expressions by appending
  `... + (x * 0)` and potentially extended the number of SSA values used
  in the dbg.value. This also erroneously triggered an assert in the
  salvage function that the element width would be strictly positive.
  These issues are resolved by simply ignoring these useless operands.

  Reviewed By: aprantl

  Differential Revision: https://reviews.llvm.org/D111809

PR: 262608
Reported by: Damjan Jovanovic <damjan.jov@gmail.com>
MFC after: 3 days

(cherry picked from commit 1b3bef43e3cb7fb0ab49b813839915514c1134cc)

2 years agomount: make libxo support more locale-aware
Piotr Pawel Stefaniak [Sun, 26 Sep 2021 20:50:28 +0000 (22:50 +0200)]
mount: make libxo support more locale-aware

"special", "node", and "mounter" are not guaranteed to be encoded with
UTF-8. Use the appropriate modifier.

(cherry picked from commit 260f26f035af2095a1b55c04439f479c49e4056c)

2 years agomount: add libxo(3) support
Cameron Katri [Thu, 23 Sep 2021 20:51:30 +0000 (22:51 +0200)]
mount: add libxo(3) support

Adds --libxo to mount(8).

(cherry picked from commit e725ee7eb672a8501600552283d3d08a2f7b6847)

2 years agocap_fileargs: silence warnings of unused variable
Mariusz Zaborski [Sun, 20 Mar 2022 10:17:31 +0000 (11:17 +0100)]
cap_fileargs: silence warnings of unused variable

We still want to fetch the variable just to verify that the interface
is right.

(cherry picked from commit 1e9ce60a6d758ddf5392e96e886fd815694dd66b)

2 years agovt/vga: ignore ACPI_FADT_NO_VGA unless running virtualized
Roger Pau Monné [Thu, 24 Feb 2022 15:53:30 +0000 (16:53 +0100)]
vt/vga: ignore ACPI_FADT_NO_VGA unless running virtualized

There's too many broken hardware out there that wrongly has the
ACPI_FADT_NO_VGA bit set. Ignore it unless running as a virtualized
guest, as then the expectation would be that the hypervisor does
provide correct ACPI tables.

Reviewed by: emaste, 0mp, eugen
Sponsored by: Citrix Systems R&D
PR: 230172

(cherry picked from commit 0518832011caba1e9dcee054d7884797ed8a74c2)