Commit graph

267108 commits

Author SHA1 Message Date
Zhenlei Huang
eaab06d53d 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 7acd322ebe)
2021-11-24 17:45:51 +01:00
Mateusz Piotrowski
51f4d6a6bc top.1: Use the Dq macros instead of \*lq and \*rq
MFC after:	3 days

(cherry picked from commit 01e3140571)
2021-11-24 17:10:31 +01:00
Mateusz Piotrowski
745ffe0ee8 top.1: Improve description of -m
Describe -m argument as "mode" instead of "display".

MFC after:	3 days

(cherry picked from commit c947fc5fae)
2021-11-24 17:10:04 +01:00
Mateusz Piotrowski
5f3b6ce64f 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:		9d6cce02a7
MFC after:	3 days

(cherry picked from commit b8135ed67c)
2021-11-24 17:09:31 +01:00
Mateusz Piotrowski
cd66a1b1c8 top.1: Sort options alphabetically
While here, add a short sentence introducing the options.

MFC after:	3 days

(cherry picked from commit 1125390415)
2021-11-24 17:07:02 +01:00
Mateusz Piotrowski
615b3385c9 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 82d0f865ee)
2021-11-24 17:03:37 +01:00
Mark Johnston
f695727330 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 8a693ccf86)
2021-11-24 10:55:37 -05:00
Andriy Gapon
f1d2f22b34 pca954x: driver for PCA954x / TCA954x I2C switches
At the moment only PCA9548A is supported and has been tested.

(cherry picked from commit c0525ab1d1)
2021-11-24 16:19:09 +02:00
John Baldwin
c8c2d908dd 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 0177102173)
2021-11-23 15:48:07 -08:00
John Baldwin
05504819e3 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 6a3a6fe34b)
2021-11-23 15:47:57 -08:00
John Baldwin
e1d8f7fc1d 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 753bcca440)
2021-11-23 15:47:52 -08:00
John Baldwin
d7b47e163d 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 16bea05ac3)
2021-11-23 15:11:54 -08:00
John Baldwin
abb212fe13 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 694c708d6a)
2021-11-23 15:11:54 -08:00
John Baldwin
b2d704ea88 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 d71830cdf0)
2021-11-23 15:11:54 -08:00
John Baldwin
6987f78ea1 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 83a54b582f)
2021-11-23 15:11:54 -08:00
John Baldwin
e91446cd84 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 233ce578a4)
2021-11-23 15:11:54 -08:00
John Baldwin
38b44748ab ktls: Add simple receive tests of kernel TLS.
Similar to the simple transmit tests added in
a10482ea74, 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 3e7f8a8da2)
2021-11-23 15:11:53 -08:00
John Baldwin
32993b8e58 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 d1c369f926)
2021-11-23 15:11:53 -08:00
John Baldwin
94280c5811 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 900a28fe33)
2021-11-23 15:11:53 -08:00
John Baldwin
27d29db0fa 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 0ff2a12ae3)
2021-11-23 15:11:53 -08:00
John Baldwin
9b6f4b35d2 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 44265dc3da)
2021-11-23 15:11:53 -08:00
John Baldwin
93074f595e 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 522a2aa761)
2021-11-23 15:11:53 -08:00
John Baldwin
d8feb950a6 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 e900338c09)
2021-11-23 15:11:53 -08:00
John Baldwin
aa7aa23171 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 4e057806cf)
2021-11-23 15:11:49 -08:00
John Baldwin
351541661c 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 7178578192)
2021-11-23 15:11:45 -08:00
Ed Maste
64ecbc0cd3 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 e818178e3a)
2021-11-23 15:11:45 -08:00
John Baldwin
71e6792cbe 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 a10482ea74)
2021-11-23 15:11:45 -08:00
John Baldwin
81b6dba1a0 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 4827bf76bc)
2021-11-23 15:11:45 -08:00
John Baldwin
ba6b771d17 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 9f03d2c001)
2021-11-23 15:11:44 -08:00
John Baldwin
0053fedc1b 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 a63752cce6)
2021-11-23 15:11:44 -08:00
John Baldwin
412a8b92d9 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:		4f0f5bf995 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 cdbc4a074b)
2021-11-23 15:11:44 -08:00
John Baldwin
9811763b41 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 4f0f5bf995)
2021-11-23 15:11:44 -08:00
John Baldwin
b3d02f0be3 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
fc79cf4fea 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 7ef7b252ad)
2021-11-23 15:11:44 -08:00
John Baldwin
5ce0850641 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 4a92afae7f)
2021-11-23 15:11:44 -08:00
John Baldwin
6afc00ed13 ktls: Use COUNTER_U64_DEFINE_EARLY for the ktls_toe_chacha20 counter.
I missed updating this counter when rebasing the changes in
9c64fc4029 after the switch to
COUNTER_U64_DEFINE_EARLY in 1755b2b989.

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

(cherry picked from commit 90972f0402)
2021-11-23 15:11:44 -08:00
John Baldwin
98641c00a3 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 4dd6800e22)
2021-11-23 15:11:44 -08:00
John Baldwin
b7f27a60ac 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 9c64fc4029)
2021-11-23 15:11:44 -08:00
John Baldwin
ff590791ff 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 ef3f98ae47)
2021-11-23 15:11:43 -08:00
John Baldwin
5f6c2bd03b 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 c6efcb1281)
2021-11-23 15:11:43 -08:00
John Baldwin
b07b1f890e 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 d1b6fef075)
2021-11-23 15:11:43 -08:00
John Baldwin
7ec9f24cdb crypto: Don't assert on valid IV length for Chacha20-Poly1305.
The assertion checking for valid IV lengths added in 1833d6042c
was not properly updated to permit an IV length of 8 in commit
42dcd39528.

Reported by:	syzbot+f0c0559b8be1d6eb28c7@syzkaller.appspotmail.com
Reviewed by:	markj
Fixes:		42dcd39528 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 442ad83e38)
2021-11-23 15:11:34 -08:00
Kirk McKusick
8b495114ea Allow GEOM utilities to specify a -v option.
Follow up for 3c8192eb8267

(cherry picked from commit e38717c128)
2021-11-23 15:04:33 -08:00
Kirk McKusick
0fdc76eaab Allow GEOM utilities to specify a -v option.
(cherry picked from commit 68bff4a07e)
2021-11-23 15:04:33 -08:00
Colin Percival
a0fc5094bf 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 231bac4ccc)
2021-11-23 11:48:50 -08:00
Bjoern A. Zeeb
f4aba8c9f0 if_epair: rework
Rework if_epair(4) to no longer use netisr and dpcpu.
Instead use mbufq and swi_net.
This simplifies the code and seems to make it work better and
no longer hang.

Work largely by bz@, with minor tweaks by kp@.

Reviewed by:	bz, kp
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D31077

(cherry picked from commit 3dd5760aa5)
2021-11-23 16:50:51 +01:00
Mark Johnston
35dfdb88ea unix: Remove a write-only local variable
Reported by:	clang
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 42188bb5c1)
2021-11-23 09:32:46 -05:00
Mark Johnston
8c29b0eeb0 aesni: Avoid a potential out-of-bounds load in AES_GCM_encrypt()
Reported by:	Jenkins (KASAN job)
Reviewed by:	cem, jhb
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4285655adb)
2021-11-23 09:32:33 -05:00
Eugene Grosbein
f085bb0e62 rc.d/rctl: unbreak for distinct /usr filesystem
Both rctl and used xargs utility live in /usr/bin
so add REQUIRE: FILESYSTEMS

Reported by:	Peter <pmc@citylink.dinoex.sub.org>

(cherry picked from commit 0c54fe172a)
2021-11-23 15:29:41 +07:00
Cy Schubert
7ae7d3862e RELNOTES: Add comment about WiFi 6 support 2021-11-22 10:42:11 -08:00
Allan Jude
32a2fed6e7 openssl: Fix detection of ARMv7 and ARM64 CPU features
OpenSSL assumes the same value for AT_HWCAP=16 (Linux)
So it ends up calling elf_auxv_info() with AT_CANARY which
returns ENOENT, and all acceleration features are disabled.

With this, my ARM64 test machine runs the benchmark
`openssl speed -evp aes-256-gcm` nearly 20x faster
going from 100 MB/sec to 2000 MB/sec

It also improves sha256 from 300 MB/sec to 1800 MB/sec

This fix has been accepted but not yet merged upstream:
https://github.com/openssl/openssl/pull/17082

PR:		259937
Reviewed by:	manu, imp
MFC after:	immediate
Relnotes:	yes
Fixes:		88e852c0b5 ("OpenSSL: Merge OpenSSL 1.1.1j")
Sponsored by:	Ampere Computing LLC
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D33060

(cherry picked from commit d9bb798725)
2021-11-22 18:12:20 +00:00