]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
19 months agovmm: Remove support for vm_rendezvous with a cpuid of -1.
John Baldwin [Fri, 18 Nov 2022 18:03:23 +0000 (10:03 -0800)]
vmm: Remove support for vm_rendezvous with a cpuid of -1.

This is not currently used.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37164

19 months agovmm: Remove vcpuid from I/O port handlers.
John Baldwin [Fri, 18 Nov 2022 18:03:14 +0000 (10:03 -0800)]
vmm: Remove vcpuid from I/O port handlers.

No I/O ports are vCPU-specific (unlike memory which does have
vCPU-specific ranges such as the local APIC).

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37163

19 months agovmm: Pass vcpu instead of vm and vcpuid to APIs used from CPU backends.
John Baldwin [Fri, 18 Nov 2022 18:03:05 +0000 (10:03 -0800)]
vmm: Pass vcpu instead of vm and vcpuid to APIs used from CPU backends.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37162

19 months agovmm: Use struct vcpu in the instruction emulation code.
John Baldwin [Fri, 18 Nov 2022 18:02:09 +0000 (10:02 -0800)]
vmm: Use struct vcpu in the instruction emulation code.

This passes struct vcpu down in place of struct vm and and integer
vcpu index through the in-kernel instruction emulation code.  To
minimize userland disruption, helper macros are used for the vCPU
arguments passed into and through the shared instruction emulation
code.

A few other APIs used by the instruction emulation code have also been
updated to accept struct vcpu in the kernel including
vm_get/set_register and vm_inject_fault.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37161

19 months agovmm: Add vm_gpa_hold_global wrapper function.
John Baldwin [Fri, 18 Nov 2022 18:01:57 +0000 (10:01 -0800)]
vmm: Add vm_gpa_hold_global wrapper function.

This handles the case that guest pages are being held not on behalf of
a virtual CPU but globally.  Previously this was handled by passing a
vcpuid of -1 to vm_gpa_hold, but that will not work in the future when
vm_gpa_hold is changed to accept a struct vcpu pointer.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37160

19 months agovmm: Add _KERNEL guards for io headers shared with userspace.
John Baldwin [Fri, 18 Nov 2022 18:01:51 +0000 (10:01 -0800)]
vmm: Add _KERNEL guards for io headers shared with userspace.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37159

19 months agobhyve: Remove unused vm and vcpu arguments from vm_copy routines.
John Baldwin [Fri, 18 Nov 2022 18:01:44 +0000 (10:01 -0800)]
bhyve: Remove unused vm and vcpu arguments from vm_copy routines.

The arguments identifying the VM and vCPU are only needed for
vm_copy_setup.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37158

19 months agovmm: Use struct vcpu with the vmm_stat API.
John Baldwin [Fri, 18 Nov 2022 18:01:18 +0000 (10:01 -0800)]
vmm: Use struct vcpu with the vmm_stat API.

The function callbacks still use struct vm and and vCPU index.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37157

19 months agovmm: Expose struct vcpu as an opaque type.
John Baldwin [Fri, 18 Nov 2022 18:01:05 +0000 (10:01 -0800)]
vmm: Expose struct vcpu as an opaque type.

Pass a pointer to the current struct vcpu to the vcpu_init callback
and save this pointer in the CPU-specific vcpu structures.

Add routines to fetch a struct vcpu by index from a VM and to query
the VM and vcpuid from a struct vcpu.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37156

19 months agovmm: Use VLAPIC_CTR* in more places.
John Baldwin [Fri, 18 Nov 2022 18:00:59 +0000 (10:00 -0800)]
vmm: Use VLAPIC_CTR* in more places.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37155

19 months agovmm vmx: Add VMX_CTR* wrapper macros.
John Baldwin [Fri, 18 Nov 2022 18:00:49 +0000 (10:00 -0800)]
vmm vmx: Add VMX_CTR* wrapper macros.

These macros are similar to VCPU_CTR* but accept a single vmx_vcpu
pointer as the first argument instead of separate vm and vcpuid.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37154

19 months agovmm svm: Add SVM_CTR* wrapper macros.
John Baldwin [Fri, 18 Nov 2022 18:00:38 +0000 (10:00 -0800)]
vmm svm: Add SVM_CTR* wrapper macros.

These macros are similar to VCPU_CTR* but accept a single svm_vcpu
pointer as the first argument instead of separate vm and vcpuid.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37153

19 months agovmm: Remove the per-vm cookie argument from vmmops taking a vcpu.
John Baldwin [Fri, 18 Nov 2022 18:00:00 +0000 (10:00 -0800)]
vmm: Remove the per-vm cookie argument from vmmops taking a vcpu.

This requires storing a reference to the per-vm cookie in the
CPU-specific vCPU structure.  Take advantage of this new field to
remove no-longer-needed function arguments in the CPU-specific
backends.  In particular, stop passing the per-vm cookie to functions
that either don't use it or only use it for KTR traces.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37152

19 months agovmm: Refactor storage of CPU-dependent per-vCPU data.
John Baldwin [Fri, 18 Nov 2022 17:59:21 +0000 (09:59 -0800)]
vmm: Refactor storage of CPU-dependent per-vCPU data.

Rather than storing static arrays of per-vCPU data in the CPU-specific
per-VM structure, adopt a more dynamic model similar to that used to
manage CPU-specific per-VM data.

That is, add new vmmops methods to init and cleanup a single vCPU.
The init method returns a pointer that is stored in 'struct vcpu' as a
cookie pointer.  This cookie pointer is now passed to other vmmops
callbacks in place of the integer index.  The index is now only used
in KTR traces and when calling back into the CPU-independent layer.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37151

19 months agovmm vmx: Add a global bool to indicate if the host has the TSC_AUX MSR.
John Baldwin [Fri, 18 Nov 2022 17:58:56 +0000 (09:58 -0800)]
vmm vmx: Add a global bool to indicate if the host has the TSC_AUX MSR.

A future commit will remove direct access to vCPU structures from
struct vmx, so add a dedicated boolean for this rather than checking
the capabilities for vCPU 0.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37269

19 months agovmm: Rework snapshotting of CPU-specific per-vCPU data.
John Baldwin [Fri, 18 Nov 2022 17:58:41 +0000 (09:58 -0800)]
vmm: Rework snapshotting of CPU-specific per-vCPU data.

Previously some per-vCPU state was saved in vmmops_snapshot and other
state was saved in vmmops_vcmx_snapshot.  Consolidate all per-vCPU
state into the latter routine and rename the hook to the more generic
'vcpu_snapshot'.  Note that the CPU-independent per-vCPU data is still
stored in a separate blob as well as the per-vCPU local APIC data.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37150

19 months agovmm svm: Mark all VMCB state caches dirty on vCPU restore.
John Baldwin [Fri, 18 Nov 2022 17:58:22 +0000 (09:58 -0800)]
vmm svm: Mark all VMCB state caches dirty on vCPU restore.

Mark Johnston noticed that this was missing VMCB_CACHE_LBR.  Just set
all the bits as is done in svm_run() rather than trying to clear
individual bits.

Reported by: markj
Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37259

19 months agovmm vmx: Refactor per-vCPU data.
John Baldwin [Fri, 18 Nov 2022 17:58:08 +0000 (09:58 -0800)]
vmm vmx: Refactor per-vCPU data.

Add a struct vmx_vcpu to hold per-vCPU data specific to VT-x and
move parallel arrays out of struct vmx into a single array of
this structure.

While here, dynamically allocate the VMCS, APIC page and PIR
descriptors for each vCPU rather than embedding them.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37149

19 months agovmm svm: Refactor per-vCPU data.
John Baldwin [Fri, 18 Nov 2022 17:57:48 +0000 (09:57 -0800)]
vmm svm: Refactor per-vCPU data.

- Allocate VMCBs separately to avoid excessive padding in struct
  svm_vcpu.

- Allocate APIC pages dynamically directly in struct vlapic.

- Move vm_mtrr into struct svm_vcpu rather than using a separate
  parallel array.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37148

19 months agovmm: Use vm_get_maxcpus() instead of VM_MAXCPU in various places.
John Baldwin [Fri, 18 Nov 2022 17:57:38 +0000 (09:57 -0800)]
vmm: Use vm_get_maxcpus() instead of VM_MAXCPU in various places.

Mostly these are loops that iterate over all possible vCPU IDs for a
specific virtual machine.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37147

19 months agovmm: Simplify saving of absolute TSC values in snapshots.
John Baldwin [Fri, 18 Nov 2022 17:57:29 +0000 (09:57 -0800)]
vmm: Simplify saving of absolute TSC values in snapshots.

Read the current "now" TSC value and use it to compute absolute time
saved value in vm_snapshot_vcpus rather than iterating over vCPUs
multiple times in vm_snapshot_vm.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D37146

19 months agopkgbase: do not record dependency on non-existent liby package
Ed Maste [Thu, 17 Nov 2022 19:22:33 +0000 (14:22 -0500)]
pkgbase: do not record dependency on non-existent liby package

liby-dev provides (only) liby.a.  liby has no headers or man pages, and
there is no liby package.  Add a special case to record no dependency on
the package that does not exist.

PR: 266923
Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37429

19 months agostand: Remove i386-only support fire firewire
Warner Losh [Fri, 18 Nov 2022 17:33:03 +0000 (10:33 -0700)]
stand: Remove i386-only support fire firewire

Remove support for booting off of firewire, and for having dcons via
firewire in the loader. Kernel support for these things is unchanged.
Discussed on arch@ and the current state is not working (and the build
was wrong to boot).

Sponsored by: Netflix
Discussed: https://lists.freebsd.org/archives/freebsd-arch/2022-November/000267.html
Reviewed by: kevans, melifaro, emaste
Differential Revision: https://reviews.freebsd.org/D37334

19 months agoarm64/pmap: freed only used for PV_STATS
Warner Losh [Fri, 18 Nov 2022 17:04:04 +0000 (10:04 -0700)]
arm64/pmap: freed only used for PV_STATS

When PV_STATS is defined, freed is used. Otherwise it isn't. Mark it as
__pvused and define __pvused appropriately.

Sponsored by: Netflix
Reviewed by: tsoome, rpokala, andrew
Differential Revision: https://reviews.freebsd.org/D37438

19 months agotftpd: type nit
Dag-Erling Smørgrav [Fri, 18 Nov 2022 16:26:54 +0000 (17:26 +0100)]
tftpd: type nit

Sponsored by: Klara, Inc.

19 months agotftp: cleanup
Dag-Erling Smørgrav [Fri, 18 Nov 2022 16:01:09 +0000 (17:01 +0100)]
tftp: cleanup

Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37433

19 months agotftpd: Plug memory leaks in option handling code.
Dag-Erling Smørgrav [Fri, 18 Nov 2022 15:39:15 +0000 (16:39 +0100)]
tftpd: Plug memory leaks in option handling code.

Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37423

19 months agoamd64 libc: add missed GNU-stack annotation to memmove/memcpy
Konstantin Belousov [Fri, 18 Nov 2022 02:24:34 +0000 (04:24 +0200)]
amd64 libc: add missed GNU-stack annotation to memmove/memcpy

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

19 months agoMFV: expat 2.5.0
Xin LI [Fri, 18 Nov 2022 06:10:01 +0000 (22:10 -0800)]
MFV: expat 2.5.0

MFC after: 2 weeks

19 months agoVendor import of expat 2.5.0
Xin LI [Fri, 18 Nov 2022 06:08:44 +0000 (22:08 -0800)]
Vendor import of expat 2.5.0

19 months agoMFV: xz-embedded 3f438e15109229bb14ab45f285f4bff5412a9542
Xin LI [Fri, 18 Nov 2022 06:04:57 +0000 (22:04 -0800)]
MFV: xz-embedded 3f438e15109229bb14ab45f285f4bff5412a9542

MFC after: 2 weeks

19 months agoUpdates to UFS/FFS superblock integrity checks when reading a superblock.
Kirk McKusick [Thu, 17 Nov 2022 22:50:27 +0000 (14:50 -0800)]
Updates to UFS/FFS superblock integrity checks when reading a superblock.

Further updates adding casts to avoid 32-bit multiplication overflow
inspired by fixes in commit 017367c1146a69.

No legitimate superblocks should fail as a result of these changes.

Sponsored by: The FreeBSD Foundation

19 months agoevdev: Extend EVIOCGRAB ioctl scope to cover sysmouse interface
Vladimir Kondratyev [Thu, 17 Nov 2022 21:48:42 +0000 (00:48 +0300)]
evdev: Extend EVIOCGRAB ioctl scope to cover sysmouse interface

of psm(4), ums(4) and sysmouse(4) drivers.
EVIOCGRAB ioctl execution on /dev/input/event# device node gains
exclusive access to this device to caller. It is used mostly for
development purposes and remote control software. See e.g.
https://reviews.freebsd.org/D30020 which is the reason of creation
of this change.

MFC after: 2 weeks
Tested by: corvink
Differential revision: https://reviews.freebsd.org/D30542

19 months agoheimdal: Fix: Too large time skew, client time 1970-01-01T01:00:00
Cy Schubert [Thu, 17 Nov 2022 15:43:29 +0000 (07:43 -0800)]
heimdal: Fix: Too large time skew, client time 1970-01-01T01:00:00

Part of ed549cb0c53f zeroed out a data structure in the resulting code-file
when a TUTCTime type was freed. This part of the patch applies to Heimdal
7.1+ and not our Heimdal 1.5.2.

PR: 267827
Reported by: Peter Much <pmc@citylink.dinoex.sub.org>
Tested by: Peter Much <pmc@citylink.dinoex.sub.org>
Fixes: ed549cb0c53f
MFC after: TBD with philip@

19 months agoarm64 pmap: implement per-superpage locks
Andrew Turner [Fri, 19 Aug 2022 13:54:36 +0000 (13:54 +0000)]
arm64 pmap: implement per-superpage locks

As with amd64 pmap introduce per-superpage locks backed by pages
allocated by their respective domains.

This significiantly reduces lock contantion from pmap when running
poudriere on a 160 core Ampere Altra server

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36310

19 months agoMark the debug.vnlru_nowhere sysctl as CTLFLAG_STATS
Eric van Gyzen [Thu, 17 Nov 2022 16:42:28 +0000 (10:42 -0600)]
Mark the debug.vnlru_nowhere sysctl as CTLFLAG_STATS

The kernel doesn't read it.  It's only writable so it can be cleared.

Sponsored by: Dell EMC Isilon

19 months agotftpd: whitespace cleanup
Dag-Erling Smørgrav [Thu, 17 Nov 2022 16:09:58 +0000 (16:09 +0000)]
tftpd: whitespace cleanup

19 months agotftp: Fix buffer overflow and fd leak in multi-file PUT.
Dag-Erling Smørgrav [Thu, 17 Nov 2022 16:15:04 +0000 (17:15 +0100)]
tftp: Fix buffer overflow and fd leak in multi-file PUT.

Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37422

19 months agocounter: fix SYSCTL_COUNTER_U64_ARRAY type
Gleb Smirnoff [Thu, 17 Nov 2022 16:16:14 +0000 (08:16 -0800)]
counter: fix SYSCTL_COUNTER_U64_ARRAY type

There is nothing wrong with declaring an array as CTLTYPE_U64.  Note
that sysctl(8) is able to print such arrays and doesn't need any change.

Fixes: b5b7b142a7e0e74bdd8c497f6a14804e71654dfd

19 months agolibarchive: Add missing MLINK.
Dag-Erling Smørgrav [Thu, 17 Nov 2022 16:11:41 +0000 (17:11 +0100)]
libarchive: Add missing MLINK.

Differential Revision: https://reviews.freebsd.org/D37398

19 months agopkgbase: report type for duplicated METALOG entries
Ed Maste [Thu, 17 Nov 2022 14:15:20 +0000 (09:15 -0500)]
pkgbase: report type for duplicated METALOG entries

Duplicate METALOG file entries are more of a concern than duplicate
directories.  The metalog check tool previously did not include the
entry type in the warnings, making it hard to find the ones of concern.

Sponsored by: The FreeBSD Foundation

19 months agoman9: add vm_map_unwire link
Ed Maste [Thu, 17 Nov 2022 15:15:26 +0000 (10:15 -0500)]
man9: add vm_map_unwire link

Reported by: markj (in D37416)
Sponsored by: The FreeBSD Foundation

19 months agoObsoleteFiles: correct path to removed rc.sendmail man page
Ed Maste [Thu, 17 Nov 2022 15:12:58 +0000 (10:12 -0500)]
ObsoleteFiles: correct path to removed rc.sendmail man page

Fixes: 820b62d9410e ("ObsoleteFiles: the rc.sendmail(8)...")

19 months agoman9: correct vm_page_wire.9 links
Ed Maste [Thu, 17 Nov 2022 02:29:51 +0000 (21:29 -0500)]
man9: correct vm_page_wire.9 links

PR: 244596
Reviewed by: markj
Fixes: fee2a2fa3983 ("Change synchonization rules for ...")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37416

19 months agopkgbase: examine METALOG files relative to stage root directory
Ed Maste [Wed, 16 Nov 2022 19:53:42 +0000 (14:53 -0500)]
pkgbase: examine METALOG files relative to stage root directory

Previously we stripped the '.' from the beginning of each METALOG entry
to determine the path to stat.  This meant that we examined files on the
build host, not the staged files.

Instead, strip off the last part of the specified METALOG pathname to
find the stage root directory, and stat files relative to that.

Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37412

19 months agoMFV: Merge xz 5.2.8
Xin LI [Thu, 17 Nov 2022 04:36:06 +0000 (20:36 -0800)]
MFV: Merge xz 5.2.8

Relnotes: yes
MFC after:      2 weeks

19 months agovfs_vnops.c: Fix blksize for ZFS
Rick Macklem [Thu, 17 Nov 2022 01:37:22 +0000 (17:37 -0800)]
vfs_vnops.c: Fix blksize for ZFS

Since ZFS reports _PC_MIN_HOLE_SIZE as 512 (although it
appears that an unwritten region must be at least f_iosize
to remain unallocated), vn_generic_copy_file_range()
uses 4096 for the copy blksize for ZFS, reulting in slow copies.

For most other file systems, _PC_MIN_HOLE_SIZE and f_iosize
are the same value, so this patch modifies the code to
use f_iosize for most cases.  It also documents in comments
why the blksize is being set a certain way, so that the code
does not appear to be doing "magic math".

Reported by: allanjude
Reviewed by: allanjude, asomers
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D37076

19 months agozfs: workaround panic on rootfs mount
Martin Matuska [Thu, 17 Nov 2022 01:00:05 +0000 (02:00 +0100)]
zfs: workaround panic on rootfs mount

The import of OpenZFS PR 13758 causes a panic in zfsctl_is_node()
if ZFS is mounting as root filesystem. This implements a workaround
until the issue is resolved by authors.

19 months agoman9: remove duplicate superio_find_dev link
Ed Maste [Thu, 17 Nov 2022 00:28:17 +0000 (19:28 -0500)]
man9: remove duplicate superio_find_dev link

PR: 244596
Fixes: c812bea351021 ("add superio.4 and superio.9 ...")
Sponsored by: The FreeBSD Foundation

19 months agolibcompat: avoid installing include files twice
Ed Maste [Thu, 17 Nov 2022 00:12:18 +0000 (19:12 -0500)]
libcompat: avoid installing include files twice

Previously some headers were getting installed twice, once as expected
and then a second time as part of the compat32 library stage.

Makefile.libcompat sets -DLIBRARIES_ONLY for the install make invocation
which causes bsd.lib.mk to skip headers.  However some headers are
handled via bsd.prog.mk, which does not use LIBRARIES_ONLY.  Explicitly
set MK_INCLUDES=no.

Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37413

19 months agozfs: unbreak 32-bit world build broken in dbd5678dc
Martin Matuska [Wed, 16 Nov 2022 23:33:26 +0000 (00:33 +0100)]
zfs: unbreak 32-bit world build broken in dbd5678dc

19 months agozfs: merge openzfs/zfs@2163cde45
Martin Matuska [Wed, 16 Nov 2022 20:25:24 +0000 (21:25 +0100)]
zfs: merge openzfs/zfs@2163cde45

Notable upstream pull request merges:
  #13680 Add options to zfs redundant_metadata property
  #13758 Allow mounting snapshots in .zfs/snapshot as a regular user
  #13838 quota: disable quota check for ZVOL
  #13839 quota: extend quota for dataset
  #13973 Fix memory leaks in dmu_send()/dmu_send_obj()
  #13977 Avoid unnecessary metaslab_check_free calling
  #13978 PAM: Fix unchecked return value from zfs_key_config_load()
  #13979 Handle possible null pointers from malloc/strdup/strndup()
  #13997 zstream: allow decompress to fix metadata for uncompressed
         records
  #13998 zvol_wait logic may terminate prematurely
  #14001 FreeBSD: Fix a pair of bugs in zfs_fhtovp()
  #14003 Stop ganging due to past vdev write errors
  #14039 Optimize microzaps
  #14050 Fix draid2+2s metadata error on simultaneous 2 drive failures
  #14062 zed: Avoid core dump if wholedisk property does not exist
  #14077 Propagate extent_bytes change to autotrim thread
  #14079 FreeBSD: vn_flush_cached_data: observe vnode locking contract
  #14093 Fix ARC target collapse when zfs_arc_meta_limit_percent=100
  #14106 Add ability to recompress send streams with new compression
         algorithm
  #14119 Deny receiving into encrypted datasets if the keys are not
         loaded
  #14120 Fix arc_p aggressive increase
  #14129 zed: Prevent special vdev to be replaced by hot spare
  #14133 Expose zfs_vdev_open_timeout_ms as a tunable
  #14135 FreeBSD: Fix out of bounds read in zfs_ioctl_ozfs_to_legacy()
  #14152 Adds the `-p` option to `zfs holds`
  #14161 Handle and detect #13709's unlock regression

Obtained from: OpenZFS
OpenZFS commit: 2163cde450d0898b5f7bac16afb4e238485411ff

19 months agoCheck alignment of fp in unwind_frame
Dapeng Gao [Wed, 16 Nov 2022 18:29:28 +0000 (18:29 +0000)]
Check alignment of fp in unwind_frame

A misaligned frame pointer is certainly not a valid frame pointer and
with strict alignment enabled (as on CHERI) can cause panics when it is
loaded from later in the code.

This is a recommit of 40e0fa10f58d90744c2857b57adf0ddbce1a1e1c with
is_aligned() corrected to __is_aligned().

Reviewed By: jhb
Differential Revision: https://reviews.freebsd.org/D34646

19 months agoregen src.conf.5 after MK_CXX and arm64 Hyper-V changes
Ed Maste [Wed, 16 Nov 2022 16:36:35 +0000 (11:36 -0500)]
regen src.conf.5 after MK_CXX and arm64 Hyper-V changes

Reported by: matteo

19 months agobhyve: build DSDT table by basl
Corvin Köhne [Wed, 6 Apr 2022 09:10:40 +0000 (11:10 +0200)]
bhyve: build DSDT table by basl

Building the DSDT table by basl will allow it to be loaded by qemu's
ACPI table loader.

Building the DSDT is complex and basl doesn't support it yet. For that
reason, it's still compiled by iasl. It's just a bit restructured.
Upcoming commits will restructure the builds of all other ACPI tables in
a similar way. So, this commit is done for consistency reasons. We're
starting with DSDT because it doesn't point to any other tables and it's
the last one in our current build list.

Reviewed by: jhb, markj (older version)
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36993

19 months agobhyve: add basl support for common table header
Corvin Köhne [Wed, 6 Apr 2022 09:10:40 +0000 (11:10 +0200)]
bhyve: add basl support for common table header

Most ACPI tables are using the same header. Make it easy to create this
header by creating a function for it.

Reviewed by: jhb, markj (older version)
Approved by: manu (mentor)
MFC after: 2 weeks
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D36992

19 months agousb/dwc3: Use more () for macros variables
Emmanuel Vadot [Wed, 16 Nov 2022 10:57:56 +0000 (11:57 +0100)]
usb/dwc3: Use more () for macros variables

Suggested by: andrew
Sponsored by: Beckhoff Automation GmbH & Co. KG

19 months agoarm64/rockchip: Remove rk3328-dwc3 overlays
Emmanuel Vadot [Tue, 15 Nov 2022 12:57:44 +0000 (13:57 +0100)]
arm64/rockchip: Remove rk3328-dwc3 overlays

Not needed after
3c790abfba67 arm64/rk_dwc3: Remove RK3328 support
c45296f16f79 dwc3: Handle optional clocks

Differential Revision: https://reviews.freebsd.org/D37395
Sponsored by: Beckhoff Automation GmbH & Co. KG

19 months agousb/dwc3: Only force USB2 based on the PHY register and IP version
Emmanuel Vadot [Tue, 15 Nov 2022 12:54:49 +0000 (13:54 +0100)]
usb/dwc3: Only force USB2 based on the PHY register and IP version

We shouldn't force USB2 only based on if we have an external PHY.
The internal PHY register tell us what link speed we can acheive
and we need to force USB2 only if it cannot do USB3.
This is only available after revision 0x290A of the dwc3 IP.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D37394
Fixed: 1331c0f44b6a ("Add support for RockChip RK356X to DWC3 driver.")
Sponsored by: Beckhoff Automation GmbH & Co. KG

19 months agousb/dwc3: Read the full IDs/version
Emmanuel Vadot [Tue, 15 Nov 2022 10:22:23 +0000 (11:22 +0100)]
usb/dwc3: Read the full IDs/version

We need to enable some quirks based on the version so read it.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D37393
Sponsored by: Beckhoff Automation GmbH & Co. KG

19 months agoarm64/rk_dwc3: Remove RK3328 support
Emmanuel Vadot [Tue, 15 Nov 2022 10:21:19 +0000 (11:21 +0100)]
arm64/rk_dwc3: Remove RK3328 support

The RK3328 dts doesn't have the glue node so we need the dwc3 driver
to attach directly.

Differential Revision: https://reviews.freebsd.org/D37396
Sponsored by: Beckhoff Automation GmbH & Co. KG

19 months agodwc3: Handle optional clocks
Emmanuel Vadot [Tue, 15 Nov 2022 08:58:30 +0000 (09:58 +0100)]
dwc3: Handle optional clocks

Usually dwc3 needs a glue node that contain the SoC specific clocks/resets.
For some reason the RK3328 DTS doesn't have this glue node and the clocks
are specified in the dwc3 node directly.
The bindings says that it is allowed but doesn't specified some strict names
for them.
Add a specific case for RK3328 based on the compatible string.

Reviewed by: andrew
Differential Revision: https://reviews.freebsd.org/D37392
Sponsored by: Beckhoff Automation GmbH & Co. KG

19 months agotcp: remove unused t_rttbest
Michael Tuexen [Wed, 16 Nov 2022 10:22:13 +0000 (11:22 +0100)]
tcp: remove unused t_rttbest

No functional change intended.

Reviewed by: rscheff@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D37401

19 months agoVendor import of xz-5.2.8 (trimmed).
Xin LI [Wed, 16 Nov 2022 05:53:08 +0000 (21:53 -0800)]
Vendor import of xz-5.2.8 (trimmed).

19 months agors: Test actual output in the tests.
John Baldwin [Wed, 16 Nov 2022 05:20:18 +0000 (21:20 -0800)]
rs: Test actual output in the tests.

Previously the tests just verified if command line arguments raised an
error or not, they did not test how command line arguments affected
the output.  This adds some sample (if simple) input and output to
each flag test as well as adding a few additional trivial tests.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D36835

19 months agors: Use getopt() and strtol() instead of mannual parsing.
John Baldwin [Wed, 16 Nov 2022 05:19:35 +0000 (21:19 -0800)]
rs: Use getopt() and strtol() instead of mannual parsing.

This uses the "::" extension to getopt() to handle options which take
an optional argument.

The updated flag tests were all wrong before and only passed because
the manual parser failed to raise errors when a required argument was
missing.  The invalid argument test now gets a better error message.

Reviewed by: brooks, imp, emaste
Differential Revision: https://reviews.freebsd.org/D36834

19 months agodepend-cleanup.sh: Handle rs(1) moving to C++.
John Baldwin [Wed, 16 Nov 2022 05:17:28 +0000 (21:17 -0800)]
depend-cleanup.sh: Handle rs(1) moving to C++.

To support changes in filenames for programs (and not just libraries),
update clean_dep() to check .depend.foo.o files as well as
.depend.foo.pico files.

19 months agors: Convert to C++ to convert elem to a std::vector<char *>.
John Baldwin [Wed, 16 Nov 2022 05:03:12 +0000 (21:03 -0800)]
rs: Convert to C++ to convert elem to a std::vector<char *>.

This also updates various indices and counters from int to size_t to
pacify resulting -Wsign-compare warnings.

Reviewed by: brooks
Differential Revision: https://reviews.freebsd.org/D36833

19 months agoshare: i18n: fix mismatch in BIG5 esdb generation
Kyle Evans [Wed, 16 Nov 2022 04:07:28 +0000 (22:07 -0600)]
share: i18n: fix mismatch in BIG5 esdb generation

In the first loop, we setup Big5_$i_variable where $i are elements of
$PART with : replaced to @.  Do the same in the second loop when we're
trying to refer to the same variable.

No functional change, because none of the in-tree mappings have an @
in them.

Sponsored by: Klara, Inc.

19 months agosrc.opts.mk: Disable all of LLVM if C++ support is disabled.
John Baldwin [Wed, 16 Nov 2022 03:21:20 +0000 (19:21 -0800)]
src.opts.mk: Disable all of LLVM if C++ support is disabled.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D36891

19 months agobhyve: Use XHCI_PORTREG_PTR in one place that open-coded it.
John Baldwin [Wed, 16 Nov 2022 03:19:35 +0000 (19:19 -0800)]
bhyve: Use XHCI_PORTREG_PTR in one place that open-coded it.

Reviewed by: corvink, markj
Differential Revision: https://reviews.freebsd.org/D36888

19 months agolibfetch: Pass a zeroed digest to DigestCalcResponse.
John Baldwin [Wed, 16 Nov 2022 03:18:58 +0000 (19:18 -0800)]
libfetch: Pass a zeroed digest to DigestCalcResponse.

GCC 12 warns that passing "" (a constant of char[1]) to a parameter of
type char[33] could potentially overread.  It is not clear from the
context that c->qops can never be "auth-int" (and if it can't, then
the "auth-int" handling in DigestCalcResponse is dead code that should
be removed since this is the only place the function is called).

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D36825

19 months agodiff: Don't (ab)use sprintf() as a kind of strcat().
John Baldwin [Wed, 16 Nov 2022 03:17:36 +0000 (19:17 -0800)]
diff: Don't (ab)use sprintf() as a kind of strcat().

Previously print_header() used sprintf() of a buffer to itself as a
kind of string builder but without checking for overflows.  This
raised -Wformat-truncation and -Wrestrict warnings in GCC.  Instead,
just conditionally print the new timestamp fields after the initial
strftime()-formatted string.  While here, use sizeof(buf) with
strftime() rather than a magic number.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D36814

19 months agodiff: Don't treat null characters like carriage returns in readhash().
John Baldwin [Wed, 16 Nov 2022 03:16:50 +0000 (19:16 -0800)]
diff: Don't treat null characters like carriage returns in readhash().

The implicit fall-through in the !D_FORCEASCII case caused null
characters to be treated as carriage returns honoring the D_STRIPCR,
D_FOLDBLANKS, and D_IGNOREBLANKS flags.

Reported by: GCC -Wimplicit-fallthrough
Reviewed by: bapt
Fixes:   3cbf98e2bee9 diff: read whole files to determine if they are ASCII text
Differential Revision: https://reviews.freebsd.org/D36813

19 months agoLinuxKPI: in efi.h include queue.h
Bjoern A. Zeeb [Tue, 15 Nov 2022 23:08:05 +0000 (23:08 +0000)]
LinuxKPI: in efi.h include queue.h

sys/linker.h needs sys/queue.h;  this gets another wireless driver
closer to compiling on main.

MFC after: 3 days

19 months agoHandle and detect #13709's unlock regression (#14161)
Rich Ercolani [Tue, 15 Nov 2022 22:44:12 +0000 (17:44 -0500)]
Handle and detect #13709's unlock regression (#14161)

In #13709, as in #11294 before it, it turns out that 63a26454 still had
the same failure mode as when it was first landed as d1d47691, and
fails to unlock certain datasets that formerly worked.

Rather than reverting it again, let's add handling to just throw out
the accounting metadata that failed to unlock when that happens, as
well as a test with a pre-broken pool image to ensure that we never get
bitten by this again.

Fixes: #13709
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
19 months agotftpd: cleanup
Dag-Erling Smørgrav [Tue, 15 Nov 2022 22:37:54 +0000 (23:37 +0100)]
tftpd: cleanup

Sponsored by: Klara, Inc.

19 months agoipfilter: replace defunct home page link with FAQ URL
Ed Maste [Tue, 15 Nov 2022 21:58:51 +0000 (16:58 -0500)]
ipfilter: replace defunct home page link with FAQ URL

ipfilter.org disappeared in mid 2004.  There is still a FAQ at
https://www.phildev.net/ipf so point to that.

19 months agolibalias: improve handling of invalid SCTP packets
Michael Tuexen [Tue, 15 Nov 2022 20:05:02 +0000 (21:05 +0100)]
libalias: improve handling of invalid SCTP packets

In case of a paritial chunk only pretend the result is OK if
the packet is not the last fragment and there is a valid association.

PR: 267476
MFC after: 3 days

19 months agorpc.tlsservd.8: Update man page for new -N/--numdaemons option
Rick Macklem [Tue, 15 Nov 2022 21:30:41 +0000 (13:30 -0800)]
rpc.tlsservd.8: Update man page for new -N/--numdaemons option

Commit 1e588a9ceb36 added a new command line option -N/numdaemons
that specifies how many daemons to run. This allows a server
to be configured with more than one rpc.tlsservd daemon, which
may be necessary to handle a reboot for an NFS server with
many NFS-over-TLS client mounts.

This patch updates the man page for this commit.

This is a content change.

Reviewed by: karels, pauamma (man pages)
Differential Revision: https://reviews.freebsd.org/D37382

19 months agoheimdal: Fix multiple security vulnerabilities
Cy Schubert [Tue, 8 Nov 2022 08:53:29 +0000 (00:53 -0800)]
heimdal: Fix multiple security vulnerabilities

The following issues are patched:

 - CVE-2022-42898 PAC parse integer overflows
 - CVE-2022-3437 Overflows and non-constant time leaks in DES{,3} and arcfour
 - CVE-2021-44758 NULL dereference DoS in SPNEGO acceptors
 - CVE-2022-44640 Heimdal KDC: invalid free in ASN.1 codec

    Note that CVE-2022-44640 is a severe vulnerability, possibly a 10.0
    on the Common Vulnerability Scoring System (CVSS) v3, as we believe
    it should be possible to get an RCE on a KDC, which means that
    credentials can be compromised that can be used to impersonate
    anyone in a realm or forest of realms.

    Heimdal's ASN.1 compiler generates code that allows specially
    crafted DER encodings of CHOICEs to invoke the wrong free function
    on the decoded structure upon decode error.  This is known to impact
    the Heimdal KDC, leading to an invalid free() of an address partly
    or wholly under the control of the attacker, in turn leading to a
    potential remote code execution (RCE) vulnerability.

    This error affects the DER codec for all extensible CHOICE types
    used in Heimdal, though not all cases will be exploitable.  We have
    not completed a thorough analysis of all the Heimdal components
    affected, thus the Kerberos client, the X.509 library, and other
    parts, may be affected as well.

    This bug has been in Heimdal's ASN.1 compiler since 2005, but it may
    only affect Heimdal 1.6 and up.  It was first reported by Douglas
    Bagnall, though it had been found independently by the Heimdal
    maintainers via fuzzing a few weeks earlier.

    While no zero-day exploit is known, such an exploit will likely be
    available soon after public disclosure.

 - CVE-2019-14870: Validate client attributes in protocol-transition
 - CVE-2019-14870: Apply forwardable policy in protocol-transition
 - CVE-2019-14870: Always lookup impersonate client in DB

Sponsored by: so (philip)
Obtained from: so (philip)
Tested by: philip, cy
MFC after: immediately

19 months agoipfilter: Document count_mask_bits() arguments
Cy Schubert [Mon, 14 Nov 2022 23:58:02 +0000 (15:58 -0800)]
ipfilter: Document count_mask_bits() arguments

Document arguments input to count_mask_bits().

MFC after: 3 days

19 months agocxgbe: Enable TOE TLS RX when an RX key is provided via setsockopt().
John Baldwin [Tue, 15 Nov 2022 20:08:51 +0000 (12:08 -0800)]
cxgbe: Enable TOE TLS RX when an RX key is provided via setsockopt().

Rather than requiring a socket to be created as a TLS socket from the
get go, switch a TOE socket from "plain" TOE to TLS mode when a
receive key is added to the socket.

The firmware is only able to switch a "plain" TOE connection to TLS
mode if the head of the pending socket data is the start of a TLS
record, so the connection is migrated to TLS mode as a multi-step
process.

When TOE TLS RX is enabled, the associated connection's receive side
is frozen via a flag in the TCB.  The state of the socket buffer is
then examined to determine if the pending data in the socket buffer
ends on a TLS record boundary.  If so, the connection is migrated to
TLS mode and unfrozen.  Otherwise, the connection is unfrozen
temporarily until more data arrives.  Once more data arrives, the
receive queue is frozen again and rechecked.  This continues until the
connection is paused at a record boundary.  Any records received
before TLS mode is enabled are decrypted as software records.

Note that this removes the 'rx_tls_ports' sysctl.  TOE TLS offload for
receive is now enabled automatically on existing TOE connections when
using a KTLS-aware SSL library just as it was previously enabled
automatically for TLS transmit.  This also enables TLS offload for TOE
connections which enable TLS after passing initial data in the clear
(e.g. STARTTLS with SMTP).

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37351

19 months agocxgbe: Various whitespace fixes.
John Baldwin [Tue, 15 Nov 2022 20:03:57 +0000 (12:03 -0800)]
cxgbe: Various whitespace fixes.

Mostly trailing whitespace and spaces before tabs.

Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37350

19 months agoktls: Add tests for receiving corrupted or invalid records.
John Baldwin [Tue, 15 Nov 2022 20:03:19 +0000 (12:03 -0800)]
ktls: Add tests for receiving corrupted or invalid records.

These should all trigger errors when reading from the socket.

Tests include truncated records (socket closed early on the other
side), corrupted records (bits flipped in explicit IVs, ciphertext, or
MAC), invalid header fields, and various invalid record lengths.

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37373

19 months agoktls_ocf: Reject encrypted TLS records using AEAD that are too small.
John Baldwin [Tue, 15 Nov 2022 20:02:57 +0000 (12:02 -0800)]
ktls_ocf: Reject encrypted TLS records using AEAD that are too small.

If a TLS record is too small to contain the required explicit IV,
record_type (TLS 1.3), and MAC, reject attempts to decrypt it with
EMSGSIZE without submitting it to OCF.  OCF drivers may not properly
detect that regions in the crypto request are outside the bounds of
the mbuf chain.  The caller isn't supposed to submit such requests.

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37372

19 months agoktls: Add tests for software AES-CBC decryption for TLS 1.1+.
John Baldwin [Tue, 15 Nov 2022 20:02:28 +0000 (12:02 -0800)]
ktls: Add tests for software AES-CBC decryption for TLS 1.1+.

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37371

19 months agoktls: Add software support for AES-CBC decryption for TLS 1.1+.
John Baldwin [Tue, 15 Nov 2022 20:02:03 +0000 (12:02 -0800)]
ktls: Add software support for AES-CBC decryption for TLS 1.1+.

This is mainly intended to provide a fallback for TOE TLS which may
need to use software decryption for an initial record at the start
of a connection.

Reviewed by: markj
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37370

19 months agoImport device-tree files from Linux 6.0
Emmanuel Vadot [Tue, 15 Nov 2022 19:02:06 +0000 (20:02 +0100)]
Import device-tree files from Linux 6.0

Sponsored by:   Beckhoff Automation GmbH & Co. KG

19 months agoImport device-tree files from Linux 5.19
Emmanuel Vadot [Tue, 15 Nov 2022 19:01:13 +0000 (20:01 +0100)]
Import device-tree files from Linux 5.19

Sponsored by:   Beckhoff Automation GmbH & Co. KG

19 months agoImport device-tree files from Linux 6.0
Emmanuel Vadot [Tue, 15 Nov 2022 18:51:46 +0000 (19:51 +0100)]
Import device-tree files from Linux 6.0

19 months agoImport device-tree files from Linux 5.19
Emmanuel Vadot [Tue, 15 Nov 2022 18:50:16 +0000 (19:50 +0100)]
Import device-tree files from Linux 5.19

19 months agoSplit out the arm64 EL2 exception vectors
Andrew Turner [Mon, 31 Oct 2022 15:08:26 +0000 (15:08 +0000)]
Split out the arm64 EL2 exception vectors

These were originally in locore.S as they are only needed so we have
a valid value to put into the vbar_el2 register. As these will soon
be used by bhyve so move them to a new file as we already have with
the EL1 exception vectors in exception.S.

Obtained from: https://github.com/FreeBSD-UPB/freebsd-src (earlier version)
Sponsored by: Innovate UK
Sponsored by: The FreeBSD Foundation

19 months agoAdd more arm64 hypervisor registers
Andrew Turner [Mon, 14 Nov 2022 15:42:51 +0000 (15:42 +0000)]
Add more arm64 hypervisor registers

These will be used by bhyve.

Sponsored by: Innovate UK
Sponsored by: The FreeBSD Foundation

19 months agoPut the arm64 vttbr_el2 register into a state
Andrew Turner [Tue, 15 Nov 2022 12:53:28 +0000 (12:53 +0000)]
Put the arm64 vttbr_el2 register into a state

Zero the vttbr_el2 register on each CPU so we can tell if we are
running the host or guest kernel from a hypervisor.

Obtained from: https://github.com/FreeBSD-UPB/freebsd-src (earlier version)
Sponsored by: Innovate UK
Sponsored by: The FreeBSD Foundation

19 months agoAdd the arch field to the arm64 MIDR macros
Andrew Turner [Mon, 14 Nov 2022 15:48:43 +0000 (15:48 +0000)]
Add the arch field to the arm64 MIDR macros

For completeness add accessors for the MIDR field. As the field is
always 0xf on arm64 it is unneeded in the current MICR handling, but
will be used in the vmm module for bhyve.

Obtained from: https://github.com/FreeBSD-UPB/freebsd-src (earlier version)
Sponsored by: The FreeBSD Foundation

19 months agomac_lomac: whack giant usage
Mateusz Guzik [Tue, 15 Nov 2022 14:31:41 +0000 (14:31 +0000)]
mac_lomac: whack giant usage

It does not protect anything, the code looks dodgy regardless.

19 months agoRetire broken GPROF support from the kernel
Mateusz Guzik [Tue, 15 Nov 2022 10:56:13 +0000 (10:56 +0000)]
Retire broken GPROF support from the kernel

The option is not even recognized and with that patched it does not
compile. Even if it did work, it would be prohibitively expensive to
use.

Interested parties can use pmcstat or dtrace instead.

19 months agodtrace: avoid kinst warn when not used
Mateusz Guzik [Tue, 15 Nov 2022 10:01:05 +0000 (10:01 +0000)]
dtrace: avoid kinst warn when not used

Reviewed by: markj
Sponsored by: Rubicon Communications, LLC ("Netgate")

19 months agoLinuxKPI: add memset_startat macro
Bjoern A. Zeeb [Mon, 14 Nov 2022 23:26:22 +0000 (23:26 +0000)]
LinuxKPI: add memset_startat macro

Add a memset_startat() macro which sets a pattern from a struct member
to the end of the struct.   Needed by a wireless driver.

MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D37389