]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoHyper-V: vPCI: Prepopulate device bars
Wei Hu [Sat, 27 Nov 2021 06:42:34 +0000 (06:42 +0000)]
Hyper-V: vPCI: Prepopulate device bars

In recent Hyper-V releases on Windows Server 2022, vPCI code does not
initialize the last 4 bit of device bar registers. This behavior change
could result weird problems cuasing PCI code failure when configuring
bars.

Just write all 1's to those bars whose probed values are not the same
as current read ones. This seems to make Hyper-V vPCI and
pci_write_bar() to cooperate correctly on these releases.

Reported by: khng@freebsd.org
Tested by: khng@freebsd.org
MFC after: 2 weeks
Sponsored by: Microsoft

(cherry picked from commit 75412a521f60d4b0393c730ffb284e7c6ff9d2de)

2 years agosctp: Remove now-unneeded mb_unmapped_to_ext() calls
Mark Johnston [Tue, 16 Nov 2021 18:38:09 +0000 (13:38 -0500)]
sctp: Remove now-unneeded mb_unmapped_to_ext() calls

sctp_delayed_checksum() now handles unmapped mbufs, thanks to m_apply().

No functional change intended.

Reviewed by: tuexen
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 756bb50b6a867f3309ce76d76f1842a667dd303a)

2 years agosctp: Use m_apply() to calcuate a checksum for an mbuf chain
Mark Johnston [Tue, 16 Nov 2021 18:36:30 +0000 (13:36 -0500)]
sctp: Use m_apply() to calcuate a checksum for an mbuf chain

m_apply() works on unmapped mbufs, so this will let us elide
mb_unmapped_to_ext() calls preceding sctp_calculate_cksum() calls in
the network stack.

Modify sctp_calculate_cksum() to assume it's passed an mbuf header.
This assumption appears to be true in practice, and we need to know the
full length of the chain.

No functional change intended.

Reviewed by: tuexen, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit b4d758a0cc54d991d2bdf7f697ec0b6b3fd6230d)

2 years agombuf: Only allow extpg mbufs if the system has a direct map
Mark Johnston [Tue, 16 Nov 2021 18:31:04 +0000 (13:31 -0500)]
mbuf: Only allow extpg mbufs if the system has a direct map

Some upcoming changes will modify software checksum routines like
in_cksum() to operate using m_apply(), which uses the direct map to
access packet data for unmapped mbufs.  This approach of course does not
work on platforms without a direct map, so we have to disallow the use
of unmapped mbufs on such platforms.

I believe this is the right tradeoff: we only configure KTLS on amd64
and arm64 today (and one KTLS consumer, NFS TLS, requires a direct map
already), and the use of unmapped mbufs with plain sendfile is a recent
optimization.  If need be, m_apply() could be modified to create
CPU-private mappings of extpg mbuf pages as a fallback.

So, change mb_use_ext_pgs to be hard-wired to zero on systems without a
direct map.  Note that PMAP_HAS_DMAP is not a compile-time constant on
some systems, so the default value of mb_use_ext_pgs has to be
determined during boot.

Reviewed by: jhb
Discussed with: gallatin
Sponsored by: The FreeBSD Foundation

(cherry picked from commit fcaa890c4469118255d463495b4044eef484fa3e)

2 years agoext2fs: check for eh_depth in ext4_ext_check_header()
Neel Chauhan [Wed, 17 Nov 2021 00:25:04 +0000 (16:25 -0800)]
ext2fs: check for eh_depth in ext4_ext_check_header()

PR: 259112
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: fsu (src)
Differential Revision: https://reviews.freebsd.org/D33030

(cherry picked from commit be60d8f276fa20fc11ad814e54c9c2540f79c7da)

2 years agosyslogd: fix WITHOUT_INET builds
Artem Khramov [Sat, 12 Jun 2021 17:21:13 +0000 (20:21 +0300)]
syslogd: fix WITHOUT_INET builds

Since 2d82b47 syslogd can't be built with `WITHOUT_INET` or
`WITHOUT_INET6` build variables set, because `iovlist_truncate` is not
defined but used.

This change wraps the problematic `iovlist_truncate` call within ifdef
directive.  It's compiled out in this situation...

Pull Request: https://github.com/freebsd/freebsd-src/pull/475
Reviewed by: imp@ (commit message slightly tweaked)

(cherry picked from commit f06fa6f88733d709a5f9dd3a27b1a08571e49e6b)

PR: 260098

2 years agosrc.conf.5: regen
Ed Maste [Mon, 29 Nov 2021 14:16:17 +0000 (09:16 -0500)]
src.conf.5: regen

2 years agoDo not build libatf-c++ when WITHOUT_CXX
Ed Maste [Fri, 29 Oct 2021 03:01:21 +0000 (23:01 -0400)]
Do not build libatf-c++ when WITHOUT_CXX

libatf-c++ requires C++ support.

From jrtc27: bit slightly odd this isn't gated by MK_TESTS (which itself
depends on MK_CXX), but this makes sense given the current behaviour.

Reported by: Michael Dexter, Build Option Survey
Reviewed by: imp, jrtc27
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32732

(cherry picked from commit 6ce99625ca7acecaa64723f0440007eb3f60f53d)

2 years agosrc.opts.mk: Add WITHOUT_CXX dependencies
Ed Maste [Fri, 29 Oct 2021 01:43:33 +0000 (21:43 -0400)]
src.opts.mk: Add WITHOUT_CXX dependencies

OFED, OPENMP, and PMC depend on C++ support.  Force them off when
building WITHOUT_CXX.

Reported by: Michael Dexter, Build Option Survey
Reviewed by: imp, jrtc27
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32730

(cherry picked from commit 0e1c864898c1803835b1be0d59342ca761051db8)

2 years agoDon't build sanitizer runtimes under WITHOUT_CXX
Ed Maste [Fri, 29 Oct 2021 00:49:12 +0000 (20:49 -0400)]
Don't build sanitizer runtimes under WITHOUT_CXX

In the past we built the sanitizer runtimes when building Clang
(and using Clang as the compiler) but 7676b388adbc changed this to
be conditional only on using Clang, to make the runtimes available
for external Clang.

They fail to build when WITHOUT_CXX is set though, so add MK_CXX
as part of the condition.

Reported by: Michael Dexter, Build Option Survey
Reviewed by: imp, jrtc27
Fixes: 7676b388adbc ("Always build the sanitizer runtimes...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32731

(cherry picked from commit ad09e2c8cfbc2cf6f2b8826c121d6de8b3bfe96d)

2 years agonet tests: basic if_gif(4) test case
Kristof Provost [Thu, 4 Nov 2021 16:15:19 +0000 (17:15 +0100)]
net tests: basic if_gif(4) test case

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

(cherry picked from commit 6e0755b37b20f776c7a9ac7a720db1af13966717)

2 years agoif_gif: fix vnet shutdown panic
Kristof Provost [Thu, 4 Nov 2021 17:05:58 +0000 (18:05 +0100)]
if_gif: fix vnet shutdown panic

If an if_gif exists and has an address assigned inside a vnet when the
vnet is shut down we failed to clean up the address, leading to a panic
when we ip_destroy() and the V_in_ifaddrhashtbl is not empty.

This happens because of the VNET_SYS(UN)INIT order, which means we
destroy the if_gif interface before the addresses can be purged (and
if_detach() does not remove addresses, it assumes this will be done by
the stack teardown code).

Set subsystem SI_SUB_PSEUDO just like if_bridge so the cleanup
operations happen in the correct order.

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

(cherry picked from commit 8ca6c11a7cf834721c03cbe1a1aab0a17bae4d4d)

2 years agoHoist cddl prebuild lib dependency definitions out of a MK_ZFS block
Mark Johnston [Fri, 26 Nov 2021 14:27:19 +0000 (09:27 -0500)]
Hoist cddl prebuild lib dependency definitions out of a MK_ZFS block

The compilation of several libraries under cddl/lib is not conditional
on MK_ZFS = "yes", so their dependency on libspl is not conditional
either.  Unbreak buildworld when WITHOUT_ZFS is set.

Reported by: bz
Fixes: 9e9c651caceb ("cddl: fix missing ZFS library dependencies")

(cherry picked from commit 7b3642da21cb4b1c301d8c6b6ce0847d19d8a473)

2 years agocddl: fix missing ZFS library dependencies
Greg V [Sat, 16 Oct 2021 16:29:28 +0000 (19:29 +0300)]
cddl: fix missing ZFS library dependencies

In 9fae47666 zfsd got a libspl dependency to avoid undefined references.
However that workaround did not help external consumers of libzfs_core.

Fix all missing dependencies lld 13 and the rtld complain about.

Reviewed by: freqlabs, markj

(cherry picked from commit 9e9c651caceb9ecd17131e8bb29791ba4cf1cec7)

2 years agoamd64: Initialize kernel_pmap's active CPU set to all_cpus
Mark Johnston [Mon, 15 Nov 2021 17:41:24 +0000 (12:41 -0500)]
amd64: Initialize kernel_pmap's active CPU set to all_cpus

This is in preference to simply filling the cpuset, and allows the
conditional in pmap_invalidate_cpu_mask() to be elided.

Also export pmap_invalidate_cpu_mask() outside of pmap.c for use in a
subsequent commit.

Suggested by: kib
Reviewed by: alc, kib
Tested by: pho
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 71e6e9da225aede95f6813a0fcf886538d0da9fe)

2 years agovm_page: Remove vm_page_sbusy() and vm_page_xbusy()
Mark Johnston [Mon, 15 Nov 2021 16:35:52 +0000 (11:35 -0500)]
vm_page: Remove vm_page_sbusy() and vm_page_xbusy()

They are unused today and cannot be safely used in the face of unlocked
lookup, in which pages may be busied without the object lock held.

Obtained from: jeff (object_concurrency patches)
Reviewed by: kib

(cherry picked from commit a2665158d03e87dad410384e5c61c72e675f3edd)

2 years agovm_page: Consolidate page busy sleep mechanisms
Mark Johnston [Mon, 15 Nov 2021 16:35:44 +0000 (11:35 -0500)]
vm_page: Consolidate page busy sleep mechanisms

- Modify vm_page_busy_sleep() and vm_page_busy_sleep_unlocked() to take
  a VM_ALLOC_* flag indicating whether to sleep on shared-busy, and fix
  up callers.
- Modify vm_page_busy_sleep() to return a status indicating whether the
  object lock was dropped, and fix up callers.
- Convert callers of vm_page_sleep_if_busy() to use vm_page_busy_sleep()
  instead.
- Remove vm_page_sleep_if_(x)busy().

No functional change intended.

Obtained from: jeff (object_concurrency patches)
Reviewed by: kib

(cherry picked from commit 87b646630c4892e21446cd096bea6bcaecea33ac)

2 years agovm: Add a mode to vm_object_page_remove() which skips invalid pages
Mark Johnston [Mon, 15 Nov 2021 16:44:04 +0000 (11:44 -0500)]
vm: Add a mode to vm_object_page_remove() which skips invalid pages

This will be used to break a deadlock in ZFS between the per-mountpoint
teardown lock and page busy locks.  In particular, when purging data
from the page cache during dataset rollback, we want to avoid blocking
on the busy state of invalid pages since the busying thread may be
blocked on the teardown lock in zfs_getpages().

Add a helper, vn_pages_remove_valid(), for use by filesystems.  Bump
__FreeBSD_version so that the OpenZFS port can make use of the new
helper.

PR: 258208
Reviewed by: avg, kib, sef
Tested by: pho (part of a larger patch)
Sponsored by: The FreeBSD Foundation

(cherry picked from commit d28af1abf031ee87a478b37180e3f0c518caedf6)

2 years agoFix segment size in compressing core dumps
Justin Hibbits [Fri, 1 Oct 2021 18:39:18 +0000 (13:39 -0500)]
Fix segment size in compressing core dumps

A core segment is bounded in size only by memory size.  On 64-bit
architectures this means a segment can be much larger than 4GB.
However, compress_chunk() takes only a u_int, clamping segment size to
4GB-1, resulting in a truncated core.  Everything else, including the
compressor internally, uses size_t, so use size_t at the boundary here.

This dates back to the original refactor back in 2015 (r279801 /
aa14e9b7).

PR: 260006
Sponsored by: Juniper Networks, Inc.

(cherry picked from commit 63cb9308a75b99fe057409705bc1b2ac0293f578)

2 years agopchtherm: Let the driver be compiled into the kernel
N.J. Mann [Mon, 22 Nov 2021 17:04:05 +0000 (12:04 -0500)]
pchtherm: Let the driver be compiled into the kernel

PR: 259776

(cherry picked from commit a11983366ea72165809837a667d58e2ad440c496)

2 years agonfsstat: Add output for counts of new RPCs to the "-E" option
Rick Macklem [Sun, 14 Nov 2021 21:36:14 +0000 (13:36 -0800)]
nfsstat: Add output for counts of new RPCs to the "-E" option

Add output to the "-E" option for new RPCs related
to NFSv4.1/4.2. Also, add output of the counts for
allocated layouts and the title for the "Client"
section (which was lost during a previous commit).

(cherry picked from commit 75c666197cc7574f6f0d48344f8725f72072fc84)

2 years agostyle.Makefile.5: Do not require $FreeBSD$ SCM IDs
Mateusz Piotrowski [Thu, 18 Nov 2021 21:00:30 +0000 (22:00 +0100)]
style.Makefile.5: Do not require $FreeBSD$ SCM IDs

It's no longer required to have those SCM IDs at the start of makefiles.

MFC after: 3 days

(cherry picked from commit 1ac5586c6d86134922e18871b270ca483c00bf8b)

2 years agoos-release.5: Fix quoting of dots
Mateusz Piotrowski [Tue, 23 Nov 2021 10:34:44 +0000 (11:34 +0100)]
os-release.5: Fix quoting of dots

Dots needs to escaped with \& to be places inside Ql quotes.

MFC after: 3 days

(cherry picked from commit ee7485bef53df9108a20e497dac6341d030248ce)

2 years agoffs_softdep: Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:17:41 +0000 (19:17 +0100)]
ffs_softdep: Fix a typo in a source code comment

- s/conditonally/conditionally/

(cherry picked from commit bebff615877efdf549e5033b47ade4d8553f6a77)

2 years agoppbus(4): Fix a typo in source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:19:36 +0000 (19:19 +0100)]
ppbus(4): Fix a typo in source code comment

- s/quering/querying/

Obtained from: NetBSD

(cherry picked from commit 975e2e3f84b0b7425185c9bb43722da779e8cd98)

2 years agolpr(1): Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 19:04:09 +0000 (20:04 +0100)]
lpr(1): Fix a typo in a source code comment

-s /debuging/debugging/

(cherry picked from commit 840d72371bdc48be58152c839160c492bef7f1b7)

2 years agofirewire(4): Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:50:56 +0000 (19:50 +0100)]
firewire(4): Fix a typo in a source code comment

- s/unavailabe/unavailable/

(cherry picked from commit 3e5ddef0fd391049f378456e10a0cea015652bc0)

2 years agoixl(4): Fix a typo in a sysctl description
Gordon Bergling [Fri, 19 Nov 2021 18:59:28 +0000 (19:59 +0100)]
ixl(4): Fix a typo in a sysctl description

(cherry picked from commit d7125850f031f8e763ff35c70fda310a1419b876)

2 years agoiscsi(4): Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:29:21 +0000 (19:29 +0100)]
iscsi(4): Fix a typo in a source code comment

- s/conditon/condition/

(cherry picked from commit 5e21882bb4e7d36ebcf0300234486a54ff4e7b13)

2 years agosched_ule(4): Fix two typo in source code comments
Gordon Bergling [Fri, 19 Nov 2021 18:13:28 +0000 (19:13 +0100)]
sched_ule(4): Fix two typo in source code comments

- s/conditons/conditions/
- s/unconditonally/unconditionally/

(cherry picked from commit 15b5c347f1916d14e84765ae68921755ee930612)

2 years agoTWL: Fix a typo in a source code comment
Gordon Bergling [Fri, 19 Nov 2021 18:26:34 +0000 (19:26 +0100)]
TWL: Fix a typo in a source code comment

- s/maxium/maximum/

(cherry picked from commit 8b11850f9d04c096d8ed3647db512f8feceefaf4)

2 years agomkimg: zero entry in vhdx_write_metadata
Ed Maste [Sun, 21 Nov 2021 00:29:11 +0000 (19:29 -0500)]
mkimg: zero entry in vhdx_write_metadata

Otherwise _reserved might contain uninitialized data.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 036af1053acd6cae68c5fb6bed30508f2e40be13)

2 years agoFix coredump_phnum test with ASLR enabled
Ed Maste [Sun, 21 Nov 2021 17:17:20 +0000 (12:17 -0500)]
Fix coredump_phnum test with ASLR enabled

coredump_phnum intends to generate a core file with many PT_LOAD
segments.  Previously it called mmap() in a loop with alternating
protections, relying on each mapping following the previous, to produce
a core file with many page-sized PT_LOAD segments.  With ASLR on we no
longer have this property of each mmap() following the previous.

Instead, perform a single allocation, and then use mprotect() to set
alternating pages to PROT_READ.

PR: 259970
Reported by: lwhsu, mw
Reviewed by: kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33070

(cherry picked from commit 8ec4c5dae32765701ac70811455084efd1570c32)

2 years agong_h4: add deprecation notice
Ed Maste [Thu, 25 Nov 2021 16:55:34 +0000 (11:55 -0500)]
ng_h4: add deprecation notice

It is already gone in FreeBSD 14.

Sponsored by: The FreeBSD Foundation

2 years agoicee: allow configuration via hints on FDT-based systems
Andriy Gapon [Thu, 4 Nov 2021 11:56:22 +0000 (13:56 +0200)]
icee: allow configuration via hints on FDT-based systems

On-board devices should be configured via the FDT and overlays.
Hints are primarily useful for external and temporarily attached devices.
Adding hints is much easier and faster than writing and compiling
an overlay.

(cherry picked from commit 01e3492337cb48484e03be38340cc67ac5e30a5b)

2 years agods1307: allow configuration via hints on FDT-based systems
Andriy Gapon [Thu, 4 Nov 2021 11:55:35 +0000 (13:55 +0200)]
ds1307: allow configuration via hints on FDT-based systems

On-board devices should be configured via the FDT and overlays.
Hints are primarily useful for external and temporarily attached devices.
Adding hints is much easier and faster than writing and compiling
an overlay.

(cherry picked from commit 27645265c4e49ad7eaa25847a280307acb138da8)

2 years agosddadone: 'error' gets assigned only errno codes, never MMC_ERR codes
Andriy Gapon [Fri, 9 Jul 2021 14:28:40 +0000 (17:28 +0300)]
sddadone: 'error' gets assigned only errno codes, never MMC_ERR codes

(cherry picked from commit e17b58ecbcb644f76cceda4ca7ff08f7677b5dfd)

2 years agopNFS: Add nfsstats counters for number of Layouts
Rick Macklem [Sat, 13 Nov 2021 01:32:55 +0000 (17:32 -0800)]
pNFS: Add nfsstats counters for number of Layouts

For pNFS, Layouts are issued by the server to indicate
where a file's data resides on the DS(s).  This patch
adds counters for how many layouts are allocated to
the nfsstatsv1 structure, using two reserved fields.

(cherry picked from commit ce9676de86f267986f61979151101e3d8a6d61bc)

2 years agoofwfb: fix vga/hdmi console with ASMEDIA during boot on powerpc64(le)
Alfredo Dal'Ava Junior [Wed, 3 Nov 2021 16:42:28 +0000 (13:42 -0300)]
ofwfb: fix vga/hdmi console with ASMEDIA during boot on powerpc64(le)

On recent OpenBMC firmware, the onboard ASMEDIA video card framebuffer
address was removed from device tree for security purposes (value is set
to zero to avoid leaking the address).

This patch works around the problem by taking framebuffer base address
from the "ranges" property of a parent node.

Reviewed by: luporl, jhibbits (on IRC)
MFC after: 2 weeks
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D30626

(cherry picked from commit b042d10cdc71ddd6ef3449261d712b05c648746e)

2 years agolibpfct: be consistent with u_int vs. uint
Kristof Provost [Fri, 5 Nov 2021 08:37:56 +0000 (09:37 +0100)]
libpfct: be consistent with u_int vs. uint

Always use uint64_t over u_int64_t, for the sake of consistency.

No functional change.

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

(cherry picked from commit 7bb3c927f7d9c48b356b4d20907b813f9b83273b)

2 years agolagg: fix unused-but-set-variable
Kristof Provost [Fri, 19 Nov 2021 16:22:48 +0000 (17:22 +0100)]
lagg: fix unused-but-set-variable

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

(cherry picked from commit 3142d4f622d2f95da5c7c52f60ce840411a07b0a)

2 years agopf tests: basic test for ridentifier
Kristof Provost [Fri, 29 Oct 2021 15:52:59 +0000 (17:52 +0200)]
pf tests: basic test for ridentifier

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

(cherry picked from commit 508161111dc23cee0a41fa70de865743c694502f)

2 years agopf: Introduce ridentifier
Kristof Provost [Fri, 29 Oct 2021 15:40:53 +0000 (17:40 +0200)]
pf: Introduce ridentifier

Allow users to set a number on rules which will be exposed as part of
the pflog header.
The intent behind this is to allow users to correlate rules across
updates (remember that pf rules continue to exist and match existing
states, even if they're removed from the active ruleset) and pflog.

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

(cherry picked from commit 76c5eecc3490d89a9a3492ed2354802b69d69602)

2 years agoUpdate deprecation version for drivers removed in main
Ed Maste [Thu, 25 Nov 2021 16:47:03 +0000 (11:47 -0500)]
Update deprecation version for drivers removed in main

Removal of the amr, esp, iir, mly and twa drivers was planned before
FreeBSD 13, but did not happen before the branch.  Update the
depreciation notices to indicate that they are gone in FreeBSD 14.

Sponsored by: The FreeBSD Foundation

2 years agocloudabi: add deprecation notice in stable branches
Ed Maste [Thu, 25 Nov 2021 16:45:59 +0000 (11:45 -0500)]
cloudabi: add deprecation notice in stable branches

It has been removed from main before 14.0.

Sponsored by: The FreeBSD Foundation

2 years agobridge(4): Use American spelling of "behavior"
Guangyuan Yang [Mon, 22 Nov 2021 02:41:49 +0000 (21:41 -0500)]
bridge(4): Use American spelling of "behavior"

Fixes: 8406182dbeb972698775e2468902bc5f6e593d72
Reported by: Pau Amma <pauamma@gundo.com>

(cherry picked from commit 28ba36c65db8b4d95abcd543b97f2ec5161cdae5)

2 years agokmod_syms.awk: fix removal of the export list from the symbol table
Konstantin Belousov [Sun, 7 Nov 2021 09:00:07 +0000 (11:00 +0200)]
kmod_syms.awk: fix removal of the export list from the symbol table

(cherry picked from commit 0d7a6199b61d55caf0a682ef072bdd107472ab49)

2 years agoFix some modules to export more used symbols
Konstantin Belousov [Sun, 7 Nov 2021 08:42:24 +0000 (10:42 +0200)]
Fix some modules to export more used symbols

(cherry picked from commit 5bb3134a8c21cb87b30e135ef168483f0333dabb)

2 years agoUPDATING: Add an entry for commit 6e8e261f0d4e
Rick Macklem [Thu, 25 Nov 2021 00:47:03 +0000 (16:47 -0800)]
UPDATING: Add an entry for commit 6e8e261f0d4e

This is a direct commit.

2 years agoparam.h: Bump __FreeBSD_version to 1300522
Rick Macklem [Thu, 25 Nov 2021 00:39:52 +0000 (16:39 -0800)]
param.h: Bump __FreeBSD_version to 1300522

Commit 6e8e261f0d4e changed the internal KAPI between the NFS modules.
Bump __FreeBSD_version to 1300522.

This is a direct commit.

2 years agonfscl: Add a LayoutError RPC for NFSv4.2 pNFS mounts
Rick Macklem [Thu, 11 Nov 2021 23:43:58 +0000 (15:43 -0800)]
nfscl: Add a LayoutError RPC for NFSv4.2 pNFS mounts

If a pNFS server's DS runs out of disk space, it replies
NFSERR_NOSPC to the client doing writing.  For the Linux
client, it then sends a LayoutError RPC to the MDS server to
tell it about the error.  This patch adds the same to the
FreeBSD NFSv4.2 pNFS client, to maintain Linux compatible
behaviour, particlularily for non-FreeBSD pNFS servers.

(cherry picked from commit 44744f75386e2102584acbca24fbe67de16051ca)

2 years agonfsd: Fix the NFSv4.2 pNFS MDS server for NFSERR_NOSPC via LayoutError
Rick Macklem [Mon, 8 Nov 2021 23:58:00 +0000 (15:58 -0800)]
nfsd: Fix the NFSv4.2 pNFS MDS server for NFSERR_NOSPC via LayoutError

If a pNFS server's DS runs out of disk space, it replies
NFSERR_NOSPC to the client doing writing.  For the Linux
client, it then sends a LayoutError RPC to the MDS server to
tell it about the error and keeps retrying, doing repeated
LayoutGets to the MDS and Write RPCs to the DS.  The Linux client is
"stuck" until disk space on the DS is free'd up unless
a subsequent LayoutGet request is sent a NFSERR_NOSPC
reply.
The looping problem still occurs for NFSv4.1 mounts, but no
fix for this is known at this time.

This patch changes the pNFS MDS server to reply to LayoutGet
operations with NFSERR_NOSPC once a LayoutError reports the
problem, until the DS has available space.  This keeps the Linux
NFSv4.2 from looping.

Found during recent testing because of issues w.r.t. a DS
being out of space found during a recent IEFT NFSv4 working
group testing event.

(cherry picked from commit f8dc06303bac39be53872de7429aa54694b3f86a)

2 years agonfsd: Fix f_bavail and f_ffree for NFSv4 when negative
Rick Macklem [Mon, 8 Nov 2021 20:59:31 +0000 (12:59 -0800)]
nfsd: Fix f_bavail and f_ffree for NFSv4 when negative

Since the NFS Space_available and Files_available are unsigned,
the NFSv3 server sets them to 0 when negative, so that they
do not appear to be large positive values for non-FreeBSD clients.
This patch fixes the NFSv4 server to do the same.

Found during a recent IEFT NFSv4 working group testing event.

(cherry picked from commit d70ca5b00eede3367ce659a03b2f9cc9729cd0dd)

2 years agoiser: Remove redundant linuxkpi MODULE_DEPEND
Ka Ho Ng [Mon, 15 Nov 2021 06:04:08 +0000 (14:04 +0800)]
iser: Remove redundant linuxkpi MODULE_DEPEND

Since ibcore depends on linuxkpi, there is no need to pull in the
linuxkpi dependency in iser.

Sponsored by: The FreeBSD Foundation
Reviewed by: trasz
Differential Revision: https://reviews.freebsd.org/D32977

(cherry picked from commit f7523c8a19d008412ccc969b12eeb756613f3678)

2 years agopf tests: route_to:icmp_nat_head requires scapy
Kristof Provost [Wed, 3 Nov 2021 09:34:20 +0000 (10:34 +0100)]
pf tests: route_to:icmp_nat_head requires scapy

Document the requirement so the test is skipped if scapy is not
installed.

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

(cherry picked from commit 11703705c2f77498246b9523aae44040bd346c00)

2 years agoriscv: add COMPAT_FREEBSD12 option
Kristof Provost [Tue, 16 Nov 2021 19:46:26 +0000 (20:46 +0100)]
riscv: add COMPAT_FREEBSD12 option

Turn on compat option for older FreeBSD versions (i.e. 12). We do not
enable the compat options for 11 or older because riscv was never
supported in those versions.

Reviewed by: jrtc27 (previous version)
MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D33015

(cherry picked from commit 23e1961e78b0ac4d1cf03426d1a642962069f2b9)

2 years agodevfs.rules: Correctly unhide pf in vnet jails
Zhenlei Huang [Wed, 3 Nov 2021 11:46:48 +0000 (12:46 +0100)]
devfs.rules: Correctly unhide pf in vnet jails

Revision 9e9be081d8 introduced a new devfs rule devfsrules_jail_vnet. It
includes rule devfsrules_jail which include other rules. Unfortunately
devfs could not recursively parse the action include and thus
devfsrules_jail_vnet will expose all nodes.

PR: 255660
Reviewed by: kp
Obtained from: Gijs Peskens <gijs@peskens.net>
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D32814

(cherry picked from commit 7acd322ebe2072b1d73b1d19c14ab12a300ba8e8)

2 years agotop.1: Use the Dq macros instead of \*lq and \*rq
Mateusz Piotrowski [Thu, 18 Nov 2021 14:55:27 +0000 (15:55 +0100)]
top.1: Use the Dq macros instead of \*lq and \*rq

MFC after: 3 days

(cherry picked from commit 01e3140571bab1a7283e33669de171865cdb8028)

2 years agotop.1: Improve description of -m
Mateusz Piotrowski [Thu, 18 Nov 2021 14:31:48 +0000 (15:31 +0100)]
top.1: Improve description of -m

Describe -m argument as "mode" instead of "display".

MFC after: 3 days

(cherry picked from commit c947fc5fae31c5935a57abcaa76f40fc8950ce59)

2 years agotop.1: Fix a typo in description of H interactive command
Mateusz Piotrowski [Thu, 18 Nov 2021 12:50:56 +0000 (13:50 +0100)]
top.1: Fix a typo in description of H interactive command

B is listed as an interactive command to toggle the display of threads.
This is a typo introduced during the conversion of the manual page to
mdoc.

Fixes: 9d6cce02a78c967e69b603d503545c4b43d7765f
MFC after: 3 days

(cherry picked from commit b8135ed67ce86e40fa7b46653ff54c769f2e7c98)

2 years agotop.1: Sort options alphabetically
Mateusz Piotrowski [Thu, 18 Nov 2021 13:11:23 +0000 (14:11 +0100)]
top.1: Sort options alphabetically

While here, add a short sentence introducing the options.

MFC after: 3 days

(cherry picked from commit 112539041590259a9d1e34999a80dc607c69f4db)

2 years agotop: Sort flags in usage message
Mateusz Piotrowski [Thu, 18 Nov 2021 13:21:34 +0000 (14:21 +0100)]
top: Sort flags in usage message

While here, fix the indentation of the second line in the message.

MFC after: 3 days

(cherry picked from commit 82d0f865ee9a93213876c14342b147e31b7ade0d)

2 years agoExport symbols from opensolaris.ko and dtrace.ko
Mark Johnston [Wed, 17 Nov 2021 16:01:59 +0000 (11:01 -0500)]
Export symbols from opensolaris.ko and dtrace.ko

Both modules provide many symbols used by various DTrace provider
modules, so just export everything.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 8a693ccf86f90469910c5b2425ddb8a75e298487)

2 years agopca954x: driver for PCA954x / TCA954x I2C switches
Andriy Gapon [Tue, 18 Aug 2020 09:16:28 +0000 (12:16 +0300)]
pca954x: driver for PCA954x / TCA954x I2C switches

At the moment only PCA9548A is supported and has been tested.

(cherry picked from commit c0525ab1d1ce69ab3d589e95733caedb04e0dcbd)

2 years agoarm64, riscv: Fix TRAF_PC() to return the PC, not the return address.
John Baldwin [Fri, 1 Oct 2021 18:53:12 +0000 (11:53 -0700)]
arm64, riscv: Fix TRAF_PC() to return the PC, not the return address.

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

(cherry picked from commit 0177102173f39e17366a32eb22653aeb5248c355)

2 years agoriscv: Assert that SUM is not set in SSTATUS for exceptions.
John Baldwin [Wed, 21 Apr 2021 20:57:20 +0000 (13:57 -0700)]
riscv: Assert that SUM is not set in SSTATUS for exceptions.

Reviewed by: mhorne
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29764

(cherry picked from commit 6a3a6fe34bf36b6e745b3e9ad1a991de057729c7)

2 years agoriscv: Clear SUM in SSTATUS for supervisor mode exceptions.
John Baldwin [Wed, 21 Apr 2021 20:57:04 +0000 (13:57 -0700)]
riscv: Clear SUM in SSTATUS for supervisor mode exceptions.

Previously, a page fault taken during copyin/out and related functions
would run the entire fault handler while permitting direct access to
user addresses.  This could also leak across context switches (e.g. if
the page fault handler was preempted by an interrupt or slept for disk
I/O).

To fix, clear SUM in assembly after saving the original version of
SSTATUS in the supervisor mode trapframe.

Reviewed by: mhorne, jrtc27
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29763

(cherry picked from commit 753bcca440a4d2c95f48536b586131b84c0bb87e)

2 years agoktls: Split encrypt vs decrypt OCF counters.
John Baldwin [Tue, 16 Nov 2021 17:58:52 +0000 (09:58 -0800)]
ktls: Split encrypt vs decrypt OCF counters.

Reviewed by: gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33006

(cherry picked from commit 16bea05ac3275d41663939da0d5c26d89f15cd53)

2 years agoktls tests: Check the return values of close().
John Baldwin [Tue, 16 Nov 2021 17:56:15 +0000 (09:56 -0800)]
ktls tests: Check the return values of close().

Suggested by: markj
Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33004

(cherry picked from commit 694c708d6a0d00f84fa53357a1cc8a72272a26e3)

2 years agoktls: Use ATF_REQUIRE instead of assert() for validating TLS header lengths.
John Baldwin [Tue, 16 Nov 2021 17:56:15 +0000 (09:56 -0800)]
ktls: Use ATF_REQUIRE instead of assert() for validating TLS header lengths.

The TLS header length field is set by the kernel, so if it is
incorrect that is an indication of a kernel bug, not an internal error
in the tests.

Prompted by: markj (comment in an earlier review)
Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D33003

(cherry picked from commit d71830cdf0df6dbc4bd3332daa95d9ecd7d64060)

2 years agoktls: Add tests ensuring unsupported receive cipher suites are rejected.
John Baldwin [Mon, 15 Nov 2021 19:32:49 +0000 (11:32 -0800)]
ktls: Add tests ensuring unsupported receive cipher suites are rejected.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32982

(cherry picked from commit 83a54b582f89ff63f9076eb7d50b5cdbd009905f)

2 years agoktls: Add tests ensuring invalid receive cipher suites are rejected.
John Baldwin [Mon, 15 Nov 2021 19:32:15 +0000 (11:32 -0800)]
ktls: Add tests ensuring invalid receive cipher suites are rejected.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32981

(cherry picked from commit 233ce578a424a7a3e5cf21ea6ba2b2036950d54f)

2 years agoktls: Add simple receive tests of kernel TLS.
John Baldwin [Mon, 15 Nov 2021 19:31:16 +0000 (11:31 -0800)]
ktls: Add simple receive tests of kernel TLS.

Similar to the simple transmit tests added in
a10482ea7476d68d1ab028145ae6d97cef747b49, these tests test the kernel
TLS functionality directly by manually encrypting TLS records using
randomly generated keys and writing them to a socket to be processed
by the kernel.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32980

(cherry picked from commit 3e7f8a8da254cfa97af90c3aae1cb827da55fc9d)

2 years agoktls: Add tests ensuring various invalid cipher suites are rejected.
John Baldwin [Mon, 15 Nov 2021 19:30:48 +0000 (11:30 -0800)]
ktls: Add tests ensuring various invalid cipher suites are rejected.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32843

(cherry picked from commit d1c369f926e7d04354d044cc13d8ecfb3e325636)

2 years agoktls: Reject some invalid cipher suites.
John Baldwin [Mon, 15 Nov 2021 19:28:56 +0000 (11:28 -0800)]
ktls: Reject some invalid cipher suites.

- Reject AES-CBC cipher suites for TLS 1.0 and TLS 1.1 using auth
  algorithms other than SHA1-HMAC.

- Reject AES-GCM cipher suites for TLS versions older than 1.2.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32842

(cherry picked from commit 900a28fe33ef998aaee55cb243f4efa35471da07)

2 years agoktls: Add tests for sending empty fragments for TLS 1.0 connections.
John Baldwin [Mon, 15 Nov 2021 19:27:15 +0000 (11:27 -0800)]
ktls: Add tests for sending empty fragments for TLS 1.0 connections.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32841

(cherry picked from commit 0ff2a12ae32a3a88be63f4036599c1324ce04f78)

2 years agoktls: Add padding tests for AES-CBC MTE cipher suites.
John Baldwin [Mon, 15 Nov 2021 19:26:45 +0000 (11:26 -0800)]
ktls: Add padding tests for AES-CBC MTE cipher suites.

For each AES-CBC MTE cipher suite, test sending records with 1 to 16
bytes of payload.  This ensures that all of the potential padding
values are covered.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32840

(cherry picked from commit 44265dc3dae1d373f33f474244b5c9811471080b)

2 years agoDrop "All rights reserved" from a Netflix copyright.
John Baldwin [Thu, 11 Nov 2021 22:41:16 +0000 (14:41 -0800)]
Drop "All rights reserved" from a Netflix copyright.

Reviewed by: imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32778

(cherry picked from commit 522a2aa7613aa43f4d3bb5bdd1d87f966304be34)

2 years agoMove the ICL_CONN_*LOCK* macros to <dev/iscsi/icl.h>.
John Baldwin [Fri, 5 Nov 2021 23:38:25 +0000 (16:38 -0700)]
Move the ICL_CONN_*LOCK* macros to <dev/iscsi/icl.h>.

These macros are not backend-specific but reference a
backend-independent field in struct icl_conn.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32858

(cherry picked from commit e900338c0987603456df8d9a8aeec5c239106d0b)

2 years agocrypto: Cleanup mtx_init() calls.
John Baldwin [Tue, 2 Nov 2021 18:27:20 +0000 (11:27 -0700)]
crypto: Cleanup mtx_init() calls.

Don't pass the same name to multiple mutexes while using unique types
for WITNESS.  Just use the unique types as the mutex names.

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32740

(cherry picked from commit 4e057806cf56b238a0a3ef7af140f447d7b67ab5)

2 years agocrypto: Use a single "crypto" kproc for all of the OCF kthreads.
John Baldwin [Tue, 2 Nov 2021 18:26:21 +0000 (11:26 -0700)]
crypto: Use a single "crypto" kproc for all of the OCF kthreads.

Reported by: julian
Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32739

(cherry picked from commit 717857819223d9c0f81eb38abd0df200532e1cdc)

2 years agotests: do not build ktls_test if WITHOUT_OPENSSL
Ed Maste [Mon, 8 Nov 2021 17:08:34 +0000 (12:08 -0500)]
tests: do not build ktls_test if WITHOUT_OPENSSL

ktls_test requires libcrypto to build, and fails if it is not available
(which is the case when building WITHOUT_OPENSSL).

Reported by: Michael Dexter, Build Option Survey
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32895

(cherry picked from commit e818178e3a597922ce77bee874e441a1b7df0099)

2 years agoktls: Add simple transmit tests of kernel TLS.
John Baldwin [Mon, 1 Nov 2021 18:28:10 +0000 (11:28 -0700)]
ktls: Add simple transmit tests of kernel TLS.

Note that these tests test the kernel TLS functionality directly.
Rather than using OpenSSL to perform negotiation and generate keys,
these tests generate random keys send data over a pair of TCP sockets
manually decrypting the TLS records generated by the kernel.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32652

(cherry picked from commit a10482ea7476d68d1ab028145ae6d97cef747b49)

2 years agoktls: Fix assertion for TLS 1.0 CBC when using non-zero starting seqno.
John Baldwin [Wed, 27 Oct 2021 23:35:56 +0000 (16:35 -0700)]
ktls: Fix assertion for TLS 1.0 CBC when using non-zero starting seqno.

The starting sequence number used to verify that TLS 1.0 CBC records
are encrypted in-order in the OCF layer was always set to 0 and not to
the initial sequence number from the struct tls_enable.

In practice, OpenSSL always starts TLS transmit offload with a
sequence number of zero, so this only matters for tests that use a
random starting sequence number.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32676

(cherry picked from commit 4827bf76bce8814b9d9a0d883467a3d2366e59a2)

2 years agoktls: Ensure FIFO encryption order for TLS 1.0.
John Baldwin [Wed, 13 Oct 2021 19:30:15 +0000 (12:30 -0700)]
ktls: Ensure FIFO encryption order for TLS 1.0.

TLS 1.0 records are encrypted as one continuous CBC chain where the
last block of the previous record is used as the IV for the next
record.  As a result, TLS 1.0 records cannot be encrypted out of order
but must be encrypted as a FIFO.

If the later pages of a sendfile(2) request complete before the first
pages, then TLS records can be encrypted out of order.  For TLS 1.1
and later this is fine, but this can break for TLS 1.0.

To cope, add a queue in each TLS session to hold TLS records that
contain valid unencrypted data but are waiting for an earlier TLS
record to be encrypted first.

- In ktls_enqueue(), check if a TLS record being queued is the next
  record expected for a TLS 1.0 session.  If not, it is placed in
  sorted order in the pending_records queue in the TLS session.

  If it is the next expected record, queue it for SW encryption like
  normal.  In addition, check if this new record (really a potential
  batch of records) was holding up any previously queued records in
  the pending_records queue.  Any of those records that are now in
  order are also placed on the queue for SW encryption.

- In ktls_destroy(), free any TLS records on the pending_records
  queue.  These mbufs are marked M_NOTREADY so were not freed when the
  socket buffer was purged in sbdestroy().  Instead, they must be
  freed explicitly.

Reviewed by: gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D32381

(cherry picked from commit 9f03d2c00167c8047416e0048e3b7f89d73baf8e)

2 years agoktls: Reject attempts to enable AES-CBC with TLS 1.3.
John Baldwin [Wed, 13 Oct 2021 19:12:58 +0000 (12:12 -0700)]
ktls: Reject attempts to enable AES-CBC with TLS 1.3.

AES-CBC cipher suites are not supported in TLS 1.3.

Reported by: syzbot+ab501c50033ec01d53c6@syzkaller.appspotmail.com
Reviewed by: tuexen, markj
Differential Revision: https://reviews.freebsd.org/D32404

(cherry picked from commit a63752cce6462d08bbec08cad931d70dec2f5b4c)

2 years agoFurther refine the ExpDataSN checks for SCSI Response PDUs.
John Baldwin [Tue, 26 Oct 2021 21:50:05 +0000 (14:50 -0700)]
Further refine the ExpDataSN checks for SCSI Response PDUs.

According to 11.4.8 in RFC 7143, ExpDataSN MUST be 0 if the response
code is not Command Completed, but we were requiring it to always be
the count of DataIn PDUs regardless of the response code.

In addition, at least one target (OCI Oracle iSCSI block device)
returns an ExpDataSN of 0 when returning a valid completion with an
error status (Check Condition) in response to a SCSI Inquiry.  As a
workaround for this target, only warn without resetting the connection
for a 0 ExpDataSN for responses with a non-zero error status.

PR: 259152
Reported by: dch
Reviewed by: dch, mav, emaste
Fixes: 4f0f5bf99591 iscsi: Validate DataSN values in Data-In PDUs in the initiator.
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32650

(cherry picked from commit cdbc4a074bec094dc7f1dfde0773a9417d118ffa)

2 years agoiscsi: Validate DataSN values in Data-In PDUs in the initiator.
John Baldwin [Tue, 24 Aug 2021 21:58:34 +0000 (14:58 -0700)]
iscsi: Validate DataSN values in Data-In PDUs in the initiator.

As is done in the target, require that DataSN values are consecutive
and in-order.  If an out of order Data-In PDU is received, force a
session reconnect.  In addition, when a SCSI Response PDU is received,
verify that the ExpDataSN field matches the count of Data-In PDUs
received for this command.  If not, force a session reconnect.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D31594

(cherry picked from commit 4f0f5bf99591ad9907822082270523ac919e3b8c)

2 years agoctld: Always declare MaxRecvDataSegmentLength.
John Baldwin [Tue, 26 Oct 2021 21:52:40 +0000 (14:52 -0700)]
ctld: Always declare MaxRecvDataSegmentLength.

This key is Declarative and should always be sent even if the
initiator did not send it's own limit.  This is similar to the fix in
fc79cf4fea72 but for the target side.  However, unlike that fix,
failure to send the key simply results in reduced performance.

PR: 259439
Reviewed by: mav, emaste
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32651

(cherry picked from commit 7ef7b252adc0152e5f726d00640124c5de0909a9)

2 years agoktls_ocf: Fix a few places to not hardcode the GMAC hash length.
John Baldwin [Tue, 25 May 2021 23:59:18 +0000 (16:59 -0700)]
ktls_ocf: Fix a few places to not hardcode the GMAC hash length.

This is not a functional change as the Poly1305 hash is the same
length as the GMAC hash length.

Reviewed by: gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30137

(cherry picked from commit 4a92afae7fcbb0a8453712dfec5de086aaf5cba4)

2 years agoktls: Use COUNTER_U64_DEFINE_EARLY for the ktls_toe_chacha20 counter.
John Baldwin [Sat, 20 Feb 2021 00:33:46 +0000 (16:33 -0800)]
ktls: Use COUNTER_U64_DEFINE_EARLY for the ktls_toe_chacha20 counter.

I missed updating this counter when rebasing the changes in
9c64fc40290e08f6dc6b75aa04084b04e48a61af after the switch to
COUNTER_U64_DEFINE_EARLY in 1755b2b9891bb1bfa7a58383ef5126821f7e46e3.

Fixes: 9c64fc40290e Add Chacha20-Poly1305 as a KTLS cipher suite.
Sponsored by: Netflix

(cherry picked from commit 90972f04026a2248d616d7466053ff53cf8fdf9d)

2 years agoAdd Chacha20-Poly1305 support in the OCF backend for KTLS.
John Baldwin [Thu, 18 Feb 2021 17:24:26 +0000 (09:24 -0800)]
Add Chacha20-Poly1305 support in the OCF backend for KTLS.

This supports Chacha20-Poly1305 for both send and receive for TLS 1.2
and for send in TLS 1.3.

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27841

(cherry picked from commit 4dd6800e22b08fa1f756115600e9436818abb168)

2 years agoAdd Chacha20-Poly1305 as a KTLS cipher suite.
John Baldwin [Thu, 18 Feb 2021 17:23:59 +0000 (09:23 -0800)]
Add Chacha20-Poly1305 as a KTLS cipher suite.

Chacha20-Poly1305 for TLS is an AEAD cipher suite for both TLS 1.2 and
TLS 1.3 (RFCs 7905 and 8446).  For both versions, Chacha20 uses the
server and client IVs as implicit nonces xored with the record
sequence number to generate the per-record nonce matching the
construction used with AES-GCM for TLS 1.3.

Reviewed by: gallatin
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27839

(cherry picked from commit 9c64fc40290e08f6dc6b75aa04084b04e48a61af)

2 years agocxgbe: Only run ktls_tick when NIC TLS is enabled.
John Baldwin [Thu, 14 Oct 2021 17:59:16 +0000 (10:59 -0700)]
cxgbe: Only run ktls_tick when NIC TLS is enabled.

Previously the body of ktls_tick was a nop when NIC TLS was disabled,
but the callout was still scheduled consuming power on otherwise-idle
systems with Chelsio T6 adapters.  Now the callout only runs while NIC
TLS is enabled on at least one interface of an adapter.

Reported by: mav
Reviewed by: np, mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32491

(cherry picked from commit ef3f98ae4778a8d4463166c5ff3c7831099c6048)

2 years agobhyve: Support setting the disk serial number for VirtIO block devices.
John Baldwin [Fri, 17 Sep 2021 16:55:06 +0000 (09:55 -0700)]
bhyve: Support setting the disk serial number for VirtIO block devices.

Reviewed by: allanjude
Obtained from: illumos
Differential Revision: https://reviews.freebsd.org/D31983

(cherry picked from commit c6efcb1281f3518a92fdc579d2c3c3c74eb6070c)

2 years agoStop creating socket aio kprocs during boot.
John Baldwin [Tue, 12 Oct 2021 21:03:07 +0000 (14:03 -0700)]
Stop creating socket aio kprocs during boot.

Create the initial pool of kprocs on demand when the first socket AIO
request is submitted instead.  The pool of kprocs used for other AIO
requests is similarly created on first use.

Reviewed by: asomers
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D32468

(cherry picked from commit d1b6fef0751b70819e632d7d4722efbc8f94b80b)

2 years agocrypto: Don't assert on valid IV length for Chacha20-Poly1305.
John Baldwin [Tue, 9 Nov 2021 18:52:30 +0000 (10:52 -0800)]
crypto: Don't assert on valid IV length for Chacha20-Poly1305.

The assertion checking for valid IV lengths added in 1833d6042c9a
was not properly updated to permit an IV length of 8 in commit
42dcd39528c6.

Reported by: syzbot+f0c0559b8be1d6eb28c7@syzkaller.appspotmail.com
Reviewed by: markj
Fixes: 42dcd39528c6 crypto: Support Chacha20-Poly1305 with a nonce size of 8 bytes.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32860

(cherry picked from commit 442ad83e38e8fda46d9facbd1ddd92bc23e3773e)

2 years agoAllow GEOM utilities to specify a -v option.
Kirk McKusick [Thu, 11 Nov 2021 20:10:28 +0000 (12:10 -0800)]
Allow GEOM utilities to specify a -v option.

Follow up for 3c8192eb8267

(cherry picked from commit e38717c1282f8bc8b16389839bea015359413df8)

2 years agoAllow GEOM utilities to specify a -v option.
Kirk McKusick [Fri, 29 Oct 2021 05:49:48 +0000 (22:49 -0700)]
Allow GEOM utilities to specify a -v option.

(cherry picked from commit 68bff4a07e3fa6c30a0c0ff6cf5f0bef95dcbd72)

2 years agortsol/rtsold: Add option to skip random delay
Colin Percival [Tue, 16 Nov 2021 18:24:05 +0000 (10:24 -0800)]
rtsol/rtsold: Add option to skip random delay

In accordance with a SHOULD in RFC 4861, rtsol and rtsold wait a
random time between zero and one (aka MAX_RTR_SOLICITATION_DELAY)
seconds before sending a Router Solicitation, in order to avoid
network congestion if many hosts come online at once.  (The
question of how many hosts would be required to cause congestion
by each sending a single packet on a Gbps+ network is left to the
reader.)

The new option -i disables this wait and instructs rtsol and rtsold
to send the Router Solicitation immediately.

Relnotes: yes
Sponsored by: https://www.patreon.com/cperciva
Differential Revision: https://reviews.freebsd.org/D32956

(cherry picked from commit 231bac4ccc431381d70c966a5bd5a95fbfc1f163)