Commit Graph

140513 Commits

Author SHA1 Message Date
Jessica Clarke
fa5af3219f xdma: Fix another -Wunused-but-set-variable warning previously missed
MFC after:	1 week
2021-12-10 05:06:54 +00:00
Jessica Clarke
434cb1c4a6 riscv: Fix PLIC -Wunused-but-set-variable warnings 2021-12-10 04:51:32 +00:00
Jessica Clarke
d90c3b51cc xdma: Fix -Wunused-but-set-variable warnings
MFC after:	1 week
2021-12-10 04:48:51 +00:00
Alexander Motin
8493918868 busdma: Remove outdated comments about Giant.
MFC after:	2 weeks
2021-12-09 22:18:53 -05:00
Florian Walpen
a9545eede4 Add idle priority scheduling privilege group to MAC/priority
Add an idletime user group that allows non-root users to run processes
with idle scheduling priority. Privileges are granted by a MAC policy in
the mac_priority module. For this purpose, the kernel privilege
PRIV_SCHED_IDPRIO was added to sys/priv.h (kernel module ABI change).

Deprecate the system wide sysctl(8) knob
security.bsd.unprivileged_idprio which lets any user run idle priority
processes, regardless of context. While the knob is still working, it is
marked as deprecated in the description and in the man pages.

MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D33338
2021-12-10 04:54:48 +02:00
Florian Walpen
a20a2450cd Add PRIV_SCHED_IDPRIO
The privilege allows the holder to assign idle priority type to thread
or process.

MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D33338
2021-12-10 04:54:48 +02:00
Alexander Motin
35b2021a0a ahc: Mark sysctls with CTLFLAG_MPSAFE.
MFC after:	2 weeks
2021-12-09 21:36:21 -05:00
Alexander Motin
35efbedc98 fxp: Mark sysctls with CTLFLAG_MPSAFE.
MFC after:	2 weeks
2021-12-09 21:16:16 -05:00
Alexander Motin
fdec27ed82 wbwd: Mark sysctls with CTLFLAG_MPSAFE.
MFC after:	2 weeks
2021-12-09 21:13:10 -05:00
Alexander Motin
a69f810466 smist: Remove unneeded Giant from bus_dma_tag_create().
bus_dmamap_load() call uses BUS_DMA_NOWAIT.

MFC after:	2 weeks
2021-12-09 20:54:22 -05:00
Alexander Motin
e06c67eef8 hptiop: Remove Giant locking around ioctls.
The methods have their own locking and don't require Giant.

MFC after:	2 weeks
2021-12-09 20:35:21 -05:00
Alexander Motin
63e0f96ace hpt27xx: Remove FreeBSD 9.x support including Giant.
MFC after:	2 weeks
2021-12-09 20:24:29 -05:00
Alexander Motin
5ae7518b7b fxp: Remove unneeded Giant from bus_dma_tag_create().
All bus_dmamap_load() calls here use BUS_DMA_NOWAIT.

MFC after:	2 weeks
2021-12-09 20:09:48 -05:00
Alexander Motin
de291c5d10 acpi_cpu: Replace Giant with bus_topo_lock. 2021-12-09 20:08:25 -05:00
Warner Losh
21e22be91a ed: Remove options
ed(4) was removed some time ago, but these options relevant to only it
weren't GC'd at the time. Remove them.

Sponsored by:		Netflix
2021-12-09 17:41:39 -07:00
Warner Losh
96e500a3f9 hda: Push giant / newbus topo lock down a layer
Rather than picking up Giant at the start of these sysctl handlers, push
acquiring Giant down a layer to protect walking the children and also
to add/delete children for the reconfigure.

Sponsored by:		Netflix
Reviewed by:		mav, jhb
Differential Revision:	https://reviews.freebsd.org/D33057
2021-12-09 17:04:58 -07:00
Warner Losh
d14bc7230b newbus: add bus_topo_assert
Add bus_topo_assert() and implmement it as GIANT_REQUIRED for the
moment. This will allow us to change more easily to a newbus-specific
lock int he future.

Sponsored by:		Netflix
Reviewed by:		wulf, mav, jhb
Differential Revision:	https://reviews.freebsd.org/D31833
2021-12-09 17:04:57 -07:00
Warner Losh
815a0973b2 bus: mark sysctls MPSAFE
Mark the sysctls MPSAFE and pickup the bus topo lock while processing
them.

Sponsored by:		Netflix
Reviewed by:		mav, jhb
Differential Revision:	https://reviews.freebsd.org/D31832
2021-12-09 17:04:57 -07:00
Warner Losh
c6df6f5322 Create wrapper for Giant taken for newbus
Create a wrapper for newbus to take giant and for busses to take it too.
bus_topo_lock() should be called before interacting with newbus routines
and unlocked with bus_topo_unlock(). If you need the topology lock for
some reason, bus_topo_mtx() will provide that.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D31831
2021-12-09 17:04:45 -07:00
Rick Macklem
ab639f2398 nfscl: Check for an error return from nfsrv_getattrbits()
There were two places where the client code did not check
for a parse error return from nfsrv_getattrbits().

This patch fixes both of these cases.

Reported by:	rtm@lcs.mit.edu
Tested by:	rtm@lcs.mit.edu
PR:	260272
MFC after:	2 weeks
2021-12-09 14:32:22 -08:00
Rick Macklem
d9931c2561 nfscl: Sanity check the callback tag length
The sanity check for tag length in a callback request
was broken in two ways:

It checked for a negative value, but not a large positive
value.

It did not set taglen to -1, to indicate to the code that
it should not be used.

This patch fixes both of these issues.

Reported by:	rtm@lcs.mit.edu
Tested by:	rtm@lcs.mit.edu
PR:	260266
MFC after:	2 weeks
2021-12-09 14:15:48 -08:00
Dmitry Chagin
0f74021fb6 pseudofs: Destroy vncache hashtbl on pseudofs module unload.
Reviewed by:		mjg, kib
Differential Revision:	https://reviews.freebsd.org/D31605
MFC after:		2 weeks
2021-12-09 21:41:08 +00:00
John Baldwin
1a62e9bc00 Add <machine/tls.h> header to hold MD constants and helpers for TLS.
The header exports the following:

- Definition of struct tcb.
- Helpers to get/set the tcb for the current thread.
- TLS_TCB_SIZE (size of TCB)
- TLS_TCB_ALIGN (alignment of TCB)
- TLS_VARIANT_I or TLS_VARIANT_II
- TLS_DTV_OFFSET (bias of pointers in dtv[])
- TLS_TP_OFFSET (bias of "thread pointer" relative to TCB)

Note that TLS_TP_OFFSET does not account for if the unbiased thread
pointer points to the start of the TCB (arm and x86) or the end of the
TCB (MIPS, PowerPC, and RISC-V).

Note also that for amd64, the struct tcb does not include the unused
tcb_spare field included in the current structure in libthr.  libthr
does not use this field, and the existing calls in libc and rtld that
allocate a TCB for amd64 assume it is the size of 3 Elf_Addr's (and
thus do not allocate room for tcb_spare).

A <sys/_tls_variant_i.h> header is used by architectures using
Variant I TLS which uses a common struct tcb.

Reviewed by:	kib (older version of x86/tls.h), jrtc27
Sponsored by:	The University of Cambridge, Google Inc.
Differential Revision:	https://reviews.freebsd.org/D33351
2021-12-09 13:17:13 -08:00
John Baldwin
03f6b14106 mips: Rename TLS_DTP_OFFSET to TLS_DTV_OFFSET.
This is the more standard name for the bias of dtv pointers used on
other platforms.  This also fixes a few other places that were using
the wrong bias previously on MIPS such as dlpi_tls_data in struct
dl_phdr_info and the recently added __libc_tls_get_addr().

Reviewed by:	kib, jrtc27
Sponsored by:	The University of Cambridge, Google Inc.
Differential Revision:	https://reviews.freebsd.org/D33346
2021-12-09 13:16:00 -08:00
Mateusz Guzik
e735fa3212 net/if.c: plug set-but-not-unused vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 20:39:40 +00:00
Mateusz Guzik
f955fec726 ioat: plug set-but-not-unused vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 20:21:16 +00:00
John Baldwin
ec434c85b4 Bump __FreeBSD_version for software crypto changes.
- enc_xform now supports AEAD ciphers.
- The Blake-2S/B auth transforms now support Init before
  Setkey like other auth transforms.
2021-12-09 11:53:07 -08:00
John Baldwin
dc475c9bee cryptosoft: Stop single-threading requests within a session.
All of the request handlers no longer modify session state, so remove
the mutex limiting operations to one per session.  In addition, change
the pointer to the session state passed to process callbacks to const.

Suggested by:	mjg
Reviewed by:	mjg, markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33317
2021-12-09 11:52:43 -08:00
John Baldwin
6113a08b98 cryptosoft: Fully support per-operation keys for auth algorithms.
Only pre-allocate auth contexts when a session-wide key is provided or
for sessions without keys.  For sessions with per-operation keys,
always initialize the on-stack context directly rather than
initializing the session context in swcr_authprepare (now removed) and
then copying that session context into the on-stack context.

This approach permits parallel auth operations without needing a
serializing lock.  In addition, the previous code assumed that auth
sessions always provided an initial key unlike cipher sessions which
assume either an initial key or per-op keys.

While here, fix the Blake2 auth transforms to function like other auth
transforms where Setkey is invoked after Init rather than before.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33316
2021-12-09 11:52:42 -08:00
John Baldwin
b54d12841e cryptosoft: Allocate cipher contexts on the stack during operations.
As is done with authentication contexts, allocate cipher contexts on
the stack while completing requests.  This permits safely dispatching
concurrent requests on a single session.  The cipher context in the
session is now only allocated when a session key is provided during
session setup to serve as a template to initialize the on-stack
context similar to auth operations.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33198
2021-12-09 11:52:42 -08:00
John Baldwin
f313909a50 cryptosoft: Rename sw_kschedule member to sw_ctx.
The cipher context isn't always a key schedule, so use a more generic
name.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33197
2021-12-09 11:52:42 -08:00
John Baldwin
ab91fb6c21 crypto: Refactor software support for AEAD ciphers.
Extend struct enc_xform to add new members to handle auth operations
for AEAD ciphers.  In particular, AEAD operations in cryptosoft no
longer use a struct auth_hash.  Instead, the setkey and reinit methods
of struct enc_xform are responsible for initializing both the cipher
and auth state.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33196
2021-12-09 11:52:42 -08:00
John Baldwin
356c922f74 GMAC: Reset initial hash value and counter in AES_GMAC_Reinit().
Previously, these values were only cleared in AES_GMAC_Init(), so a
second set of operations could reuse the final hash as the initial
hash.  Currently this bug does not trigger in cryptosoft as existing
GMAC and GCM operations always use an on-stack auth context
initialized from a template context.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33315
2021-12-09 11:52:42 -08:00
John Baldwin
c172a407fb cryptosoft: Reject AES-CCM/GCM sessions with invalid key lengths.
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33195
2021-12-09 11:52:41 -08:00
John Baldwin
6e17a2e00d crypto: Validate AES-GCM IV length in check_csp().
This centralizes the check for valid nonce lengths for AES-GCM.

While here, remove some duplicate checks for valid AES-GCM tag lengths
from ccp(4) and ccr(4).

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33194
2021-12-09 11:52:41 -08:00
John Baldwin
ec498562b7 crypto: Don't assert for empty output buffers.
It is always valid for crp_payload_output_start to be 0.  However, if
an output buffer is empty (e.g. a decryption request with a tag but an
empty payload), the existing assertion failed since 0 is not less than
0.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33193
2021-12-09 11:52:41 -08:00
Navdeep Parhar
357ba2cf17 cxgbe(4): Update firmwares to 1.26.4.0
(Rest is from the README that came with the firmware)

Version : 1.26.4.0
Date    : 12/02/2021

Fixes
-----

BASE:
- Fixed error on setting 25G speed on 100G copper with multiple FEC set in
  firmware commands.
- Handle link of unknown optics modules by enabling module tx unconditionally.
- Fixed link not coming up for 25G CRS phys. Firmware incorrectly tried to
  bring up the link in RS-FEC but as per IEEE spec, it must be BASER FEC.
- Fixed an issue where firmware doesn't automatically retry next FEC if driver
  asks to bring up the link using RS-FEC and link doesn't come up.

Obtained from:	Chelsio Communications
MFC after:	1 month
Sponsored by:	Chelsio Communications
2021-12-09 11:25:31 -08:00
Mateusz Guzik
8ad5b9498e Revert "geom_bde: plug set-but-not-used vars"
The commit at hand happens to break userspace build as the header ins
included by sbin/gbde/gbde.c and the __diagused macro is not provided to
userspace.

Revert until this gets sorted out.

This reverts commit 26e837e2d4.
2021-12-09 19:23:05 +00:00
Bjoern A. Zeeb
df38ada293 modules: increase MAXMODNAME and provide backward compat
With various firmware files used by graphics and wireless drivers
we are exceeding the current 32 character module name (file path
in kldxref) length.
In order to overcome this issue bump it to the maximum path length
for the next version.
To be able to MFC provide backward compat support for another version
of the struct as the offsets for the second half change due to the
array size increase.

MAXMODNAME being defined to MAXPATHLEN needs param.h to be
included first.  With only 7 modules (or LinuxKPI module.h) not
doing that adjust them rather than including param.h in module.h [1].

Reported by:	Greg V (greg unrelenting.technology)
Sponsored by:	The FreeBSD Foundation
Suggested by:	imp [1]
MFC after:	10 days
Reviewed by:	imp (and others to different level)
Differential Revision:	https://reviews.freebsd.org/D32383
2021-12-09 18:09:53 +00:00
Mateusz Guzik
2cc5a480a6 geom_raid3: plug set-but-not-unused vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 18:08:03 +00:00
Mateusz Guzik
c904812018 geom_eli: mostly plug set-but-not-unused vars
The remaining case is an ignored error.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 18:05:06 +00:00
Mateusz Guzik
0d81fba680 geom_mirror: plug set-but-not-unused vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 18:00:27 +00:00
Mateusz Guzik
0a048d4a98 mbuf: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 17:59:11 +00:00
Mateusz Guzik
26e837e2d4 geom_bde: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 17:53:48 +00:00
Mateusz Guzik
a521105980 fxp: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 17:45:12 +00:00
Mateusz Guzik
793c74e415 arm/freescale: remove FBIOSCURSOR
Unbreaks building EFIKA_MX

Fixes:	b9d3b253e2 ("fb: Remove unused cursors ioctls")
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 17:00:43 +00:00
Mateusz Guzik
81f64bc0db firewire: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 16:37:26 +00:00
Mateusz Guzik
cf8e3ea23f pcm: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 16:37:26 +00:00
Mateusz Guzik
d8664f6e2f et: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 16:37:26 +00:00
Mateusz Guzik
b9723c5ba9 amdtemp: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 16:37:26 +00:00