freebsd.git
21 months agonet80211: update (parts of) frame types and subtypes and annotate
Bjoern A. Zeeb [Wed, 31 Aug 2022 22:26:28 +0000 (22:26 +0000)]
net80211: update (parts of) frame types and subtypes and annotate

Update to the full list of frame type and subtype values based on
802.11-2020 with 11ax and 11ay extensions. This includes the 4th type
"Extension" (IEEE80211_FC0_TYPE_EXT).
While here annotate them with descriptions which should help matching
names (as at times things get confusing with LinuxKPI).
Also remove some 802.11-1997 values Reserved nowadays.

No functional changes.

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

21 months agoFlush and close getnextino cache when done using it in Pass 1b.
Kirk McKusick [Sat, 3 Sep 2022 21:15:50 +0000 (14:15 -0700)]
Flush and close getnextino cache when done using it in Pass 1b.

Reported by:  Peter Holm
Sponsored by: The FreeBSD Foundation

21 months agoUpdates to UFS/FFS superblock integrity checks when reading a superblock.
Kirk McKusick [Sat, 3 Sep 2022 21:08:25 +0000 (14:08 -0700)]
Updates to UFS/FFS superblock integrity checks when reading a superblock.

Yet more updates based on ways Peter Holm found to corrupt UFS
superblocks in ways that could cause kernel hangs or crashes.

No legitimate superblocks should fail as a result of these changes.

Reported by:  Peter Holm
Tested by:    Peter Holm
Sponsored by: The FreeBSD Foundation

21 months agonet80211 / drivers: rename to IEEE80211_FC0_SUBTYPE_QOS_DATA
Bjoern A. Zeeb [Wed, 31 Aug 2022 22:19:32 +0000 (22:19 +0000)]
net80211 / drivers: rename to IEEE80211_FC0_SUBTYPE_QOS_DATA

Going through the Frame (Sub)types the "QOS Data" being called "QOS"
scheme leads to a naming conflict for QOS_CFPOLL and QOS_CFACKPOLL
(if added).   Rename QOS* to QOS_DATA* to avoid the conflict and
to also better match the standards name.

No functional changes intended.

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

21 months agonet80211: simplify an #ifdef INET/INET6 block
Bjoern A. Zeeb [Wed, 31 Aug 2022 22:35:42 +0000 (22:35 +0000)]
net80211: simplify an #ifdef INET/INET6 block

I got lost in the #ifdef #endif here so I changed the code to a
switch block with two non-overlapping #ifdef parts and a default
which makes it a lot easier to read.

No functional changes.

Sponsored by: The FreeBSD Foundation
Reviewed by: (zlei.huang gmail.com)
MFC after: 5 days
Differential Revision: https://reviews.freebsd.org/D36411

21 months agobsdinstall(8) hostname: Update for bsddialog 0.3
Alfonso S. Siciliano [Sat, 3 Sep 2022 20:12:46 +0000 (22:12 +0200)]
bsdinstall(8) hostname: Update for bsddialog 0.3

 * Delete --hline info. bsddialog(1) 0.3 closes an --inputbox pressing
   only Enter (restoring the previous LGPL-dialog behavior).
 * Add dynamic width auto-sizing.

21 months agomlx5en(4): Correct a typo in a kernel error message
Gordon Bergling [Sat, 3 Sep 2022 17:29:33 +0000 (19:29 +0200)]
mlx5en(4): Correct a typo in a kernel error message

- s/ouput/output

MFC after: 5 days

21 months agonetpfil: Fix a typo in a source code comment
Gordon Bergling [Sat, 3 Sep 2022 17:18:54 +0000 (19:18 +0200)]
netpfil: Fix a typo in a source code comment

- s/intergers/integers/

While here, fix some whitespace issues.

MFC after: 3 days

21 months agortld(1): Fix a typo in a source code comment
Gordon Bergling [Sat, 3 Sep 2022 17:16:32 +0000 (19:16 +0200)]
rtld(1): Fix a typo in a source code comment

- s/interger/integer/

MFC after: 3 days

21 months agolibm: Correct some typos in source code comments
Gordon Bergling [Sat, 3 Sep 2022 17:14:02 +0000 (19:14 +0200)]
libm: Correct some typos in source code comments

- s/modfied/modified/
- s/minimun/minimum/

While here, fix some mandoc warnings:

- whitespace at end of input line
- unusual Xr punctuation
- missing comma before name

Obtained from: NetBSD
MFC after: 5 days

21 months agobsddialog(1): Fix Makefile typo
Alfonso S. Siciliano [Sat, 3 Sep 2022 15:46:26 +0000 (17:46 +0200)]
bsddialog(1): Fix Makefile typo

Fix build fault caused by a typo in the Makefile.

21 months agocontrib/bsddialog: Import version 0.3
Alfonso S. Siciliano [Sat, 3 Sep 2022 14:40:21 +0000 (16:40 +0200)]
contrib/bsddialog: Import version 0.3

New features overview:
 * Unicode. User interface handles multi-column characters. API can
   handle char* like a multibyte character string. Internally wide
   characters are used for keyboard input, to adapt word wrapping and
   dynamic text auto-sizing for multi-column characters.
 * Forms refactoring. Complete rewrite deleting libformw dependency.
 * Theme. New utility options to save and load custom theme at run-time.
 * TUI navigation. Added keys to navigate input components. Changed
   default focus behavior of input dialogs to be LGPL-dialog-like; a new
   option can set the previous whiptail-like behavior.

See /usr/src/contrib/bsddialog/CHANGELOG '2022-08-29 Version 0.3'
for more detailed information.

Merge commit '2c9fd7655ba54e7239f528e1af9fe09662de9b03'

21 months agocontrib/bsddialog: Import version 0.3
Alfonso S. Siciliano [Sat, 3 Sep 2022 14:36:16 +0000 (16:36 +0200)]
contrib/bsddialog: Import version 0.3

New features overview:
 * Unicode. User interface handles multi-column characters. API can
   handle char* like a multibyte character string. Internally wide
   characters are used for keyboard input, to adapt word wrapping and
   dynamic text auto-sizing for multi-column characters.
 * Forms refactoring. Complete rewrite deleting libformw dependency.
 * Theme. New utility options to save and load custom theme at run-time.
 * TUI navigation. Added keys to navigate input components. Changed
   default focus behavior of input dialogs to be LGPL-dialog-like; a new
   option can set the previous whiptail-like behavior.

See /usr/src/contrib/bsddialog/CHANGELOG '2022-08-29 Version 0.3'
for more detailed information.

21 months agoltc430x(4): Fix a typo in a source code comment
Gordon Bergling [Sat, 3 Sep 2022 13:43:05 +0000 (15:43 +0200)]
ltc430x(4): Fix a typo in a source code comment

- s/overriden/overridden/

MFC after: 3 days

21 months agobce(4): Fix a typo in a source code comment
Gordon Bergling [Sat, 3 Sep 2022 13:39:51 +0000 (15:39 +0200)]
bce(4): Fix a typo in a source code comment

- s/overriden/overridden/

MFC after: 3 days

21 months agobge(4): Fix a typo in a source code comment
Gordon Bergling [Sat, 3 Sep 2022 13:38:26 +0000 (15:38 +0200)]
bge(4): Fix a typo in a source code comment

- s/overriden/overridden/

MFC after: 3 days

21 months agobxe(4): Fix two typos in source code comments
Gordon Bergling [Sat, 3 Sep 2022 13:36:00 +0000 (15:36 +0200)]
bxe(4): Fix two typos in source code comments

- s/overriden/overridden/

MFC after: 3 days

21 months agomalo(4): Fix a typo in asource code comment
Gordon Bergling [Sat, 3 Sep 2022 13:34:27 +0000 (15:34 +0200)]
malo(4): Fix a typo in asource code comment

- s/overriden/overridden/

MFC after: 3 days

21 months agosdhci(4): Fix a typo in asource code comment
Gordon Bergling [Sat, 3 Sep 2022 13:31:59 +0000 (15:31 +0200)]
sdhci(4): Fix a typo in asource code comment

- s/overriden/overridden/

MFC after: 3 days

21 months agosound(4): Fix a typo in asource code comment
Gordon Bergling [Sat, 3 Sep 2022 13:30:39 +0000 (15:30 +0200)]
sound(4): Fix a typo in asource code comment

- s/overriden/overridden/

MFC after: 3 days

21 months agopci(4): Fix a typo in asource code comment
Gordon Bergling [Sat, 3 Sep 2022 13:28:05 +0000 (15:28 +0200)]
pci(4): Fix a typo in asource code comment

- s/overriden/overridden/

MFC after: 3 days

21 months agokern: Fix a typo in asource code comment
Gordon Bergling [Sat, 3 Sep 2022 13:26:55 +0000 (15:26 +0200)]
kern: Fix a typo in asource code comment

- s/overriden/overridden/

MFC after: 3 days

21 months agoath(4): Fix two typos in source code comments
Gordon Bergling [Sat, 3 Sep 2022 13:24:48 +0000 (15:24 +0200)]
ath(4): Fix two typos in source code comments

- s/overriden/overridden/

MFC after: 3 days

21 months agousb: Fix two typos in source code comments
Gordon Bergling [Sat, 3 Sep 2022 13:22:42 +0000 (15:22 +0200)]
usb: Fix two typos in source code comments

- s/overriden/overridden/

MFC after: 3 days

21 months agotcp_rack: Fix two typos in source code comments
Gordon Bergling [Sat, 3 Sep 2022 13:05:42 +0000 (15:05 +0200)]
tcp_rack: Fix two typos in source code comments

- s/overriden/overridden/

MFC after: 3 days

21 months agonetisr(9): Fix a typo in a source code comment
Gordon Bergling [Sat, 3 Sep 2022 13:04:15 +0000 (15:04 +0200)]
netisr(9): Fix a typo in a source code comment

- s/overriden/overridden/

MFC after: 3 days

21 months agocron(8): Fix a typo in a source code comment
Gordon Bergling [Sat, 3 Sep 2022 13:00:29 +0000 (15:00 +0200)]
cron(8): Fix a typo in a source code comment

- s/overriden/overridden/

MFC after: 3 days

21 months agotip(1): Fix a typo in a source code comment
Gordon Bergling [Sat, 3 Sep 2022 12:59:03 +0000 (14:59 +0200)]
tip(1): Fix a typo in a source code comment

- s/overriden/overridden/

MFC after: 3 days

21 months agorc.conf: Fix a typo in a comment
Gordon Bergling [Sat, 3 Sep 2022 12:57:39 +0000 (14:57 +0200)]
rc.conf: Fix a typo in a comment

- s/overriden/overridden/

MFC after: 3 days

21 months agoifconfig(8): Fix a typo in source code comment
Gordon Bergling [Sat, 3 Sep 2022 12:55:54 +0000 (14:55 +0200)]
ifconfig(8): Fix a typo in source code comment

- s/overriden/overridden/

MFC after: 3 days

21 months agoisp(4): Fix two typos in source code comments
Gordon Bergling [Sat, 3 Sep 2022 12:54:14 +0000 (14:54 +0200)]
isp(4): Fix two typos in source code comments

- s/overriden/overridden/

MFC after: 3 days

21 months agoimpi(4): Fix two typos in source code comments
Gordon Bergling [Sat, 3 Sep 2022 12:52:44 +0000 (14:52 +0200)]
impi(4): Fix two typos in source code comments

- s/overriden/overridden/

MFC after: 3 days

21 months agolibc/stdio: only roll FILE state back on EINTR
Konstantin Belousov [Fri, 2 Sep 2022 13:39:38 +0000 (16:39 +0300)]
libc/stdio: only roll FILE state back on EINTR

Reported by: JunT <takimoto-j@kba.biglobe.ne.jp>
PR: 266171
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D36427

21 months ago__swbuf(): style
Konstantin Belousov [Fri, 2 Sep 2022 14:00:56 +0000 (17:00 +0300)]
__swbuf(): style

Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D36427

21 months agoqat: Move CWARNFLAGS down so it works.
John Baldwin [Fri, 2 Sep 2022 21:52:19 +0000 (14:52 -0700)]
qat: Move CWARNFLAGS down so it works.

CWARNFLAGS must be added to after including kern.mk, otherwise all the
warnings set in kern.mk are ignored.  This is why the
-Wmissing-prototypes warnings were not seen previously.

While here, drop -Wno-pointer-sign as it is doesn't seem to be needed,
but add -Wno-cast-qual to silence warnings for various casts of const
pointers to non-const pointers.

Reviewed by: MichalX.Gulbicki_intel.com, markj
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D36332

21 months agoqat: Add #includes for missing prototypes.
John Baldwin [Fri, 2 Sep 2022 21:51:54 +0000 (14:51 -0700)]
qat: Add #includes for missing prototypes.

This fixes numerous -Wmissing-prototypes warnings when that warning
is enabled.

Reviewed by: MichalX.Gulbicki_intel.com, markj
Sponsored by: DARPA
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D36331

21 months agoqat: Add a prototype for icp_adf_is_dev_in_error.
John Baldwin [Fri, 2 Sep 2022 21:50:09 +0000 (14:50 -0700)]
qat: Add a prototype for icp_adf_is_dev_in_error.

Reviewed by: MichalX.Gulbicki_intel.com, markj
Sponsored by: DARPA
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D36330

21 months agoqat: Drop extraneous parentheses from some macro values.
John Baldwin [Fri, 2 Sep 2022 21:49:40 +0000 (14:49 -0700)]
qat: Drop extraneous parentheses from some macro values.

This header duplicates a few #defines in "adf_cfg_strings.h".  The
latter header does not use the unneeded parentheses, but if a C file
includes both of these headers, clang raises an error because the macro
is redefined with a different value.

Reviewed by: markj
Sponsored by: DARPA
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D36329

21 months agorelease: Set loader_menu_multi_user_prompt to "Installer" for installer
Jessica Clarke [Fri, 2 Sep 2022 19:30:50 +0000 (20:30 +0100)]
release: Set loader_menu_multi_user_prompt to "Installer" for installer

This makes it more obvious that the media being booted is an installer
rather than an installed system, which is otherwise hard to distinguish.
It also provides a more user-friendly, and more accurate, prompt.

Reviewed by: gjb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36419

21 months agolualoader: Add loader_menu_multi_user_prompt config variable
Jessica Clarke [Fri, 2 Sep 2022 19:30:40 +0000 (20:30 +0100)]
lualoader: Add loader_menu_multi_user_prompt config variable

This allows the "Multi user" in "[B]oot Multi user" to be substituted
with another string, for example with "Installer" in installer media.
Note that this is lua-only at the moment, since loader.4th's menu.rc
defines the alternate name as Boot [M]ulti User, unlike lualoader which
leaves it as [B]oot Multi user. Ideally loader.4th would adopt the newer
and simpler lualoader behaviour and then it could gain support for this
option, but loader.4th is on the way out and isn't used by any official
installer media so this is not a significant concern.

Reviewed by: kevans, rpokala
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36418

21 months agoraw ip: fix regression with multicast and RSVP
Gleb Smirnoff [Fri, 2 Sep 2022 19:17:09 +0000 (12:17 -0700)]
raw ip: fix regression with multicast and RSVP

With 61f7427f02a raw sockets protosw has wildcard pr_protocol.  Protocol
of a specific pcb is stored in inp_ip_p.

Reviewed by: karels
Reported by: karels
Differential revision: https://reviews.freebsd.org/D36429
Fixes: 61f7427f02a307d28af674a12c45dd546e3898e4

21 months agoi386 doreti: Fix calculation of stack frame size
Tijl Coosemans [Fri, 2 Sep 2022 14:16:35 +0000 (16:16 +0200)]
i386 doreti: Fix calculation of stack frame size

Reviewed by: kib
Fixes: e8b2980e4a12 - i386 doreti: stop saving/restoring %ecx

21 months agostand: Parse BIOS revision from SMBIOS
Kornel Dulęba [Fri, 2 Sep 2022 11:08:32 +0000 (13:08 +0200)]
stand: Parse BIOS revision from SMBIOS

Add a smbios.bios.revision kenv, which contains the system BIOS revision
as defined in SMBIOS specification, section 3.3.1.
Since the revision is stored in two separate byte fields,
the smbios_setenv helper can't be used.
Read and construct the kenv manually instead.

Approved by: mw(mentor)
Sponsored by: Stormshield
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D36413

21 months agotpm: Fix entropy harvesting logic
Kornel Dulęba [Fri, 2 Sep 2022 11:07:03 +0000 (13:07 +0200)]
tpm: Fix entropy harvesting logic

Use a taskqueue instead of a callout.
Callout functions mustn't sleep, where as the TPM driver
uses a sx lock in order to serialize accesses to the device.
Since the entropy harvesting feature is not enabled by default,
this commit should not bring any functional changes to the GENERIC
kernel.

Approved by: mw(mentor)
Sponsored by: Stormshield
Obtained from: Semihalf
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D36412

21 months agods1307: add support for the EPSON RX-8035SA I2C RTC
Mathew McBride [Sat, 23 Jul 2022 00:29:16 +0000 (00:29 +0000)]
ds1307: add support for the EPSON RX-8035SA I2C RTC

The EPSON RX-8035SA I2C RTC has a similar time register layout to the
ds1307 family, with some minor differences in bit positions, polarity
and control registers.  Further generalize ds1307 to make it easier
to add more compatible chips and add support for the EPSON RX-8035SA.

MFC after: 6 days
Sponsored by: Traverse Technologies
Differential Revision: https://reviews.freebsd.org/D35837

21 months agolocal_unbound: rc: allow to overwrite pid file path
Bjoern A. Zeeb [Thu, 11 Aug 2022 14:32:06 +0000 (14:32 +0000)]
local_unbound: rc: allow to overwrite pid file path

Certain configurations need to use a different path for pidfile.
Allow rc.conf to overwrite it.

Reviewed by: cy, 0mp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D36141

21 months agoacpi: Fix error message
Warner Losh [Thu, 1 Sep 2022 17:34:36 +0000 (11:34 -0600)]
acpi: Fix error message

Fix a formatting error from 195f794318a33

Fixes: 195f794318a33
Sponsored by: Netflix

21 months agohwpmc: Avoid touching MSR_DEBUGCTLMSR inside VMs.
Alexander Motin [Thu, 1 Sep 2022 17:18:04 +0000 (13:18 -0400)]
hwpmc: Avoid touching MSR_DEBUGCTLMSR inside VMs.

At least KVM in Proxmox seems not happy about it.  Just to be safe
block it for all VMs, since it should just improve profile accuracy.

MFC after: 1 week

21 months agokboot: List sources one per line to make merges easier
Warner Losh [Thu, 1 Sep 2022 17:07:34 +0000 (11:07 -0600)]
kboot: List sources one per line to make merges easier

Make SRC an alphabetical list of files, one per line.

Sponsored by: Netflix

21 months agokboot: add minmalist init functionality
Warner Losh [Thu, 1 Sep 2022 17:06:43 +0000 (11:06 -0600)]
kboot: add minmalist init functionality

It is desirable to run kboot as the first program in some LinuxBoot
environments. This is the traditional "pid 1" or "init" program. When
running as pid 1. rovide a minimal environment based on what sysvinit,
u-root, initramfs-tools and other like projects do. We mount /dev, /sys,
/proc, make symlinks from /dev/fd to /dev/proc, and create /tmp, /run,
and /var. We also setup stdin/out/err to the console, set the tty
characteristics of same and block the appropriate signals.

This is indended as an environment that never does a fork/exec. If
that's required, the process groups, session leaders and all things
POSIX terminal handlers will need to be added.

Unlike the general purpose linux projects in this area, no attempt is
made to support very old kernels.

When not pid 1, we skip all of the above.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36368

21 months agostand: Add lua binding loader.has_command
Warner Losh [Thu, 1 Sep 2022 17:06:19 +0000 (11:06 -0600)]
stand: Add lua binding loader.has_command

Give scripts the ability to determine if the currently running loader
has provided a command.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36365

21 months agostand: Add interp_has_builtin_cmd to see if we have a command
Warner Losh [Thu, 1 Sep 2022 17:06:01 +0000 (11:06 -0600)]
stand: Add interp_has_builtin_cmd to see if we have a command

interp_has_builtin_cmd() will try to lookup the passed in command and
returns true if it was found, false otherwise.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36364

21 months agostand: separate the command lookup from the command execution
Warner Losh [Thu, 1 Sep 2022 17:05:42 +0000 (11:05 -0600)]
stand: separate the command lookup from the command execution

Factor out interp_lookup_cmd to search for a command from
interp_builtin_cmd. This simplifies the latter and can be used to expand
lua to ask if a command exists.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D36363

21 months agoacpi: Move some errors with RSDP and XSLT out from under bootverbose
Warner Losh [Thu, 1 Sep 2022 16:39:34 +0000 (10:39 -0600)]
acpi: Move some errors with RSDP and XSLT out from under bootverbose

Failure to map RSDP, XSLT and checksum failures are events that can't
happen unless something has gone wrong. As such, they should be reported
always, and not in bootverbose. This has been this way since it was
originally brought in to parse APIC tables.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D36406

21 months agoacpi: Unmap RSDP in more error cases
Warner Losh [Thu, 1 Sep 2022 16:39:20 +0000 (10:39 -0600)]
acpi: Unmap RSDP in more error cases

Add missing pmap_unmapbios() calls for when we return 0. Otherwise we
can leave the table mapped when it is of no use.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D36405

21 months agoacpi: arm64 doesn't support ACPI 1.0 RSDP, report when we see one
Warner Losh [Thu, 1 Sep 2022 16:38:53 +0000 (10:38 -0600)]
acpi: arm64 doesn't support ACPI 1.0 RSDP, report when we see one

arm64 requires ACPI RSDP Revision 2.0 since it requires 64-bit physical
addresses. It is an error worth reporting if we have a RSDP pointer, but
it points to the wrong version.

Sponsored by: Netflix
Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D36404

21 months agostand: Document EFI consoles
Warner Losh [Thu, 1 Sep 2022 16:34:30 +0000 (10:34 -0600)]
stand: Document EFI consoles

Document how EFI consoles work, at least on x86. There's a number of
weird quirks and limitations that are generally known, but not
documented until now. Include information on how EFI decides what the
defualt console is, how to set it and how to cope with common
situations. Note limitations and mismatch between ACPI (which uses UID
to identify a device) and our console code (which uses a raw address)
and explain why we can't translate between them in the loader.

Sponsored by: Netflix
Reviewed by: manu, kevans, rpokala, pauamma
Differential Revision: https://reviews.freebsd.org/D36286

21 months agostand: Stop setting hints for bios loader too
Warner Losh [Thu, 1 Sep 2022 16:33:09 +0000 (10:33 -0600)]
stand: Stop setting hints for bios loader too

Catch up to 2753bbe71b5a and remove the old hints.

Sponsored by: Netflix

21 months agolinuxkpi: on i386 only use first_msi_irq if apic is in kernel config
Tijl Coosemans [Sat, 1 May 2021 16:01:22 +0000 (18:01 +0200)]
linuxkpi: on i386 only use first_msi_irq if apic is in kernel config

21 months agoi386 machine/cpu.h: include sys/systm.h for cpu_ticks()
Tijl Coosemans [Wed, 31 Aug 2022 18:56:49 +0000 (20:56 +0200)]
i386 machine/cpu.h: include sys/systm.h for cpu_ticks()

Fixes build of graphics/drm-510-kmod on i386.

21 months agoFix reading the correct ID and REV.
Søren Schmidt [Thu, 1 Sep 2022 07:36:37 +0000 (07:36 +0000)]
Fix reading the correct ID and REV.

Reviewed by: manu

21 months agoAdd support for TCS4525 pmic.
Ganbold Tsagaankhuu [Thu, 1 Sep 2022 07:31:08 +0000 (07:31 +0000)]
Add support for TCS4525 pmic.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D36209

21 months agoFix problem getting gpio version during attach.
Ganbold Tsagaankhuu [Thu, 1 Sep 2022 07:21:56 +0000 (07:21 +0000)]
Fix problem getting gpio version during attach.
Both RK3328 and RK3399 don't have GPIO_VER_ID register.
Set gpio version depending on compat string of the parent.

21 months agomount_nfs.8: Reword sentence so .Pa macro works
Rick Macklem [Wed, 31 Aug 2022 23:19:22 +0000 (16:19 -0700)]
mount_nfs.8: Reword sentence so .Pa macro works

Commit 603677334a64 added a sentence with a file path
in it. However, it did not use .Pa since it would leave
a space after it, where ('s) was supposed to go.

This patch rewords the sentence so that .Pa can
be used.

This is a content change.

Suggested by: mkarels

21 months agoiwlwifi: move an ieee80211_get_tid() call
Bjoern A. Zeeb [Wed, 31 Aug 2022 23:01:36 +0000 (23:01 +0000)]
iwlwifi: move an ieee80211_get_tid() call

Introduce a local change.  It seems ieee80211_get_tid() does not deal
with non-dataqos packets unlike net80211's ieee80211_gettid().
Gernally all calls in Linux drivers to ieee80211_get_tid() seem to
be proceeded by an ieee80211_is_data_qos() check.

Moving the ieee80211_get_tid() has no difference in the result, but
(a) saves us the call if we do not need it due to an earlier return,
and (b) allows us to put an assert into the LinuxKPI ieee80211_get_tid()
implementation to avoid accidentally returning random frame header data
in case of a missing earlier ieee80211_is_data_qos() check in (future/
other) drivers.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

21 months agotcp: Functional implementation of Accurate ECN
Richard Scheffenegger [Wed, 31 Aug 2022 13:01:25 +0000 (15:01 +0200)]
tcp: Functional implementation of Accurate ECN

The AccECN handshake and TCP header flags are supported,
no support yet for the AccECN option. This minimalistic
implementation is sufficient to support DCTCP while
dramatically cutting the number of ACKs, and provide ECN
response from the receiver to the CC modules.

Reviewed By: #transport, #manpages, rrs, pauamma
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D21011

21 months agotcp: finish SACK loss recovery on sudden lack of SACK blocks
Richard Scheffenegger [Wed, 31 Aug 2022 12:49:25 +0000 (14:49 +0200)]
tcp: finish SACK loss recovery on sudden lack of SACK blocks

While a receiver should continue sending SACK blocks for the
duration of a SACK loss recovery, if for some reason the
TCP options no longer contain these SACK blocks, but we
already started maintaining the Scoreboard, keep on handling
incoming ACKs (without SACK) as belonging to the SACK recovery.

Reported by: thj
Reviewed by: tuexen, #transport
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D36046

21 months agoStore mpidr as a 64-bit value on arm64
Andrew Turner [Thu, 25 Aug 2022 08:28:28 +0000 (08:28 +0000)]
Store mpidr as a 64-bit value on arm64

The mpidr register is 64 bit on arm64 and 32 bit on arm. Fix this by
extending the arm64 definition to include the top 32 bits.

To preserve KBI when MFCing split the value into two 32 bit values.
This will be cleaned up later only on main.

Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36346

21 months agoOptionalObsoleteFiles.inc: Add missing sendmail feature macro files.
Peter Wemm [Wed, 31 Aug 2022 08:54:04 +0000 (01:54 -0700)]
OptionalObsoleteFiles.inc: Add missing sendmail feature macro files.

MFC after: 3 days

21 months agoarm64: Fix hwpmc module for OPT_ACPI isn't selected
Emmanuel Vadot [Mon, 29 Aug 2022 09:50:52 +0000 (11:50 +0200)]
arm64: Fix hwpmc module for OPT_ACPI isn't selected

Fixes: 59191f3573f6 ("Add support of ARM CMN-600 controller ...")
Sponsored by: Beckhoff Automation GmbH & Co. KG

21 months agoprotosw: repair protocol selection logic in socket(2)
Gleb Smirnoff [Wed, 31 Aug 2022 04:19:46 +0000 (21:19 -0700)]
protosw: repair protocol selection logic in socket(2)

Pointy hat to: glebius
Fixes: 61f7427f02a307d28af674a12c45dd546e3898e4

21 months agoprocstat: fix printing divert(4) sockets
Gleb Smirnoff [Tue, 30 Aug 2022 23:26:21 +0000 (16:26 -0700)]
procstat: fix printing divert(4) sockets

21 months agotests: use PF_DIVERT/SOCK_RAW instead of PF_INET/SOCK_RAW/IPPROTO_DIVERT
Gleb Smirnoff [Tue, 30 Aug 2022 23:23:36 +0000 (16:23 -0700)]
tests: use PF_DIVERT/SOCK_RAW instead of PF_INET/SOCK_RAW/IPPROTO_DIVERT

21 months agoipfwpcap: use PF_DIVERT/SOCK_RAW instead of PF_INET/SOCK_RAW/IPPROTO_DIVERT
Gleb Smirnoff [Tue, 30 Aug 2022 23:22:50 +0000 (16:22 -0700)]
ipfwpcap: use PF_DIVERT/SOCK_RAW instead of PF_INET/SOCK_RAW/IPPROTO_DIVERT

21 months agonatd: use PF_DIVERT/SOCK_RAW instead of PF_INET/SOCK_RAW/IPPROTO_DIVERT
Gleb Smirnoff [Tue, 30 Aug 2022 23:21:19 +0000 (16:21 -0700)]
natd: use PF_DIVERT/SOCK_RAW instead of PF_INET/SOCK_RAW/IPPROTO_DIVERT

21 months agosqlite3: Vendor import of sqlite3 3.39.2
Cy Schubert [Tue, 30 Aug 2022 22:54:32 +0000 (15:54 -0700)]
sqlite3: Vendor import of sqlite3 3.39.2

Changes at https://www.sqlite.org/releaselog/3_39_2.html.

Security:       CVE-2022-35737
Obtained from:  https://www.sqlite.org/2022/sqlite-autoconf-3390200.tar.gz
MFC after:      immediately

Merge commit '1545dd7d6cc54bdfca9bc9f74c42745b514b60c9' into sqlite3/main3

21 months agosqlite3: Vendor import of sqlite3 3.39.2
Cy Schubert [Tue, 30 Aug 2022 22:29:34 +0000 (15:29 -0700)]
sqlite3: Vendor import of sqlite3 3.39.2

Changes at https://www.sqlite.org/releaselog/3_39_2.html.

Obtained from: https://www.sqlite.org/2022/sqlite-autoconf-3390200.tar.gz

21 months agodivert(4): make it compilable and working without INET
Gleb Smirnoff [Tue, 30 Aug 2022 22:09:21 +0000 (15:09 -0700)]
divert(4): make it compilable and working without INET

Differential revision: https://reviews.freebsd.org/D36383

21 months agodivert(4): maintain own cb database and stop using inpcb KPI
Gleb Smirnoff [Tue, 30 Aug 2022 22:09:21 +0000 (15:09 -0700)]
divert(4): maintain own cb database and stop using inpcb KPI

Here go cons of using inpcb for divert:
- divert(4) uses only 16 bits (local port) out of struct inpcb,
  which is 424 bytes today.
- The inpcb KPI isn't able to provide hashing for divert(4),
  thus it uses global inpcb list for lookups.
- divert(4) uses INET-specific part of the KPI, making INET
  a requirement for IPDIVERT.

Maintain our own very simple hash lookup database instead.  It
has mutex protection for write and epoch protection for lookups.
Since now so->so_pcb no longer points to struct inpcb, don't
initialize protosw methods to methods that belong to PF_INET.
Also, drop support for setting options on a divert socket.  My
review of software in base and ports confirms that this has no
use and unlikely worked before.

Differential revision: https://reviews.freebsd.org/D36382

21 months agodivert(4): provide statistics
Gleb Smirnoff [Tue, 30 Aug 2022 22:09:21 +0000 (15:09 -0700)]
divert(4): provide statistics

Instead of incrementing pretty random counters in the IP statistics,
create divert socket statistics structure.  Export via netstat(1).

Differential revision: https://reviews.freebsd.org/D36381

21 months agoprotosw: cleanup protocols that existed merely to provide pr_input
Gleb Smirnoff [Tue, 30 Aug 2022 22:09:21 +0000 (15:09 -0700)]
protosw: cleanup protocols that existed merely to provide pr_input

Since 4.4BSD the protosw was used to implement socket types created
by socket(2) syscall and at the same to demultiplex incoming IPv4
datagrams (later copied to IPv6).  This story ended with 78b1fc05b20.

These entries (e.g. IPPROTO_ICMP) in inetsw that were added to catch
packets in ip_input(), they would also be returned by pffindproto()
if user says socket(AF_INET, SOCK_RAW, IPPROTO_ICMP).  Thus, for raw
sockets to work correctly, all the entries were pointing at raw_usrreq
differentiating only in the value of pr_protocol.

With 78b1fc05b20 all these entries are no longer needed, as ip_protox
is independent of protosw.  Any socket syscall requesting SOCK_RAW type
would end up with rip_protosw.  And this protosw has its pr_protocol
set to 0, allowing to mark socket with any protocol.

For IPv6 raw socket the change required two small fixes:
o Validate user provided protocol value
o Always use protocol number stored in inp in rip6_attach, instead
  of protosw value, which is now always 0.

Differential revision: https://reviews.freebsd.org/D36380

21 months agodivert: declare PF_DIVERT domain and stop abusing PF_INET
Gleb Smirnoff [Tue, 30 Aug 2022 22:09:21 +0000 (15:09 -0700)]
divert: declare PF_DIVERT domain and stop abusing PF_INET

The divert(4) is not a protocol of IPv4.  It is a socket to
intercept packets from ipfw(4) to userland and re-inject them
back.  It can divert and re-inject IPv4 and IPv6 packets today,
but potentially it is not limited to these two protocols.  The
IPPROTO_DIVERT does not belong to known IP protocols, it
doesn't even fit into u_char.  I guess, the implementation of
divert(4) was done the way it is done basically because it was
easier to do it this way, back when protocols for sockets were
intertwined with IP protocols and domains were statically
compiled in.

Moving divert(4) out of inetsw accomplished two important things:

1) IPDIVERT is getting much closer to be not dependent on INET.
   This will be finalized in following changes.
2) Now divert socket no longer aliases with raw IPv4 socket.
   Domain/proto selection code won't need a hack for SOCK_RAW and
   multiple entries in inetsw implementing different flavors of
   raw socket can merge into one without requirement of raw IPv4
   being the last member of dom_protosw.

Differential revision: https://reviews.freebsd.org/D36379

21 months agomount_nfs.8: Note that NFSv4 requires unique /etc/hostid's
Rick Macklem [Tue, 30 Aug 2022 14:55:32 +0000 (07:55 -0700)]
mount_nfs.8: Note that NFSv4 requires unique /etc/hostid's

Recent problems related to NFSv4 mounts has been traced
to multiple NFSv4 clients using the same /etc/hostid
(or kern.hostuuid, if you prefer).

This patch adds a sentence to the man page noting that
clients must have unique /etc/hostid's.

This is a content change.

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

21 months agocp: Fix build without VM_AND_BUFFER_CACHE_SYNCHRONIZED.
Alexander Motin [Tue, 30 Aug 2022 14:51:21 +0000 (10:51 -0400)]
cp: Fix build without VM_AND_BUFFER_CACHE_SYNCHRONIZED.

It allows to not use mmap() for small files, which is not helpful
in case of ZFS.  Should be no functional change.

MFC after: 1 week

21 months agoucom(4): Make sure the open routine is executed synchronously.
Dave Baukus [Tue, 30 Aug 2022 14:19:40 +0000 (16:19 +0200)]
ucom(4): Make sure the open routine is executed synchronously.

To avoid issues starting any USB transfers before the open
function is complete.

Differential Revision: https://reviews.freebsd.org/D36391
MFC after: 1 week
Sponsored by: NVIDIA Networking

21 months agoumodem(4): Clear stall at every open.
Hans Petter Selasky [Tue, 30 Aug 2022 14:01:43 +0000 (16:01 +0200)]
umodem(4): Clear stall at every open.

Some controllers like the XHCI(4) loose track of the data toggle value when
USB receive transfers are cancelled at close. This in turn can lead to to
data loss after the next open.

To avoid data loss, make sure both the receive and transmit data toggles
get reset, before trying to read or write any data.

Differential Revision: https://reviews.freebsd.org/D36391
Submitted by: Dave Baukus <daveb@spectralogic.com>
MFC after: 1 week
Sponsored by: NVIDIA Networking

21 months agotcp: remove a dead code leftover from T/TCP,
Gleb Smirnoff [Tue, 30 Aug 2022 02:30:12 +0000 (19:30 -0700)]
tcp: remove a dead code leftover from T/TCP,

that doesn't have any value today.

21 months agodivert: merge div_output() into div_send()
Gleb Smirnoff [Tue, 30 Aug 2022 02:15:01 +0000 (19:15 -0700)]
divert: merge div_output() into div_send()

No functional change intended.

21 months agodomains: merge domain_init() into domain_add()
Gleb Smirnoff [Tue, 30 Aug 2022 02:15:01 +0000 (19:15 -0700)]
domains: merge domain_init() into domain_add()

domain_init() called at SI_SUB_PROTO_DOMAIN/SI_ORDER_SECOND is always
called right after domain_add(), that had been called at SI_ORDER_FIRST.
Note that protocols aren't initialized yet at this point, since they are
usually scheduled to initialize at SI_ORDER_THIRD.

After this merge it becomes clear that DOMF_SUPPORTED / DOMF_INITED
can be garbage collected as they are set & checked in the same function.

For initialization of the domain system itself it is now clear that
domaininit() can be garbage collected and static initializer is enough.

21 months agodomains: use queue(9) SLIST for linked list of domains
Gleb Smirnoff [Tue, 30 Aug 2022 02:15:01 +0000 (19:15 -0700)]
domains: use queue(9) SLIST for linked list of domains

21 months agodomains: init pr_domain in pr_init()
Gleb Smirnoff [Tue, 30 Aug 2022 02:15:01 +0000 (19:15 -0700)]
domains: init pr_domain in pr_init()

21 months agombufs: isolate max_linkhdr and max_protohdr handling in the mbuf code
Gleb Smirnoff [Tue, 30 Aug 2022 02:14:25 +0000 (19:14 -0700)]
mbufs: isolate max_linkhdr and max_protohdr handling in the mbuf code

o Statically initialize max_linkhdr to default value without relying
  on domain(9) code doing that.
o Statically initialize max_protohdr to a sane value, without relying
  on TCP being always compiled in.
o Retire max_datalen. Set, but not used.
o Don't make the domain(9) system responsible in validating these
  values and updating max_hdr.  Instead provide KPI max_linkhdr_grow()
  and max_protohdr_grow().
o Call max_linkhdr_grow() from IEEE802.11 and max_protohdr_grow() from
  TCP.  Those are the only protocols today that may want to grow.

Reviewed by: tuexen
Differential revision: https://reviews.freebsd.org/D36376

21 months agobhyve virtio-scsi: Avoid out of bounds accesses to guest requests.
John Baldwin [Mon, 29 Aug 2022 22:36:11 +0000 (15:36 -0700)]
bhyve virtio-scsi: Avoid out of bounds accesses to guest requests.

- Ignore I/O requests with insufficiently sized input or output
  buffers (those not containing compete request headers).

- Ignore control requests with improperly sized buffers.

- While here, explicitly zero the output header of an I/O request to
  avoid leaking malloc garbage from the host if the header is not
  fully populated.

PR: 264521
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: mav, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36271

21 months agobhyve virtio-scsi: Tidy warning and debug prints.
John Baldwin [Mon, 29 Aug 2022 22:35:42 +0000 (15:35 -0700)]
bhyve virtio-scsi: Tidy warning and debug prints.

Use a consistent prefix ("virtio-scsi: ") similar to the e1000 device
model.

Reviewed by: mav, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36270

21 months agobhyve e1000: Sanitize transmit ring indices.
John Baldwin [Mon, 29 Aug 2022 22:35:15 +0000 (15:35 -0700)]
bhyve e1000: Sanitize transmit ring indices.

When preparing to transmit pending packets, ensure that the head (TDH)
and tail (TDT) indices are in bounds.  Note that validating values
when they are written is not sufficient along as the transmit length
(TDLEN) could be changed turning a value that was valid when written
into an out of bounds value.

While here, add further restrictions to the head register (TDH).  The
manual states that writing to this value while transmit is enabled can
cause unexpected behavior and that it should only be written after a
reset.  As such, ignore attempts to write while transmit is active,
and also ignore writes of non-zero values.  Later e1000 chipsets have
this register as read-only.

Also ignore any attempts to transmit packets if the transmit ring's
size is zero.

PR: 264567
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36269

21 months agorouting: constantify @rc in rib_decompose_notification().
Alexander V. Chernikov [Mon, 29 Aug 2022 18:10:21 +0000 (18:10 +0000)]
routing: constantify @rc in rib_decompose_notification().

Clarify the @rc immutability by explicitly marking @rc const.

MFC after: 2 weeks

21 months agodevstat: Remove DTrace io probes lacking a BIO reference
Mark Johnston [Mon, 29 Aug 2022 17:22:36 +0000 (13:22 -0400)]
devstat: Remove DTrace io probes lacking a BIO reference

The io:::start and end probes trace individual I/O requests.

Also remove the unimplemented wait-start and wait-done probes.

PR: 266098
MFC after: 1 week

21 months agomakefs tests: Do not run ZFS tests in parallel
Mark Johnston [Mon, 29 Aug 2022 16:39:33 +0000 (12:39 -0400)]
makefs tests: Do not run ZFS tests in parallel

makefs-created pools always have the same GUID and thus cannot be
imported simultaneously.

Reported by: olivier

21 months agomakefs tests: Do not install ZFS tests if WITHOUT_ZFS is defined
Mark Johnston [Mon, 29 Aug 2022 16:35:37 +0000 (12:35 -0400)]
makefs tests: Do not install ZFS tests if WITHOUT_ZFS is defined

21 months agomakefs: Remove some redundant initializations
Mark Johnston [Mon, 29 Aug 2022 16:33:55 +0000 (12:33 -0400)]
makefs: Remove some redundant initializations

No functional change intended.