]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoice(4): Update to version 0.29.4-k
Eric Joyner [Wed, 23 Jun 2021 20:41:54 +0000 (13:41 -0700)]
ice(4): Update to version 0.29.4-k

Includes various feature improvements and bug fixes.

Notable changes include:
- Firmware logging support
- Link management flow changes
- New sysctl to report aggregated error counts
- Health Status Event reporting from firmware (Use the new read-only
  tunables hw.ice.enable_health_events / dev.ice.#.enable_health_events
  to turn this off)

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

(cherry picked from commit 9cf1841c4aaf8fbab06132ab9f76094f34ad7c7b)

2 years agoice_ddp: Update to 1.3.24.0
Eric Joyner [Fri, 25 Jun 2021 17:20:24 +0000 (10:20 -0700)]
ice_ddp: Update to 1.3.24.0

This version is intended to be used with the 0.29.4 version of the
ice(4) driver, which will be be committed afterwards.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: stallamr_netapp.com
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D30887

(cherry picked from commit 538ef055b7ea11326ba22197537e617587a0d677)
(cherry picked from commit 070f7812da16b692d4e65fdfd418654fdb42729d)

2 years agoFix ifa refcount leak in ifa_ifwithnet()
Ryan Stone [Thu, 11 Feb 2021 16:17:58 +0000 (11:17 -0500)]
Fix ifa refcount leak in ifa_ifwithnet()

In 4f6c66cc9c75c8, ifa_ifwithnet() was changed to no longer
ifa_ref() the returned ifaddr, and instead the caller was required
to stay in the net_epoch for as long as they wanted the ifaddr
to remain valid.  However, this missed the case where an AF_LINK
lookup would call ifaddr_byindex(), which still does ifa_ref()
the ifaddr.  This would cause a refcount leak.

Fix this by inlining the relevant parts of ifaddr_byindex() here,
with the ifa_ref() call removed.  This also avoids an unnecessary
entry and exit from the net_epoch for this case.

I've audited all in-tree consumers of ifa_ifwithnet() that could
possibly perform an AF_LINK lookup and confirmed that none of them
will expect the ifaddr to have a reference that they need to
release.

MFC after: 2 months
Sponsored by: Dell Inc
Differential Revision: https://reviews.freebsd.org/D28705
Reviewed by: melifaro

(cherry picked from commit 5adea417d494b9c0e186cf2d06f98873d02d1834)

2 years agovt_vga: fix colour in pixel blocks with more than 4 colours
Ed Maste [Wed, 2 Mar 2022 16:40:00 +0000 (11:40 -0500)]
vt_vga: fix colour in pixel blocks with more than 4 colours

VGA hardware provides many different graphics and data access modes,
each with different capabilities and limitations.

VGA vt(4) graphics mode operates on blocks of pixels at a time.  When a
given pixel block contains only two colours the vt_vga driver uses write
mode 3.  When the block contains more than two colours it uses write
mode 0.  This is done because two-colour write mode 3 is much more
efficient.

In practice write mode 3 is used most of the time, as there is often a
single foreground colour and single background colour across the entire
console.  One common exception requiring the use of mode 0 is when the
mouse cursor is drawn over a background other than black, as we need
black and white for the cursor in addition to the background colour.

VGA's default 16-colour palette provides the same set of colours as the
system console, but in a different order.  Previously we configured a
non-default VGA palette that had the same colours at the same indexes.
However, this caused anything drawn before the kernel started (drawn by
the loader, for instance) to change colours once the kernel configured
the new, non-default palette.

In 5e251aec8636 we switched to leaving the default VGA palette in place,
translating console colour indexes to VGA colour indexes as necessary.
This translation was missed for the write mode 0 case for pixel blocks
with more than two colours.

PR: 261751
Reviewed by: adrian
MFC after: 1 week
Fixes: 5e251aec8636 ("vt(4): Use default VGA palette")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34412

(cherry picked from commit f266082f113a6a110c28034c64693c2cc216fd9d)

2 years agovt(4): note that VGA palette configuration is not supported
Ed Maste [Thu, 3 Mar 2022 22:01:44 +0000 (17:01 -0500)]
vt(4): note that VGA palette configuration is not supported

PR: 261311
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34431

(cherry picked from commit b126b79b27d479a3bd91e7f58f95ba8ce6b5655a)

2 years agovt_vga: Correct "plane" spelling
Ed Maste [Wed, 2 Mar 2022 14:08:25 +0000 (09:08 -0500)]
vt_vga: Correct "plane" spelling

I suspect the variable names and comments were accidentally French.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 731a929ac908774cdb74f0444b075be6248190bd)

2 years agovt: whitespace and style(9) updates
Ed Maste [Tue, 22 Feb 2022 21:30:27 +0000 (16:30 -0500)]
vt: whitespace and style(9) updates

(cherry picked from commit 327da507f9df0eb4ab3b5621c5a38fb90d250e02)

2 years agosdhci_xenon: remove redundant code in property parsing
Bartlomiej Grzesik [Thu, 15 Jul 2021 15:20:46 +0000 (17:20 +0200)]
sdhci_xenon: remove redundant code in property parsing

Remove redundant ofw property parsing in driver code, is already
taken care of in mmc_fdt_helpers.

Move ofw parsing to attach method.

Reviewed by: manu
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D31409

(cherry picked from commit 6ad816a999171874c36c73d5794d0d25ff8fd311)

2 years agosdhci_xenon: add AP807 compatible string
Bartlomiej Grzesik [Wed, 14 Jul 2021 12:47:40 +0000 (14:47 +0200)]
sdhci_xenon: add AP807 compatible string

This patch adds compatible string for xenon controller found on
AP807 north brige. It is fully compatible with existing driver.

Reviewed by: manu
Sponsored by: Semihalf
Differential Revision: https://reviews.freebsd.org/D31407

(cherry picked from commit 1b9ce0885e5f53ea5818ee593babf11f6b5d5761)

2 years agosdhci_xenon: add UHS support
Marcin Wojtas [Tue, 4 May 2021 23:47:37 +0000 (01:47 +0200)]
sdhci_xenon: add UHS support

This patch adds the necessary methods resolution to the sdhci_xenon
driver which are required to configure UHS modes for SD/MMC devices.
Apart from the two generic routines, the custom sdhci_xenon_set_uhs_timing
function is responsible for setting the SDHCI_HOST_CONTROL2 register
with appropriate mode select values - in case of HS200 and HS400
they are non-standard.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30565
MFC after: 2 weeks

(cherry picked from commit 4fa977f854e27c93c22acfa6a3ba38f5c4959e15)

2 years agosdhci_xenon: improve the VCCQ voltage switch sequence
Marcin Wojtas [Thu, 27 May 2021 18:39:12 +0000 (20:39 +0200)]
sdhci_xenon: improve the VCCQ voltage switch sequence

Improve the VCCQ voltage switch, so that to properly
handle the SDHCI_HOST_CONTROL2 register signaling
flags and along with manipulating the regulator.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30564
MFC after: 2 weeks

(cherry picked from commit c80e2ca57e0c1b3647b55471584c6d32214232ea)

2 years agosdhci_xenon: allow to properly disable the UHS signaling
Marcin Wojtas [Thu, 27 May 2021 17:48:17 +0000 (19:48 +0200)]
sdhci_xenon: allow to properly disable the UHS signaling

Until now the "no-1-8-v" DT flag wrongly disabled the SDHCI_CAN_VDD_180
- slot 1.8V power supply capability, whereas it refers to the signaling
voltage. Fix the sdhci_xenon_read_4 and allow to disable the UHS modes
depending on the DT property or PHY slow mode. While at it - make sure
the unsupported 1.2V signaling is always disabled and not reported
in the bootverbose log.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30563
MFC after: 2 weeks

(cherry picked from commit df868762841b93d934413651818e510ea443def8)

2 years agosdhci_xenon: enable MMC FDT parsing
Marcin Wojtas [Sat, 1 May 2021 07:55:06 +0000 (09:55 +0200)]
sdhci_xenon: enable MMC FDT parsing

The mmc_fdt_parse allows to parse more MMC-related
FDT properties. Start using it. "wp-inverted" property,
VQMMC and newly added VMMC power supply parsing
is now done in a generic code.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30562
MFC after: 2 weeks

(cherry picked from commit 43e31350f8f67087b641d85520e20176e152dda7)

2 years agosdhci: allow setting MMC capabilities before sdhci_init_slot
Marcin Wojtas [Tue, 4 May 2021 22:57:50 +0000 (00:57 +0200)]
sdhci: allow setting MMC capabilities before sdhci_init_slot

With this change the host controller drivers can set the MMC capabilities
(e.g. using mmc_fdt_parse() helper) before calling sdhci_init_slot().
This way the configuration dump (eg. in bootverbose) can include the
possible additional information.

Reviewed by: manu
Obtained from: Semihalf
Sponsored by: Marvell
Differential Revision: https://reviews.freebsd.org/D30561
MFC after: 2 weeks

(cherry picked from commit 5652be30a322f2543bc1e3bcc135abc56b3eb268)

2 years agormlock: Temporarily revert commit c84bb8cd771c
Mark Johnston [Mon, 7 Mar 2022 15:35:59 +0000 (10:35 -0500)]
rmlock: Temporarily revert commit c84bb8cd771c

It appears to have introduced a regression on arm64, possibly due to the
fact that the pcpu pointer is reloaded outside of the critical section
in _rm_rlock().  Until this is resolved one way or another, let's
revert.

Reported by: Ronald Klop <ronald-lists@klop.ws>
Sponsored by: The FreeBSD Foundation

(cherry picked from commit afb44cb01018eb1363cb4ee20a31534b844d00f7)

2 years agoipfilter: Print protocol when listing NAT table mappings
Cy Schubert [Mon, 28 Feb 2022 19:43:33 +0000 (11:43 -0800)]
ipfilter: Print protocol when listing NAT table mappings

NAT table mappings list only the source and destination IP, the source
and destinaion port numbers, and their mappings. But the protocol is not
listed. Now that Facebook and Google use QUIC, seeing port 443 in in a
list of active NAT sessions could mean 443/tcp or 443/udp. This patch
adds the protocol to the listing to aid in determining whether HTTPS is
TCP or QUIC in a NAT mapping listing. This also helps differentiatinete
between other protocols such as ICMP, ESP, and AH in ipnat list of active
sessions.

(cherry picked from commit 9291d079d54b828b43d3714a5f19f0ffe92837b8)

2 years agounbound: Vendor import 1.15.0
Cy Schubert [Fri, 18 Feb 2022 00:05:15 +0000 (16:05 -0800)]
unbound: Vendor import 1.15.0

Vendor import GA release of unbound 1.15.0.

(cherry picked from commit 9cf5bc93f6ba1711ae7bf96a982a2b3c8b073a18)

2 years agodhclient: support VID 0 (no vlan) decapsulation
Franco Fichtner [Mon, 14 Feb 2022 14:43:29 +0000 (09:43 -0500)]
dhclient: support VID 0 (no vlan) decapsulation

VLAN ID 0 is supposed to be interpreted as having no VLAN with a bit of
priority on the side, but the kernel is not able to decapsulate this on
the fly so dhclient needs to take care of it.

Reviewed by: markj

(cherry picked from commit abf5bff71d38da3c797a3b6decb426c375cc0f8f)

2 years agopci: Fix a -Wunused-but-set-variable warning
Mark Johnston [Mon, 28 Feb 2022 15:54:42 +0000 (10:54 -0500)]
pci: Fix a -Wunused-but-set-variable warning

(cherry picked from commit 4db93fb278fce5f1034a9868413a641d9554214e)

2 years agoaxge: Fix a -Wunused-but-set-variable warning
Mark Johnston [Mon, 28 Feb 2022 15:54:32 +0000 (10:54 -0500)]
axge: Fix a -Wunused-but-set-variable warning

(cherry picked from commit 9218449b98fdd176b9df1542551d0996aaa31f51)

2 years agobhnd: Fix some -Wunused-but-set-variable warnings
Mark Johnston [Mon, 28 Feb 2022 15:54:25 +0000 (10:54 -0500)]
bhnd: Fix some -Wunused-but-set-variable warnings

(cherry picked from commit 1db163b82565302edebcfde9aee3a77586bccb1f)

2 years agocdce: Fix a -Wunused-but-set-variable warning
Mark Johnston [Mon, 28 Feb 2022 16:08:55 +0000 (11:08 -0500)]
cdce: Fix a -Wunused-but-set-variable warning

(cherry picked from commit ceb246c7b2834b40812ccd03a61d8c1cab6b5ca2)

2 years agoaxe: Fix a -Wunused-but-set-variable warning
Mark Johnston [Mon, 28 Feb 2022 16:07:19 +0000 (11:07 -0500)]
axe: Fix a -Wunused-but-set-variable warning

(cherry picked from commit f4a5d1f6c4405b0bdf62481617f66afa1da3527d)

2 years agoiwm: Fix -Wunused-but-set-variable warnings
Mark Johnston [Mon, 28 Feb 2022 15:54:15 +0000 (10:54 -0500)]
iwm: Fix -Wunused-but-set-variable warnings

(cherry picked from commit 1dc8ed06f37a0d5ff4b78791885d7ba6dd3e407b)

2 years agotests: Fix the test plan for closefrom_test
Mark Johnston [Sun, 6 Mar 2022 17:56:33 +0000 (12:56 -0500)]
tests: Fix the test plan for closefrom_test

Fixes: f3f3e3c44d3b ("fd: add close_range(..., CLOSE_RANGE_CLOEXEC)")
Reported by: Jenkins

(cherry picked from commit 3a01dcc99ff9044bbd46386a48ed870838cfb555)

2 years agofd: add close_range(..., CLOSE_RANGE_CLOEXEC)
Mateusz Guzik [Thu, 3 Mar 2022 12:45:11 +0000 (13:45 +0100)]
fd: add close_range(..., CLOSE_RANGE_CLOEXEC)

For compatibility with Linux.

MFC after: 3 days
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D34424

(cherry picked from commit f3f3e3c44d3b1776653bbf19eab17ce006a815d8)

2 years agouart_dev_ns8250: Switch ACPI UART subtype for Marvell SoCs
Marcin Wojtas [Thu, 20 May 2021 21:37:02 +0000 (23:37 +0200)]
uart_dev_ns8250: Switch ACPI UART subtype for Marvell SoCs

DBG2 ACPI table description [1] specifies three subtypes
related to 16550 UART:
0x0 - 16550 compatible
0x1 - 16550 subset
0x12 - 16550 compatible with parameters defined in Generic Address Structure (GAS)

It turned out however, that the Windows OS treats 0x0 subtype as
legacy x86 UART with 8-bit access. ARM SoCs can use types 0x1 (16550 with
fixed mmio32 access) or 0x12 (16550 with fully respected GAS contents).

Switch Marvell SoCs ACPI UART subtype to 0x1 - thanks to that the same firmware
can run properly with UART output in FreeBSD, Windows 10, Linux and ESXI
hypervisor. Tests showed the older firmware versions that use 0x0
UART subtype in SPCR table continue to display output properly.

[1] https://docs.microsoft.com/en-us/windows-hardware/drivers/bringup/acpi-debug-port-table

Obtained from: Semihalf
Sponsored by: ARM
Differential revision: https://reviews.freebsd.org/D30386
MFC after: 2 weeks

(cherry picked from commit 9cf66a0458f4913d34cb3c5f6b653c78f70de8a8)

2 years agopci_host_generic: update Synopsys device description for ACPI
Marcin Wojtas [Thu, 16 Sep 2021 14:39:42 +0000 (16:39 +0200)]
pci_host_generic: update Synopsys device description for ACPI

The recent addition of Synopsys ECAM quirk set the
device description only for the DT variant.
Do the same in ACPI case.

Reported by: jrtc27

(cherry picked from commit e8a872536042970b4dbf14dc75755a352fb14488)

2 years agopci_host_generic: Add Synopsys Designware PCIe controller quirk
Pawel Anikiel [Mon, 13 Sep 2021 14:59:40 +0000 (16:59 +0200)]
pci_host_generic: Add Synopsys Designware PCIe controller quirk

Due to the quirky nature of the Synopsys Designware PCIe IP,
the type 0 configuration is broadcast and whatever device
is plugged into slot, will appear at each 32 device
positions of bus0. Mitigate the issue by filtering out
duplicated devices on this bus for both DT and ACPI cases.

Reviewed by: mw
Sponsored by: Semihalf
MFC: after 3 weeks
Differential revision: https://reviews.freebsd.org/D31887

(cherry picked from commit 2de4c7f6d08798fb6269582907155703d1ab5ef4)

2 years agommc: Fix HS200/HS400 capability check
Kornel Duleba [Sun, 28 Nov 2021 11:24:07 +0000 (12:24 +0100)]
mmc: Fix HS200/HS400 capability check

HS200 and HS400 speeds can be enabled either with 1.2, or 1.8V signaling voltage.
Because of that we have four cabability flags: MMC_CAP_MMC_HS200_120,
MMC_CAP_MMC_HS200_180, MMC_CAP_MMC_HS400_120, MMC_CAP_MMC_HS400_180.

MMC logic only enables HS200/HS400 mode if both flags are set for the corresponding speed.
Fix that by being more permissive in host timing cap check.

Reviewed by: manu, mw
MFC after: 2 weeks
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential revision: https://reviews.freebsd.org/D33130

(cherry picked from commit 8661e085fb953855dbc7059f21a64a05ae61b22c)

2 years agoocs_fc: Ignore flogi failure when the remote node is pt2pt winner
Ram Kishore Vegesna [Fri, 4 Mar 2022 14:40:32 +0000 (20:10 +0530)]
ocs_fc: Ignore flogi failure when the remote node is pt2pt winner

Updated commit 79c56c9af583, do not proceed with discovery
if flogi fails in pt2pt winner case.

MFC after: 3 days

(cherry picked from commit 625a8bfb047a94459b4ab41f08fe5a2c23694039)

2 years agoocs_fc: Do not respond to unsolicited NOP BLS command.
Ram Kishore Vegesna [Thu, 3 Mar 2022 12:46:56 +0000 (18:16 +0530)]
ocs_fc: Do not respond to unsolicited NOP BLS command.

Summary: Drop unsolicited BLS commands other than ABTS.

Reviewed by: mav

MFC after: 3 days

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

(cherry picked from commit 57e4b677559a742031c7478d801c1e218afae239)

2 years agoocs_fc: Support persistent topology feature
Ram Kishore Vegesna [Thu, 3 Mar 2022 16:00:27 +0000 (21:30 +0530)]
ocs_fc: Support persistent topology feature

Summary: Enable persistent topology across power cycles/firmware resets.

Reviewed by: mav

MFC after: 3 days

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

(cherry picked from commit 965e2154e7682572e99e4c8fd4776dfe8f836b24)

2 years agoocs_fc: Ignore flogi failure when the discovery is already done.
Ram Kishore Vegesna [Thu, 3 Mar 2022 11:44:03 +0000 (17:14 +0530)]
ocs_fc: Ignore flogi failure when the discovery is already done.

Summary:
Some targets are not responding to the FLOGI in point-to-point topology,
If the pt2pt discovery is done, Ignore the FLOGI failure.

MFC after: 3 days

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

(cherry picked from commit 79c56c9af583b4c6e079594b7b6ff8176e6bff7d)

2 years agoRELNOTES: Note addition of zfskeys
Mateusz Piotrowski [Sun, 6 Mar 2022 20:28:29 +0000 (21:28 +0100)]
RELNOTES: Note addition of zfskeys

zfskeys is about to be released for the first time with FreeBSD
13.1-RELEASE.

This is a direct commit.

Reviewed by: allanjude
Sponsored: Modirum
Sponsored: Klara Inc.
Differential Revision: https://reviews.freebsd.org/D34428

2 years agorc.conf: Fix a typo
Mateusz Piotrowski [Fri, 4 Mar 2022 19:14:18 +0000 (20:14 +0100)]
rc.conf: Fix a typo

Reported by: Pau Amma <pauamma@gundo.com>
MFC after: 3 days
MFC with: 8719e8a951b78

(cherry picked from commit 9062598e748acdfc0fb5cf31fa10691d3513d814)

2 years agorc.conf: Document zfskeys
Mateusz Piotrowski [Thu, 3 Mar 2022 19:03:09 +0000 (20:03 +0100)]
rc.conf: Document zfskeys

Fixes: 33ff39796ffe Add zfskeys rc.d script for auto-loading encryption keys
MFC after: 3 days
Reviewed by: allanjude
Sponsored by: Modirum
Sponsored by: Klara, Inc
Differential Revision: https://reviews.freebsd.org/D34427

(cherry picked from commit 8719e8a951b78ca555ed777e99d5e2b90f3c4e7b)

2 years agozstd: build with C11
Mateusz Guzik [Tue, 1 Mar 2022 20:07:44 +0000 (20:07 +0000)]
zstd: build with C11

This enables thread-aware timers which in turn fixes benchmark result
reports.

Reviewed by: cem
Differential Revision: https://reviews.freebsd.org/D34238

(cherry picked from commit 6882d53b7fb884d9fe390d579d4e48ca21d1a48f)

2 years agouname: -v: strip final whitespace compatibly with uname(3)
наб [Fri, 18 Feb 2022 13:34:40 +0000 (14:34 +0100)]
uname: -v: strip final whitespace compatibly with uname(3)

This restores POSIX.1 conformance

PR: 260938
(cherry picked from commit 7e05fa3b449007adaa6e588ebb3b8d76f30b355c)

2 years agocache: improve vnode vs name assertion in cache_enter_time
Mateusz Guzik [Wed, 9 Feb 2022 20:41:24 +0000 (21:41 +0100)]
cache: improve vnode vs name assertion in cache_enter_time

(cherry picked from commit 1d65a9b47eab75f12fcb5cc7547a69441ef764a3)

2 years agocache: remove NOCACHE handling from cache_fplookup_noentry
Mateusz Guzik [Wed, 9 Feb 2022 20:39:28 +0000 (21:39 +0100)]
cache: remove NOCACHE handling from cache_fplookup_noentry

It was copy-pasted from locked lookup. As LOOKUP operation cannot have
the flag set it was always ending up setting MAKEENTRY.

(cherry picked from commit 611470a51560db61488b2d864176b8076eb5a65c)

2 years agocache: whack "set but not used" warnings
Mateusz Guzik [Sun, 14 Nov 2021 16:57:11 +0000 (16:57 +0000)]
cache: whack "set but not used" warnings

(cherry picked from commit 7e9680d3be484baac7fe78cef2be4e7ce4b4946f)

2 years agocache: only let non-dir descriptors through when doing EMPTYPATH lookups
Mateusz Guzik [Wed, 27 Oct 2021 18:17:59 +0000 (20:17 +0200)]
cache: only let non-dir descriptors through when doing EMPTYPATH lookups

Otherwise things like realpath against a file and '.' end up with an
illegal state of having a regular vnode for the parent.

Reported by: syzbot+9aa5439dd9c708aeb1a8@syzkaller.appspotmail.com

(cherry picked from commit 628c3b307fb29e9812008b8a0b3ccb73e0f0ecfa)

2 years agocache: only assert on flags when dealing with EMPTYPATH
Mateusz Guzik [Sun, 17 Oct 2021 08:40:16 +0000 (10:40 +0200)]
cache: only assert on flags when dealing with EMPTYPATH

Reported by: syzbot+bd48ee0843206a09e6b8@syzkaller.appspotmail.com
Fixes: 7dd419cabc6bb9e0 ("cache: add empty path support")

(cherry picked from commit 1045352f150346ba422b3a3ce6344fc694bc3aa4)

2 years agocache: add empty path support
Mateusz Guzik [Sun, 26 Sep 2021 13:00:24 +0000 (15:00 +0200)]
cache: add empty path support

This avoids spurious drop offs as EMPTY is passed regardless of the
actual path name.

Pushign the work inside the lookup instead of just ignorign the flag
allows avoid checking for empty pathname for all other lookups.

(cherry picked from commit 7dd419cabc6bb9e019c56d15f8e6a88ee2f46859)

2 years agocache: retire cache_fast_revlookup sysctl
Mateusz Guzik [Mon, 23 Aug 2021 13:29:42 +0000 (15:29 +0200)]
cache: retire cache_fast_revlookup sysctl

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

(cherry picked from commit b65ad70195d874ac28e6e65d2fd8acf5d9a79236)

2 years agolibusb(3): Ignore SIGPIPE when initializing the LibUSB v1.0 API.
Hans Petter Selasky [Wed, 2 Mar 2022 11:31:27 +0000 (12:31 +0100)]
libusb(3): Ignore SIGPIPE when initializing the LibUSB v1.0 API.

The LibUSB v1.0 emulation layer uses pipes internally to signal between
threads. When USB devices are reset, as part of loading firmware, SIGPIPE
may happen, and that is expected and should be ignored.

PR: 261891
Sponsored by: NVIDIA Networking

(cherry picked from commit d94d94e2c06b4331f706a3b4eca058041294ea05)

2 years agolinuxkpi: Add mmap_lock.h
Emmanuel Vadot [Wed, 16 Feb 2022 10:26:14 +0000 (11:26 +0100)]
linuxkpi: Add mmap_lock.h

This contain mmap_read_lock, mmap_read_unlock and mmap_write_lock_killable
which are abstraction around down_read, up_read and down_write_killable.
Note that in Linux 5.8 mmap_sem was renamed to mmap_lock.
We might want to do the same at some point but some drivers still uses
the old mmap locking API.

Reviewed by: bz
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34297

(cherry picked from commit 995c3b88d485b9b64ab94efe270d424b2526ade7)

2 years agolinuxkpi: Add atomic64_fetch_add
Emmanuel Vadot [Wed, 16 Feb 2022 09:44:55 +0000 (10:44 +0100)]
linuxkpi: Add atomic64_fetch_add

Linux variant of atomic_fetchadd_64.

Reviewed by: bz
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34296

(cherry picked from commit 1889bed23debb2029970c0f8e79db6b622c3cb09)

2 years agolinuxkpi: Add orderly_poweroff
Emmanuel Vadot [Tue, 15 Feb 2022 11:06:26 +0000 (12:06 +0100)]
linuxkpi: Add orderly_poweroff

This simply poweroff the system.
Needed by drm-kmod v5.8

Reviewed by: bz
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34287

(cherry picked from commit 8021ba67231de90f17a951497474ab017b7dab9e)

2 years agolinuxkpi: Add dev_emerg
Emmanuel Vadot [Tue, 15 Feb 2022 11:05:56 +0000 (12:05 +0100)]
linuxkpi: Add dev_emerg

Needed by drm-kmod v5.8

Reviewed by: bz
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34286

(cherry picked from commit e3f1af9b33e95b549ccc7363bd963cc50cd5b9d7)

2 years agolinuxkpi: Add backlight_device_set_brightness
Emmanuel Vadot [Tue, 15 Feb 2022 11:05:07 +0000 (12:05 +0100)]
linuxkpi: Add backlight_device_set_brightness

This simply set the brightness of a backlight device.
Needed by drm-kmod v5.8

Reviewed by: bz, emaste
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34285

(cherry picked from commit 2cc3af6e1d795c6d33afaf994c18abaab87a443b)

2 years agolinuxkpi: Add user_write_access_*
Emmanuel Vadot [Tue, 15 Feb 2022 11:04:40 +0000 (12:04 +0100)]
linuxkpi: Add user_write_access_*

Needed by drm-kmod v5.8

Reviewed by: bz
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34284

(cherry picked from commit 4f689b302fc49fc11d19169386f6ccfad05f47dd)

2 years agolinuxkpi: Add list_rotate_to_front
Emmanuel Vadot [Fri, 11 Feb 2022 15:10:08 +0000 (16:10 +0100)]
linuxkpi: Add list_rotate_to_front

This just calls list_move_tail.

Reviewed by: hselasky, bz
Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D34251

(cherry picked from commit bf7deecfe7604c394d0c89ca58ce5d22b0d5641c)

2 years agolinuxkpi: Add __var_waitqueue
Emmanuel Vadot [Fri, 11 Feb 2022 10:33:59 +0000 (11:33 +0100)]
linuxkpi: Add __var_waitqueue

This returns the wait queue based on the object but in LinuxKPI
we only have one waitqueue for this.

Reviewed by: hselasky, bz
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34250

(cherry picked from commit cb15ed7da2be02b108d732e41bb6e68febf93f90)

2 years agolindebugfs: Fix write
Emmanuel Vadot [Mon, 31 Jan 2022 13:46:16 +0000 (14:46 +0100)]
lindebugfs: Fix write

For write operation pseudofs creates an sbuf with the data.
Use this data instead of the uio as it's not usable anymore after
uiomove.

Reviewed by: hselasky
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D34114

(cherry picked from commit 867b4decb4d50579152e52c594632cdc0f6266ff)

2 years agosystat: Display seconds in vmstat mode
Peter Jeremy [Sat, 29 Jan 2022 09:41:19 +0000 (20:41 +1100)]
systat: Display seconds in vmstat mode

Providing a timestamp with seconds granularity helps make it obvious
that the display is updating.

Reviewed by:    mckusick
Differential Revision:  https://reviews.freebsd.org/D29181

(cherry picked from commit c9d1fa7003d5def224e9cfa5d38314f187487eb9)

2 years agogeom_gate: Distinguish between classes of errors
Peter Jeremy [Sat, 29 Jan 2022 10:15:51 +0000 (21:15 +1100)]
geom_gate: Distinguish between classes of errors

The geom_gate API provides 2 distinct paths for exchanging error
details between the kernel and the userland client: Including an error
code in the g_gate_ctl_io structure passed in the ioctl(2) call or
having the ioctl(2) call return -1 with an error code in errno. The
latter reflects errors in the ioctl(2) call itself whilst the former
reflects errors within the geom_gate instance.

The G_GATE_CMD_START ioctl blocks waiting for an I/O request to be
directed to the geom_gate instance and the wait can fail
(necessitating an error return) if the geom_gate instance is destroyed
or if the msleep(9) fails. The code previously treated both error
cases indentically: Returning ECANCELED as a geom_gate instance error
(which the ggatec treats as a fatal error).  Whilst this is the correct
behaviour if the geom_gate instance is destroyed, a msleep(9) failure
is unrelated to the geom_gate instance itself and should be reported
as an ioctl(2) "failure".  The distinction is important because
msleep(9) can return ERESTART, which means the system call should be
retried (and this will occur automatically as part of the generic
syscall return processing).

This change alters the msleep(9) handling to directly return the error
code from msleep(9), which ensures ERESTART is correctly handled,
rather than being treated as a fatal error.

Reviewed by:    Johannes Totz <jo@bruelltuete.com>
Differential Revision:  https://reviews.freebsd.org/D33996

(cherry picked from commit afcd1210246bebd8ed9bdaf31bd5218630af4cdc)

2 years agocxgbe(4): Enable the hardware TCP Offload Module (t4_tom) on aarch64.
Navdeep Parhar [Wed, 2 Mar 2022 22:30:15 +0000 (14:30 -0800)]
cxgbe(4): Enable the hardware TCP Offload Module (t4_tom) on aarch64.

Sponsored by: Chelsio Communications

(cherry picked from commit 13a0d225bede5107cbf061e25cf3b85aeb18f5b6)

2 years agocxgbe(4): Dump some more debug registers in cim_dump_regs.
Navdeep Parhar [Wed, 2 Mar 2022 18:55:55 +0000 (10:55 -0800)]
cxgbe(4): Dump some more debug registers in cim_dump_regs.

Sponsored by: Chelsio Communications

(cherry picked from commit 17f564a784e9d6b11eabce9dfd11302ae7632b23)

2 years agocxgb(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.
Navdeep Parhar [Mon, 10 Jan 2022 19:18:38 +0000 (11:18 -0800)]
cxgb(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.

Sponsored by: Chelsio Communications

(cherry picked from commit 6792568fe2687db960cb02cfc744b2e87947d38b)

2 years agobsdinstall: Fix typo (Instalation -> Installation).
Navdeep Parhar [Thu, 3 Jun 2021 04:43:14 +0000 (21:43 -0700)]
bsdinstall: Fix typo (Instalation -> Installation).

(cherry picked from commit 5104dfbeff3e1489f1caee482c7ad1ff9be8e61d)

2 years agocontrib/bc: MFC version 5.2.2
Stefan Eßer [Sat, 5 Feb 2022 21:26:36 +0000 (22:26 +0100)]
contrib/bc: MFC version 5.2.2

This release assigns a default value to the internal program name
variable in case the program is invoked with argv[0] == NULL.

There was no security issue: the prevuous program version would have
been immediately terminated due to a NULL dereference.

(cherry picked from commit 00698711dee1d990d3db9c41bf58394e589eecfe)

2 years agocontrib/bc: MFC version 5.2.1
Stefan Eßer [Tue, 30 Nov 2021 17:40:32 +0000 (18:40 +0100)]
contrib/bc: MFC version 5.2.1

Merge commit 'e63540eed295749528548c2e3a90f5a6e57275c8'

(cherry picked from commit 10041e99a0c29c9f99c4148fc173bb12dd26aa8d)

2 years agoSkip -flto for all MIPS ports
Warner Losh [Tue, 16 Nov 2021 23:10:25 +0000 (16:10 -0700)]
Skip -flto for all MIPS ports

There likely should be a macro for the ports that support lto, but I'm
making sure that all the mips things build before decommissioning it and
this is the only thing that's broken...

Sponsored by: Netflix

(cherry picked from commit d677d4be0c23a8061710232334e9dc703e591bc4)

2 years agolibc: return partial sysctl() result if buffer is too small
Stefan Eßer [Fri, 4 Feb 2022 12:44:20 +0000 (13:44 +0100)]
libc: return partial sysctl() result if buffer is too small

Testing of a new feature revealed that calling sysctl() to retrieve
the value of the user.localbase variable passing too low a buffer size
could leave the result buffer unchanged.

The behavior in the normal case of a sufficiently large buffer was
correct.

All known callers pass a sufficiently large buffer and have thus not
been affected by this issue. If a non-default value had been assigned
to this variable, the result was as documented, too.

Fix the function to fill the buffer with a partial result, if the
passed in buffer size is too low to hold the full result.

(cherry picked from commit e11ad014d1468729ecf758ab3709618a78feae1b)

libc: add helper furnction to set sysctl() user.* variables

Testing had revealed that trying to retrieve the user.localbase
variable into to small a buffer would return the correct error code,
but would not fill the available buffer space with a partial result.

A partial result is of no use, but this is still a violation of the
documented behavior, which has been fixed in the previous commit to
this function.

I just checked the code for "user.cs_path" and found that it had the
same issue.

Instead of fixing the logic for each user.* sysctl string variable
individually, this commit adds a helper function set_user_str() that
implements the semantics specified in the sysctl() man page.

It is currently only used for "user.cs_path" and "user.localbase",
but it will offer a significant simplification when further such
variables will be added (as I intend to do).

(cherry picked from commit 9535d9f104d82487abfc3a64de18f9d010bba6d2)

sysctlbyname(): restore access to user variables

The optimization of sysctlbyname() in commit d05b53e0baee7 had the
side-effect of not going through the fix-up for the user.* variables
in the previously called sysctl() function.

This lead to 0 or an empty strings being returned by sysctlbyname()
for all user.* variables.

An alternate implementation would store the user variables in the
kernel during system start-up. That would allow to remove the fix-up
code in the C library that is currently required to provide the actual
values.

This update restores the previous code path for the user.* variables
and keeps the performance optimization intact for all other variables.

(cherry picked from commit af7d105379a649b7af4bffd15fbeab692bb52b69)

2 years agowhereis: fix fetching of user.cs_path sysctl variable
Stefan Eßer [Fri, 4 Feb 2022 22:37:12 +0000 (23:37 +0100)]
whereis: fix fetching of user.cs_path sysctl variable

The current implementation of sysctlbyname() does not support the user
sub-tree. This function exits with a return value of 0, but sets the
passed string buffer to an empty string.

As a result, the whereis program did not use the value of the sysctl
variable "user.cs_path", but only the value of the environment
variable "PATH".

This update makes whereis use the sysctl function with a fixed OID,
which already supports the user sub-tree.

(cherry picked from commit c454c57163574ace86b49626b06637e93e05d5e6)

2 years agodev/pci: fix potential panic due to bogus VPD data
Stefan Eßer [Sun, 20 Feb 2022 21:07:35 +0000 (22:07 +0100)]
dev/pci: fix potential panic due to bogus VPD data

A panic has been observed on a system with a Intel X520 dual LAN
device. The panic is caused by a KASSERT() noticing that the amount
of VPD data copied out to the pciconf command does not match the
amount of data read from the device.

The cause of the size mismatch was VPD data that started with 0x82,
the VPD tag that indicates that a VPD ident follows, but with a length
of more than 255 characters, which happens to be the maximum ident
size supported by the API between kernel and the pciconf program.
The data provided did not resemble an actual VPD identifier, and it
can be assumed that the initial tag value 0x82 happens to be there
by accident.

An ident size of 255 far exceeds the sensible length of that data
element, which is in the order of at most 30 to 40 bytes.

This patch adds several consitstency checks to the VPD parser, the
most critical being that ident lengths of more than 255 bytes are
rejected. Other checks reject VPD with more than one ident tag or
with an empty (zero length) ident string.

This patch prevents the panic that occured when "pciconf -lV" was
executed on the affected system.

During the anaylsis of the issue and the VPD code it has been
found that the VPD parser uses a state machine that accepts tags
in any order and combination. This is a bad match for the actual
VPD data, which has a very simple structure that can be parsed
with a non-recursive direct descent parser (which always knows
exactly which token to expect next).

A review fpr a much simpler VPD parser that performs many more
consistency checks and rejects invalid VPD has been proposed in
review https://reviews.freebsd.org/D34268.

(cherry picked from commit f01c863337f7b097d03069daee359b6b5ecd0279)

2 years agofetch: make -S argument accept values > 2GB
Stefan Eßer [Sun, 20 Feb 2022 14:24:43 +0000 (15:24 +0100)]
fetch: make -S argument accept values > 2GB

Use strtoll() to parse the argument of the -S option.

FreeBSD has supported 64 bit file offsets for more than 25 years on
all architectures and off_t is a 64 bit integer type for that reason.

While strtol() returns a 64 bit value on 64 LP64 architectures, it
is limit to 32 bit on e.g. i386. The strtoll() function returns a 64
but result on all supported architectures and therefore supports the
possible file lengths and file offsets on 32 bit archtectures.

(cherry picked from commit 32066c96fa00fc19c8355e1956ca5aa9ead37673)

2 years agobin/df: allow -t option to be used together with -l
Stefan Eßer [Thu, 10 Feb 2022 20:09:34 +0000 (21:09 +0100)]
bin/df: allow -t option to be used together with -l

The df command provides a -l option to exclude all non-local file
systems and a -t option with a (positive or negative) list of file
system types to display.

This commit adds support for a combination of -l and -t. If both are
specified, the parameter list of the -t option is applied on top of
the selection of öocal file systems (independently of the order of
the -l and -t options).

E.g., "df -t noprocfs,sysfs -l" will select all local file systems
except those of type procfs and sysfs.

(cherry picked from commit f0fd4a32c4f7ab5eb008ab08a1a13cb20d4b30d2)

2 years agofread.c: fix undefined behavior
Stefan Eßer [Sat, 15 Jan 2022 23:30:04 +0000 (00:30 +0100)]
fread.c: fix undefined behavior

A case of undefined behavior in __fread() has been detected by UBSAN
and reported by Mark Millard:

/usr/main-src/lib/libc/stdio/fread.c:133:10: runtime error: applying
zero offset to null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior in
/usr/main-src/lib/libc/stdio/fread.c:133:10

While being benign (the NULL pointer is later passed to memcpy() with
a length argument of 0), this issue causes in the order of 600 Kyua
test cases to fail on systems running a world built with WITH_UBSAN
and WITH_ASAN.

The undefined behavior can be prevented by skipping operations that
have no effect for r == 0. Mark Millard has suggested to only skip
this code segment if fp->_p == NULL, but I have verified that for the
case of r == 0 no further argument checking is performed on the
addresses passed to memcpy() and thus no bugs are hidden from the
sanitizers due to the simpler condition chosen.

(cherry picked from commit 10af8e45a89818754b80315539e167ae49599f17)

2 years agoqsort.c: prevent undefined behavior
Stefan Eßer [Thu, 13 Jan 2022 10:09:38 +0000 (11:09 +0100)]
qsort.c: prevent undefined behavior

Mark Milliard has detected a case of undefined behavior with the LLVM
UBSAN. The mandoc program called qsort with a==NULL and n==0, which is
allowed by the POSIX standard. The qsort() in FreeBSD did not attempt
to perform any accesses using the passed pointer for n==0, but it did
add an offset to the pointer value, which is undefined behavior in
case of a NULL pointer. This operation has no adverse effects on any
achitecture supported by FreeBSD, but could be caught in more strict
environments.

After some discussion in the freebsd-current mail list, it was
concluded that the case of a==NULL and n!=0 should still be caught by
UBSAN (or cause a program abort due to an illegal access) in order to
not hide errors in programs incorrectly invoking qsort().

Only the the case of a==NULL and n==0 should be fixed to not perform
the undefined operation on a NULL pointer.

This commit makes qsort() exit before reaching the point of
potentially undefined behvior for the case n==0, but does not test
the value of a, since the result will not depend on whether this
pointer is NULL or an actual pointer to an array if n==0.

The issue found by Mark Milliard in the whatis command has been
reported to the upstream (OpenBSD) and has already been patched
there.

(cherry picked from commit d106f982a54cd299671ccad58bc456138a22ae7b)

2 years agobitset.9: add description of BIT_ISSET
Doug Moore [Thu, 6 Jan 2022 12:14:18 +0000 (13:14 +0100)]
bitset.9: add description of BIT_ISSET

Extracted from abandoned review https://reviews.freebsd.org/D33701.

(cherry picked from commit 145c65fc5791d1e4a21c7653f68a55cfd1772aac)

cpuset.9: add description of CPU_ISSET

(cherry picked from commit eaf3c3af9c88dc63ea09833397f2bbeded16f553)

2 years agousr.bin/stat: honour locale for "-t %+"
Stefan Eßer [Sat, 30 Oct 2021 07:00:34 +0000 (09:00 +0200)]
usr.bin/stat: honour locale for "-t %+"

The man page states that "-t %+" prints time information in the same
format as date with no format specifier.

This was not the case, the format used was always that of date for the
POSIX locale.

The fix suggested by the reporter leads to output that matches the
documentation.

(cherry picked from commit 20f8331aca892ff812510609b3bc4e747b201197)

2 years agonetstat: Fix typo
Stefan Eßer [Fri, 2 Jul 2021 06:38:42 +0000 (08:38 +0200)]
netstat: Fix typo

Correct spelling of "received packers" to "received packets".

(cherry picked from commit c5b8d7b7c14f72a4ad12e610222642c69374dd4a)

2 years agousr.bin/calendar: do not treat // in text as comment
Stefan Eßer [Mon, 7 Jun 2021 13:46:24 +0000 (15:46 +0200)]
usr.bin/calendar: do not treat // in text as comment

The C++-style comment marker "//" has been added with the rewrite of
the preprocessor features. Since this character sequence occurs in
ULRS, the reminder of the URL was considered a comment and stripped
from the calendar line.

Change parsing of "//" to only start a comment at the begin of a line
or when preceeded by a white-space character.

(cherry picked from commit 35b8fd0b699a20f71d5636069347b243eb336979)

2 years agopowerpc64: fix loader regression
Leandro Lupori [Tue, 21 Sep 2021 20:22:42 +0000 (17:22 -0300)]
powerpc64: fix loader regression

After b4cb3fe0e39a, loader started crashing on PowerPC64, with a
Program Exception (700) error. The problem was that archsw was
used before being initialized, with the new mount feature. This
change fixes the issue by initializing archsw earlier, before
setting currdev, that triggers the mount.

Reviewed by: tsoome
MFC after: 1 month
X-MFC-With: b4cb3fe0e39a
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D32027

(cherry picked from commit 680ca739458ba8cba221ea74794c2cd9771c77f8)

2 years agormlock: Micro-optimize read locking
Mark Johnston [Fri, 25 Feb 2022 18:42:51 +0000 (13:42 -0500)]
rmlock: Micro-optimize read locking

Use get_pcpu() instead of an open-coded pcpu_find(td->td_oncpu).  This
eliminates some memory accesses and results in a shorter instruction
sequence.  Note that get_pcpu() didn't exist when rmlocks were added.

Reviewed by: jah, mjg
Sponsored by: The FreeBSD Foundation

(cherry picked from commit c84bb8cd771ce4bed58152e47a32dda470bef23a)

2 years agonfscl: Fix a use after free in nfscl_cleanupkext()
Rick Macklem [Fri, 25 Feb 2022 15:27:03 +0000 (07:27 -0800)]
nfscl: Fix a use after free in nfscl_cleanupkext()

ler@, markj@ reported a use after free in nfscl_cleanupkext().
They also provided two possible causes:
- In nfscl_cleanup_common(), "own" is the owner string
  owp->nfsow_owner.  If we free that particular
  owner structure, than in subsequent comparisons
  "own" will point to freed memory.
- nfscl_cleanup_common() can free more than one owner, so the use
  of LIST_FOREACH_SAFE() in nfscl_cleanupkext() is not sufficient.

I also believe there is a 3rd:
- If nfscl_freeopenowner() or nfscl_freelockowner() is called
  without the NFSCLSTATE mutex held, this could race with
  nfscl_cleanupkext().
  This could happen when the exclusive lock is held
  on the client, such as when delegations are being returned
  or when recovering from NFSERR_EXPIRED.

This patch fixes them as follows:
1 - Copy the owner string to a local variable before the
    nfscl_cleanup_common() call.
2 - Modify nfscl_cleanup_common() so that it will never free more
    than the first matching element.  Normally there should only
    be one element in each list with a matching open/lock owner
    anyhow (but there might be a bug that results in a duplicate).
    This should guarantee that the FOREACH_SAFE loops in
    nfscl_cleanupkext() are adequate.
3 - Acquire the NFSCLSTATE mutex in nfscl_freeopenowner()
    and nfscl_freelockowner(), if it is not already held.
    This serializes all of these calls with the ones done in
    nfscl_cleanup_common().

(cherry picked from commit 1cedb4ea1a790f976ec6211c938dfaa23874b497)

2 years agodwc: Support phy mode MII
Emmanuel Vadot [Tue, 22 Feb 2022 08:58:36 +0000 (09:58 +0100)]
dwc: Support phy mode MII

Some board use dwc phy in MII mode, so do not fail to attach if this is
the case.
Only rockchip code uses the phy mode to program some custom syscon register.

PR: 260848
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit da6252a6a099e6253207b69960e6762ce3cca0f8)

2 years agodwc: Release resources when attach fails
Emmanuel Vadot [Tue, 22 Feb 2022 08:53:11 +0000 (09:53 +0100)]
dwc: Release resources when attach fails

PR: 259282
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 30f16ad460e2f9631484d04f067d80ee578473bc)

2 years agossh: correct configure option name
Ed Maste [Tue, 1 Mar 2022 14:35:46 +0000 (09:35 -0500)]
ssh: correct configure option name

The option is security-key-builtin not security-key-internal.  There is
no change to the generated config.h because the option defaults off
anyway.

MFC after: 3 days
Fixes: 87152f340549 ("ssh: disble internal security key...")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit f1421a8972a2c8babfacfd1270258492579e0208)

2 years agonetinet: simplify RSS ifdef statements
Franco Fichtner [Tue, 8 Feb 2022 02:22:03 +0000 (19:22 -0700)]
netinet: simplify RSS ifdef statements

Approved by: transport (rrs)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D31583

(cherry picked from commit 47ded797ce9620f055f005e9dccfcd03613b1804)

2 years agousb(4): Automagically apply all quirks for USB mass storage devices.
Hans Petter Selasky [Mon, 21 Feb 2022 08:24:28 +0000 (09:24 +0100)]
usb(4): Automagically apply all quirks for USB mass storage devices.

Currently there are five quirks the USB stack tries to automagically detect:
- UQ_MSC_NO_PREVENT_ALLOW
- UQ_MSC_NO_SYNC_CACHE
- UQ_MSC_NO_TEST_UNIT_READY
- UQ_MSC_NO_GETMAXLUN
- UQ_MSC_NO_START_STOP

If any of the quirks above are set, no further quirks will be probed.

If any of the USB mass storage tests fail, the USB device is
re-enumerated as a last resort to clear any error states from the
device. Then the USB stack will try to probe and attach the umass<N>
device passing the detected quirks.

While at it give more details in dmesg about what is going on.

Tested by: several
Submitted by: Idwer Vollering <vidwer_fbsdbugs@gmail.com>
Differential Revision: https://reviews.freebsd.org/D30919
Sponsored by: NVIDIA Networking

(cherry picked from commit 7520b88860d7a79432e12ffcc47056844518bb62)

2 years agomlx5ib: Add support for NDR link speed.
Hans Petter Selasky [Mon, 21 Feb 2022 08:25:29 +0000 (09:25 +0100)]
mlx5ib: Add support for NDR link speed.

The IBTA specification has new speed - NDR. That speed supports signaling
rate of 100Gb. mlx5 IB driver translates link modes reported by ConnectX
device to IB speed and width. Added translation of new 100Gb, 200Gb and
400Gb link modes to NDR IB type and width of x1, x2 or x4 respectively.

Linux commits:
f946e45f59ef01ff54ffb3b1eba3a8e7915e7326

Sponsored by: NVIDIA Networking

(cherry picked from commit 91c8ffd7e60fa7f017731cd234c01b7cddc05272)

2 years agoibcore: Add support for NDR link speed.
Hans Petter Selasky [Mon, 21 Feb 2022 08:25:10 +0000 (09:25 +0100)]
ibcore: Add support for NDR link speed.

Add new IBTA speed NDR, supporting signaling rate of 100Gb.

Linux commit:
c7adf7717301558e8852949d8e3dc3748d1a4a97

Sponsored by: NVIDIA Networking

(cherry picked from commit 1aa593b90ca96acb0d996daef9739ec98538f0db)

2 years agomlx5core: Add PCI IDs for ConnectX-8.
Hans Petter Selasky [Mon, 21 Feb 2022 08:25:45 +0000 (09:25 +0100)]
mlx5core: Add PCI IDs for ConnectX-8.

Sponsored by: NVIDIA Networking

(cherry picked from commit eb16e362d6cb96fab733d94fa01b7a1c84ccb436)

2 years agomlx5core: Add PCI IDs for ConnectX-7.
Hans Petter Selasky [Mon, 21 Feb 2022 08:25:23 +0000 (09:25 +0100)]
mlx5core: Add PCI IDs for ConnectX-7.

Linux commits:
505a7f5478062c6cd11e22022d9f1bf64cd8eab3
dd8595eabeb486d41ad9994e6cece36e0e25e313

Sponsored by: NVIDIA Networking

(cherry picked from commit ea8aacc523e8ac43e035097233774f30b1d33653)

2 years agovfs_unregister: fix error handling
Marvin Ma [Fri, 25 Feb 2022 15:34:33 +0000 (09:34 -0600)]
vfs_unregister: fix error handling

Due to misplaced braces, an error from vfs_uninit() in the VFCF_SBDRY
case was ignored.

Reported by: Anton Rang <rang@acm.org>
Reviewed by: Anton Rang <rang@acm.org>, markj
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34375

(cherry picked from commit 1517b8d5a7f58897200497811de1b18809c07d3e)

2 years agommap map_at_zero test: handle W^X
Arka Sharma [Fri, 18 Feb 2022 15:34:15 +0000 (09:34 -0600)]
mmap map_at_zero test: handle W^X

Use kern.elfXX.allow_wx to decide whether to map W+X or W-only memory.

Future work could expand this test to add an "allow_wx" axis to the
test matrix, but I would argue that a separate test should be written,
since that's orthogonal to map_at_zero.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit 766c2466ff465b3c7c1a46be729b42a6da47de03)

2 years agoatrtc: reads Century field from FADT table
Austin Zhang [Thu, 13 Jan 2022 17:13:25 +0000 (11:13 -0600)]
atrtc: reads Century field from FADT table

The ACPI spec describes the FADT->Century field as:

    The RTC CMOS RAM index to the century of data value (hundred and
    thousand year decimals).  If this field contains a zero, then the
    RTC centenary feature is not supported.  If this field has a non-zero
    value, then this field contains an index into RTC RAM space that
    OSPM can use to program the centenary field.

Use this field to decide whether to program the CENTURY register
of the CMOS RTC device.

Reviewed by: akumar3@isilon.com, dab, vangyzen
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D33667

MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit e1ef6c0ef256f797d629b9490db3f0034b28ae43)

2 years agoddb: do not assume that ffs is mounted with softdep
Keith Owens [Wed, 25 Aug 2021 01:59:31 +0000 (20:59 -0500)]
ddb: do not assume that ffs is mounted with softdep

Avoid a panic when debugging with "show ffs" in ddb.

Reviewed By: kib, markj, mckusick
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D31622

(cherry picked from commit 3b29c8b4bdb0e396d7bb5d0760f11d7fa4208c84)

2 years agoipmi: support getting address from EFI
Yinlong Lu [Thu, 29 Apr 2021 10:04:36 +0000 (05:04 -0500)]
ipmi: support getting address from EFI

The original implementation only supports getting the address from legacy
BIOS (by searching for the SMBIOS_SIG pattern in a fixed address space).

Try to get the SMBIOS table from EFI through efirt (EFI Runtime Services)
firstly.  Continue to search in the legacy BIOS if a NULL address is
returned from EFI.

By this way the ipmi function supports both legacy BIOS and UEFI systems.

Reviewed by: dab, vangyzen
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D30007

(cherry picked from commit ee8b757a949a9575c7355ea01f0475e0c526b9e5)

2 years agoipmi,smbios: move smbios_walk_table to smbios.h
Greg V [Wed, 7 Apr 2021 20:05:49 +0000 (15:05 -0500)]
ipmi,smbios: move smbios_walk_table to smbios.h

This function will be used for exposing DMI info as sysctls in the
smbios module (in an upcoming review).

While here, add __packed to the structs.

Reviewed by: dab
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29270

(cherry picked from commit f689cb23b2782d0d0f586bcfabbad68f728ed1df)

2 years agosmbios: support getting address from EFI
Greg V [Wed, 7 Apr 2021 19:46:29 +0000 (14:46 -0500)]
smbios: support getting address from EFI

On some systems (e.g. Lenovo ThinkPad X240, Apple MacBookPro12,1)
the SMBIOS entry point is not found in the <0xFFFFF space.

Follow the SMBIOS spec and use the EFI Configuration Table for
locating the entry point on EFI systems.

Reviewed by: rpokala, dab
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29276

(cherry picked from commit a29bff7a5216bd5f4a76228788e7eacf235004de)

2 years agosmbios: Move smbios driver out from x86 machdep code
Allan Jude [Tue, 23 Feb 2021 21:14:18 +0000 (21:14 +0000)]
smbios: Move smbios driver out from x86 machdep code

Add it to the x86 GENERIC and MINIMAL kernels

Sponsored by: Ampere Computing LLC
Submitted by: Klara Inc.
Reviewed by: rpokala
Differential Revision: https://reviews.freebsd.org/D28738

(cherry picked from commit d0673fe160b04f8162f380926d455dfb966f08fb)

2 years agofuse: Fix build on 32-bit architectures
Jessica Clarke [Thu, 3 Mar 2022 03:22:30 +0000 (03:22 +0000)]
fuse: Fix build on 32-bit architectures

MFC 3d721de049be ("Fix NFS exports of FUSE file systems for big
directories") missed a case of a uint64_t from HEAD that should be a
u_long in 13 due to KPI differences. Specifically, HEAD has b214fcceacad
("Change VOP_READDIR's cookies argument to a **uint64_t"), but stable/13
does not.

This is a direct commit to stable/13.

2 years agotime_t is pathological: use %j + cast to print it.
Warner Losh [Fri, 1 Oct 2021 18:14:35 +0000 (12:14 -0600)]
time_t is pathological: use %j + cast to print it.

Sponsored by: Netflix

(cherry picked from commit 4aed5c3c9d1d78986d3feba3f128187c59fb2dfe)

2 years ago[skip ci] fusefs: delete a stray comment from 91972cfcddf
Alan Somers [Sat, 12 Feb 2022 16:27:56 +0000 (09:27 -0700)]
[skip ci] fusefs: delete a stray comment from 91972cfcddf

(cherry picked from commit 0b6a34acda4245215df29be35e4ef4bba995ec91)

2 years agoFix NFS exports of FUSE file systems for big directories
Alan Somers [Sun, 2 Jan 2022 17:18:47 +0000 (10:18 -0700)]
Fix NFS exports of FUSE file systems for big directories

The FUSE protocol does not require that a directory entry's d_off field
outlive the lifetime of its directory's file handle.  Since the NFS
server must reopen the directory on every VOP_READDIR call, that means
it can't pass uio->uio_offset down to the FUSE server.  Instead, it must
read the directory from 0 each time.  It may need to issue multiple
FUSE_READDIR operations until it finds the d_off field that it's looking
for.  That was the intention behind SVN r348209 and r297887, but a logic
bug prevented subsequent FUSE_READDIR operations from ever being issued,
rendering large directories incompletely browseable.

Reviewed by: rmacklem

(cherry picked from commit d088dc76e1a62ecb6c05bd2b14ee48a9f9a7e2bd)

fusefs: optimize NFS readdir for FUSE_NO_OPENDIR_SUPPORT

In its lowest common denominator, FUSE does not require that a directory
entry's d_off field is valid outside of the lifetime of the directory's
FUSE file handle.  But since NFS is stateless, it must reopen the
directory on every call to VOP_READDIR.  That means reading the
directory all the way from the first entry.  Not only does this create
an O(n^2) condition for large directories, but it can also result in
incorrect behavior if either:

* The file system _does_ change the d_off field for the last directory
  entry previously seen by NFS, or
* The file system deletes the last directory entry previously seen by
  NFS.

Handily, for file systems that set FUSE_NO_OPENDIR_SUPPORT d_off is
guaranteed to be valid for the lifetime of the directory entry, there is
no need to read the directory from the start.

Reviewed by: rmacklem

(cherry picked from commit 4a6526d84a56f398732bff491e63aa42f796a27d)

fusefs: require FUSE_NO_OPENDIR_SUPPORT for NFS exporting

FUSE file systems that do not set FUSE_NO_OPENDIR_SUPPORT do not
guarantee that d_off will be valid after closing and reopening a
directory.  That conflicts with NFS's statelessness, that results in
unresolvable bugs when NFS reads large directories, if:

* The file system _does_ change the d_off field for the last directory
  entry previously returned by VOP_READDIR, or
* The file system deletes the last directory entry previously seen by
  NFS.

Rather than doing a poor job of exporting such file systems, it's better
just to refuse.

Even though this is technically a breaking change, 13.0-RELEASE's
NFS-FUSE support was bad enough that an MFC should be allowed.

Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D33726

(cherry picked from commit 00134a07898fa807b8a1fcb2596f0e3644143f69)

fusefs: fix the build without INVARIANTS after 00134a07898

MFC with: 00134a07898fa807b8a1fcb2596f0e3644143f69
Reported by: se

(cherry picked from commit 18ed2ce77a254f365a4687d6afe8eeba2aad2e13)