Commit Graph

283631 Commits

Author SHA1 Message Date
Pierre Pronchery
74192f9b2d ktls_test: specify OpenSSL 1.1 API
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
2023-05-11 10:30:51 -04:00
Corvin Köhne
60793cee27
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
2023-05-11 14:30:19 +02:00
Corvin Köhne
ca14781c81
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
2023-05-11 14:20:32 +02:00
Li-Wen Hsu
fec7422037
Complete removing twe(4)
Fixes:	062a7b918f twe: Remove driver
2023-05-11 16:28:23 +08:00
Kristof Provost
0229fab2fe 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
2023-05-11 09:48:50 +02:00
Dag-Erling Smørgrav
27e74c8fff md5: Add missing <errno.h>.
Sponsored by:	Klara, Inc.
Reviewed by:	yuripv
Differential Revision:	https://reviews.freebsd.org/D40051
2023-05-11 06:24:02 +00:00
Enji Cooper
4e9041a786 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
2023-05-10 22:39:32 -07:00
Miroslav Lachman
0661f93892 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
2023-05-10 23:40:18 -05:00
Warner Losh
062a7b918f twe: Remove driver
Sponsored by:		Netflix
2023-05-10 22:24:12 -06:00
Kyle Evans
3cb2f5f369 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
2023-05-10 23:10:53 -05:00
Konstantin Belousov
b6d3a9644d net/pfkeyv2.h: fix typo, meNber
Sponsored by:	NVidia networking
MFC after:	3 days
2023-05-11 02:52:39 +03:00
Ed Maste
3d6a94db10 Install spleen vt(4) fonts
From https://github.com/fcambus/spleen, imported into contrib in
0d66206fff.

Reviewed by:	Frederic Cambus
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D20654
2023-05-10 13:57:07 -04:00
Dag-Erling Smørgrav
09aee57098 tsort: Add unit tests.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D40043
2023-05-10 15:45:44 +02:00
Dag-Erling Smørgrav
b55bc49e86 tsort: Replace bcopy() with memcpy().
Also fix an indentation error I introduced in the previous commit.

Fixes:		cb46f47c79
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D40042
2023-05-10 15:45:38 +02:00
Dag-Erling Smørgrav
00de65aaed md5: Add missing references to sha384.
Fixes:		4849767cb1
Sponsored by:	Klara, Inc.
Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D40032
2023-05-10 15:45:11 +02:00
Mitchell Horne
031049cf32 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
2023-05-10 10:26:35 -03:00
Mitchell Horne
36db6b0496 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
2023-05-10 10:25:17 -03:00
Mitchell Horne
1bc55f5839 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
2023-05-10 10:18:21 -03:00
Mitchell Horne
c3b611e153 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
2023-05-10 10:17:41 -03:00
Alexander V. Chernikov
444b9aa78c ifconfig: fix family selection after 982cd5ae8e 2023-05-10 12:40:51 +00:00
Alexander V. Chernikov
a3cb80bc63 ifconfig: fix interface selection after 982cd5ae8e. 2023-05-10 12:22:39 +00:00
Zachary Leaf
2b8c4137d4 arm64: fix stack unwinding past exception handlers
Commit 281402e0a5 ("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
2023-05-10 12:54:54 +01:00
Alexander V. Chernikov
982cd5ae8e 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
2023-05-10 10:39:12 +00:00
Alexander V. Chernikov
3c851dc19b 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
2023-05-10 09:57:01 +00:00
Alexander V. Chernikov
30d0fc6f33 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
2023-05-10 09:57:01 +00:00
Alexander V. Chernikov
1224878016 netlink: export carp VHID when dumping interface addresses.
MFC after:	2 weeks
2023-05-10 09:57:01 +00:00
Dag-Erling Smørgrav
facc213643 md5: Don't increment a bool.
Fixes:		4849767cb1
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D40020
2023-05-10 09:25:21 +00:00
Dag-Erling Smørgrav
90eaf4b2f9 md5: Include <osreldate.h> for __FreeBSD_version.
It is usually provided by <sys/param.h>, but not when bootstrapping.

Fixes:		4849767cb1
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	yuripv, kevans
Differential Revision:	https://reviews.freebsd.org/D40018
2023-05-10 09:25:21 +00:00
Dag-Erling Smørgrav
f1ceb05a46 md5: Fix input error check.
Fixes:		4849767cb1
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	tsoome, kevans, lwhsu
Differential Revision:	https://reviews.freebsd.org/D40017
2023-05-10 09:25:21 +00:00
Ed Maste
0e04dd3b66 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
2023-05-09 21:10:03 -04:00
Ed Maste
b6271cc0d0 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
2023-05-09 21:09:39 -04:00
Ed Maste
e32fecd0c2 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
2023-05-09 20:18:19 -04:00
Colin Percival
c55b7e5226 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
2023-05-09 16:28:09 -07:00
Ed Maste
f5f1b9a982 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
2023-05-09 17:13:44 -04:00
Kirk McKusick
b3fe5d9322 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
2023-05-09 13:08:10 -07:00
Andrew Gallatin
1985585233 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
2023-05-09 13:09:34 -04:00
Andrew Gallatin
8b0dafdb2f 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
2023-05-09 13:09:34 -04:00
Ed Maste
ea6dd3d1d4 Revert "cpuset: increase userland maximum size to 1024"
This reverts commit 76887e84be.

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
2023-05-09 13:05:00 -04:00
Jonathan T. Looney
8a16fb4730 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:	6b8dd26e7c ("locks: convert delay times to u_short")
MFC after:	2 weeks
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D39372
2023-05-09 16:20:49 +00:00
Konstantin Belousov
bf864c3ed5 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
2023-05-09 18:30:07 +03:00
Konstantin Belousov
0c1c5e36eb 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
2023-05-09 18:30:07 +03:00
Konstantin Belousov
bba6249ae9 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
2023-05-09 18:30:07 +03:00
Konstantin Belousov
361c8f75a6 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
2023-05-09 18:30:07 +03:00
Konstantin Belousov
d0f67f9757 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
2023-05-09 18:30:07 +03:00
Konstantin Belousov
9801e7c275 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
2023-05-09 18:30:07 +03:00
Konstantin Belousov
ccc6b87b38 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
2023-05-09 18:30:07 +03:00
Alexander V. Chernikov
e8e7e1462e netlink: fix compiler warnings 2023-05-09 15:26:16 +00:00
Alexander V. Chernikov
04dacd5691 netlink: temporary skip snl(3) capped test. 2023-05-09 14:59:41 +00:00
Alexander V. Chernikov
88bd9ef618 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
2023-05-09 14:55:47 +00:00
Alexander V. Chernikov
ba9c815d30 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
2023-05-09 14:45:57 +00:00