Commit Graph

140479 Commits

Author SHA1 Message Date
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
Mateusz Guzik
8c3149be54 amd64: plug set-but-not-used vars in pmap
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-12-09 16:37:26 +00:00
Justin Hibbits
d2de68811a Fix assert check for SV_DSO_SIG in exec_sysvec_init_secondary()
The only requirement for SV_DSO_SIG here is that the flags match between
the source and target sysentvec.

The current assertion is too strict and fails on powerpc64, the only
other architecture than amd64 that uses this function, which doesn't
implement sigtramp in a VDSO.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D33355
2021-12-08 22:54:07 -06:00
Alexander Motin
63346fef33 mca: Some error handling logic improvements.
- Enable local MCEs on capable Intel CPUs.  It delivers exceptions
only to the affected CPU instead of global broadcast, requiring a lot
of synchronization between CPUs.  AMD always deliver MCEs locally.
 - Make MCE handler process only uncorrected errors, while CMCI and
polling only corrected.  It reduces synchronization problems between
them and is explicitly recommended by the documentation.
 - Add minimal support for uncorrected software recoverable errors
on Intel CPUs.  It allows to avoid kernel panics in case uncorrected
errors do not affect current operation, like ones found during scrub
or write.  Such errors are only logged, postponing the panic until
the corrupted data will actually be needed (that may never happen).
 - Reduce polling period from 1 hour to 5 minutes.

MFC after:	2 weeks
2021-12-08 21:39:24 -05:00
Konstantin Belousov
b7c55487ff Regen 2021-12-09 02:49:10 +02:00
Konstantin Belousov
5346570276 swapoff: add one more variant of the syscall
Requested and reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33343
2021-12-09 02:48:46 +02:00
Konstantin Belousov
c1a8472793 syscalls: add COMPAT13
Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D33343
2021-12-09 02:48:32 +02:00
John Baldwin
a6765c4b44 libmd: Only define SHA256_Transform_c when using the ARM64 ifunc.
GCC 9 doesn't define a SHA256_Transform symbol when the stub just wraps
SHA256_Transform_c resulting in an undefined symbol for
_libmd_SHA256_Transform in libmd.so.

Discussed with:	andrew, jrtc27
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D31945
2021-12-08 14:25:02 -08:00
Konstantin Belousov
ecd8245e0d Kernel linkers: add emergency sysctl to restore old behavior
allowing linking to static symbols from other files.  Default the new
settings to true, delaying the change of the kernel linker behavior
for other day.

Suggested by:	emaste
PR:	207898
Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32878
2021-12-08 23:32:30 +02:00
Konstantin Belousov
95c20faf11 kernel linker: do not read debug symbol tables for non-debug symbols
In particular, this prevents resolving locals from other files.
To access debug symbol tables, add LINKER_LOOKUP_DEBUG_SYMBOL and
LINKER_DEBUG_SYMBOL_VALUES kobj methods, which are allowed to use
any types of present symbols in all tables.

PR:	207898
Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32878
2021-12-08 23:32:29 +02:00
Konstantin Belousov
72f6662662 linker_debug_symbol_values(): use proper linker interface to get debug values
Reported by:	markj
Reviewed by:	emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32878
2021-12-08 23:32:26 +02:00
Konstantin Belousov
c37c6f994f Style
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32878
2021-12-08 23:32:20 +02:00
Brooks Davis
adb1267505 syscall_args: remove MAXARGS define
Use nitems instead and just use a magic `8` for the size of the args
array.  MAXARGS was rarely used (only in arm64 code) and is an overly
generic name to polute the namespace with.

Requested by:	kib in D33308
2021-12-08 18:45:41 +00:00
Brooks Davis
547566526f Make struct syscall_args machine independent
After a round of cleanups in late 2020, all definitions are
functionally identical.

This removes a rotted __aligned(8) on arm. It was added in
b7112ead32 and was intended to align the
args member so that 64-bit types (off_t, etc) could be safely read on
armeb compiled with clang. With the removal of armev, this is no
longer needed (armv7 requires that 32-bit aligned reads of 64-bit
values be supported and we enable such support on armv6).  As further
evidence this is unnecessary, cleanups to struct syscall_args have
resulted in args being 32-bit aligned on 32-bit systems.  The sole
effect is to bloat the struct by 4 bytes.

Reviewed by:	kib, jhb, imp
Differential Revision:	https://reviews.freebsd.org/D33308
2021-12-08 18:45:33 +00:00
Alexander Motin
9a128e1678 mca: Switch to using taskqueue_enqueue_timeout_sbt().
Previously it was not allowed on fast taskqueues.  It was fixed in
4730a8972b.  This should make no functional change, just a bit
cleaner and efficient code.

MFC after:	1 week
2021-12-08 12:29:15 -05:00
Alexander Motin
3bdba24c74 mca: Decode new Intel status bits.
MFC after:	1 week
2021-12-08 12:03:28 -05:00
Andrew Turner
8d0b41b058 Handle table attributes in the arm64 kernel map
When getting the arm64 kernel maps sysctl we should look at the table
attributes as well as the block/page attributes. These attributes are
different to the last level attributes so need to be translated.

The previous code assumed the table and block/page attributes are
identical, however this is not the case. Handle the difference by
extracting the code into new helper functions & calling them as needed
based on the entry type being checked.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33321
2021-12-08 11:22:17 +00:00
Hubert Mazur
de9c000ced sdhci_fsl_fdt: Add support for HS200/HS400 modes
The controller requires some custom logic to perform MMC tuning
and to later switch to HS400 mode. Implement it supplying mmcbr_tune
and sdhci_set_uhs_timing devmethods respectivly. Since the latter
is called unconditionally when the ios is updated we need to keep
track of the tuning state in sc and execute the HS400 switch logic
only when required.

Two HS200/HS400 related errata were implemented.
1. In HS400 modes the clock divisors are limited to 4, 8, 12.
   Apply it by falling back to the closes, higher divider when needed.
2. Hardware tuning procedure can sometimes fails. If that is the case
   fallback to the software tuning.

Reviewed by: 		manu, mw
Obtained from:		Semihalf
Sponsored by:		Alstom Group
Differential revision:	https://reviews.freebsd.org/D33320
2021-12-08 11:21:02 +01:00
Artur Rojek
ec9333c3aa sdhci_fsl_fdt: Fix vccq reconfiguration
As `vqmmc-supply` is an optional Device Tree property, don't skip vccq
reconfiguration when the regulator is not specified. Instead, accept
voltage specified by the `voltage-ranges` property.

The actual voltage switch is done through a hw register in LS1028A.
Add errata flag for other boards, as they are not supported. Return
not supported error code when switching to 1.8V on affected platforms.

Fixes: b08bf4c35c ("sdhci_fsl_fdt: Skip vccq reconfiguration without regulator")

Co-authored-by: Artur Rojek <ar@semihalf.com>

Reviewed by: 		manu, mw
Obtained from:		Semihalf
Sponsored by:		Alstom Group
Differential revision:	https://reviews.freebsd.org/D33319
2021-12-08 11:21:02 +01:00
Hubert Mazur
44a95c49c2 sdhci_fsl_fdt: Add LS1012A compat string
Add compat string for LS1012A board and fill SoC specific
structure data.

Reviewed by: 		manu, mw
Obtained from: 		Semihalf
Sponsored by:		Alstom Group
Differential Revision:	https://reviews.freebsd.org/D33318
2021-12-08 11:21:02 +01:00
Hans Petter Selasky
8fa952937b ng_ubt(4): Add missing module dependency for _net_bluetooth sysctl node.
Differential Revision:  https://reviews.freebsd.org/D33282
PR:		238235
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-12-08 10:18:32 +01:00
Vincenzo Maffione
e0f4cdba53 e1000: fix interface capabilities management
The e1000 drivers (em, lem, igb) are currently looking at the
iflib copies of the capabilities bitvectors (scctx->isc_capabilities
and scctx->isc_capenable) rather than the ifnet ones
(ifp->if_capabilities and ifp->if_capenable). However, the latter
are the ones that are actually updated by ifconfig and that should
be used by the drivers during interface operation. The former are
set by the driver on interface attach (for iflib internal use)
and should not be used anymore by the driver.
This patch fixes the e1000 driver to use the correct bitvectors.

PR:		260068
Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33154
2021-12-08 08:55:40 +00:00
Hubert Mazur
3785106a5b sdhci_fsl_fdt: Implement pulse width detection errata
Some boards do not detect pulse width reliably.
Implement workaround by writing 0 to special register.
Apply errata for board by adding flag to chosen soc specific data.

Obtained from: Semihalf
Sponsored by: Alstom Group
Reviewed by: mw, manu
Differential Revision: https://reviews.freebsd.org/D33222
2021-12-08 09:34:19 +01:00
Kornel Duleba
cbac9a3613 enetc: Serialize MDIO transactions
In theory we can have multiple concurrent accesses to the MDIO bus,
e.g. link status check tick and ifconfig request.
In that case we need to make sure that all MDIO transaction are
serialized.

Obtained from: Semihalf
Sponsored by: Alstom Group
2021-12-08 09:32:51 +01:00
Kornel Duleba
b3d4891af0 enetc: Fix VID/mcast address hash calculation
The hash is calculated by XOR-ing together bits of the VID.
Prepend a statement with "!!" to make sure that we're get bit 0
on both sides of the equation.

Obtained from: Semihalf
Sponsored by: Alstom Group
2021-12-08 09:32:51 +01:00
Stefan Eßer
49c2c62889 sys/_bitset.h: Fix fall-out from commit 5e04571cf3
The changes to the bitset macros allowed sched.h to be included
into userland programs without name space pollution due to BIT_*
and BITSET_* macros.

The definition of a "struct bitset" had been overlooked. This name
space pollution caused the build of port print/miktex to fail.

This commit makes the definition of struct bitset depend on the
same condition as the visibility of the BIT_* and BITSET_* macros,
i.e. needs _KERNEL or _WANT_FREEBSD_BITSET to be defined before
including sys/_bitset.h.

It has been tested with "make universe" since a prior attempt to
fix the issue broke the PowerPC64 kernel build.

This commit shall be MFCed together with commit 5e04571cf3.

Reported by:    arrowd
MFC after:      1 month
2021-12-08 08:52:56 +01:00
Alexander Motin
935dc0de88 mca: Remove excessively verbose debug messages.
Expecially in case of AMD there was more than dozen lines per CPU.

MFC after:	1 week
2021-12-07 22:27:09 -05:00
Alexander Motin
c2003f2684 mca: Make some sysctls also a loader tunables.
MFC after:	1 week
2021-12-07 22:22:01 -05:00
Jason A. Harmening
cfc2cfeca1 unionfs: implement VOP_VPUT_PAIR
unionfs must pass VOP_VPUT_PAIR directly to the underlying FS so that
it can have a chance to manage any special locking considerations that
may be necessary.  The unionfs implementation is based heavily on the
corresponding nullfs implementation.

Also note some outstanding issues with the unionfs locking scheme, as
a first step in fixing those issues in a future change.

Discussed with:	kib
Tested by:	pho
Differential Revision: https://reviews.freebsd.org/D33008
2021-12-07 16:20:02 -08:00
Jason A. Harmening
6d8420d444 Remove unnecessary thread argument from unionfs_nodeget() and _noderem()
Also remove a couple of write-only variables found by the recent clang
update.  No functional change intended.

Discussed with:	kib
Differential Revision:	https://reviews.freebsd.org/D33008
2021-12-07 16:20:02 -08:00
Stefan Eßer
e9aeb50797 sys/_bitset.h: revert commit 74e014dbfa
It caused kernel build for PowerPC64 to fail.

A different patch is being tested with make universe to make sure it
works on all architectures.

MFC after:	1 month<N [day[s]|week[s]|month[s]].  Request a reminder email>
2021-12-07 23:34:33 +01:00
Stefan Eßer
22c4ab6cb0 sys/_bitset.h: Fix fall-out from commit 5e04571cf3
There is a reference to malloc() in #define __BITSET_ALLOC. Even
though this macro is only defined but not used, it causes the lang/gcc
ports to fail. The gcc ports "poison" a number of functions including
malloc() and prevent their use (including in macro definitions).

This commit moved the declaration of __BITSET_ALLOC into the
conditional block that depends on _KERNEL or _WANT_FREEBSD_BITSET
being defined.

There is no use of __BITSET_ALLOC in the FreeBSD sources, and userland
programs that want to use BITSEC_ALLOC will define _WANT_FREEBSD_BITSET
anyway.

This patch has been tested by building lang/gcc11 and a successful
make buildworld.

This commit shall be MFCed together with commit 5e04571cf3.

MFC after:	1 month
2021-12-07 20:29:26 +01:00
Konstantin Belousov
74e014dbfa sys/_bitset.h: Fix fall-out from commit 5e04571cf3
The changes to the bitset macros allowed sched.h to be included into
userland programs without name space pollution due to BIT_* and
BITSET_* macros.

The definition of a global variable "bitset" had been overlooked.
This name space pollution caused a compile failure in print/miktex.

This commit renames the bitset variable to __bitset with the same
mapping back to the bitset if _KERNEL or _WANT_FREEBSD_BITSET is
defined.

This fix has been suggested by kib. It has been tested to let the
build of the print/miktex port succeed and to not break buildworld.

This commit shall be MFCed together with commit 5e04571cf3.

Reported by:	arrowd
MFC after:	1 month
2021-12-07 20:28:22 +01:00
Andrew Turner
38dbca7243 Teach vm.pmap.kernel_maps about both XN bits
The arm64 vm.pmap.kernel_maps sysctl would only check the kernel XN bit
when printing the kernel mapping. It can also be useful to check none
of the mappings allow userspace to execute from a given virtual address.
To check for this add the user XN bit when getting the kernel maps.

While here fix the ATTR_S1_AP_USER check to use ATTR_S1_AP to shift the
value to the correct offset.

Reviewed by:	kib (earlier version), markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33304
2021-12-07 15:42:18 +00:00
Hans Petter Selasky
03f0393477 ng_ubt(4): Make net.bluetooth.usb_isoc_enable writable.
Differential Revision:	https://reviews.freebsd.org/D33282
PR:		238235
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-12-07 11:50:51 +01:00