]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agollvm: Revert "[HardwareLoops] Change order of SCEV expression construction for InitLo...
Alfredo Dal'Ava Junior [Thu, 2 Sep 2021 17:54:31 +0000 (14:54 -0300)]
llvm: Revert "[HardwareLoops] Change order of SCEV expression construction for InitLoopCount."

Reverts llvm commit 42eaf4fe0adef3344adfd9fbccd49f325cb549ef, pointed
from bisect as source of regression that causes liblzma to compress/
uncompress incorrectly. It's know to affect powerpc64 BE only.

The patch unbreaks FreeBSD powerpc64 installation media, since
bsdinstall can't uncompress the *.txz produced by FreeBSD CI. It's
probably miscompiling other software bas well.

Upstream PR: https://bugs.llvm.org/show_bug.cgi?id=51714

Reviewed by: dim
MFC after: 2 days
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D31804

2 years agowpa: Enable RSN Preauthentication
Cy Schubert [Fri, 3 Sep 2021 13:14:59 +0000 (06:14 -0700)]
wpa: Enable RSN Preauthentication

RSN Preauthentication allows a station autnetnicate to an AP that
it is not associated with yet while associated with a different AP.
This allows athentication to multiple APs simulteneously.

Tested by: philip
MFC after: 2 months

2 years agowpa: Enable MBO
Cy Schubert [Fri, 3 Sep 2021 13:14:01 +0000 (06:14 -0700)]
wpa: Enable MBO

Enable WiFi 6 MBO (Multi Band Operation). MBO is a prereq to 802.11ax.

MBO allows the efficient use of multiple frequency bands (channels).

To facilitate MBO, WNM (Wireless Network Monitoring) is a prerequisite.
It is required to build.

Tested by: philip
MFC after: 2 months

2 years agowpa: Import wpa_supplicant/hostapd commits up to b4f7506ff
Cy Schubert [Fri, 3 Sep 2021 13:07:19 +0000 (06:07 -0700)]
wpa: Import wpa_supplicant/hostapd commits up to b4f7506ff

Merge vendor commits 40c7ff83e74eabba5a7e2caefeea12372b2d3f9a,
efec8223892b3e677acb46eae84ec3534989971f, and
2f6c3ea9600b494d24cac5a38c1cea0ac192245e.

Tested by: philip
MFC after: 2 months

2 years agopf: ensure states passed to pf_free_state() are always unlinked
Kristof Provost [Fri, 3 Sep 2021 07:36:19 +0000 (09:36 +0200)]
pf: ensure states passed to pf_free_state() are always unlinked

In pf_create_state() we can end up deleting the state immediately. This
can happen if we fail to map the relevant addresses or fail
normalization or fail to insert it into the state table.
If that happens we delete the state again with pf_free_state(). However,
this asserts that the state must be unlinked.

It's correct to simply set the state to PFTM_UNLINKED because we've not
yet linked it.

Submitted by: Mateusz Guzik <mjg@FreeBSD.org>
Reviewed by: scottl
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D31752

2 years agotcp: document TCP Fast Open (RFC 7413) in tcp(4)
Philip Paeps [Fri, 3 Sep 2021 02:33:12 +0000 (10:33 +0800)]
tcp: document TCP Fast Open (RFC 7413) in tcp(4)

Adds documentation for the TCP_FASTOPEN socket option
and related MIB variables to the tcp(4) manual page.

PR: 257907
Reviewed by: gbe
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D31764

2 years agoMissed line from 7af4475a6e31.
Alexander Motin [Fri, 3 Sep 2021 02:25:16 +0000 (22:25 -0400)]
Missed line from 7af4475a6e31.

MFC after: 2 weeks

2 years agocallout(9): Allow spin locks use with callout_init_mtx().
Alexander Motin [Fri, 3 Sep 2021 01:16:46 +0000 (21:16 -0400)]
callout(9): Allow spin locks use with callout_init_mtx().

Implement lock_spin()/unlock_spin() lock class methods, moving the
assertion to _sleep() instead.  Change assertions in callout(9) to
allow spin locks for both regular and C_DIRECT_EXEC cases. In case of
C_DIRECT_EXEC callouts spin locks are the only locks allowed actually.

As the first use case allow taskqueue_enqueue_timeout() use on fast
task queues.  It actually becomes more efficient due to avoided extra
context switches in callout(9) thanks to C_DIRECT_EXEC.

MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D31778

2 years agovmd(4): Major driver refactoring
Alexander Motin [Fri, 3 Sep 2021 00:58:02 +0000 (20:58 -0400)]
vmd(4): Major driver refactoring

 - Re-implement pcib interface to use standard pci bus driver on top of
vmd(4) instead of custom one.
 - Re-implement memory/bus resource allocation to properly handle even
complicated configurations.
 - Re-implement interrupt handling to evenly distribute children's MSI/
MSI-X interrupts between available vmd(4) MSI-X vectors and setup them
to be handled by standard OS mechanisms with minimal overhead, except
sharing when unavoidable.

Successfully tested on Dell XPS 13 laptop with Core i7-1185G7 CPU (VMD
device ID 0x9a0b) and single NVMe SSD, dual-booting with Windows 10.

Successfully tested on Supermicro X11DPI-NT motherboard with Xeon(R)
Gold 6242R CPUs (VMD device ID 0x201d), simultaneously handling NVMe
SSD on one PCIe port and PLX bridge with 3 NVMe and 1 AHCI SSDs on
another.  Handles SSD hot-plug (except Optane 905p for some reason,
which are not detected until manual bus rescan) and enabled IOMMU
(directly connected SSDs work, but ones connected to the PLX fail
without errors from IOMMU).

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.
Differential revision: https://reviews.freebsd.org/D31762

2 years agobnxt(4): Fix bugs in WOL support.
Alexander Motin [Thu, 2 Sep 2021 22:11:58 +0000 (18:11 -0400)]
bnxt(4): Fix bugs in WOL support.

Before this change driver reported IFCAP_WOL_MAGIC enabled, but not
supported.  It caused errors on some SIOCSIFCAP calls.  Instead
report the support if hardware supports WOL, and enabled status if
it has such filter installed on boot.

Also bnxt_wol_config() should check WOL status in if_getcapenable(),
not in if_getcapabilities() to get current one.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

2 years agoloader.efi: fix console output after BS off
Toomas Soome [Thu, 2 Sep 2021 21:17:32 +0000 (00:17 +0300)]
loader.efi: fix console output after BS off

When Boot Services (BS) are switched off, we can not use BS
functions any more. Since drawn console does implement our own
Blt(), we can use it to draw the console.

However, SimpleTextOutput protocol based console output must be
blocked.

Tested by inserting printf() after ExitBootServices() call.

MFC after: 1 week

2 years agoses: Guard the elm_type_names declaration by _KERNEL
Alan Somers [Mon, 30 Aug 2021 20:45:13 +0000 (14:45 -0600)]
ses: Guard the elm_type_names declaration by _KERNEL

MFC after: 2 weeks
Sponsored by: Axcient

2 years agoses: Correct spelling of "Temperature Sensor"
Alan Somers [Mon, 30 Aug 2021 19:59:32 +0000 (13:59 -0600)]
ses: Correct spelling of "Temperature Sensor"

According to SES 4 revision 2 table 71, it should be singular.

MFC after: 2 weeks
Sponsored by: Axcient

2 years agohmt(4): Add support for touchpads with no "button type" or
Vladimir Kondratyev [Thu, 2 Sep 2021 19:33:51 +0000 (22:33 +0300)]
hmt(4): Add support for touchpads with no "button type" or

"maximum number of contacts" usages.

Assume touchpad to be a clickpad if it has only internal button.
Set number of contacts to 5 for touchpads and to 10 for touchscreens.
Check for fetched report length to avoid reading of stalled data.
Fixes Dell Precision 7550 laptop.

Tested by: Shawn Webb <shawn.webb_AT_hardenedbsd_DOT_org>
PR: 257992
MFC after: 2 week

2 years agohpen(4): Add support for legacy MS-compatible single touch protocol
Vladimir Kondratyev [Thu, 2 Sep 2021 19:33:24 +0000 (22:33 +0300)]
hpen(4): Add support for legacy MS-compatible single touch protocol

It is used by many pre- and post- 2014 eGalax touchscreens.

Tested by: Mark Kane <mark_AT_kane_DOT_mn>
MFC after: 2 week

2 years agohidbus(4): Add routine to check presence of collection of given usage
Vladimir Kondratyev [Thu, 2 Sep 2021 19:32:57 +0000 (22:32 +0300)]
hidbus(4): Add routine to check presence of collection of given usage

MFC after: 2 week

2 years agohidmap: Do not forget to initialize bitmap items to unset state
Vladimir Kondratyev [Thu, 2 Sep 2021 19:32:14 +0000 (22:32 +0300)]
hidmap: Do not forget to initialize bitmap items to unset state

MFC after: 2 week

2 years agohidmap: Implement forbidden flag for hidmap item.
Vladimir Kondratyev [Thu, 2 Sep 2021 19:31:51 +0000 (22:31 +0300)]
hidmap: Implement forbidden flag for hidmap item.

If HID usage is mapped to evdev event by hidmap item marked with this
flag than entire driver attachment is blocked.

MFC after: 2 week

2 years agohmt(4): Add support for serial packet reporting mode
Vladimir Kondratyev [Thu, 2 Sep 2021 19:31:17 +0000 (22:31 +0300)]
hmt(4): Add support for serial packet reporting mode

In Serial mode, each packet contains information that describes a
single physical contact point. Multiple contacts are streamed
serially. In this mode, devices report all contact information in a
series of packets. The device sends a separate packet for each
concurrent contact.

Serial packet reporting mode is used by post-2014 eGalax touchscreens.

Tested by: Mark Kane <mark_AT_kane_DOT_mn>
MFC after: 2 weeks

2 years agopsm: Use evdev autorelease feature for Synaptics and Elantech drivers
Vladimir Kondratyev [Thu, 2 Sep 2021 19:30:29 +0000 (22:30 +0300)]
psm: Use evdev autorelease feature for Synaptics and Elantech drivers

MFC after: 2 weeks

2 years agopsm: Enable touch-tracking for late Synaptics PS/2 touchpads.
Vladimir Kondratyev [Thu, 2 Sep 2021 19:29:49 +0000 (22:29 +0300)]
psm: Enable touch-tracking for late Synaptics PS/2 touchpads.

They are true multitouch internally but Synaptics PS/2 protocol
limitations do not all allow to export touch identificators.

MFC after: 2 weeks

2 years agoevdev: Do not export multitouch functions which are unused outside evdev
Vladimir Kondratyev [Thu, 2 Sep 2021 19:28:34 +0000 (22:28 +0300)]
evdev: Do not export multitouch functions which are unused outside evdev

2 years agocyapa(4): Adapt to recent evdev KPI changes
Vladimir Kondratyev [Thu, 2 Sep 2021 19:28:05 +0000 (22:28 +0300)]
cyapa(4): Adapt to recent evdev KPI changes

MFC after: 2 weeks

2 years agowmt(4): Adapt to recent KPI changes
Vladimir Kondratyev [Thu, 2 Sep 2021 19:27:02 +0000 (22:27 +0300)]
wmt(4): Adapt to recent KPI changes

MFC after: 2 weeks

2 years agohmt(4): Adapt to recent KPI changes
Vladimir Kondratyev [Thu, 2 Sep 2021 19:25:27 +0000 (22:25 +0300)]
hmt(4): Adapt to recent KPI changes

MFC after: 2 weeks

2 years agoopenssh: diff reduction against upstream 7.9p1
Ed Maste [Thu, 2 Sep 2021 17:38:30 +0000 (13:38 -0400)]
openssh: diff reduction against upstream 7.9p1

Clean up whitespace and nonfunctional differences, and unused functions.

2 years agocluster_write(): do not access buffer after it is released
Konstantin Belousov [Thu, 2 Sep 2021 04:04:23 +0000 (07:04 +0300)]
cluster_write(): do not access buffer after it is released

The issue was reported by
Alexander Lochmann <alexander.lochmann@tu-dortmund.de>,
who found the problem by performing lock analysis using LockDoc,
see https://doi.org/10.1145/3302424.3303948.

Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31780

2 years agovmem: disable debug.vmem_check by default
Mateusz Guzik [Thu, 2 Sep 2021 09:49:39 +0000 (11:49 +0200)]
vmem: disable debug.vmem_check by default

It has a prohibitive performance impact when running real workloads.

Note this only affects kernels with DIAGNOSTIC.

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

2 years agogetdelim(3): Fix losing data on [EAGAIN]
Bryan Drewery [Wed, 25 Aug 2021 18:37:11 +0000 (11:37 -0700)]
getdelim(3): Fix losing data on [EAGAIN]

Currently when an [EAGAIN] is encountered we return a partial result
that does not contain the delimeter.  On the next (successful) read we
were returning the next part of the line without the preceding string
from the first failed call.

Fix this by using the same mechanism as ungetc(3) does.  For the buffered
case we could simply set fp->_r and fp->_p back to their values before
sappend() is ran but for simplicity ungetc(3) is done in there as well.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D31687

2 years agoopenssh: regenerate freebsd-namespace.h
Ed Maste [Thu, 2 Sep 2021 01:54:57 +0000 (21:54 -0400)]
openssh: regenerate freebsd-namespace.h

For some reason poly64 was omitted when this file was last generated
(perhaps it was inlined by the Clang version then in use).

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoopenssh: tag generated file with @generated
Ed Maste [Thu, 2 Sep 2021 01:49:44 +0000 (21:49 -0400)]
openssh: tag generated file with @generated

Tools like Phabricator use the @generated tag to identify files that
may be excluded from review by default.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agodtrace: fix ipfw_rule_info_t translator
Andrey V. Elsukov [Thu, 2 Sep 2021 13:35:01 +0000 (16:35 +0300)]
dtrace: fix ipfw_rule_info_t translator

322e5efda8578b has changed field names in the struct ip_fw.
Use correct names in ipfw_rule_info_t translator in the ipfw.d script.

Reported by: Keith White <kwhite uottawa at gmail>
MFC after: 1 week

2 years agoSymbol.map: Remove an extra space before _Fork
Ka Ho Ng [Thu, 2 Sep 2021 13:07:08 +0000 (21:07 +0800)]
Symbol.map: Remove an extra space before _Fork

Make it consistent with all other entries.

Sponsored by: The FreeBSD Foundation

2 years agoman: A trailing space cleanup in man9's Makefile
Ka Ho Ng [Thu, 2 Sep 2021 13:04:01 +0000 (21:04 +0800)]
man: A trailing space cleanup in man9's Makefile

Sponsored by: The FreeBSD Foundation

2 years agopfctl: Don't use PRIu64
Kristof Provost [Wed, 1 Sep 2021 16:18:26 +0000 (18:18 +0200)]
pfctl: Don't use PRIu64

Rather than PRIu64 we can just treat the data as uintmax_t, and use %jx
instead.

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

2 years agostress2: Update test to new working of option nomtime
Peter Holm [Thu, 2 Sep 2021 07:12:58 +0000 (07:12 +0000)]
stress2: Update test to new working of option nomtime

2 years agostress2: Added timeout for looping mdnsd
Peter Holm [Thu, 2 Sep 2021 07:11:01 +0000 (07:11 +0000)]
stress2: Added timeout for looping mdnsd

2 years agostress2: Fix cleanup
Peter Holm [Thu, 2 Sep 2021 07:09:39 +0000 (07:09 +0000)]
stress2: Fix cleanup

2 years agostress2: Fix cleanup
Peter Holm [Thu, 2 Sep 2021 07:08:58 +0000 (07:08 +0000)]
stress2: Fix cleanup

2 years agostress2: Fix cleanup
Peter Holm [Thu, 2 Sep 2021 07:07:44 +0000 (07:07 +0000)]
stress2: Fix cleanup

2 years agostress2: Make test less verbose
Peter Holm [Thu, 2 Sep 2021 07:06:55 +0000 (07:06 +0000)]
stress2: Make test less verbose

2 years agoopenssh: regenerate config.h
Ed Maste [Thu, 2 Sep 2021 00:35:45 +0000 (20:35 -0400)]
openssh: regenerate config.h

Since config.h was last regenerated FreeBSD has added (a stub) libdl,
and has removed sys/dir.h.  Regenerate config.h to avoid spurious
additional changes when OpenSSH is next updated.

There should be no issue if this change is MFC'd, but I don't plan to do
so.  Although configure checks for libdl HAVE_LIBDL isn't even used, and
sys/dir.h was non-functional before being removed.  The state of these
two config.h settings should make no difference in the built OpenSSH.

Sponsored by: The FreeBSD Foundation

2 years agoopenssh: disable libwrap (TCP wrappers) at configure time
Ed Maste [Thu, 2 Sep 2021 00:30:05 +0000 (20:30 -0400)]
openssh: disable libwrap (TCP wrappers) at configure time

We define LIBWRAP at build time in secure/usr.sbin/sshd/Makefile if
WITH_TCPWRAPPERS is in effect, so it should not be set in config.h.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoopenssh: clarify krb5 use in freebsd-configure
Ed Maste [Thu, 2 Sep 2021 00:23:40 +0000 (20:23 -0400)]
openssh: clarify krb5 use in freebsd-configure

freebsd-configure.sh runs configure twice, --with-kerberos5 and
--without-kerberos5, in order to build a config.h that defaults to
kerberos5 disabled, and a small config file that represents the
differences.

Rename config.h.orig to config.h.kerberos5 to clarify the intent of this
script.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoena: Update driver version to v2.4.1
Michal Krawczyk [Thu, 12 Aug 2021 08:34:30 +0000 (10:34 +0200)]
ena: Update driver version to v2.4.1

Some of the changes in this release:
* Hardware RSS hash key reconfiguration and indirection table
reconfiguration support.
* Full kernel RSS support.
* Extra statistic counters.
* Netmap support for ENAv3.
* Locking assertions.
* Extra log messages.
* Reset handling fixes.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Implement full RSS reconfiguration
Artur Rojek [Thu, 12 Aug 2021 08:34:29 +0000 (10:34 +0200)]
ena: Implement full RSS reconfiguration

Bind RX/TX queues and MSI-X vectors to matching CPUs based on the RSS
bucket entries.

Introduce sysctls for the following RSS functionality:
- rss.indir_table:      indirection table mapping
- rss.indir_table_size: indirection table size
- rss.key:              RSS hash key (if Toeplitz used)

Said sysctls are only available when compiled without `option RSS`, as
kernel-side RSS support currently doesn't offer RSS reconfiguration.

Migrate the hash algorithm from CRC32 to Toeplitz and change the initial
hash value to 0x0 in order to match the standard Toeplitz implementation.
Provide helpers for hash key inversion required for HW operations.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Add missing statistics
Artur Rojek [Thu, 12 Aug 2021 08:34:29 +0000 (10:34 +0200)]
ena: Add missing statistics

Provide the following sysctl statistics in order to stay aligned with
the Linux driver:
* rx_ring.csum_good
* tx_ring.unmask_interrupt_num

Also rename the 'bad_csum' statistic name to 'csum_bad' for alignment.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Share ena_global_lock between driver instances
Artur Rojek [Thu, 12 Aug 2021 08:34:28 +0000 (10:34 +0200)]
ena: Share ena_global_lock between driver instances

In order to use `ena_global_lock` in sysctl context, it must be kept
outside the driver instance's software context, as sysctls can be called
before attach and after detach, leading to lock use before sx_init and
after sx_destroy otherwise.
Solve this issue by turning `ena_global_lock` into a file scope
variable, shared between all instances of the driver and associated
sysctl context, and in turn initialized/destroyed in dedicated
SYSINIT/SYSUNINIT functions.
As a side effect, this change also fixes existing race in the reset
routine, when simultaneously accessing sysctl exposed properties.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Disable meta descriptor caching for netmap
Artur Rojek [Thu, 12 Aug 2021 08:34:28 +0000 (10:34 +0200)]
ena: Disable meta descriptor caching for netmap

If LLQ is being used, `ena_tx_ctx.meta_valid` must stay enabled. This
fixes netmap support on latest generation ENA HW and aligns it with the
core driver behavior.

As netmap doesn't support any csum offloads, the
`adapter->disable_meta_caching` value can be simply passed to the HW.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Move RSS logic into its own source files
Artur Rojek [Thu, 12 Aug 2021 08:34:27 +0000 (10:34 +0200)]
ena: Move RSS logic into its own source files

Delegate RSS related functionality into separate .c/.h files in
preparation for the full RSS support.

While at it, reorder functions and remove prototypes for ones with
internal linkage.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Add locking assertions
Artur Rojek [Thu, 12 Aug 2021 08:34:26 +0000 (10:34 +0200)]
ena: Add locking assertions

ENA silently assumed that ena_up, ena_down and ena_start_xmit routines
should be called within locked context. Driver's logic heavily assumes
on concurrent access to those routines, so for safety and better
documentation about this assumption, the locking assertions were added
to the above functions.

The assertion was added only for the main steps (skipping the helper
functions) which can be called from multiple places including the kernel
and the driver itself.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Add extra log messages
Artur Rojek [Thu, 12 Aug 2021 08:34:26 +0000 (10:34 +0200)]
ena: Add extra log messages

Stay aligned with the Linux driver by adding the following logs:
* inform the user about retrying queue creation
* warn on non-empty ena_tx_buffer.mbuf prior to ena_tx_map_mbuf

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Prevent reset after device destruction
Artur Rojek [Thu, 12 Aug 2021 08:34:25 +0000 (10:34 +0200)]
ena: Prevent reset after device destruction

Check for ENA_FLAG_TRIGGER_RESET inside a locked context in order to
avoid potential race conditions with ena_destroy_device. This aligns the
reset task logic with the Linux driver.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Trigger reset on ena_com_prepare_tx failure
Artur Rojek [Thu, 12 Aug 2021 08:34:24 +0000 (10:34 +0200)]
ena: Trigger reset on ena_com_prepare_tx failure

All ena_com_prepare_tx errors other than ENA_COM_NO_MEM are fatal and
require device reset.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Avoid unnecessary mbuf collapses for LLQ condition
Artur Rojek [Thu, 12 Aug 2021 08:34:17 +0000 (10:34 +0200)]
ena: Avoid unnecessary mbuf collapses for LLQ condition

In case of Low-latency Queue, one small enough descriptor can be pushed
directly to the ENA hw, thus saving one fragment. Check for this
condition before performing collapse.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agosyscalls.master: correct formatting issues
Brooks Davis [Wed, 1 Sep 2021 20:54:38 +0000 (21:54 +0100)]
syscalls.master: correct formatting issues

Reviewed by: kevans, emaste
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D31351

2 years agosyscalls.master: switch to CAPENABLED flags
Brooks Davis [Wed, 1 Sep 2021 20:54:38 +0000 (21:54 +0100)]
syscalls.master: switch to CAPENABLED flags

Switch the main syscall table to use CAPENABLED flags rather than
capabilities.conf.  This avoid synchronization issues between
syscalls.master and capabilities.conf (e.g. when renaming a syscall
during development).

For now, move capabilities.conf to sys/compat/freebsd32 and use it
there.  Use of sys/compat/freebsd32/syscalls.master should be replaced
by makesyscalls.lua enhancements to allow the main one to be used.

This change results in no changes to generated files after running
`make sysent`.

Reviewed by: kevans, emaste
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D31350

2 years agomakesyscalls.lua: add a CAPENABLED flag
Brooks Davis [Wed, 1 Sep 2021 20:54:38 +0000 (21:54 +0100)]
makesyscalls.lua: add a CAPENABLED flag

The CAPENABLED flag indicates that the syscall can be used in capsicum
capability mode.  It is intended to replace capabilities.conf.

Reviewed by: kevans, emaste
MFC after: 1 week
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D31349

2 years agoRevert "arm: Bump KSTACK_PAGES default to match i386/amd64"
Kevin Bowling [Wed, 1 Sep 2021 20:06:27 +0000 (13:06 -0700)]
Revert "arm: Bump KSTACK_PAGES default to match i386/amd64"

This reverts commit b684d812fcb04b2997fd755405a92c36b9f6e30e.

It causes an issue on a pfsense routing workload where memory
fragmentation prevents the necessary consecutive pages from being
readily available.

Reported by: pfsense (mjg, scottl)
Approved by: ian
MFC after: 1 day
Differential Revision: https://reviews.freebsd.org/D31244

2 years agoppbus: Set the lock for pps interface, update to latest api
Warner Losh [Wed, 1 Sep 2021 19:37:27 +0000 (13:37 -0600)]
ppbus: Set the lock for pps interface, update to latest api

Since we take a lock when we enter the ioctl, we need to set driver_mtx
in the pps structure so it can be dropped while sleeping during a call
to timepps_fetch() with a non-zero timeout (PPS_CANWAIT feature).

MFC After: 5 days
Sponsored by: Netflix
Reviewed by: ian
Differential Revision: https://reviews.freebsd.org/D31763

2 years agoopenssh: update note about class-based login restrictions
Ed Maste [Wed, 1 Sep 2021 20:09:56 +0000 (16:09 -0400)]
openssh: update note about class-based login restrictions

2 years agoopenssh: simplify login class restrictions
Ed Maste [Tue, 31 Aug 2021 19:30:50 +0000 (15:30 -0400)]
openssh: simplify login class restrictions

Login class-based restrictions were introduced in 5b400a39b8ad.  The
code was adapted for sshd's Capsicum sandbox and received many changes
over time, including at least fc3c19a9fceebd393de91cc3, and
e8c56fba2926.

During an attempt to upstream the work a much simpler approach was
suggested.  Adopt it now in the in-tree OpenSSH to reduce conflicts with
future updates.

Submitted by: Yuchiro Naito (against OpenSSH-portable on GitHub)
Obtained from: https://github.com/openssh/openssh-portable/pull/262
Reviewed by: allanjude, kevans
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31760

2 years agokevent: Fix races between timer detach and kqtimer_proc_continue()
Mark Johnston [Wed, 1 Sep 2021 18:18:58 +0000 (14:18 -0400)]
kevent: Fix races between timer detach and kqtimer_proc_continue()

- When detaching a knote, we need to double check the enqueued flag
  after acquiring the process lock, as kqtimer_proc_continue() may have
  toggled it.
- kqtimer_proc_continue() could in principle reschedule a stopped
  callout after filt_timerdetach() drains the callout.  So, we need to
  re-check.

Reported by: syzbot+4a4cebb3ec07892cb040@syzkaller.appspotmail.com
Reported by: syzbot+a9c04bc76078a3b7dd8d@syzkaller.appspotmail.com
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31772

2 years agopf tests: altq:codel_bridge requires if_bridge
Kristof Provost [Wed, 1 Sep 2021 14:09:14 +0000 (16:09 +0200)]
pf tests: altq:codel_bridge requires if_bridge

Check that the bridge module is loaded before running this test.
It likely will be (as a result of running the bridge tests), but if it's
not we'll get spurious failures.

MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agounionfs: style
Jason A. Harmening [Tue, 31 Aug 2021 01:55:42 +0000 (18:55 -0700)]
unionfs: style

Fix the more egregious style(9) violations in unionfs.
No functional change intended.

2 years agounionfs: rework pathname handling
Jason A. Harmening [Sun, 29 Aug 2021 21:36:15 +0000 (14:36 -0700)]
unionfs: rework pathname handling

Running stress2 unionfs tests reliably produces a namei_zone corruption
panic due to unionfs_relookup() attempting to NUL-terminate a newly-
allocate pathname buffer without first validating the buffer length.

Instead, avoid allocating new pathname buffers in unionfs entirely,
using already-provided buffers while ensuring the the correct flags
are set in struct componentname to prevent freeing or manipulation
of those buffers at lower layers.

While here, also compute and store the path length once in the unionfs
node instead of constantly invoking strlen() on it.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D31728

2 years agosctp: Always check for a vanishing inpcb when processing COOKIE-ECHO
Mark Johnston [Wed, 1 Sep 2021 14:28:17 +0000 (10:28 -0400)]
sctp: Always check for a vanishing inpcb when processing COOKIE-ECHO

We previously did this only in the normal case where no association
exists yet.  However, it is not safe to process COOKIE-ECHO even if an
association exists, as sctp_process_cookie_existing() may dereference
the socket pointer.

See also commit 0c7dc84076b64ef74c24f04400d572f75ef61bb4.

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

2 years agosctp: Hold association locks across socket wakeups when freeing
Mark Johnston [Wed, 1 Sep 2021 14:27:51 +0000 (10:27 -0400)]
sctp: Hold association locks across socket wakeups when freeing

At this point we do not hold the inpcb lock, so the only thing holding
the socket reference live is the TCB lock, which needs to be acquired by
sctp_inpcb_free() in order to destroy associations.  Defer the unlock to
until after we dereference the socket reference.

Reported by: syzbot+1d0f2c4675de76a4cf1e@syzkaller.appspotmail.com
Reported by: syzbot+fabee77954fe69d3a5ad@syzkaller.appspotmail.com
Reviewed by: tuexen
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31754

2 years agosctp: Release the socket reference when detaching an association
Mark Johnston [Wed, 1 Sep 2021 14:27:31 +0000 (10:27 -0400)]
sctp: Release the socket reference when detaching an association

Later in sctp_free_assoc(), when we clean up chunk lists,
sctp_free_spbufspace() is used to reset the byte count in the socket
send buffer.  However, if the PCB is going away, the socket may already
have been detached from the PCB, in which case this becomes a use-after
free.  Clear the socket reference from the association before detaching
it from the PCB, if the PCB has already lost its socket reference.

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

2 years agosctp: Implement sctp_inpcb_bind_locked()
Mark Johnston [Wed, 1 Sep 2021 14:04:47 +0000 (10:04 -0400)]
sctp: Implement sctp_inpcb_bind_locked()

This will be used by sctp_listen() to avoid dropping locks when
performing an implicit bind.  No functional change intended.

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

2 years agosctp: Add macros to assert on inp info lock state
Mark Johnston [Wed, 1 Sep 2021 14:06:02 +0000 (10:06 -0400)]
sctp: Add macros to assert on inp info lock state

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

2 years agovfs: Use file_cred for VOP_DEALLOCATE in vn_deallocate if non-NULL
Ka Ho Ng [Wed, 1 Sep 2021 12:18:24 +0000 (20:18 +0800)]
vfs: Use file_cred for VOP_DEALLOCATE in vn_deallocate if non-NULL

This changes vn_deallocate() to match the behavior of vn_rdwr() when
picking which ucred to use. That is, vn_deallocate() uses file_cred for
making VOP call if it is non-NULL, or use active_cred otherwise.

Sponsored by: The FreeBSD Foundation
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D31712

2 years agoif_cdce: Add support for setting RX filtering
Kornel Duleba [Tue, 31 Aug 2021 12:22:30 +0000 (14:22 +0200)]
if_cdce: Add support for setting RX filtering

We can now set promisc and allmulti modes.
Filtering of given multicast addresses is not supported.
Changing the mode is done by sending a command described in:
"USB CDC Subclass Specification for Ethernet Devices v1.2, section 6.2.4".
This means that at least in theory this feature should work with all
modems that are using this driver.

This fixes Huawei E3372h-320 running new firmware in "HiLink" mode.
Previously it would reset a few seconds after its mode was changed
with "usb_modeswitch".
Setting RX filter to default value at the end of attach function
fixed that.

Sponsored by: Stormshield
Obtained from: Semihalf
Differential revision: https://reviews.freebsd.org/D31766
MFC after: 2 weeks
Reviewed by: hps

2 years agopf: import pf_set_protostate() from OpenBSD
Kristof Provost [Tue, 20 Jul 2021 16:38:16 +0000 (18:38 +0200)]
pf: import pf_set_protostate() from OpenBSD

to change a state's state (that term is overloaded in pf, protocol state
like ESTABLISHED for tcp here), don't do it directly, but go through a newly
introduced pf_set_protostate()

Reviewed by: kbowling
Obtainted from: OpenBSD
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31729

2 years agopf: Add counters for syncookies
Kristof Provost [Sun, 29 Aug 2021 13:54:50 +0000 (15:54 +0200)]
pf: Add counters for syncookies

Count when we send a syncookie, receive a valid syncookie or detect a
synflood.

Reviewed by: kbowling
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D31713

2 years agocam: revert second half of 75b5caa08ef
Edward Tomasz Napierala [Wed, 1 Sep 2021 09:34:27 +0000 (09:34 +0000)]
cam: revert second half of 75b5caa08ef

This turns debugging printf() into a KASSERT().

Reviewed By: imp
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D31523

2 years agorouting: Disallow zero nexthop weights in nexthop groups.
Alexander V. Chernikov [Mon, 30 Aug 2021 21:49:00 +0000 (21:49 +0000)]
routing: Disallow zero nexthop weights in nexthop groups.

Adding such nexthops breaks calc_min_mpath_slots() assumptions,
 thus resulting in the incorrect nexthop group creation and
 eventually leading to panic.
Reported by: avg
MFC after: 1 week

2 years agoOpenSSL: Reduce diff with the upstream
Jung-uk Kim [Wed, 1 Sep 2021 04:10:59 +0000 (00:10 -0400)]
OpenSSL: Reduce diff with the upstream

No functional change expected.

2 years agoOpenSSL: Regen manual pages for 1.1.1l
Jung-uk Kim [Wed, 1 Sep 2021 04:09:34 +0000 (00:09 -0400)]
OpenSSL: Regen manual pages for 1.1.1l

2 years agoImport OpenSSL 1.1.1l
Jung-uk Kim [Wed, 1 Sep 2021 04:26:38 +0000 (00:26 -0400)]
Import OpenSSL 1.1.1l

2 years agoAlign taskqueue_enqueue_timeout() to hardclock.
Alexander Motin [Wed, 1 Sep 2021 03:47:51 +0000 (23:47 -0400)]
Align taskqueue_enqueue_timeout() to hardclock.

It is done for all other KPIs using HZ, but was missed here.

MFC after: 2 weeks

2 years agograid: Avoid tasting devices with small sector sizes
Mark Johnston [Tue, 31 Aug 2021 21:09:52 +0000 (17:09 -0400)]
graid: Avoid tasting devices with small sector sizes

The RAID metadata parsers effectively assume a sector size of 512 bytes
or larger, but md(4) devices can be created with a sector size that's
any power of 2.  Add some seatbelts to graid tasting routines to ensure
that the requested sector(s) are large enough for the device to
plausibly contain RAID metadata.

Reported by: syzbot+f43583c9bf8357c8b56f@syzkaller.appspotmail.com
Reported by: syzbot+537dd9f22b91b698e161@syzkaller.appspotmail.com
Reported by: syzbot+51509dd48871c57c6e47@syzkaller.appspotmail.com
Reported by: syzbot+c882a31037ea2a54ff63@syzkaller.appspotmail.com
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agoitimer: Serialize access to the p_itimers array
Mark Johnston [Tue, 31 Aug 2021 20:38:05 +0000 (16:38 -0400)]
itimer: Serialize access to the p_itimers array

Fix the following race between itimer_proc_continue() and process exit.

itimer_proc_continue() may be called via realitexpire(), the real
interval timer.  Note that exit1() drains this timer _after_ draining
and freeing itimers.  Moreover, itimers_exit() is called without the
process lock held; it only acquires the proc lock when deleting
individual itimers, so once they are drained we free p->p_itimers
without any synchronization.  Thus, itimer_proc_continue() may load a
non-NULL p->p_itimers array and iterate over it after it has been freed.

Fix the problem by using the process lock when clearing p->p_itimers, to
synchronize with itimer_proc_continue().  Formally, accesses to this
field should be protected by the process lock anyway, and since the
array is allocated lazily this will not incur any overhead in the common
case.

Reported by: syzbot+c40aa8bf54fe333fc50b@syzkaller.appspotmail.com
Reported by: syzbot+929be2f32503bbc3844f@syzkaller.appspotmail.com
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31759

2 years agomdconfig: Add a regression test for mediasize rounding
Mark Johnston [Tue, 31 Aug 2021 19:50:09 +0000 (15:50 -0400)]
mdconfig: Add a regression test for mediasize rounding

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agomd: Clamp to a multiple of the sector size when resizing
Mark Johnston [Tue, 31 Aug 2021 19:35:08 +0000 (15:35 -0400)]
md: Clamp to a multiple of the sector size when resizing

We do this when creating md(4) devices, in kern_mdattach_locked(), but
not when resizing the provider.  Apply the same policy when resizing, as
many GEOM classes do not expect to deal with providers for which
pp->mediasize % pp->sectorsize != 0.

Reported by: syzkaller
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

2 years agonvme(4): Add MSI and single MSI-X support.
Alexander Motin [Tue, 31 Aug 2021 17:34:48 +0000 (13:34 -0400)]
nvme(4): Add MSI and single MSI-X support.

If we can't allocate more MSI-X vectors, accept using single shared.
If we can't allocate any MSI-X, try to allocate 2 MSI vectors, but
accept single shared.  If still no luck, fall back to shared INTx.

This provides maximal flexibility in some limited scenarios.  For
example, vmd(4) does not support INTx and can handle only limited
number of MSI/MSI-X vectors without sharing.

MFC after: 1 week

2 years agosctp: Fix racy UNBOUND flag check in sctp_inpcb_bind()
Mark Johnston [Tue, 31 Aug 2021 11:43:47 +0000 (07:43 -0400)]
sctp: Fix racy UNBOUND flag check in sctp_inpcb_bind()

SCTP needs to avoid binding a given socket twice.  The check used to
avoid this is racy since neither the inpcb lock nor the global info lock
is held.  Fix it by synchronizing using the global info lock.  In
particular, sctp_inpcb_bind() may drop the inpcb lock in some cases, but
the info lock is sufficient to prevent double insertion into PCB hash
tables.

Reported by: syzbot+548a8560d959669d0e12@syzkaller.appspotmail.com
Reviewed by: tuexen
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D31734

2 years agosctp: Simplify the free port search in sctp_inpcb_bind()
Mark Johnston [Tue, 31 Aug 2021 11:43:39 +0000 (07:43 -0400)]
sctp: Simplify the free port search in sctp_inpcb_bind()

Eliminate a flag variable and reduce indentation.  No functional change
intended.

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

2 years agosctp: Avoid unnecessary refcount bumps in sctp_inpcb_bind()
Mark Johnston [Tue, 31 Aug 2021 11:43:27 +0000 (07:43 -0400)]
sctp: Avoid unnecessary refcount bumps in sctp_inpcb_bind()

We only drop the inp lock when binding to a specific port.  So, only
acquire an extra reference when required.  This simplifies error
handling a bit.

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

2 years agosctp: Remove always-false checks in sctp_inpcb_bind()
Mark Johnston [Tue, 31 Aug 2021 11:43:13 +0000 (07:43 -0400)]
sctp: Remove always-false checks in sctp_inpcb_bind()

No functional change intended.

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

2 years agorouting: simplify malloc flags in alloc_nhgrp().
Alexander V. Chernikov [Tue, 31 Aug 2021 08:12:54 +0000 (08:12 +0000)]
routing: simplify malloc flags in alloc_nhgrp().

MFC after: 1 week

2 years agozfs: merge openzfs/zfs@3b89d9518 (master) into main
Martin Matuska [Tue, 31 Aug 2021 06:58:27 +0000 (08:58 +0200)]
zfs: merge openzfs/zfs@3b89d9518 (master) into main

Notable upstream pull request merges:
  #12022 Fix endianness issues with zstd
  #12319 Extend zpool-iostat to account for ZIO_PRIORITY_REBUILD
  #12458 Add hole punching support on FreeBSD version 1400032
  #12473 Initialize parity blocks before RAID-Z reconstruction benchmarking
  #12511 Make 'zpool labelclear -f' work on offlined disks
  #12514 FreeBSD: Don't remove SA xattr if not SA znode

Obtained from: OpenZFS
OpenZFS commit: 3b89d9518df2c7fd747e349873a3d4d498beb20e

2 years agoumodem: Add Huawei E3372h-320 device id
Kornel Duleba [Tue, 31 Aug 2021 06:44:36 +0000 (08:44 +0200)]
umodem: Add Huawei E3372h-320 device id

After switching the dongle to the Huawei alternate mode(modem mode)
with usb_modeswitch the serial interfaces had all of their ids set to
0xFF.
After modifying umodem to work with that it attached successfully and
I've managed to configure device with standard AT commands to get
internet connection.

2 years agomvneta: Fix MTU update sequence
Kornel Duleba [Tue, 31 Aug 2021 06:22:29 +0000 (08:22 +0200)]
mvneta: Fix MTU update sequence

After MTU is updated we might start using allocating RX buffers from different pool. (MJUM9BYTES vs MCLBYTES)
Because of that we need to update the RX buffer size in hardware.
Previously it was done only when the interface was up, which is incorrect since MTU can be changed at any time.

Differential revision: https://reviews.freebsd.org/D31724
Sponsored by: Stormshield
Obtained from: Semihalf
MFC after: 2 weeks
Reviewed by: wma

2 years agoffs_update(): Do not assume that EBUSY can only come LK_NOWAIT trylock
Konstantin Belousov [Thu, 26 Aug 2021 16:17:39 +0000 (19:17 +0300)]
ffs_update(): Do not assume that EBUSY can only come LK_NOWAIT trylock

Instead do protective check for the local flags and do not interpret
EBUSY specially if we did not request trylock mode for bread().

Reviewed by: mckusick
Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agoffs_update(): recalculate flags after relocking the vnode
Konstantin Belousov [Thu, 26 Aug 2021 16:12:58 +0000 (19:12 +0300)]
ffs_update(): recalculate flags after relocking the vnode

Inode type could migrate between snapshot and regular types while the
vnode is unlocked.  Recalculate flags specific for snapshot after relock.

Reviewed by: mckusick
Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

2 years agopci_host_generic_fdt: set domain number
Bartlomiej Grzesik [Tue, 31 Aug 2021 04:25:05 +0000 (06:25 +0200)]
pci_host_generic_fdt: set domain number

Set domain number to device unit.

Some boards have multiple RCs handled by different drivers,
this ensures that there are no collisions with ofw_pcib.

Obtained from: Semihalf
Reviewed by: wma
Differential revision: https://reviews.freebsd.org/D31508

2 years agoqoriq_dw_pci: Fix typo in link status checking code
Bartlomiej Grzesik [Tue, 31 Aug 2021 04:22:33 +0000 (06:22 +0200)]
qoriq_dw_pci: Fix typo in link status checking code

On some DesignWare PCIe controllers accessing config registers of slots
whose link is down triggers a SError. Because of that we need to check the
link status before any acceses config space.
Due to a typo link was always reported up.
This fixes a SError that occured during boot on LS1028A-RDB.

Obtained from: Semihalf
Reviewed by: wma
Differential revision: https://reviews.freebsd.org/D31509

2 years agoFix an early return in ctld UCL parser
Ryan Stone [Wed, 7 Jul 2021 20:04:10 +0000 (16:04 -0400)]
Fix an early return in ctld UCL parser

If the UCL ctld parser encountered a port that used the CTL
ioctl device, it fell into a special case that had an erroneous
early return.  This caused all configuration in the target
following the port attribute to be skipped.  Fix this by replacing
the return with a continue so that the rest of the config is
parsed correctly.

Sponsored by: Dell EMC Isilon
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31703
Reviewed by: bapt

2 years agoamd64: correctly calculate KVA of the preloaded ucode blob
Konstantin Belousov [Mon, 30 Aug 2021 20:25:31 +0000 (23:25 +0300)]
amd64: correctly calculate KVA of the preloaded ucode blob

when kernphys != 2M

Reported and tested by: kbowling
Sponsored by: The FreeBSD Foundation
MFC after: 3 days