Commit Graph

269142 Commits

Author SHA1 Message Date
John Baldwin
655eb762c3 aesni: Support AES-CCM requests with a truncated tag.
Reviewed by:	sef
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32115
2021-10-06 14:08:48 -07:00
John Baldwin
c09c379c7a aesni: Permit AES-CCM requests with neither payload nor AAD.
Reviewed by:	sef
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32114
2021-10-06 14:08:47 -07:00
John Baldwin
d718c2d3c8 aesni: Handle requests with an empty payload.
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32113
2021-10-06 14:08:47 -07:00
John Baldwin
8e6af6adfc aesni: Support multiple nonce lengths for AES-CCM.
Reviewed by:	sef
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32112
2021-10-06 14:08:47 -07:00
John Baldwin
ae18720d27 crypto: Support multiple nonce lengths for AES-CCM.
Permit nonces of lengths 7 through 13 in the OCF framework and the
cryptosoft driver.  A helper function (ccm_max_payload_length) can be
used in OCF drivers to reject CCM requests which are too large for the
specified nonce length.

Reviewed by:	sef
Sponsored by:	Chelsio Communications, The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32111
2021-10-06 14:08:47 -07:00
John Baldwin
bcb0fd6acc cryptocheck: Support multiple IV sizes for AES-CCM.
By default, the "normal" IV size (12) is used, but it can be overriden
via -I.  If -I is not specified and -z is specified, issue requests
for all possible IV sizes.

Reviewed by:	markj
Sponsored by:	 Chelsio Communications, The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32110
2021-10-06 14:08:47 -07:00
John Baldwin
a0cbcbb791 cryptodev: Allow some CIOCCRYPT operations with an empty payload.
If an operation would generate a MAC output (e.g. for digest operation
or for an AEAD or EtA operation), then an empty payload buffer is
valid.  Only reject requests with an empty buffer for "plain" cipher
sessions.

Some of the AES-CCM NIST KAT vectors use an empty payload.

While here, don't advance crp_payload_start for requests that use an
empty payload with an inline IV. (*)

Reported by:	syzbot+d4b94fbd9a44b032f428@syzkaller.appspotmail.com (*)
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32109
2021-10-06 14:08:47 -07:00
John Baldwin
70dbebea12 cryptodev: Permit CIOCCRYPT for AEAD ciphers.
A request without AAD for an AEAD cipher can be submitted via
CIOCCRYPT rather than CIOCCRYPTAEAD.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32108
2021-10-06 14:08:47 -07:00
John Baldwin
16676123fc cryptodev: Permit explicit IV/nonce and MAC/tag lengths.
Add 'ivlen' and 'maclen' fields to the structure used for CIOGSESSION2
to specify the explicit IV/nonce and MAC/tag lengths for crypto
sessions.  If these fields are zero, the default lengths are used.

This permits selecting an alternate nonce length for AEAD ciphers such
as AES-CCM which support multiple nonce leengths.  It also supports
truncated MACs as input to AEAD or ETA requests.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32107
2021-10-06 14:08:46 -07:00
John Baldwin
5ae5ed5b8f cryptosoft, ccr: Use crp_iv directly for AES-CCM and AES-GCM.
Rather than copying crp_iv to a local array on the stack that is then
passed to xform reinit routines, pass crp_iv directly and remove the
local copy.

Reviewed by:	markj
Sponsored by:	Chelsio Communications, The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32106
2021-10-06 14:08:46 -07:00
John Baldwin
1833d6042c crypto: Permit variable-sized IVs for ciphers with a reinit hook.
Add a 'len' argument to the reinit hook in 'struct enc_xform' to
permit support for AEAD ciphers such as AES-CCM and Chacha20-Poly1305
which support different nonce lengths.

Reviewed by:	markj
Sponsored by:	Chelsio Communications, The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32105
2021-10-06 14:08:46 -07:00
John Baldwin
cb128893b9 ccp, ccr: Simplify drivers to assume an AES-GCM IV length of 12.
While here, use crypto_read_iv() in a few more places in ccr(4) that I
missed previously.

Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D32104
2021-10-06 14:08:46 -07:00
John Baldwin
b4e0a27c5b cryptodev: Use 'csp' in the handlers for requests.
- Retire cse->mode and use csp->csp_mode instead.
- Use csp->csp_cipher_algorithm instead of the ivsize when checking
  for the fixup for the IV length for AES-XTS.

Reviewed by:	markj
Sponsored by:	Chelsio Communications, The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32103
2021-10-06 14:08:46 -07:00
Kevin Bowling
28ccd780a9 e1000: Function prototype cleanup
Drop arguments of function prototypes since the file is mixed between
listing arg names and not.

No functional changes

Reviewed by:	markj
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D32329
2021-10-06 14:03:38 -07:00
Felix Johnson
e7f8f3b95e login.conf.5: Mark passwordtime as implemented
login.conf.5 listed passwordtime in RESERVED CAPABILITIES, which is a
section for capabilities not implemented in the base system. However,
passwordtime has been implemented in the base for several years now.

PR:		246099
Reported by:	avg
Reviewed by:	0mp
MFC after:	3 days
2021-10-06 22:51:22 +02:00
Alan Somers
f44a448709 fusefs: fix intermittency in the dev_fuse_poll test
The DevFusePoll::access/select test would occasionally segfault.  The
cause was a file descriptor that was shared between two threads.  The
first thread would kill the second and close the file descriptor.  But
it was possible that the second would read the file descriptor before it
shut down.  That did not cause problems for kqueue, poll, or blocking
operation, but it triggered segfaults in select's macros.

MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D32142
2021-10-06 14:28:48 -06:00
Mark Johnston
880b670c6f malloc: Unmark KASAN redzones if the full allocation size was requested
Consumers that want the full allocation size will typically access the
full buffer, so mark the entire allocation as valid to avoid useless
KASAN reports.

Sponsored by:	The FreeBSD Foundation
2021-10-06 16:09:41 -04:00
Alan Somers
032a5bd55b fusefs: Fix a bug during VOP_STRATEGY when the server changes file size
If the FUSE server tells the kernel that a file's size has changed, then
the kernel must invalidate any portion of that file in cache.  But the
kernel can't do that during VOP_STRATEGY, because the file's buffers are
already locked.  Instead, proceed with the write.

PR:		256937
Reported by:	Agata <chogata@moosefs.pro>
Tested by:	Agata <chogata@moosefs.pro>
MFC after:	2 weeks
Reviewed by:	pfg
Differential Revision: https://reviews.freebsd.org/D32332
2021-10-06 14:07:33 -06:00
Alan Somers
7430017b99 fusefs: fix a recurse-on-non-recursive lockmgr panic
fuse_vnop_bmap needs to know the file's size in order to calculate the
optimum amount of readahead.  If the file's size is unknown, it must ask
the FUSE server.  But if the file's data was previously cached and the
server reports that its size has shrunk, fusefs must invalidate the
cached data.  That's not possible during VOP_BMAP because the buffer
object is already locked.

Fix the panic by not querying the FUSE server for the file's size during
VOP_BMAP if we don't need it.  That's also a a slight performance
optimization.

PR:		256937
Reported by:	Agata <chogata@moosefs.pro>
Tested by:	Agata <chogata@moosefs.pro>
MFC after:	2 weeks
2021-10-06 14:07:33 -06:00
Alan Somers
5d94aaacb5 fusefs: quiet some cache-related warnings
If the FUSE server does something that would make our cache incoherent,
we should print a warning to the user.  However, we previously warned in
some situations when we shouldn't, such as if the file's size changed on
the server _after_ our own attribute cache had expired.  This change
suppresses the warning in cases like that.  It also moves the warning
logic to a single place within the code.

PR:		256936
Reported by:	Agata <chogata@moosefs.pro>
Tested by:	Agata <chogata@moosefs.pro>, jSML4ThWwBID69YC@protonmail.com
MFC after:	2 weeks
2021-10-06 14:07:33 -06:00
Mark Johnston
a76de17715 linuxkpi: Handle a NULL cache pointer in kmem_cache_destroy()
This is compatible with Linux, and some driver error paths depend on it.

Reviewed by:	bz, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32337
2021-10-06 14:49:39 -04:00
Elyes HAOUAS
da3278ded3 ntp.conf.5: Fix typos
"certian" --> "certain"
"compatability" --> "compatibility"
"noticable" --> "noticeable"
"limite" --> "limit"
"acutal" --> "actual"
"ba" --> "be"

MFC after:	1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/550
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-10-06 10:16:04 -04:00
Konstantin Belousov
9b86d3e5de When queuing ignored signal, only abort target thread' sleep if it is inside sigwait()
Reported and tested by:	trasz
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32252
2021-10-06 17:05:22 +03:00
Konstantin Belousov
f17eb93d55 When sending ignored signal, arrange for zero return code from sleep
Otherwise consumers get unexpected EINTR errors without seeing
a properly discarded signal.

Reported and tested by:	trasz
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32252
2021-10-06 17:05:22 +03:00
Konstantin Belousov
b599982b65 Move td_pflags2 TDP2_SIGWAIT to td_flags TDF_SIGWAIT
The flag should be accessible from non-current threads.

Reviewed by:	markj
Tested by:	trasz
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32252
2021-10-06 17:05:22 +03:00
Kyle Evans
7f4bb50176 login: use sizeof(audit_cond) consistently, NFC
The other three instances were already converted to use audit_cond, this
one was just changed from sizeof(long) -> sizeof(int).
2021-10-05 23:25:29 -05:00
Konstantin Belousov
8d3cd7767a Fix mistakes in link(2) and shm_open(2)
PR:	258957
Submitted by:	sigsys@gmail.com
MFC after:	1 week
2021-10-06 06:38:26 +03:00
Konstantin Belousov
ce21d4bff1 amd64 efirt: do not flush cache for runtime pages
We actually do not know is it safe or not to flush cache for random
BAR/register page existing in the system.  It is well-known that for
instance LAPICs cannot tolerate cache flush.  As report indicates,
there are more such devices.

This issue typically affects AMD machines which do not report self-snoop,
causing real CLFLUSH invocation on the mapped pages.  Intels do self-snoop,
so this change should be nop for them, and unsafe devices, if any, are
already ignored.

Reported and tested by:	manu
Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32318
2021-10-06 05:53:20 +03:00
Konstantin Belousov
33c17670af amd64: add pmap_page_set_memattr_noflush()
Similar to pmap_page_set_memattr() by setting MD page cache attribute
to the argument.  Unlike pmap_page_set_memattr(), does not flush cache
for the direct mapping of the page.

Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32318
2021-10-06 05:53:12 +03:00
Konstantin Belousov
f8d3368b43 apic: initialize lapic_paddr statically
The default value for LAPIC registers page physical address
is usually right. Having this value available early makes
pmap_force_invalidate_cache_range(), used on non-self-snoop machines,
avoid flushing LAPIC range for early calls.

Reviewed by:	alc, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32318
2021-10-06 05:52:56 +03:00
Elyes HAOUAS
7102ec5226 unifdef.1: Fix typo on "input"
Pull request: https://github.com/freebsd/freebsd-src/pull/549
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-10-05 20:27:16 -04:00
John Baldwin
680d70b59e sysdecode_enum.3: Fix a typo: SIGBTRAP -> SIGTRAP.
MFC after:	3 days
Sponsored by:	DARPA
2021-10-05 14:55:18 -07:00
Tom Hukins
70ffa69e1b Remove obsolete amd(8) rc.conf configuration
The script that used these was removed in 13f7dbe822 along with amd
itself.

Fixes:		13f7dbe822 ("retire amd(8)")
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/548
2021-10-05 17:16:58 -04:00
Alexander Motin
730ea72c70 cam(4): Limit search for disks in SES enclosure by single bus
At least for SAS that we only support now disks are typically
connected to the same bus as the enclosure.  Limiting the search
scope makes it much faster on systems with multiple buses and
thousands of disks.

Reviewed by:	imp
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D32305
2021-10-05 15:01:16 -04:00
Alexander Motin
8f9be1eed1 cam(4): Improve XPT_DEV_MATCH
Remove *_MATCH_NONE enums, making no sense and so never used.  Make
*_MATCH_ANY enums 0 (no any match flags set), previously used by
*_MATCH_NONE.  Bump CAM_VERSION to 0x1a reflecting those changes and
add compat shims.

When traversing through buses and devices do not descend if we can
already see that requested pattern does not match the bus or device.
It allows to save significant amount of time on system with thousands
of disks when doing limited searches.

Reviewed by:	imp
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D32304
2021-10-05 14:54:03 -04:00
Alexander Motin
7835b2cb4a sbuf(9): Microoptimize sbuf_put_byte()
This function is actively used by sbuf_vprintf(), so this simple
inlining in half reduces time of kern.geom.confxml generation.

MFC after:	2 weeks
Sponsored by:	iXsystem, Inc.
2021-10-05 14:47:38 -04:00
Warner Losh
b3b15d9256 cam: Add doxygen for cam_sim_free
Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D32303
2021-10-05 07:07:47 -06:00
Mateusz Guzik
cee9a741b2 cesa: remove unused CESA_SESSIONS macro
Unused since 1b0909d51a ("OpenCrypto: Convert sessions to opaque handles
instead of integers")

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-10-05 12:17:10 +00:00
Konstantin Belousov
0eb2dcd32e mlx5_en: fix use of CALLOUT_DIRECT
Reported by:	markj
Reviewed by:	hselasky
Sponsored by:	NVIDIA Networking
MFC after:	1 week
2021-10-05 13:07:36 +03:00
Mateusz Guzik
ae4fb190fd netstat: split ipsec and ipsec6 statistics in libxo
In particular fixes --libxo json

PR:		254673
Reported by:	j.vandeville@gmail.com
Sponsored by:   Rubicon Communications, LLC ("Netgate")
2021-10-05 09:42:58 +00:00
Hans Petter Selasky
5a7de2b42c mlx4en(4): Fix wrong mbuf cluster size in mlx4_en_debugnet_init()
This fixes an "invalid cluster size" panic when debugnet is activated.

panic()
m_getzone()
debugnet_mbuf_reinit()
debugnet_any_ifnet_update()
ifhwioctl()
ifioctl()

Submitted by:	ae@
PR:		258923
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-10-05 10:48:30 +02:00
Stefan Eßer
f902ca97bd Revert erroneous commit ded0d3d486
These files came from a prior commit to contrib/bc and seem to have
been placed in the top of the source tree by a failed git rebase.

Reported by:	markj
2021-10-05 09:41:46 +02:00
Bartlomiej Grzesik
3ac5012e52 sdhci: Fix crash caused by M_WAITOK in sdhci dumps
In some contexts it is illegal to wait for memory allocation, causing
kernel panic. By default sbuf_new passes M_WAITOK to malloc,
which caused crashes when sdhci_dumpcaps or sdhci_dumpregs was callend in
non sutiable context.

Add SBUF_NOWAIT flag to sbuf_new to fix this.

Obtained from:		Semihalf
Differential revision:	https://reviews.freebsd.org/D32075
2021-10-05 06:22:32 +02:00
Konstantin Belousov
be6116fdfc pthread_mutexattr(3): document each pthread_mutexattr_set/get* function
The descriptions may be more elaborated of course, but this is a good
step at starting providing any useful information in our man page, at all.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D32243
2021-10-05 06:39:53 +03:00
Konstantin Belousov
f5b9747075 libthr(3): explain some internals of the locks implementation
Describe internal allocations, mention problems with the use of global
malloc(3) and the reasons for internal allocator existence.

Document shared objects implementation and describe shortcomings of the
chosen approach, as well as the rationale why it was done that way.

Reviewed by:	markj
Discussed with:	jilles
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D32243
2021-10-05 06:39:53 +03:00
Konstantin Belousov
6bda192013 pthread_mutexattr(3): install pthread_mutexattr_get/setpshared links
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D32243
2021-10-05 06:39:52 +03:00
Konstantin Belousov
0a6e5fc29b pthread_mutexattr(3): document pthread_mutexattr_set/getpshared
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D32243
2021-10-05 06:39:52 +03:00
Konstantin Belousov
9f3b6cdbe8 pthread_mutexattr(3): use .Fo/.Fc to avoid too long lines
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential revision:	https://reviews.freebsd.org/D32243
2021-10-05 06:39:52 +03:00
Mark Johnston
f0a08fa9f5 geom_label: Add more validation for NTFS volume tasting
- Ensure that the computed MFT record size isn't negative or larger than
  maxphys before trying to read $Volume.
- Guard against truncated records in volume metadata.
- Ensure that the record length is large enough to contain the volume
  name.
- Verify that the (UTF-16-encoded) volume name's length is a multiple of
  two.

PR:		258833, 258914
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2021-10-04 18:15:06 -04:00
Stefan Eßer
d43fa8ef53 contrib/bc: merge version 5.1.0 from vendor branch
This version adds options and functions that allow to print numbers
in the open interval (-1 .. 1) with or without a leading 0 digit.

Additionally, an option has been added to prevent line wrap and
allows to print arbitrarily long results on a single line.

Merge commit '5d58a51571721190681c50d4bd3a1f45e6282d72'
2021-10-04 22:25:24 +02:00