Commit graph

267121 commits

Author SHA1 Message Date
Ed Maste c433c96d86 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
2021-11-25 11:54:12 -05:00
Ed Maste ab3f1b678d cloudabi: add deprecation notice in stable branches
It has been removed from main before 14.0.

Sponsored by:	The FreeBSD Foundation
2021-11-25 11:54:11 -05:00
Guangyuan Yang 3218666bd0 bridge(4): Use American spelling of "behavior"
Fixes:		8406182dbe
Reported by:	Pau Amma <pauamma@gundo.com>

(cherry picked from commit 28ba36c65d)
2021-11-25 00:01:16 -05:00
Konstantin Belousov b0f2ca4348 kmod_syms.awk: fix removal of the export list from the symbol table
(cherry picked from commit 0d7a6199b6)
2021-11-25 03:09:21 +02:00
Konstantin Belousov 83271c68c4 Fix some modules to export more used symbols
(cherry picked from commit 5bb3134a8c)
2021-11-25 03:09:21 +02:00
Rick Macklem f4e3699069 UPDATING: Add an entry for commit 6e8e261f0d
This is a direct commit.
2021-11-24 16:47:03 -08:00
Rick Macklem 0c8684ae20 param.h: Bump __FreeBSD_version to 1300522
Commit 6e8e261f0d changed the internal KAPI between the NFS modules.
Bump __FreeBSD_version to 1300522.

This is a direct commit.
2021-11-24 16:39:52 -08:00
Rick Macklem 6e8e261f0d 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 44744f7538)
2021-11-24 16:32:09 -08:00
Rick Macklem 354988ca3f 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 f8dc06303b)
2021-11-24 14:35:03 -08:00
Rick Macklem 3f539826e1 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 d70ca5b00e)
2021-11-24 14:31:55 -08:00
Ka Ho Ng 35f26bdf59 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 f7523c8a19)
2021-11-24 15:17:26 -05:00
Kristof Provost 094b79ea73 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 11703705c2)
2021-11-24 17:45:51 +01:00
Kristof Provost 576d71e383 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 23e1961e78)
2021-11-24 17:45:51 +01:00
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