]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
15 months agostand: add comconsole backwards compatibility shim for aarch64
Warner Losh [Thu, 11 May 2023 20:03:30 +0000 (14:03 -0600)]
stand: add comconsole backwards compatibility shim for aarch64

Add a compat shim for the "comconsole" name so that people with a
"console=comconsole" in their loader.conf on aarch64 will continue to
work (though with a warning).

This is only aarch64: it will never be there for amd64 (where comconsole
always means talk to the hardware directly). To do that is too hard.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39983

15 months agostand: efi create eficom console device.
Warner Losh [Thu, 11 May 2023 20:03:17 +0000 (14:03 -0600)]
stand: efi create eficom console device.

Fix the 'renaming kludge' that we absolutely cannot do going forward
(it's cost us days of engineering time).

console=comconsole talks to the hardware directly. This is available
only on amd64. It is not available anywhere else (and so requires
changes for people doing comconsole on aarch64)

console=eficom talks to the console via EFI protocols.  It's available
on amd64, aarch64 and riscv64. It's the first port that we find, though
it can be overriden by efi_com_port (which should be set to the UID of
the serial port, not the I/O port, despite the name). devinfo -v
will give the UID to uartX mapping.

This is an incompatible change for HYPER-V on amd64. It only works with
eficom console, so you'll need to change your configuration in
loader.conf. No compatibility hack will ever be provided for this (since
it requires renamig, which the loader cannot reliably do).

It's also an incompatible change for aarch64. comconsole will need to
change to eficom. There might be a comconsole "shim" for this.

All the interlock to keep only eficom and comconsole from both attaching
have been removed.

RelNotes: Yes
Sponsored by: Netflix
Discussed with: kevans
Differential Revision: https://reviews.freebsd.org/D39982

15 months agoarm64: add swapueword8/32
Kyle Evans [Thu, 11 May 2023 18:23:03 +0000 (13:23 -0500)]
arm64: add swapueword8/32

Much like casueword*, except just a plain old swap.  Maintains a similar
interface to casu(9)- return value -1 (fault), 0 (success), or 1 (fail),
and also both ll/sc and LSE variants are implemented.

These will be used to implement 32-bit swp/swpb emulation on aarch64.

Reveiwed by: andrew
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D39837

15 months agoCirrus-CI: hide manual tasks from official runs
Ed Maste [Thu, 11 May 2023 15:16:51 +0000 (11:16 -0400)]
Cirrus-CI: hide manual tasks from official runs

Sponsored by: The FreeBSD Foundation

15 months agofbt/x86: update FBT_AFRAMES to match the trap handlers
Chuck Silvers [Thu, 11 May 2023 01:22:15 +0000 (18:22 -0700)]
fbt/x86: update FBT_AFRAMES to match the trap handlers

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D40054

15 months agodpaa2: Simplify addresses translation with PHYS_TO_DMAP
Dmitry Salychev [Tue, 2 May 2023 12:17:04 +0000 (14:17 +0200)]
dpaa2: Simplify addresses translation with PHYS_TO_DMAP

Approved by: bz (mentor)
Reviewed by: bz (mentor), mhorne
Differential Revision: https://reviews.freebsd.org/D39946
MFC after: 3 weeks

15 months agoktls_test: specify OpenSSL 1.1 API
Pierre Pronchery [Thu, 11 May 2023 03:49:44 +0000 (05:49 +0200)]
ktls_test: specify OpenSSL 1.1 API

Reviewed by: emaste
Sponsored by: The FreeBSD Foundation

15 months agobhyve: make passthru sel public available
Corvin Köhne [Wed, 10 May 2023 10:19:49 +0000 (12:19 +0200)]
bhyve: make passthru sel public available

The GVT-d emulation requires access to this selector to read from the
device.

Reviewed by: markj
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D40035

15 months agobhyve: add cmdline option for user defined fw_cfg items
Corvin Köhne [Wed, 8 Sep 2021 09:31:21 +0000 (11:31 +0200)]
bhyve: add cmdline option for user defined fw_cfg items

Some guest allow to configure themself by fw_cfg. E.g. Fedora CoreOs can
be provisioned by adding a JSON file as fw_cfg item.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D38338

15 months agoComplete removing twe(4)
Li-Wen Hsu [Thu, 11 May 2023 08:28:23 +0000 (16:28 +0800)]
Complete removing twe(4)

Fixes: 062a7b918fac twe: Remove driver

15 months agoe1000: fix VLAN 0
Kristof Provost [Wed, 10 May 2023 16:26:29 +0000 (18:26 +0200)]
e1000: fix VLAN 0

VLAN 0 essentially means "Treat as untagged, but with priority bits",
and is used by some ISPs.

On igb/em interfaces we did not receive packets with VLAN tag 0 unless
vlanhwfilter was disabled.

This can be fixed by explicitly listing VLAN 0 in the hardware VLAN
filter (VFTA). Do this from em_setup_vlan_hw_support(), where we already
(re-)write the VFTA.

Reviewed by: kbowling
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D40046

15 months agomd5: Add missing <errno.h>.
Dag-Erling Smørgrav [Thu, 11 May 2023 06:23:56 +0000 (06:23 +0000)]
md5: Add missing <errno.h>.

Sponsored by: Klara, Inc.
Reviewed by: yuripv
Differential Revision: https://reviews.freebsd.org/D40051

15 months agorc.subr(8): run `trailing-whitespace-fixer`
Enji Cooper [Thu, 11 May 2023 05:39:32 +0000 (22:39 -0700)]
rc.subr(8): run `trailing-whitespace-fixer`

This change deletes benign trailing whitespace from rc.subr, making
future non-stylistic changes easier to spot.

MFC after: 1 week

15 months agorc: add support for cpuset(1)
Miroslav Lachman [Thu, 11 May 2023 04:38:23 +0000 (23:38 -0500)]
rc: add support for cpuset(1)

If ${name}_cpuset is specified (and /usr is mounted), cpuset(1) will be
run to limit the service to the configured cpuset.

PR: 142434
Reviewed by: kevans

15 months agotwe: Remove driver
Warner Losh [Thu, 11 May 2023 04:24:12 +0000 (22:24 -0600)]
twe: Remove driver

Sponsored by: Netflix

15 months agolualoader: add support for .lua configuration files
Kyle Evans [Thu, 11 May 2023 04:10:53 +0000 (23:10 -0500)]
lualoader: add support for .lua configuration files

If a file is specified in loader_conf_files that ends in '.lua', lualoader
will now load and execute that file. These may be used in place of a
traditional loader.conf to use more complicated logic, where some values
may be set based on others or based on the environment that the C bits has
left us with.

Lua scripts are run in a limited environment. In particular, it does not get
access to any modules or, in-fact, anything except environment variable.

A config.buildenv hook has been added so that a local module can add
whatever it may need to to the environment.

When a global var is set in the lua script, it does not immediately alter
the loader environment. Instead, the script's environment is initially
empty and processed only if the whole script executes successfully.
Effectively, a lua configuration file either takes effect or it does not,
an error will not leave it in a half-baked state.

Reviewed by: bcr (manpages), imp
Differential Revision: https://reviews.freebsd.org/D28450

16 months agonet/pfkeyv2.h: fix typo, meNber
Konstantin Belousov [Wed, 10 May 2023 23:52:39 +0000 (02:52 +0300)]
net/pfkeyv2.h: fix typo, meNber

Sponsored by: NVidia networking
MFC after: 3 days

16 months agoInstall spleen vt(4) fonts
Ed Maste [Tue, 4 Jun 2019 20:31:00 +0000 (16:31 -0400)]
Install spleen vt(4) fonts

From https://github.com/fcambus/spleen, imported into contrib in
0d66206fff44.

Reviewed by: Frederic Cambus
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D20654

16 months agotsort: Add unit tests.
Dag-Erling Smørgrav [Wed, 10 May 2023 13:45:44 +0000 (15:45 +0200)]
tsort: Add unit tests.

MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D40043

16 months agotsort: Replace bcopy() with memcpy().
Dag-Erling Smørgrav [Wed, 10 May 2023 13:45:38 +0000 (15:45 +0200)]
tsort: Replace bcopy() with memcpy().

Also fix an indentation error I introduced in the previous commit.

Fixes: cb46f47c7969
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D40042

16 months agomd5: Add missing references to sha384.
Dag-Erling Smørgrav [Wed, 10 May 2023 13:45:11 +0000 (15:45 +0200)]
md5: Add missing references to sha384.

Fixes: 4849767cb16a
Sponsored by: Klara, Inc.
Reviewed by: allanjude
Differential Revision: https://reviews.freebsd.org/D40032

16 months agohier(7): fix a couple mandoc warnings
Mitchell Horne [Wed, 10 May 2023 13:26:35 +0000 (10:26 -0300)]
hier(7): fix a couple mandoc warnings

These references are rendered correctly without the zero-width space.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

16 months agohier(7): document /home/ and /usr/home/
Mitchell Horne [Wed, 10 May 2023 12:53:56 +0000 (09:53 -0300)]
hier(7): document /home/ and /usr/home/

Reviewed by: imp
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40002

16 months agohier(7): drop list of /usr/share/doc subdirectories
Mitchell Horne [Wed, 10 May 2023 12:53:40 +0000 (09:53 -0300)]
hier(7): drop list of /usr/share/doc subdirectories

Several entries are outdated, several new ones are missing. I do not
think there is much value added in maintaining this.

Reviewed by: imp, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40001

16 months agohier(7): drop list of /usr/include subdirectories
Mitchell Horne [Wed, 10 May 2023 12:52:47 +0000 (09:52 -0300)]
hier(7): drop list of /usr/include subdirectories

It is nice to have, however, the location of this information means that
it will naturally be missed by developers adding or removing directories
to the layout, so it trends out-of-date and it is out-of-date.

The target audience for hier(7) is users and administrators. It is not
expected to be a place that programmers should go to learn about the
purposes of the different C headers provided by FreeBSD.

Program authors needing FreeBSD-specific interfaces or libraries
(#include <sys/queue.h>, for instance) will either be following a more
detailed man page, or consulting the header contents directly. Folks
targeting standardized headers (#include <sys/time.h>) will not need
hier(7) to tell them where those headers are under /usr/include.

In other words, this is more detail than necessary for this document.
I'd go as far as to say that many of the existing entries in this list
do little more than parrot the name of the directory.

With all this in mind, let's drop the maintenance burden.

Reviewed by: imp, emaste
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40000

16 months agoifconfig: fix family selection after 982cd5ae8ef6
Alexander V. Chernikov [Wed, 10 May 2023 12:40:51 +0000 (12:40 +0000)]
ifconfig: fix family selection after 982cd5ae8ef6

16 months agoifconfig: fix interface selection after 982cd5ae8ef6.
Alexander V. Chernikov [Wed, 10 May 2023 12:06:10 +0000 (12:06 +0000)]
ifconfig: fix interface selection after 982cd5ae8ef6.

16 months agoarm64: fix stack unwinding past exception handlers
Zachary Leaf [Tue, 9 May 2023 16:04:44 +0000 (17:04 +0100)]
arm64: fix stack unwinding past exception handlers

Commit 281402e0a563 ("arm64: Shave off two instructions in exceptions")
removed the instruction that set the frame pointer (x29) as it appeared
to be unused.

The frame pointer is used in arm64/db_trace.c:db_stack_trace_cmd() when
unwinding state, and hence still needs to be set.

Add back the instruction to save_registers to properly update frame
pointer.

Reported by: andrew
Sponsored by: Arm Ltd

16 months agoifconfig: split argument parsing and actual execution logic
Alexander V. Chernikov [Wed, 10 May 2023 09:58:56 +0000 (09:58 +0000)]
ifconfig: split argument parsing and actual execution logic

Reduce the amount of global variables by creating the dedicated
 ifconfig_args structure and use it as a context-passing variable.
Simplify the code by moving all argument preparation code a
 separate function.

Reviewed by: kp (previous version)
Differential Revision: https://reviews.freebsd.org/D39932
MFC after: 2 weeks

16 months agonetlink: provide original interface lladdr in the interface dump.
Alexander V. Chernikov [Wed, 10 May 2023 09:49:34 +0000 (09:49 +0000)]
netlink: provide original interface lladdr in the interface dump.

* Store lladdr in the FreeBSD-specific IFLAF_ORIG_HWADDR attr
* Do not export empty IFLA_ADDRESS for interfaces w/o lladdrs.

MFC after: 2 weeks

16 months agonetlink: export more IPv6 ifa info
Alexander V. Chernikov [Wed, 10 May 2023 08:52:31 +0000 (08:52 +0000)]
netlink: export more IPv6 ifa info

* Fill in IFA_CACHEINFO with prefix lifetime data
* Map IPv6 IN6_IFF_ flags to Netlink IFA_F_ flags
* Store original ia6_flags in the FreeBSD-specific IFAF_FLAGS field

MFC after: 2 weeks

16 months agonetlink: export carp VHID when dumping interface addresses.
Alexander V. Chernikov [Wed, 10 May 2023 08:44:47 +0000 (08:44 +0000)]
netlink: export carp VHID when dumping interface addresses.

MFC after: 2 weeks

16 months agomd5: Don't increment a bool.
Dag-Erling Smørgrav [Tue, 9 May 2023 17:59:27 +0000 (17:59 +0000)]
md5: Don't increment a bool.

Fixes: 4849767cb16a
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D40020

16 months agomd5: Include <osreldate.h> for __FreeBSD_version.
Dag-Erling Smørgrav [Tue, 9 May 2023 17:59:19 +0000 (17:59 +0000)]
md5: Include <osreldate.h> for __FreeBSD_version.

It is usually provided by <sys/param.h>, but not when bootstrapping.

Fixes: 4849767cb16a
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: yuripv, kevans
Differential Revision: https://reviews.freebsd.org/D40018

16 months agomd5: Fix input error check.
Dag-Erling Smørgrav [Tue, 9 May 2023 17:59:13 +0000 (17:59 +0000)]
md5: Fix input error check.

Fixes: 4849767cb16a
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: tsoome, kevans, lwhsu
Differential Revision: https://reviews.freebsd.org/D40017

16 months agopkgbase: report error if files are installed multiple times
Ed Maste [Fri, 5 May 2023 17:44:39 +0000 (13:44 -0400)]
pkgbase: report error if files are installed multiple times

Files installed by `make installworld` should be installed only once.

PR: 244596
Sponsored by: The FreeBSD Foundation

16 months agoincludes: avoid installing if_wg.h twice
Ed Maste [Wed, 10 May 2023 00:28:44 +0000 (20:28 -0400)]
includes: avoid installing if_wg.h twice

if_wg.h was installed via dev/wg in LSUBDIRS and also explicitly.  We
want to install only wg/if_wg.h not the other headers, so add dev/wg to
the skip list in the copies and symlinks targets.

PR: 271266
Reviewed by: kevans
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40031

16 months agoloader: install help files only once
Ed Maste [Fri, 5 May 2023 17:43:33 +0000 (13:43 -0400)]
loader: install help files only once

Every file should be installed exactly once by `make installworld`.
This is especially important for pkgbase.

Loader help files were being installed by each loader variant (e.g.,
the simp, lua, and 4th EFI loaders).  Add a (slightly hacky) mechanism
to skip installing help files for all but one variant.

PR: 271178
Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40021

16 months agofreebsd-update: Fix merging already-updated files
Colin Percival [Fri, 5 May 2023 03:00:58 +0000 (20:00 -0700)]
freebsd-update: Fix merging already-updated files

When performing an "upgrade" (moving between FreeBSD releases, as
opposed to "update" which merely applies security/errata updates
to the installed release) FreeBSD Update:

1. Generates a list of "files needing to be merged", namely those
files which don't match the version installed in the "old" release
and have paths matching the MergeChanges configuration directive
(by default, /boot/device.hints and everything under /etc/).

and later on,

2. Compares the currently-installed files to the versions in the
"new" release, removing index entries for files which "don't need
to be updated because they're not changing".

Unfortunately if a file falls into both of these categories -- that
is to say, if a file in /etc/ is the same as the version in the new
release and not the same as the version in the old release -- the
resulting "merge" step saw that the file was no longer listed as
being part of the new release, resulting in the file being deleted.

For the first 18 years of FreeBSD Update's existence, this never
happened, since $FreeBSD$ tags resulted in "new release" files
always being different from any files systems would already have
installed.

This commit fixes this behaviour by only placing a file into the
"files needing to be merged" list if it does not match the version
in the old release *or* the version in the new release.

Reported by: des
Reviewed by: delphij (earlier version), des, emaste
MFC after: 7 days
X-EN-Candidate: yes
Differential Revision: https://reviews.freebsd.org/D39973

16 months agoCirrus-CI: add gcc12 automatic task on primary GitHub mirror
Ed Maste [Tue, 9 May 2023 18:26:47 +0000 (14:26 -0400)]
Cirrus-CI: add gcc12 automatic task on primary GitHub mirror

We want to get GCC coverage via Cirrus-CI, but don't want to trigger
excessive runs across all forks and branches.  Create a duplicate gcc12
task to run automatically for freebsd/freebsd-src.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation

16 months agoFix off-by-one error in fsck_ffs(8) chkrange() block-number check.
Kirk McKusick [Tue, 9 May 2023 20:08:10 +0000 (13:08 -0700)]
Fix off-by-one error in fsck_ffs(8) chkrange() block-number check.

On an amd64-CURRENT machine with an i-node that refers to a block
number that is one too large will cause a core dump, due to writing
beyond the end of blockmap[] and corrupting the next heap block,
which happens to contain a struct inoinfo in inphash[]. Note that
valgrind catches the blockmap[] access.

Reported by:  Robert Morris
PR:           271289
MFC after:    1 week
Sponsored by: The FreeBSD Foundation

16 months agoktls: re-work alloc thread
Andrew Gallatin [Mon, 8 May 2023 13:38:59 +0000 (09:38 -0400)]
ktls: re-work alloc thread

When the ktls_buffer zone needs to expand, it may fail due
to a lack of physically contiguous memory.  We tried to rectify
that by introducing an alloc thread to provide a context where
it is harmless to sleep, and letting that thread repopulate
the ktls_buffer zone.

However, it turns out that M_WAITOK is not enough, and we
must call vm_page_reclaim_contig_domain() to reclaim contig
memory. Worse, M_WAITOK results in the allocation essentially
busy-looping around vm_domain_alloc_fail() returning EAGIN,
causing vm_page_alloc_noobj_contig_domain() to loop and resulting
in the alloc thread consuming 100% CPU.

To fix this, we change the alloc thread to call
vm_page_reclaim_contig_domain_ext()

In order to prevent the busy loop around vm_domain_alloc_fail(), we
must change the uma_zalloc flags to M_NORECLAIM | M_NOWAIT.  However,
once that is done, these allocations become no different than the
allocations done in the critical path in ktls_buffer_alloc(), so its
best to just eliminate them.

Since we're no longer doing allocations but just calling
vm_page_reclaim_contig_domain_ext(), the name has changed to the ktls
reclaim thread.

Reviewed by: jhb, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39421

16 months agovm: implement vm_page_reclaim_contig_domain_ext()
Andrew Gallatin [Mon, 8 May 2023 13:25:40 +0000 (09:25 -0400)]
vm: implement vm_page_reclaim_contig_domain_ext()

Implement vm_page_reclaim_contig_domain_ext() to reclaim multiple
contiguous regions at once.  This makes it more efficient for users
that need multiple contiguous regions to reclaim those regions
efficiently.

This is needed because callers like ktls may need to reclaim many
contiguous regions, and each scan of physical memory can take
multiple seconds on a large memory machine (order of 100GB of
RMA).  Rather than modifying the core algorithm, I extended
vm_page_reclaim_contig_domain() to take a "desired_runs" argument to
allow the caller to request that it reclaim more than just a single
run. There is no functional change intended for all existing
callers.

The first user for this interface is the ktls code
(https://reviews.freebsd.org/D39421). By reclaiming multiple runs,
ktls goes from consuming hours of CPU to refill its buffer zone to
just seconds or minutes.

Differential Revision: https://reviews.freebsd.org/D39739
Sponsored by: Netflix
Reviewed by: alc, jhb, markj

16 months agoRevert "cpuset: increase userland maximum size to 1024"
Ed Maste [Tue, 9 May 2023 13:40:27 +0000 (09:40 -0400)]
Revert "cpuset: increase userland maximum size to 1024"

This reverts commit 76887e84be975698b14699d7d0dfb157d73e9990.

struct vm_exit currently requires that cpuset_t be identical in userland
and kernel.  This will be recommitted after these are decoupled.

PR: 271330, 269572
Reported by: corvink
Sponsored by: The FreeBSD Foundation

16 months agolocks: fix two potential overflows in the lock delay code
Jonathan T. Looney [Tue, 9 May 2023 16:20:49 +0000 (16:20 +0000)]
locks: fix two potential overflows in the lock delay code

With large numbers of CPUs, the calculation of the maximum lock delay
could overflow, leading to an unexpectedly low delay. In fact, the
maximum delay would calculate to 0 on systems with between 128 and
255 cores (inclusive). Also, when calculating the new delay in
lock_delay(), the delay would overflow if the old delay was >= 32,768.

This commit fixes these two overflows. It also updates the maximum
delay from 32,678 to SHRT_MAX.

Reviewed by: gallatin, jhb, mjg
Fixes: 6b8dd26e7c5f ("locks: convert delay times to u_short")
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D39372

16 months agoamd64 MINIMAL: SysV IPC syscalls are loadable
Konstantin Belousov [Sat, 6 May 2023 20:03:07 +0000 (23:03 +0300)]
amd64 MINIMAL: SysV IPC syscalls are loadable

Reviewed by: emaste, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39990

16 months agoamd64 MINIMAL: remove UFS from compiled-in list
Konstantin Belousov [Sat, 6 May 2023 20:02:34 +0000 (23:02 +0300)]
amd64 MINIMAL: remove UFS from compiled-in list

Reviewed by: emaste, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39990

16 months agoamd64 MINIMAL config: remove statements about UFS module
Konstantin Belousov [Sat, 6 May 2023 20:01:45 +0000 (23:01 +0300)]
amd64 MINIMAL config: remove statements about UFS module

All UFS options work for ufs.ko.

Reviewed by: emaste, imp
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39990

16 months agosmp_topo(): correct allocation sizes for trivial topologies
Konstantin Belousov [Tue, 9 May 2023 15:08:22 +0000 (18:08 +0300)]
smp_topo(): correct allocation sizes for trivial topologies

This patch should not modify the correctness, only the clarity.

Requested and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39981

16 months agosmp_topo(): make it idempotent
Konstantin Belousov [Sun, 7 May 2023 18:37:42 +0000 (21:37 +0300)]
smp_topo(): make it idempotent

If more than one call to the function occurs, it currently allocates the
same amount from the group[] array, eventually leading to the memory
corruption.

Noted and reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39981

16 months agosmp_topo: dynamically allocate group array
Konstantin Belousov [Fri, 5 May 2023 20:24:22 +0000 (23:24 +0300)]
smp_topo: dynamically allocate group array

Limit its size to mp_maxid + 1 times MAX_CACHE_LEVELS instead MAXCPU.
Allocate the array on a first call into smp_topo(9) functions, where
the mp_maxid is already known.

Make the array private to smp_topo_alloc(), assuming that the callers
that allocate top-level group do it once.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39981

16 months agoquiesce_cpus(): do not overallocate generation array
Konstantin Belousov [Fri, 5 May 2023 20:21:38 +0000 (23:21 +0300)]
quiesce_cpus(): do not overallocate generation array

Also switch to mallocarray().

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D39981

16 months agonetlink: fix compiler warnings
Alexander V. Chernikov [Tue, 9 May 2023 15:26:16 +0000 (15:26 +0000)]
netlink: fix compiler warnings

16 months agonetlink: temporary skip snl(3) capped test.
Alexander V. Chernikov [Tue, 9 May 2023 14:59:41 +0000 (14:59 +0000)]
netlink: temporary skip snl(3) capped test.

16 months agonetlink: automatically fill sin6_scope_id in the default snl(3) parsers.
Alexander V. Chernikov [Tue, 9 May 2023 14:55:47 +0000 (14:55 +0000)]
netlink: automatically fill sin6_scope_id in the default snl(3) parsers.

Add the optional post-parse hook to the snl(3) parser declaration.
Use this hook to automatically add the interface indexes to the
 link-local sockaddrs.

MFC after: 2 weeks

16 months agonetlink: use consistent variable lifetime in the default snl(3) parsers.
Alexander V. Chernikov [Tue, 9 May 2023 14:45:57 +0000 (14:45 +0000)]
netlink: use consistent variable lifetime in the default snl(3) parsers.

Currently, parsers use original strings/nla pointers instead of
duplicating them. These pointers refer to the temporary packet buffer,
 which can be silently rewritten when the next message is read.
Instead, duplicate all string/nla attributes using snl_allocz(3) to
 give control over variable lifetime to the user.

MFC after: 2 weeks

16 months agoefiwake(8): add man page
Johannes Totz [Tue, 9 May 2023 13:42:19 +0000 (14:42 +0100)]
efiwake(8): add man page

Reviewed by: christos, grahamperrin, kib
Differential revision: https://reviews.freebsd.org/D39961

16 months agogeom.8: Fix typos and wordsmith
Mateusz Piotrowski [Tue, 9 May 2023 13:46:00 +0000 (15:46 +0200)]
geom.8: Fix typos and wordsmith

MFC after: 3 days

16 months agofwget: Use BSD-2-Clause instead of BSD-2-Clause-FreeBSD
Emmanuel Vadot [Tue, 9 May 2023 14:03:39 +0000 (16:03 +0200)]
fwget: Use BSD-2-Clause instead of BSD-2-Clause-FreeBSD

Reported by: bz
Sponsored by: Beckhoff Automation GmbH & Co. KG

16 months agofwget: Fix a few kmod name
Emmanuel Vadot [Tue, 9 May 2023 14:02:03 +0000 (16:02 +0200)]
fwget: Fix a few kmod name

The -kmod part was forgot in a few names for Intel firmware.

Fixes: d198b8774d2c ("fwget: Introduce new utility")
Reported by: bz
Sponsored by: Beckhoff Automation GmbH & Co. KG

16 months agolibfido2: specify OpenSSL 1.1 API
Ed Maste [Tue, 9 May 2023 12:44:23 +0000 (08:44 -0400)]
libfido2: specify OpenSSL 1.1 API

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.  A future
libfido2 update may switch to use OpenSSL 3.0 APIs.

Sponsored by: The FreeBSD Foundation

16 months agobhyve: save/restore pir_desc
Vitaliy Gusev [Tue, 9 May 2023 08:27:29 +0000 (10:27 +0200)]
bhyve: save/restore pir_desc

Failing to preserve pir_desc can result in pending interrupts being lost
on resume leading to a hung VM.

Reviewed by: corvink, jhb
MFC after: 1 week
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D35447

16 months agobhyve: fix vCPU single-stepping on VMX
Bojan Novković [Tue, 9 May 2023 07:02:04 +0000 (09:02 +0200)]
bhyve: fix vCPU single-stepping on VMX

This patch fixes virtual machine single stepping on VMX hosts.

Currently, when using bhyve's gdb stub, each attempt at single-stepping
a vCPU lands in a timer interrupt. The current single-stepping mechanism
uses the Monitor Trap Flag feature to cause VMEXIT after a single
instruction is executed. Unfortunately, the SDM states that MTF causes
VMEXITs for the next instruction that gets executed, which is often not
what the person using the debugger expects. [1]

This patch adds a new VM capability that masks interrupts on a vCPU by
blocking interrupt injection and modifies the gdb stub to use the newly
added capability while single-stepping a vCPU.

[1] Intel SDM 26.5.2 Vol. 3C

Reviewed by: corvink, jbh
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39949

16 months agoem(4): update sysctl list, mention iflib(4)
Yuri Pankov [Tue, 9 May 2023 08:00:32 +0000 (10:00 +0200)]
em(4): update sysctl list, mention iflib(4)

Some of the settings, e.g. disabling/enabling msix, are now handled
as generic iflib variables; mention iflib explicitly in tunables
section (in addition to SEE ALSO).

Reviewed by: cc, gbe (manpages)
Differential Revision: https://reviews.freebsd.org/D39999

16 months agoRevert "uart(4): add Sunrise Point UART controllers"
Kyle Evans [Tue, 9 May 2023 06:38:32 +0000 (01:38 -0500)]
Revert "uart(4): add Sunrise Point UART controllers"

This reverts commit d1b6271118188dd25a18f2372ab1d3004335ea3c.

I've received multiple reports of machines failing to boot with
this hardware; back it out for now until we can fix it.

PR: 271147
MFC after: Morning coffee

16 months agoacl(3): improve discoverability of acl_get_perm_np(3)
Kyle Evans [Tue, 9 May 2023 03:45:12 +0000 (22:45 -0500)]
acl(3): improve discoverability of acl_get_perm_np(3)

- Mention it in acl(3) as an available function, xref
- Mention it in acl_get_permset(3), as acl_get_perm_np(3) is a natural
    follow-up to acl_get_permset(3)

Sponsored by: Klara, Inc.

16 months agocalendar: cleanup obsolete directories
Yuri Pankov [Mon, 8 May 2023 22:43:12 +0000 (00:43 +0200)]
calendar: cleanup obsolete directories

Follow 5282ada06bb and don't reinstall obsolete directories.

16 months agobhyve: specify OpenSSL 1.1 API
Ed Maste [Mon, 8 May 2023 12:09:26 +0000 (08:09 -0400)]
bhyve: specify OpenSSL 1.1 API

OPENSSL_API_COMPAT can be used to specify the OpenSSL API version in
use for the purpose of hiding deprecated interfaces and enabling
the appropriate deprecation notices.

This change is a NFC while we're still using OpenSSL 1.1.1 but will
avoid deprecation warnings upon the switch to OpenSSL 3.0.  A future
change can then switch bhyve to use OpenSSL 3.0 APIs.

Reviewed by: jhb
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39998

16 months agocpuset: increase userland maximum size to 1024
Ed Maste [Tue, 2 May 2023 20:57:12 +0000 (16:57 -0400)]
cpuset: increase userland maximum size to 1024

Hardware with more than 256 CPU cores is now available and will become
increasingly common.  Bump CPU_MAXSIZE (used for userland cpuset_t
sizing) to 1024 to define the ABI for FreeBSD 14.

PR: 269572, 271213 [exp-run]
Reviewed by: mjg, jhb
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39941

16 months agoif_ovpn tests: fix route_to test case
Kristof Provost [Mon, 8 May 2023 15:44:47 +0000 (17:44 +0200)]
if_ovpn tests: fix route_to test case

* Move the .254 address to the tunnel device so we reply through the
  tunnel.
* Remove the network route to 'break' routing, which we then 'fix' with
  pf's route-to, which is the functionality we wanted to test in the
  first place.

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

16 months agoif_ovpn: notify userspace when we've used half of the sequence numbers
Kristof Provost [Mon, 8 May 2023 14:41:48 +0000 (16:41 +0200)]
if_ovpn: notify userspace when we've used half of the sequence numbers

OpenVPN uses the sequence number (as well as a userspace supplied nonce)
to build the IV. This means we should avoid re-using sequence numbers.
However, userspace doesn't know how many packets we've sent (and thus
what sequence number we're up to).

Notify userspace when we've used half of the available sequence numbers
to tell it that it's time for a key renegotiaton.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D39570

16 months agoarm64/disassem.c: Add detection of xzr and sp
Mykola Hohsadze [Mon, 8 May 2023 13:39:09 +0000 (10:39 -0300)]
arm64/disassem.c: Add detection of xzr and sp

Added support to distinguish between XZR/WZR and SP/WSP registers.

Add new OP_ flags to indicate if the instruction allows the use of SP
for a given register field. "wSP" and "SP" are removed from w_reg and
x_reg, and helper functions are introduced for this purpose of detecting
the correct name of the x31 register.

mhorne: While here, adjust some whitespace issues from a previous
commit.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D39862

16 months agovt(4): document enable_altgr
Yuri Pankov [Mon, 8 May 2023 13:51:43 +0000 (15:51 +0200)]
vt(4): document enable_altgr

Reviewed by: bcr
Differential Revision: https://reviews.freebsd.org/D39997

16 months agomd5: Improve compatibility.
Dag-Erling Smørgrav [Mon, 8 May 2023 06:56:09 +0000 (06:56 +0000)]
md5: Improve compatibility.

* Overhaul the GNU compatibility mode to more closely emulate what the GNU tools do.

* Add a Perl compatibility mode which emulates the shasum tool that ships with Perl.  This is currently not installed.

* Overhaul the tests.

Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D39446

16 months agotwe: Add deprecation notice
Warner Losh [Mon, 8 May 2023 05:14:12 +0000 (23:14 -0600)]
twe: Add deprecation notice

This was flagged for removal in 14 over a year ago. Add deprecation to
man page.

MFC After: 3 days

16 months agoMAINTAINERS: Add myself to stand
Warner Losh [Mon, 8 May 2023 04:28:16 +0000 (22:28 -0600)]
MAINTAINERS: Add myself to stand

People email me when the boot loader breaks anyway, so ask to be
included in reviews. And ask strongly since I've had to deal with too
many major breakages lately, distruting other things I need to do.

Sponsored by: Netflix

16 months agociss: Fix typo
Warner Losh [Mon, 8 May 2023 04:25:01 +0000 (22:25 -0600)]
ciss: Fix typo

Although unused, fixed type in CISS_BOARD_UNKNOWN #define.

Submitted by: Peter Eriksson (a trivial part of D25155)

16 months agounionfs(): destroy root vnode if upper registration fails
Jason A. Harmening [Sun, 26 Mar 2023 01:50:55 +0000 (20:50 -0500)]
unionfs(): destroy root vnode if upper registration fails

If unionfs_domount() fails, the mount path will not call VFS_UNMOUNT()
to clean up after it.  If this failure happens during upper vnode
registration, the unionfs root vnode will already be allocated.
vflush() it in order to prevent the vnode from being leaked and the
subsequent vfs_mount_destroy() call from getting stuck waiting for
the mountpoint reference count to drain.

Reviewed by: kib, markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D39767

16 months agounionfs: prevent upperrootvp from being recycled during mount
Jason A. Harmening [Sun, 26 Mar 2023 01:41:33 +0000 (20:41 -0500)]
unionfs: prevent upperrootvp from being recycled during mount

If upperrootvp is doomed by a concurrent unmount, unionfs_nodeget()
may return without a reference or lock on it.  unionfs_domount() must
prevent the vnode from being recycled for use by a different file until
it is finished with the vnode, namely once vfs_register_upper_from_vp()
fails.  Accomplish this by holding the reference returned by namei()
a bit longer.

Reviewed by: kib, markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D39767

16 months agounionfs: fixes to unionfs_nodeget() error handling
Jason A. Harmening [Sun, 26 Mar 2023 01:30:25 +0000 (20:30 -0500)]
unionfs: fixes to unionfs_nodeget() error handling

If either the lower or upper vnode is found to be doomed after
locking it, the newly-created unionfs node won't be associated
with it and its lock will be dropped.  In that case, clear the
uppervp and lowervp locals as necessary to avoid further use
of the vnode in unionfs_nodeget().  If the upper vnode is doomed
but the lower vnode remains valid, additionally reset the unionfs
node's v_vnlock field to point to the lower vnode lock.

Reviewed by: kib, markj
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D39767

16 months agolibc: document when the namespace was created
Mariusz Zaborski [Sun, 7 May 2023 09:45:13 +0000 (11:45 +0200)]
libc: document when the namespace was created

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D39989

16 months agoRELNOTES: fix consistency
Elliott Mitchell [Sun, 7 May 2023 05:30:21 +0000 (23:30 -0600)]
RELNOTES: fix consistency

Colons on the commit ids started being lost at 89d197cc991a and
continued subsequent updates.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D39991

16 months agomountd: Improve error message for exports lines
Alexander Motin [Sat, 6 May 2023 18:57:14 +0000 (14:57 -0400)]
mountd: Improve error message for exports lines

Currently mountd print error message "symbolic link in export path or
statfs failed" in case some path component in an exports line fails
validation.  This revision improves the error message by giving more
information about the precise error as well as the path component that
caused the issue.

Submitted by: Andrew Walker <awalker@ixsystems.com>
Reviewed by: mav, rmacklem
Differential Revision: https://reviews.freebsd.org/D39840

16 months agohwpmc: pass pmc pointer to more class methods
Mitchell Horne [Fri, 5 May 2023 22:00:02 +0000 (19:00 -0300)]
hwpmc: pass pmc pointer to more class methods

In many cases this avoids an extra lookup, since the callers always have
pm at hand. We can also eliminate several assertions, mostly for pm !=
NULL. The class methods are an internal interface, and the callers
already handle such a scenario. No functional change intended.

Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39915

16 months agohwpmc: unused/diagused annotations in tsc class
Mitchell Horne [Fri, 5 May 2023 21:59:53 +0000 (18:59 -0300)]
hwpmc: unused/diagused annotations in tsc class

These are preferred over casts to void. No functional change.

Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39914

16 months agohwpmc: remove stub pmd_switch_{in,out} methods
Mitchell Horne [Fri, 5 May 2023 21:59:41 +0000 (18:59 -0300)]
hwpmc: remove stub pmd_switch_{in,out} methods

Most platforms (non-x86) don't require these methods and implement stub
versions. If we initialize the pmc_mdep structure to always point to the
generic versions, then we can purge the duplicate stubs.

Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39913

16 months agohwpmc: remove pmd_pcpu_{init,fini} callbacks
Mitchell Horne [Fri, 5 May 2023 21:59:33 +0000 (18:59 -0300)]
hwpmc: remove pmd_pcpu_{init,fini} callbacks

These are unused on all platforms.

Reviewed by: jkoshy, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39912

16 months agohwpmc_logging: less macro magic for type names
Mitchell Horne [Fri, 5 May 2023 21:59:27 +0000 (18:59 -0300)]
hwpmc_logging: less macro magic for type names

Provide the log type names in their entirely, rather than relying on the
macro to prepend the prefix. This improves their searchability; for
example, if I see PMCLOG_TYPE_PMCALLOCATE in libpmc I will now be able
to find where that is emitted in the kernel with a simple grep.

Reviewed by: jkoshy, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39911

16 months agohwpmc: don't use deprecated copystr(9)
Mitchell Horne [Fri, 5 May 2023 21:59:15 +0000 (18:59 -0300)]
hwpmc: don't use deprecated copystr(9)

It is just wrapper around strlcpy(), but results in more complicated
code. Clean this up to use strlcpy() or snprintf() as appropriate.

Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39910

16 months agohwpmc: use kstack_contains()
Mitchell Horne [Fri, 5 May 2023 21:59:01 +0000 (18:59 -0300)]
hwpmc: use kstack_contains()

This existing helper function is preferable to the hand-rolled
calculation of the kstack bounds.

Make some small style improvements while here. Notably, rename every
instance of "r", the return address, to "ra". Tidy the includes in the
affected files.

Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39909

16 months agohwpmc: simplify arm64 kernel stack unwinding
Mitchell Horne [Fri, 5 May 2023 21:58:40 +0000 (18:58 -0300)]
hwpmc: simplify arm64 kernel stack unwinding

Use the unwind_frame() function, which properly validates the frame
pointer and uses ADDR_MAKE_CANONICAL() for the pc, required when PAC is
enabled.

Reviewed by: andrew, markj, jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39934

16 months agopmcstat: augment an error message
Mitchell Horne [Fri, 5 May 2023 21:58:23 +0000 (18:58 -0300)]
pmcstat: augment an error message

It also applies to the -t argument.

Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39907

16 months agohwpmc: formatting of CPU and class lists
Mitchell Horne [Fri, 5 May 2023 21:58:13 +0000 (18:58 -0300)]
hwpmc: formatting of CPU and class lists

The end result is much more legible in both cases.

Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39906

16 months agohwpmc: trim MIPS CPU and class defs
Mitchell Horne [Fri, 5 May 2023 21:57:44 +0000 (18:57 -0300)]
hwpmc: trim MIPS CPU and class defs

MIPS is gone, and this is the last remaining bit in the pmc code.

Reviewed by: jkoshy, emaste
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39905

16 months agohwpmc: trim obsolete Intel CPU and class defs
Mitchell Horne [Fri, 5 May 2023 21:57:38 +0000 (18:57 -0300)]
hwpmc: trim obsolete Intel CPU and class defs

No functional change.

Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39904

16 months agopmccontrol: drop Pentium 4 special case
Mitchell Horne [Fri, 5 May 2023 21:57:23 +0000 (18:57 -0300)]
pmccontrol: drop Pentium 4 special case

This is dead code; we no longer support Pentium hardware in libpmc or
hwpmc.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

16 months agopmc_events.h: event list formatting
Mitchell Horne [Fri, 5 May 2023 21:57:14 +0000 (18:57 -0300)]
pmc_events.h: event list formatting

Improve the legibility of the list. Bump overall indentation, fix some
whitespace, and sort the IAF block.

Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39903

16 months agopmc_events.h: update event list comment
Mitchell Horne [Fri, 5 May 2023 21:56:55 +0000 (18:56 -0300)]
pmc_events.h: update event list comment

This comment is no longer in sync with the contents of __PMC_EVENTS().
Update to reflect the removal of various Intel event definitions from
this list; these event definitions now come from Linux and live in
lib/libpmc/pmu-events/.

Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39902

16 months agohwpmc: remove remaining UCP event definitions
Mitchell Horne [Fri, 5 May 2023 21:56:34 +0000 (18:56 -0300)]
hwpmc: remove remaining UCP event definitions

Although this block has remained in __PMC_EVENTS(), there is no handling
of UCP in libpmc/libpmc.c, so it is not possible to select one of these
events. It should therefore be impossible to trigger the code removed
from ucp_start_pmc(). Note that the GQ_SNOOP_MSF MSR exists only for
Nehalem and Westmere architectures, and the related events do not exist
for later generations.

The Uncore support in hwpmc has severely atrophied in general. We have
uncore event definitions in pmu-events, but the kernel support was
written against Intel Performance Measurement Architecture version 2,
and is disabled for processor generations later than Westmere. Nehalem
and Westmere lack uncore event definitions in pmu-events. I'd be
surprised if Uncore support is usable on any machine in its current
state.

Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39901

16 months agohwpmc: drop vestigial IAP event definitions
Mitchell Horne [Fri, 5 May 2023 21:55:54 +0000 (18:55 -0300)]
hwpmc: drop vestigial IAP event definitions

These are maintained elsewhere. No functional change.

Reviewed by: jkoshy
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39900