]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
22 months agotcp: avoid call to soisconnected() on transition to ESTABLISHED
Gleb Smirnoff [Thu, 8 Sep 2022 16:16:04 +0000 (09:16 -0700)]
tcp: avoid call to soisconnected() on transition to ESTABLISHED

This call existed since pre-FreeBSD times, and it is hard to understand
why it was there in the first place.  After 6f3caa6d815 it definitely
became necessary always and commit message from f1ee30ccd60 confirms that.
Now that 6f3caa6d815 is effectively backed out by 07285bb4c22, the call
appears to be useful only for sockets that landed on the incomplete queue,
e.g. sockets that have accept_filter(9) enabled on them.

Provide a new TCP flag to mark connections that are known to be on the
incomplete queue, and call soisconnected() only for those connections.

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D36488

22 months agostand: i386: take into account disk sector size for blk calculation
Kyle Evans [Thu, 8 Sep 2022 00:35:06 +0000 (19:35 -0500)]
stand: i386: take into account disk sector size for blk calculation

disk_blocks assumes BIOSDISK_SECSIZE, but the media may not be using
it.  In particular, bioscd on Parallels presents a 2K sector size, so
we end up with a short disk_blocks and subsequent validation fails when
trying to read /boot/lua.

PR: 233098
Reviewed by: imp, tsoome
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36490

22 months agoUse the cached dc zva length in arm64 memset
Andrew Turner [Wed, 7 Sep 2022 11:43:16 +0000 (12:43 +0100)]
Use the cached dc zva length in arm64 memset

On boot we cache the length the 'dc zva' instruction will zero. Use
this in the memset function to decide when to use it. As the cached
value is in .bss it will be zero on boot so memset is safe to use
before the value has been read.

Sponsored by: The FreeBSD Foundation

22 months agoImport the arm64 Cortex Strings memset into the kernel
Andrew Turner [Wed, 7 Sep 2022 11:41:13 +0000 (12:41 +0100)]
Import the arm64 Cortex Strings memset into the kernel

Bring in the last version of the optimized memset from the Cortex
Strings library that didn't use the VFP registers. While here clean up
to use the ENTRY/EDIT macros.

This is imported from:
https://git.linaro.org/toolchain/cortex-strings.git/tree/src/aarch64/memset.S?id=bc654e7a594385071b42db3c9c94bd0fd5fe0da5

Sponsored by: The FreeBSD Foundation

22 months agoImport an optimized arm64 memcmp into the kernel
Andrew Turner [Wed, 7 Sep 2022 11:12:30 +0000 (12:12 +0100)]
Import an optimized arm64 memcmp into the kernel

Bring in a version of the Arm Optimized Routines memcpy from before
the VFP registers were used.

Imported with modification from:
https://github.com/ARM-software/optimized-routines/blob/e823e3abf5f89ecb/string/aarch64/memcmp.S

Sponsored by: The FreeBSD Foundation

22 months agoImport an optimized str{n}cmp on arm64
Andrew Turner [Wed, 7 Sep 2022 10:40:26 +0000 (11:40 +0100)]
Import an optimized str{n}cmp on arm64

These are from the Arm Optimized Routines and don't use the VFP so are
safe to use in the kernel.

Sponsored by: The FreeBSD Foundation

22 months agoUpdate the arm64 kernel memcpy/memmove
Andrew Turner [Wed, 7 Sep 2022 09:51:21 +0000 (10:51 +0100)]
Update the arm64 kernel memcpy/memmove

Bring in the latest Arm Optimized Routines memcpy/memmove into the
arm64 kernel. As these functions have been merged in the current
version remove the now unneeded memmove.S.

Sponsored by: The FreeBSD Foundation

22 months agoMove the non-exported PCB_FP_* flags to the upper bits
Andrew Turner [Tue, 6 Sep 2022 16:49:00 +0000 (17:49 +0100)]
Move the non-exported PCB_FP_* flags to the upper bits

To make way for a flag for SVE move the PCB_FP_* flags we don't export
to userspace to the upper bits.

Sponsored by: The FreeBSD Foundation

22 months agoGenerate termcap.small automatically. This eliminates the
Maxim Sobolev [Fri, 19 Aug 2022 07:00:27 +0000 (22:00 -0900)]
Generate termcap.small automatically. This eliminates the
need to do synchronization by hand when termcap is updated.

Reviewed by: uqs, bapt, imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36333

22 months agorouting: constantify nh/nhg argument in <nhop|nhgrp>_get_origin().
Alexander V. Chernikov [Thu, 8 Sep 2022 10:21:25 +0000 (10:21 +0000)]
routing: constantify nh/nhg argument in <nhop|nhgrp>_get_origin().

MFC after: 1 month

22 months agorouting: add abitity to set the protocol that installed route/nexthop.
Alexander V. Chernikov [Thu, 8 Sep 2022 09:05:53 +0000 (09:05 +0000)]
routing: add abitity to set the protocol that installed route/nexthop.

Routing daemons such as bird need to know if they install certain route
 so they can clean it up on startup, as a form of achieving consistent
 state during the crash recovery.
Currently they use combination of routing flags (RTF_PROTO1) to detect
 these routes when interacting via route(4) rtsock protocol.
Netlink protocol has a special "rtm_protocol" field that is filled and
 checked by the route originator. To prepare for the upcoming netlink
 introduction, add ability to record origing to both nexthops and
 nexthop groups via <nhop|nhgrp>_<get|set>_origin() KPI. The actual
 calls will be used in the followup commits.

MFC after: 1 month

22 months agoarm64, riscv: size boot stacks appropriately
Kyle Evans [Wed, 7 Sep 2022 02:11:30 +0000 (21:11 -0500)]
arm64, riscv: size boot stacks appropriately

In 8db2e8fd16c4 ("Remove the secondary_stacks array in arm64 [...]"),
bootstacks was setup to be allocated dynamically.  While this is
generally how x86 does it, it inadvertently shrunk each boot stack from
KSTACK_PAGES pages to a single page.

Resize these back up to the expected size using the kstack_pages
tunable, as we'll need larger stacks with upcoming sanitizer work.

Reviewed by: andrew, imp, markj
Fixes: 8db2e8fd16c4 ("Remove the secondary_stacks array [...]")
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D36475

22 months agorb_tree: reduce duplication in balancing code
Doug Moore [Thu, 8 Sep 2022 04:46:19 +0000 (23:46 -0500)]
rb_tree: reduce duplication in balancing code

Change RB_INSERT_COLOR and RB_REMOVE_COLOR so that the blocks of code
that are identical except for left and right being exchanged are made
only one block with a variable to indicate left- or right-handedness.

Rename RB macros so that those not intended for external use begin
with an underscore.

Add comments to the balancing code so that another might understand it.

Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D36393

22 months agoHyper-V: storvsc: relax a couple more kasserts
Wei Hu [Thu, 8 Sep 2022 04:19:55 +0000 (04:19 +0000)]
Hyper-V: storvsc: relax a couple more kasserts

Seems these kasserts don't work well on ARM64

Fixes: 0af5a0cd2788e
Sponsored by: Microsoft

22 months agorb_tree: test rank balance
Doug Moore [Thu, 8 Sep 2022 02:40:05 +0000 (21:40 -0500)]
rb_tree: test rank balance

With _RB_DIAGNOSTIC defined, provide an RB_RANK method to compute the
rank of a node in an rb-tree, if the subtree rooted at that node is
rank-balanced, and -1 otherwise.

In rb_test, rewrite a bit to avoid malloc/free and nondeterministic
running times because of randomness. Allocate all the nodes on the
stack, and shuffle a set of keys to get randomness for the testing.

Add a rank-balance check for the completed tree.

Reviewed by: markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D36484

22 months agostand: Unbreak FAT32 in loader
Michael Gmelin [Wed, 7 Sep 2022 16:56:49 +0000 (18:56 +0200)]
stand: Unbreak FAT32 in loader

This corrects an issue introduced in b4cb3fe0e39a3, where a freshly
allocated `DOS_FS` structure would not be initialized properly before
use in `dos_open`.

In case of FAT32 file systems, this would leave `fs->dirents`
uninitialized and - depending on its content and due to checks in
`parsebs` - prevent mounting the file system successfully.

This particularily impacted the EFI loader, as it was sometimes not
able to read files from a FAT32-formatted EFI partition, including
LoaderEnv (`/efi/freebsd/loader.env`).

Accepted by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36482

22 months agoUSB: add 2 (3) more device IDs for rtw88-usb devices and a quirk
Bjoern A. Zeeb [Wed, 7 Sep 2022 23:48:59 +0000 (23:48 +0000)]
USB: add 2 (3) more device IDs for rtw88-usb devices and a quirk

Add DLink DWA-182 rev D1 and generic Realtek RTW8821CU entry found on
a Tenda U10 USB WLAN Stick, AC 650 Mbps (and possibly more devices).
The latter first presents itself as a CD device with Windows drivers
(useless on FreeBSD) first so add a quirk for that we get the wireless
device right away.

MFC after: 2 weeks
While here sort some other Realtek entries by DeviceID.

22 months agoLinuxKPI, dev: 80211 update mac80211 KPI
Bjoern A. Zeeb [Wed, 7 Sep 2022 23:38:54 +0000 (23:38 +0000)]
LinuxKPI, dev: 80211 update mac80211 KPI

Update the mac80211 ops KPI for (*conf_tx), (*assign_vif_chanctx),
(*unassign_vif_chanctx), (*start_ap), and (*stop_ap), as well as
ieee80211_beacon_get_tim() and ieee80211_beacon_get_template().

Update in-tree drivers iwlwifi and rtw88 accordingly based on upstream
changes (as well as out-of-tree ones).  This was triggered by trying to
synchronize more drivers to a common state.

MFC after: 1 week

22 months agoLinuxKPI: netdev: expose napi state
Bjoern A. Zeeb [Wed, 7 Sep 2022 23:35:41 +0000 (23:35 +0000)]
LinuxKPI: netdev: expose napi state

There are drivers directly accessing napi->state testing for bits
(NAPI_STATE_SCHED encountered so far).  Rename the internal _flags
struct field to state and expose our internal state flag bits along
with the one official aliased.

As I left in a comment, I wished Linux would hide these accesses
behind inline functions or by other means and not public expose
the implementation details.

MFC after: 1 week

22 months agoLinuxKPI: firmware: add request_partial_firmware_into_buf()
Bjoern A. Zeeb [Wed, 7 Sep 2022 23:33:45 +0000 (23:33 +0000)]
LinuxKPI: firmware: add request_partial_firmware_into_buf()

A (so far out-of-tree) driver update needs
request_partial_firmware_into_buf().  Given we load the full .ko file
using firmware(9) just do that and copy the requeste data into the
buffer (rather than poissibly only reading portions of the firmware
file).

MFC after: 1 week

22 months agonet80211: update (parts of) Action field categories
Bjoern A. Zeeb [Wed, 7 Sep 2022 23:28:13 +0000 (23:28 +0000)]
net80211: update (parts of) Action field categories

Update to the full list of action field category values based on
802.11-2020 with 11ax extensions and remove one value Reserved nowadays.
While here annotate them with descriptions.

Also add Spectrum Management and Radio Measurement action field values
needed in LinuxKPI.

No functional changes.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

22 months agoRELNOTES: Add an entry for use of "intr,nolockd" NFSv4.1/4.2 mounts
Rick Macklem [Wed, 7 Sep 2022 22:55:15 +0000 (15:55 -0700)]
RELNOTES: Add an entry for use of "intr,nolockd" NFSv4.1/4.2 mounts

Add an entry for the commits that make the mount options "intr" and
"nolockd" usable for NFSv4.1/4.2 mounts.

22 months agoRELNOTES: Add an entry for new NFSv4.1/4.2 console messages
Rick Macklem [Wed, 7 Sep 2022 22:35:55 +0000 (15:35 -0700)]
RELNOTES: Add an entry for new NFSv4.1/4.2 console messages

Add and entry for the commits that generate new console messages
indicating that all clients need to have unique /etc/hostid strings.

22 months agomount_nfs.8: Update for NFSv4 use of "nolockd"
Rick Macklem [Wed, 7 Sep 2022 21:07:20 +0000 (14:07 -0700)]
mount_nfs.8: Update for NFSv4 use of "nolockd"

Commit 33721eb991d8 enabled use of "nolockd" for
NFSv4 mounts.  This was done primarily to allow its
use with the "intr" mount option.

This patch updates the man page for this.

This is a content change.

Reviewed by: gbe (manpages), karels
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36462

22 months agovfs: flip a condition around in kern_statat
Mateusz Guzik [Wed, 7 Sep 2022 20:05:32 +0000 (22:05 +0200)]
vfs: flip a condition around in kern_statat

error tends to be 0.

22 months agosnd_hda: Remove duplicate erroneous HDA_INTEL_ALLKPS line
Neel Chauhan [Wed, 7 Sep 2022 18:05:01 +0000 (11:05 -0700)]
snd_hda: Remove duplicate erroneous HDA_INTEL_ALLKPS line

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D36483

22 months agoCirrus-CI: move QEMU pkg installation to test script
Ed Maste [Wed, 7 Sep 2022 14:12:37 +0000 (10:12 -0400)]
Cirrus-CI: move QEMU pkg installation to test script

Occasionally the QEMU package fails to build and isn't available on
-CURRENT using the Latest package set.  Move the package installation
to the test script, so that if the package isn't available we at least
still perform a build test.

Sponsored by: The FreeBSD Foundation

22 months agosnd_hda: Add the full Intel AlderLake HD Audio PCI IDs
Neel Chauhan [Wed, 7 Sep 2022 02:35:02 +0000 (19:35 -0700)]
snd_hda: Add the full Intel AlderLake HD Audio PCI IDs

This is based off the Linux file sound/hda/intel-dsp-config.c.

Reviewed by: imp (src)
Tested on: HP Spectre x360 16-f0023dx
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D36476

22 months agoHyper-V: storvsc: relax a kassert check
Wei Hu [Wed, 7 Sep 2022 15:06:54 +0000 (15:06 +0000)]
Hyper-V: storvsc: relax a kassert check

On ARM64 this kassert check could cause unnecessary panic.

Sponsored by: Microsoft

22 months agonet80211(4): Bring back an accidently reverted grammar correction
Gordon Bergling [Wed, 7 Sep 2022 11:35:45 +0000 (13:35 +0200)]
net80211(4): Bring back an accidently reverted grammar correction

- s/that that/that/

Reported by: se, danfe
MFC after: 3 days

22 months agonet80211(4): Correct a grammar mistake in a source code comment
Gordon Bergling [Wed, 7 Sep 2022 11:13:54 +0000 (13:13 +0200)]
net80211(4): Correct a grammar mistake in a source code comment

- s/the/be the/
- s/Mhz/MHz/
- s/it'll/it will/

Reported by: bz, danfe
MFC after: 3 days

22 months agonet: retire PFIL_FWD
Mateusz Guzik [Fri, 2 Sep 2022 16:37:55 +0000 (18:37 +0200)]
net: retire PFIL_FWD

It is now unused and not having it allows further clean ups.

Reviewed by: cy, glebius, kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D36452

22 months agonet: remove stale altq_input reference
Mateusz Guzik [Tue, 6 Sep 2022 18:12:54 +0000 (18:12 +0000)]
net: remove stale altq_input reference

Code setting it was removed in:
commit 325fab802e1f40c992141f945d0788c0edfdb1a4
Author: Eric van Gyzen <vangyzen@FreeBSD.org>
Date:   Tue Dec 4 23:46:43 2018 +0000

    altq: remove ALTQ3_COMPAT code

Reviewed by: glebius, kp
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D36471

22 months agovmm: Remove unneeded variable maxcpus
Emmanuel Vadot [Wed, 7 Sep 2022 09:40:03 +0000 (11:40 +0200)]
vmm: Remove unneeded variable maxcpus

Reported by: FreeBSD User <freebsd@walstatt-de.de>
Fixes: a5a918b7a906 ("vmm: permit some IPIs to be handled by userspace")

22 months agomvneta: Use clkgen API on armv7
Albert Jakieła [Tue, 6 Sep 2022 08:33:34 +0000 (10:33 +0200)]
mvneta: Use clkgen API on armv7

With addition of clkgen devices to the Armada38x we no longer
need to rely on get_tclk() to get the device frequency.
Leave it as a fallback, just in case.

Reviewed by: manu
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36465

22 months agomv_twsi: Use the clock API on armv7
Albert Jakieła [Mon, 11 Jul 2022 13:45:28 +0000 (15:45 +0200)]
mv_twsi: Use the clock API on armv7

With the addition of clkgen devices to the Armada38x, there is
no longer any need to use the get_tclk() hack.

Reviewed by: manu
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36456

22 months agoAdd ARMADA38X gateclk control
Albert Jakieła [Tue, 12 Jul 2022 09:16:21 +0000 (11:16 +0200)]
Add ARMADA38X gateclk control

This patch introduces basic gate control driver for Armada38x SoC.
Each gate controls coreclk output to a given peripheral.

Reviewed by: manu
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36455

22 months agoAdd ARMADA38X clkgen driver
Albert Jakieła [Tue, 5 Jul 2022 15:01:02 +0000 (17:01 +0200)]
Add ARMADA38X clkgen driver

This patch introduces clkgen driver for Armada38x SoCs.
Clock topology consists of single coreclk which supplies
clock signal to CPU cores and peripherials.

Reviewed by: manu
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36453

22 months agouart_bus_acpi: Read clock frequency from bus
Mateusz Kozyra [Tue, 6 Sep 2022 14:54:00 +0000 (16:54 +0200)]
uart_bus_acpi: Read clock frequency from bus

It is stored in the clock-frequency property.
In case of failure, fallback to the harcoded value stored in the
compat data.
Also, while here improve style.
Tested on LS1046ARDB and x86 PC.

Reviewed by: mw
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36326

22 months agovmm: permit some IPIs to be handled by userspace
Corvin Köhne [Wed, 7 Sep 2022 07:07:03 +0000 (09:07 +0200)]
vmm: permit some IPIs to be handled by userspace

Add VM_EXITCODE_IPI to permit returning unhandled IPIs to userland.
INIT and Startup IPIs are now returned to userland. Due to backward
compatibility reasons, a new capability is added for enabling
VM_EXITCODE_IPI.

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

22 months agobhyve: create all vcpus on startup
Corvin Köhne [Wed, 7 Sep 2022 07:05:36 +0000 (09:05 +0200)]
bhyve: create all vcpus on startup

vcpus could be restarted by the guest by sending an INIT SIPI SIPI
sequence to a vcpu. That's not supported by bhyve yet but it will be
supported in a future commit. So, create the vcpu threads only once on
startup to make restarting a vcpu easier.

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

22 months agoFix build.
Xin LI [Wed, 7 Sep 2022 06:41:10 +0000 (23:41 -0700)]
Fix build.

Pointy hat to: delphij
MFC after: 2 weeks
X-MFC-with: c65e42dbde41

22 months agoMFV: cherry-pick "PR/358: Fix width for -f - (jpalus)"
Xin LI [Wed, 7 Sep 2022 06:31:20 +0000 (23:31 -0700)]
MFV: cherry-pick "PR/358: Fix width for -f - (jpalus)"

MFC after: 1 week
PR: bin/266264

22 months agoPR/358: Fix width for -f - (jpalus)
Christos Zoulas [Mon, 4 Jul 2022 17:00:51 +0000 (17:00 +0000)]
PR/358: Fix width for -f - (jpalus)

(cherry picked from commit 19bf47777d0002ee884467e45e6ace702e40a4c1)

22 months agolibc: add test case for qsort_b(3)
Xin LI [Wed, 7 Sep 2022 06:11:46 +0000 (23:11 -0700)]
libc: add test case for qsort_b(3)

Reviewed by:  markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D36463

22 months agodivert(4): do not depend on ipfw(4)
Gleb Smirnoff [Wed, 7 Sep 2022 03:54:57 +0000 (20:54 -0700)]
divert(4): do not depend on ipfw(4)

Although originally socket was intended to use with ipfw(4) only, now
it also can be used with pf(4).  On a kernel without packet filters,
it still can be used to inject traffic.

22 months agodivert(4): don't check for CSUM_SCTP without INET
Gleb Smirnoff [Wed, 7 Sep 2022 03:54:57 +0000 (20:54 -0700)]
divert(4): don't check for CSUM_SCTP without INET

This compiles, but actually is a dead code.

Noticed by: bz
Fixes: e72c522858cb

22 months agotests: partial revert of 4627bc1e90fd17c8d4f44de6b932d456b67661fc
Gleb Smirnoff [Wed, 7 Sep 2022 03:54:49 +0000 (20:54 -0700)]
tests: partial revert of 4627bc1e90fd17c8d4f44de6b932d456b67661fc

Python's socketmodule isn't able to construct sockaddr when it doesn't
recognize the address family.  Until this is solved in python let the
tests use the compatibility way to create divert(4) socket.

22 months agoipfilter: Remove unused ioctl
Cy Schubert [Tue, 6 Sep 2022 20:58:35 +0000 (13:58 -0700)]
ipfilter: Remove unused ioctl

The SIOCSTAT1 ioctl is only used in ip_auth and is unused in ip_state.
The ip_state version was likely added to support a new statistic yet
to be developed in ipfstat(8) or for some sample userspace application
(similar in fashion to the sample provided for authentication rules).
There is no need to report individual state hash table bucket lengths
to any future userspace application.

If needed for any future debugging purposes a DTrace probe would be a
better vehicle.

This unused ioctl in ip_stat results in a panic.

PR: 266124
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 3 days

22 months agoipfilter: Remove IPL_SELECT
Cy Schubert [Fri, 25 Mar 2022 03:15:49 +0000 (20:15 -0700)]
ipfilter: Remove IPL_SELECT

IPL_SELECT was used for HP-UX >= 11.11 only. Remove this de trop code.

MFC after: 3 days

22 months agoCTL: Validate IOCTL parameters.
Alexander Motin [Wed, 7 Sep 2022 01:58:27 +0000 (21:58 -0400)]
CTL: Validate IOCTL parameters.

It was possible to cause kernel panic by passing too large args_len
or non-NULL result_nvl.

Though since the /dev/cam/ctl device is accessible only by root and
used only by limited number of tools it was not a big problem.

PR: 266115
PR: 266136
Reported by: Robert Morris <rtm@lcs.mit.edu>
MFC after: 1 week

22 months agoarm64: machdep.c fix two typos
Warner Losh [Wed, 7 Sep 2022 00:09:14 +0000 (18:09 -0600)]
arm64: machdep.c fix two typos

Sponsored by: Netflix

22 months agoFix for f4fc389.
Kirk McKusick [Tue, 6 Sep 2022 23:22:03 +0000 (16:22 -0700)]
Fix for f4fc389.

Need to check for NULL pointer before using.

Reported by:  Peter Holm
Sponsored by: The FreeBSD Foundation

22 months agoClarify error messages about bad inodes.
Kirk McKusick [Tue, 6 Sep 2022 23:16:24 +0000 (16:16 -0700)]
Clarify error messages about bad inodes.

When something was found wrong with an inode the error message
was always "UNKNOWN FILE TYPE". This error is now used only when
the file type field is wrong. Other errors have their own messages:
"BAD FILE SIZE", "NEGATIVE FILE SIZE", "BAD SPECIAL-FILE RDEV",
"INVALID DIRECT BLOCK", and "INVALID INDIRECT BLOCK".

More complete information about the inode is also provided.

Sponsored by: The FreeBSD Foundation

22 months agoImport the updated Arm Optimized Routines
Andrew Turner [Tue, 6 Sep 2022 16:20:29 +0000 (17:20 +0100)]
Import the updated Arm Optimized Routines

The main changes this brings in are:
 - Improves the performance of memcmp
 - Adds SVE implementation of memcpy
 - Uses the MTE version of some str* functions as they are faster

Sponsored by:   The FreeBSD Foundation

22 months agoloader.efi(8): document slop control, amd64 nocopy, and amd64 fault commands
Konstantin Belousov [Sun, 4 Sep 2022 07:36:35 +0000 (10:36 +0300)]
loader.efi(8): document slop control, amd64 nocopy, and amd64 fault commands

Reviewed by: imp
Discussed with: gbe (man pages)
English wording help by: rpokala
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Differential revision: https://reviews.freebsd.org/D36435

22 months agoDecode the arm64 ID_AA64ISAR1_EL1 register
Andrew Turner [Tue, 28 Jun 2022 13:39:03 +0000 (13:39 +0000)]
Decode the arm64 ID_AA64ISAR1_EL1 register

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

22 months agopf: make pfsync_state_import appease an assert in pf_free_state
Mateusz Guzik [Tue, 6 Sep 2022 14:56:29 +0000 (16:56 +0200)]
pf: make pfsync_state_import appease an assert in pf_free_state

The newly created state failed to be inserted anywhere. This follows
other places.

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

22 months agoifconfig: print interface name on SIOCIFCREATE2 error
Bjoern A. Zeeb [Tue, 6 Sep 2022 13:09:39 +0000 (13:09 +0000)]
ifconfig: print interface name on SIOCIFCREATE2 error

We have repeatedly gotten reports of unclassified SIOCIFCREATE2 errors
(usually "Device not configured").  This can happen if there is
configuration for interfaces in rc.conf which do not (yet) exist and
we try to configure.  I can, e.g., provoke this by configuring wlan
interfaces with their physical interface not installed.
In order to cut support (guesswork) down print the name of the
interface to be configured with the error message.
Hopefully this will help us in the future to improve other configuration
or driver problems.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

22 months agoFix the IV length in the armv8 AES GCM code
Andrew Turner [Wed, 31 Aug 2022 14:55:19 +0000 (15:55 +0100)]
Fix the IV length in the armv8 AES GCM code

Reviewed by: cem, delphij
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36403

22 months agoktls: Add missing NULL pointer check for TLS RX hardware offload.
Hans Petter Selasky [Tue, 6 Sep 2022 10:56:19 +0000 (12:56 +0200)]
ktls: Add missing NULL pointer check for TLS RX hardware offload.

The send tag pointer may be NULL when the ktls_reset_receive_tag()
function is invoked. Add check for this.

Reviewed by: gallatin @
Sponsored by: NVIDIA Networking

22 months agostand: Parse all arguments passed by UEFI
Michael Gmelin [Mon, 5 Sep 2022 15:56:11 +0000 (17:56 +0200)]
stand: Parse all arguments passed by UEFI

Approved by: imp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36457

22 months agopfctl: fix recrusive printing of ethernet anchors
Kristof Provost [Thu, 1 Sep 2022 09:45:19 +0000 (11:45 +0200)]
pfctl: fix recrusive printing of ethernet anchors

Similar to the preceding fix for layer three rules, ensure that we
recursively list wildcard anchors for ethernet rules.

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

22 months agopfctl: fix recrusive printing of anchors
Kristof Provost [Thu, 1 Sep 2022 08:16:24 +0000 (10:16 +0200)]
pfctl: fix recrusive printing of anchors

Fix a couple of problems with printing of anchors, in particular recursive
printing, both of inline anchors and when requested explicitly with a '*'
in the anchor.
- Correct recursive printing of wildcard anchors (recurse into child anchors
rather than rules, which don't exist)
- Print multi-part anchor paths correctly (pr6065)
- Fix comments and prevent users from specifying multi-component names for
inline anchors.

tested by phessler
ok henning

Also fix the relevant pfctl test case to reflect the new (and now
correct) behaviour).

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

22 months agopfctl: fix printing anchors
Kristof Provost [Tue, 30 Aug 2022 14:32:30 +0000 (16:32 +0200)]
pfctl: fix printing anchors

Ensure that we pass the (base) anchorname to the kernel, not the '/*'
suffix.

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

22 months agopf tests: test wildcard anchors
Kristof Provost [Wed, 31 Aug 2022 13:40:33 +0000 (15:40 +0200)]
pf tests: test wildcard anchors

Ensure that a wildcard anchor actually includes any nested anchors (i.e.
foo/* will call into foo/bar).

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D36414

22 months agoopenssl: install pc files
Baptiste Daroussin [Fri, 26 Aug 2022 14:02:09 +0000 (16:02 +0200)]
openssl: install pc files

most programs in ports are looking for .pc files in order to get the
necessary information on how to compile and link against openssl.

The ports now also has a way to hide or force a path for pkgconf.

Providing .pc files along with openssl in base will allow (once all
the supported version of FreeBSD has it) so improve the framework to
deal with openssl in base vs openssl in ports (and libressl)

This will also greatly reduce the number of patches necessary to
workaround the build systems which only knows how to detect where
openssl is installed via pkgconf.

PR: 266051
MFC After: 3 weeks
Reviewed by: jkim, delphij
Exp-run by: antoine
Differential Revision: https://reviews.freebsd.org/D36360

22 months agoinit: fix shutdown race
Corvin Köhne [Tue, 6 Sep 2022 07:06:51 +0000 (09:06 +0200)]
init: fix shutdown race

When calling shutdown, shutdown sends a signal to init and exits. This
causes a race condition for the waitpid function. If the signal wins the
race, wpid will be set to -1 and init calls death_single. If shutdown
wins the race, wpid will be set to the pid of the shutdown process and
the requested_transition will be ignored.

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

22 months agoMFV: less v608
Xin LI [Tue, 6 Sep 2022 05:52:39 +0000 (22:52 -0700)]
MFV: less v608

Relnotes: yes
MFC after: 2 weeks

22 months agoqat: make function definition match prototype
Ed Maste [Tue, 6 Sep 2022 01:24:07 +0000 (21:24 -0400)]
qat: make function definition match prototype

LacSymCb_CallbacksRegister declared with a (void) argument list but was
defined with ().  With Clang 15 this produced a warning.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

22 months agoVendor import of less v608.
Xin LI [Mon, 5 Sep 2022 23:57:47 +0000 (16:57 -0700)]
Vendor import of less v608.

22 months agoLinuxKPI: 80211 / iwlwifi: improve queue management
Bjoern A. Zeeb [Mon, 5 Sep 2022 21:03:03 +0000 (21:03 +0000)]
LinuxKPI: 80211 / iwlwifi: improve queue management

For one initialise vif->hw_queues later set in lkpi_80211_txq_tx_one()
for drivers using them.  This may still need slightly more cleanup once
we get QUEUE_CONTROL-supporting drivers into the tree.

For the other rework and improve how we deal with tid/ac/txq in
lkpi_80211_txq_tx_one() and cleanup old comments and unused code.
This seems to reduce (remove) "Invalid TXQ id" reports from iwlwifi.
(The assumption is that the frame(s) triggering this WARN_ONCE or the
added FreeBSD specific logging were sent with lkpi_80211_mo_tx()).

Adjust the one logging from e674ddec0b4138274539587fe9336b577ff1242a
to IWL_DEBUG_TX so that now this is fixed it is also not always logged
anymore but leave it in case we need to further debug queues in the
future.

Tested by: pstef, Kevin Oberman (rkoberman gmail.com)
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

22 months agoLinuxKPI: 80211: improve linuxkpi_ieee80211_get_tid()
Bjoern A. Zeeb [Mon, 5 Sep 2022 20:57:17 +0000 (20:57 +0000)]
LinuxKPI: 80211: improve linuxkpi_ieee80211_get_tid()

Continue what was started in 26a36948331bd08d9afaddfc0da724eacdb953dd
in iwlwifi and extend out internal implementation of
linuxkpi_ieee80211_get_tid() by an argument as to whether "no-QoS"
answers are acceptable.  For the LinuxKPI ieee80211_get_tid() set
this to false as the Linux derived drivers seem to do extra checks
for the QoS-Data frame before acquiring the tid.
Add KASSERTs to enforce the extra argument.
This allows us to use the net80211 variant in LinuxKPI for other
means explicitly documenting that we do accept a IEEE80211_NONQOS_TID.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

22 months agoFormatting cleanups and debugging fix.
Kirk McKusick [Mon, 5 Sep 2022 19:06:58 +0000 (12:06 -0700)]
Formatting cleanups and debugging fix.

Sponsored by: The FreeBSD Foundation

22 months agopam_unix: Remove bogus __unused attribute
Felix Palmen [Mon, 5 Sep 2022 18:50:29 +0000 (20:50 +0200)]
pam_unix: Remove bogus __unused attribute

Approved by: cy, des, tcberner (mentor)
Differential Revision: https://reviews.freebsd.org/D34320

22 months agoloop(4): make interface methods static
Gleb Smirnoff [Mon, 5 Sep 2022 17:29:10 +0000 (10:29 -0700)]
loop(4): make interface methods static

22 months agotcp: tcp6_connect() requires net epoch
Gleb Smirnoff [Mon, 5 Sep 2022 17:15:19 +0000 (10:15 -0700)]
tcp: tcp6_connect() requires net epoch

PR: 262663
Reported & tested by: dch
MFC after: 2 weeks

22 months agoRevert "usb: Remove a double words in a source code comments"
Gordon Bergling [Sun, 4 Sep 2022 15:40:25 +0000 (17:40 +0200)]
Revert "usb: Remove a double words in a source code comments"

This reverts commit 8ca67bf1273a5168f8a3787183159c477632e582.

The original comment was correct; changing it loses a key part.

Reported by: jrtc27

22 months agoRevert "stand: Grammar fix for a source code comment"
Gordon Bergling [Mon, 5 Sep 2022 13:40:55 +0000 (15:40 +0200)]
Revert "stand: Grammar fix for a source code comment"

This reverts commit 7d91d6b83e74edf278dde375e6049aca833cbebd.

The orginal comment is more natural.

Reported by:jrtc27

22 months agolibexec/rc: Add var_run rc script
Cy Schubert [Sun, 28 Aug 2022 12:48:25 +0000 (05:48 -0700)]
libexec/rc: Add var_run rc script

Users with a tmpfs /var/run will lose the directory tree state of
/var/run at reboot. This rc script will optionally (by default)
capture the state of the directory structure in /var/run prior to
shutdown and recreate it at system boot.

Alternatively a user can save the state of the /var/run directories
manually using service var_run save and disable the autosaving of
/var/run state using the var_run_autosave variable, for those
paranoid SSD users.

PR: 259585, 259699
Reported by: freebsd@walstatt-de.de,
Reviewed by: philip, gbe (previous version)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36386

22 months agopf: stop using PFIL_FWD
Mateusz Guzik [Fri, 2 Sep 2022 16:36:52 +0000 (18:36 +0200)]
pf: stop using PFIL_FWD

It is only there to check if the packet was reassembled,
relevant if we are forwarding. But if the packet originated
locally it could not have been reassembled, thus the flag is
redundant.

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

22 months agonetinet6: call lle_event eventhandler after updating state
Alexander V. Chernikov [Mon, 5 Sep 2022 12:57:20 +0000 (12:57 +0000)]
netinet6: call lle_event eventhandler after updating state

Fix nd6_na_input() eventhandler call: run eventhandler after lle
 state transition.

Old behaviour (as seen by event handler):
 * fe80::5054:ff:fe8c:63e9 dev vtnet0 lladdr 52:54:00:8c:63:e9 INCOMPLETE
New behaviour:
* fe80::5054:ff:fe8c:63e9 dev vtnet0 lladdr 52:54:00:8c:63:e9 REACHABLE

MFC after: 2 weeks

22 months agolibpmc: pmc_init() should avoid overflowing pmc_class_table
Toomas Soome [Wed, 31 Aug 2022 08:09:18 +0000 (11:09 +0300)]
libpmc: pmc_init() should avoid overflowing pmc_class_table

Use calloc().

Walk the class list we get from kernel, so we will not add something
the kernel does not know about.

Avoid picking headers from /usr/include.

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

22 months agosignal: use proc_iterate to save on work
Mateusz Guzik [Thu, 10 Mar 2022 18:58:12 +0000 (19:58 +0100)]
signal: use proc_iterate to save on work

Most notably poudriere performs kill -9 -1 in jails for each port
being built. This reduces the scan from hundrends of processes to
literally 1.

Reviewed by: jamie, markj
Differential Revision: https://reviews.freebsd.org/D34522

22 months agojail: add process linkage
Mateusz Guzik [Thu, 10 Mar 2022 18:42:37 +0000 (19:42 +0100)]
jail: add process linkage

It allows iteration over processes belonging to given jail instead of
having to walk the entire allproc list.

Note the iteration can miss processes which remains bug-compatible
with previous code.

Reviewed by: jamie (previous version), markj (previous version)
Differential Revision: https://reviews.freebsd.org/D34522

22 months agorouting: allow logging framework to be used outside of the subsystem
Alexander V. Chernikov [Mon, 5 Sep 2022 10:44:27 +0000 (10:44 +0000)]
routing: allow logging framework to be used outside of the subsystem

MFC after: 2 weeks

22 months agossh: describe deprecated options in general in update doc
Ed Maste [Fri, 19 Aug 2022 14:43:19 +0000 (10:43 -0400)]
ssh: describe deprecated options in general in update doc

Rename "HPN" to more general "Retired patches."  We handle two now-
removed patches the same way: to avoid breaking existing configurations
we accept, but ignore, the option.

Sponsored by: The FreeBSD Foundation

22 months agonfscl: Allow "nolockd" to work for NFSv4 mounts
Rick Macklem [Sun, 4 Sep 2022 20:09:33 +0000 (13:09 -0700)]
nfscl: Allow "nolockd" to work for NFSv4 mounts

Commit 40ada74ee1da modified the NFSv4.1/4.2 client so
that it would issue a DestroySession to the server when
all session slots are marked bad.  This handles the
case where session slots get broken when "intr" or "soft"
NFSv4 fairly well.1/4.2 mounts are done.

There are two other cases where having an NFSv4.1/4.2
RPC attempt terminate without completion can leave
state in a non-determinate condition.

One is file locking RPCs.  If the "nolockd" option is
used, this avoids file locking RPCs by doing locking
locally within the client.

The other is Open locks, but since all FreeBSD Open
locks are done with OPEN_SHARE_DENY_NONE, the locking
state for these should not be critical.

This patch enables use of "nolockd" for NFSv4 mounts,
so that it can be combined with "intr" and/or "soft",
making the latter more usable.

Use of "intr" or "soft" NFSv4 mounts are still not
recommended, but when combined with "nolockd" should
now work fairly well.

A man page update will be done as a separate commit.

MFC after: 2 weeks

22 months agocd9660(5): Correct a typo in a source code comment
Gordon Bergling [Sun, 4 Sep 2022 16:20:09 +0000 (18:20 +0200)]
cd9660(5): Correct a typo in a source code comment

- s/byes/bytes/

MFC after: 3 days

22 months agobxe(4): Grammar fix for a source code comment
Gordon Bergling [Sun, 4 Sep 2022 15:43:15 +0000 (17:43 +0200)]
bxe(4): Grammar fix for a source code comment

- s/that that/that the/

MFC after: 3 days

22 months agousb: Remove a double words in a source code comments
Gordon Bergling [Sun, 4 Sep 2022 15:40:25 +0000 (17:40 +0200)]
usb: Remove a double words in a source code comments

- s/that that/that/

MFC after: 3 days

22 months agostand/kboot: Add note about why we use MACHINE_ARCH here
Warner Losh [Sun, 4 Sep 2022 15:31:51 +0000 (09:31 -0600)]
stand/kboot: Add note about why we use MACHINE_ARCH here

Normally in the boot loader, we key off of MACHINE since that specifies
the kernel and the loader is very tuned to each type of MACHINE in
general. In this case, however, we're producing a Linux binary, with
Linux system calls encoded in it. These align better along the
MACHINE_ARCH axis of FreeBSD. For PowerPC the system calls are radically
different for each of our MACHINE_ARCHes, with only powerpc64 and
powerpc64le sharing the same numbers and memory layout. The same was
true about mips when it was in the tree. 32-bit arm uses the same
layout, however, for both armv6 and armv7 ports: that can be easily
shared in the unlikely event we support that in the future.

Sponsored by: Netflix

22 months agoipfilter: Grammar fix for the ipfilter howto
Gordon Bergling [Sun, 4 Sep 2022 15:37:28 +0000 (17:37 +0200)]
ipfilter: Grammar fix for the ipfilter howto

- s/that that/that the/

MFC after: 3 days

22 months agomsdosfs(5): Remove a double word in a source code comment
Gordon Bergling [Sun, 4 Sep 2022 15:34:52 +0000 (17:34 +0200)]
msdosfs(5): Remove a double word in a source code comment

- s/that that/that/

MFC after: 3 days

22 months agokern: Remove a double word in a source code comment
Gordon Bergling [Sun, 4 Sep 2022 15:32:10 +0000 (17:32 +0200)]
kern: Remove a double word in a source code comment

- s/that that/that/

MFC after: 3 days

22 months agobpf(3): Grammar fix for a source code comment
Gordon Bergling [Sun, 4 Sep 2022 15:30:05 +0000 (17:30 +0200)]
bpf(3): Grammar fix for a source code comment

- s/that that/that the/

MFC after: 3 days

22 months agopkg(8): Remove a double word in a source code comment
Gordon Bergling [Sun, 4 Sep 2022 15:28:16 +0000 (17:28 +0200)]
pkg(8): Remove a double word in a source code comment

- s/that that/that/

MFC after: 3 days

22 months agostand: Grammar fix for a source code comment
Gordon Bergling [Sun, 4 Sep 2022 15:26:48 +0000 (17:26 +0200)]
stand: Grammar fix for a source code comment

- s/that that/that this/

MFC after: 3 days

22 months agohyperv: Fix a typo in a source code comment
Gordon Bergling [Sun, 4 Sep 2022 15:19:40 +0000 (17:19 +0200)]
hyperv: Fix a typo in a source code comment

- s/Unsupport/Unsupported/

MFC after: 3 days

22 months agomsun: Remove a double word in a source code comment
Gordon Bergling [Sun, 4 Sep 2022 11:57:38 +0000 (13:57 +0200)]
msun: Remove a double word in a source code comment

- s/the the/the/

MFC after: 3 days