Commit Graph

20049 Commits

Author SHA1 Message Date
Rick Macklem
fe5c211ba8 nfsd.c: Log a more meaningful failure message
For the cases where the nfsd(8) daemon is already running or
has failed to start within a prison due to an incorrect prison
configuration, the failure message logged is:
  Can't read stable storage file: operation not permitted

This patch replaces the above with more meaningful messages.
It depends on commit 10dff9da97 to differentiate between the
above two cases, however even without this commit, the messages
should be an improvement.

MFC after:	3 months
2023-02-22 14:09:15 -08:00
Kyle Evans
c04ad15ca7 config: address a number of Coverity issues
Highlights:
- Various memory leaks
- FILE* leaks
- `tsize` in moveifchanged() is only needed if !changed, and `from_sb`
    is only valid if !changed.
- Simplify trivially true expression
- Sanity check elfdump size output (+ fix variable sizes) (des@)

CID:	1471167, 1006391, 1505333, 1505275, 1505349, 1505306, 1505232
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D38643
2023-02-16 14:37:06 -06:00
Kyle Evans
da88842029 config: error out on malformed env/hint lines
We need these to be assignments, error out if they're not.

While we're here, tag errout as __printflike so that the compiler will
sanity check the format string + args.

CID:	1505293
Reviewed by:	emaste, imp
Differential Revision:	https://reviews.freebsd.org/D38642
2023-02-16 14:37:05 -06:00
Kyle Evans
b2c5a01722 config: push path() into moveifchanged()
Every caller path()s its arguments anyways, just simplify these and push
path() into moveifchanged().  This fixes a number of memory leaks in the
process since path() allocates memory, which we will now free().

While we're here, make sure we close from_fd/to_fd appropriately.

CID:	1471040, 1471714, 1472045, 1006907, 1006908
Reviewed by:	emaste, imp
Differential Revision:	https://reviews.freebsd.org/D38641
2023-02-16 14:36:42 -06:00
Kyle Evans
f518229d55 config: fix some common issues with path() usage
None of the callers check that the allocation in path() failed, so let's
check in path() and abort instead of failing.

Along those lines, none of the callers seem to acknowledge that the
returned string needs to be free()d -- let's do that as well.  There are
a couple not addressed in this commit that will be addressed in a future
commit by pushing the path() call down into moveifchanged() instead and
freeing it properly there.

CID:	1505271, 1505250, 1505279
Reviewed by:	emaste, imp
2023-02-16 14:36:16 -06:00
Warner Losh
9a79152994 efibootmgr: Add --efidev (-u) to discover UEFI's device path to a dev or file
"efibootmgr --efidev unix-path" will return the UEFI device-path to the
file or device specified by unix-path. It's useful for debugging, but
may also be useful for scripting.

Sponsored by:		Netflix
Reviewed by:		corvink, manu
Differential Revision:	https://reviews.freebsd.org/D38617
2023-02-16 08:54:39 -07:00
Warner Losh
547fb1426c efidp: Remove write only variable
Sponsored by:		Netflix
2023-02-15 16:03:54 -07:00
Stefan Eßer
c2bb66023f kbdcontrol: enable pre-Unicode dead key table compatibility
The definition of pre-Unicode keymap ioctls will be made optional and
dependent on COMPAT_FREEBSD13 in a follow-up commit to 14-CURRENT.

While we generally provide ABI compatibility for older binaries on
a new kernel, but not functionally extended userland programs on an
old kernel, it has been specifically requested to preserve ABI
compatibility for the kbdcontrol program for both these cases.

Passing the kernel configuration option COMPAT_FREEBSD13 to the build
of kbdcontrol will make ioctls visible to the build that are normally
hidden, but required to implement compatibility with kernels that only
support 8 bit characters in dead key maps.

This commit is not to be merged to any previous FreeBSD version and
it shall be reverted as soon as this type of ABI compatibility is no
longer deemed necessary (probably before 14-STABLE is branched).

This commit is a part of review D38465 and split off to allow it to be
reverted using the commit ID.
2023-02-14 13:49:06 +01:00
Stefan Eßer
b4eab621f2 kbdcontrol.c: make pre-Unicode compatibility conditional
Support for the full range of Unicode character codes has been added
to the main keymap back in 2009, with compatibility shims added in
2011 (to support an older kbdcontrol command on a new kernel during
an upgrade from FreeBSD-8 to FreeBSD-9).

Unicode support for accented characters that are reached via dead key
combinations has been added just recently, again with compatibility
shims to allow all combinations of old/new kernel and old/new
kbdcontrol command to load and display the keymaps including the dead
key table. (But full Unicode in the dead key table requires both a new
kernel and kbdcontrol command.)

This commit makes the compatibility shims depend on the respective
compatibility ioctls (OGIO_KEYMAP, OPIO_KEYMAP, OGIO_DEADKEYMAP, and
OPIO_DEADKEYMAP) being defined in sys/kbio.h. This is true for all of
them in 13-STABLE, none in 12-STABLE (as of now), and will become
optional due to a follow-up commit to sys/kbio.h in -CURRENT.

This commit is the only part of review D38465 that should be merged
back to 12-STABLE and 13-STABLE.

MFC after:	1 month
2023-02-14 13:27:27 +01:00
Corvin Köhne
b11081dca7
bhyve: add emulation for qemu's fwcfg data port
The data port returns the data of the fwcfg item.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38333
2023-02-14 08:28:49 +01:00
Corvin Köhne
151d8131a8
bhyve: add emulation for the qemu fwcfg selector port
The selector port is used to select the desired fwcfg item.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38332
2023-02-14 08:28:43 +01:00
Corvin Köhne
9b99de77f1
bhyve: add basic qemu fwcfg implementation
qemu's fwcfg and bhyve's fwctl are both used to configure ovmf. qemu's
fwcfg is much more powerfull than bhyve's fwctl. For that reason, add
support for qemu's fwcfg.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38331
2023-02-14 08:28:37 +01:00
Corvin Köhne
fbd045021d
bhyve: maintain a list of acpi devices
The list is used to generate the dsdt entry for every acpi device.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D3830
2023-02-14 08:28:31 +01:00
Corvin Köhne
682a522d61
bhyve: add helper func to write a dsdt entry
The guest will check the dsdt to detect acpi devices. Therefore, add a
helper function to create such a dsdt entry for an acpi device.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38329
2023-02-14 08:28:27 +01:00
Corvin Köhne
13a1df5b85
bhyve: add helper func to add acpi resources
These helper function can be used to assign acpi resources to an
acpi_device.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38328
2023-02-14 08:28:21 +01:00
Corvin Köhne
1231f047c3
bhyve: add helper struct for acpi device handling
To simplify the handling of different acpi devices like qemu fwcfg or a
tpm, add a helper struct. It will handle the reporting of acpi
resources.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38327
2023-02-14 08:28:17 +01:00
Alan Somers
4bd4e4b45e sesutil: don't malloc in a tight loop
Reported by:	mav
MFC after:	1 week
Sponsored by:	Axcient
Reviwed by:	mav
Differential Revision: https://reviews.freebsd.org/D38473
2023-02-13 09:04:05 -07:00
Ihor Antonov
0a402ad2e6 daemon: add long_opts
Long options improve readability of scripts, makes code comprehension
easier.  This patch adds long options while preserving the existing CLI
interface.

Also --help/-h option is added.

Reviewed by:	allanjude, pauamma (both earlier versions), kevans
Differential Revision:	https://reviews.freebsd.org/D38244
2023-02-09 22:36:07 -06:00
Alan Somers
09f29b03dd sesutil: plug memory leaks
MFC after:	1 week
Sponsored by:	Axcient
Reviewed by:	bapt
Differential Revision: https://reviews.freebsd.org/D33955
2023-02-09 14:43:17 -07:00
Kyle Evans
83d7ed8af3 config: drop dependency on libsbuf
Use an std::stringstream instead.  get_word() and get_quoted_word() both
return a buffer that's presumed to not need release, so solve this by
returning a new special configword type that holds a string or eof/eol
state.  This cleans up caller checking for EOF/EOL to make it more
explicit what they're doing, at least in the EOL cases which previously
checked for NULL.

Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D38276
2023-02-08 22:56:10 -06:00
Alexander Kabaev
89a072d11c Makefile.amd64: remove construct that serves no purpose
The variable expansion as written will never match anything but
'amd64/.8' in OBJDIR. The original intention behind the construct
remains unclear, but "as is" it serves no other purpose but to
generate the warning. Remove it altogether.

Fixes: df90aeac24
Reviewed by: imp
Differential Revision:   https://reviews.freebsd.org/D38440
2023-02-08 12:19:39 -07:00
Emmanuel Vadot
cab549c76c pkgbase: Create a FreeBSD-console-tools package
And put in it:
 - kbdcontrol
 - vidcontrol
 - moused
 - kbdmap

Those aren't useful in a jail or for a modern desktop.
While here, split the devd.conf part into some new files.

Reviewed by:	bapt
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38321
2023-02-08 08:52:40 +01:00
Emmanuel Vadot
431b9b6692 pkgbase: Put sendmail example in the sendmail package
Reviewed by:	bapt
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38297
2023-02-08 08:50:31 +01:00
Emmanuel Vadot
06a69951fb pkgbase: Put ftp-proxy in the FreeBSD-pf package
It belongs here.
Also this unbloat FreeBSD-utilities a bit and it will not depend
on the FreeBSD-libevent1 package now.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38226
2023-02-08 08:49:43 +01:00
Emmanuel Vadot
4c9c296e63 pkgbase: Create a FreeBSD-netmap package
This unbloat FreeBSD-utilities a bit and not everyone uses
valectl which is the only in-tree consumer of libnetmap

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38225
2023-02-08 08:49:28 +01:00
Emmanuel Vadot
751ded1d02 pkgbase: Create a FreeBSD-inetd package
And put inetd and its config file in it.
This unbloat a bit FreeBSD-utilities and some people might not
want inetd always installed.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38229
2023-02-08 08:48:43 +01:00
Emmanuel Vadot
9c1720e59a pkgbase: Create a FreeBSD-smbutils package
And put smb related programs and lib in it.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38228
2023-02-08 08:48:28 +01:00
Kyle Evans
29c5f8bf9a config: drop dependency on libnv
Compile mkmakefile.c as C++ instead and use an std::unordered_map to
accomplish the same goal.

Reviewed by:	imp
Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D38275
2023-02-08 00:09:19 -06:00
Kyle Evans
2ffdc21324 config: make changes to allow some parts to build as C++
Highlights:
- Avoid keywords (this, not) as variable names
- Move yyparse into config.h with other declarations
- All declarations in config.h are assumed guilty until proven innocent
- Some const-correctness
- Casting malloc/calloc returns

Note that we're not building any C++ here yet, this will be introduced
in other commits to replace some of the lib dependencies.  Reducing the
number of FreeBSD-specific dependencies we have reduces some friction
for building our bootstrap tools independently in other environments.

Reviewed by:	imp
Sponsored by:	Klara, Inc.
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D38274
2023-02-08 00:09:10 -06:00
Tijl Coosemans
8932f7ce17 local-unbound-setup: Use default root certificates
Don't force /etc/ssl/cert.pem.  It does not exist by default, only if
security/ca_root_nss is installed.  Just use the default OpenSSL search
locations which are /etc/ssl/cert.pem and /etc/ssl/certs/.

The tls-system-cert option was added in Unbound 1.16.0.

Reviewed by:	zlei
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D38243
2023-02-07 11:13:33 +01:00
Stefan Eßer
b92f8e5c0d usr.sbin/kbdcontrol.c: Add backwards compatibility functions
This commit allows a kbdcontrol binary built with a version of kbio.h
that supports Unicode characters in dead key maps to load and display
keymaps including the dead key tables on a kernel built with a
previous version of kbio.h (that only supported 8 bit characters in
the dead key map).

This commit is meant as a temporary compatibility shim that will be
reverted when it can be assumed that all relevant systems have been
upgraded to a kernel that uses the updated kbio.h.

MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D38388
2023-02-06 23:56:44 +01:00
Marius van Witzenburg
17720d0bd0 Strip trailing slashes from DESTDIR
Solves duplicate slashes in paths

Scanning //usr/share/certs/trusted for certificates...
Scanning //usr/local/share/certs for certificates...

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/595
2023-02-04 12:11:02 -07:00
Elvin Aslanov
cfd6acbb55 jail: Correct jail_max_af_ips sysctl name
The sysctl is named "security.jail.jail_max_af_ips" with the jail_
prefix in the final part.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/605
2023-02-04 11:46:46 -07:00
Warner Losh
f051d72314 hyperv: Build and install where supported
Remove the hard-coded dependency on HYPERV being only x86. Instead, 100%
rely on MK_HYPERV. It's always right (since it's marked BROKEN (so set
to "no") on architectures we don't support).

Sponsored by:		Netflix
Reviewed by:		bz
Differential Revision:	https://reviews.freebsd.org/D38306
2023-02-01 10:21:57 -07:00
Xin LI
4bbf45cf56 etcupdate: Chase test case after pwd_mkdb(8) no longer copies comments.
MFC after:	3 days
2023-01-29 20:40:58 -08:00
John Baldwin
cf57f20edc bhyve: Fix a buffer overread in the PCI hda device model.
The sc->codecs array contains HDA_CODEC_MAX (15) entries.  The
guest-supplied cad field in the verb provided to hda_send_command is a
4-bit field that was used as an index into sc->codecs without any
bounds checking.  The highest value (15) would overflow the array.

Other uses of sc->codecs in the device model used sc->codecs_no to
determine which array indices have been initialized, so use a similar
check to reject requests for uninitialized or invalid cad indices in
hda_send_command.

PR:		264582
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	corvink, markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38128
2023-01-20 09:58:38 -08:00
John Baldwin
bfe8e339eb bhyve: Fix a global buffer overread in the PCI hda device model.
hda_write did not validate the relative register offset before using
it as an index into the hda_set_reg_table array to lookup a function
pointer to execute after updating the register's value.

PR:		264435
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	corvink, markj, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D38127
2023-01-20 09:57:45 -08:00
John Baldwin
6a284cacb1 bhyve: Remove vmctx argument from PCI device model methods.
Most of these arguments were unused.  Device models which do need
access to the vmctx in one of these methods can obtain it from the
pi_vmctx member of the pci_devinst argument instead.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D38096
2023-01-19 10:30:18 -08:00
John Baldwin
b36b14beda bhyve: Avoid triggering false -Wfree-nonheap-object warnings.
XHCI port and slot numbers are 1-based rather than 0-based.  To handle
this, bhyve was subtracting one item from the pointers saved in the
softc so that index 1 accessed index 0 of the allocated array.

However, this is UB and confused GCC 12.  The compiler noticed that
the calls to free() were using an offset and emitted a warning.
Rather than storing UB pointers in the softc, push the decrement
operation into the existing macros that wrap accesses to the relevant
arrays.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D36829
2023-01-19 10:21:50 -08:00
Gordon Bergling
72e709040f nfs: Fix a common typo in source code comments
- s/ingore/ignore/

MFC after:	3 days
2023-01-19 14:26:06 +01:00
Gordon Bergling
afc55510b1 mountd(8): Fix a typo in a source code comment
- s/ingore/ignore/

MFC after:	3 days
2023-01-19 14:23:51 +01:00
Gordon Bergling
74d2a3c16d cxgbetool(8): Fix common typos in sysctl descriptions
- s/addres/address/

MFC after:	5 days
2023-01-19 14:22:00 +01:00
Gordon Bergling
7a184a41c6 bsnmpget.1: Fix a typo in the man page
- s/ingore/ignore/

MFC after:	3 days
2023-01-19 14:18:52 +01:00
Juraj Lutter
1d577bedba unbound: Fix config file path
Commit 1838dec318 changed the
config file path to /usr/local/etc/unbound/unbound.conf which
is wrong for unbound in base.

Reported by:	Ihor Antonov <ihor_AT_antonovs_family>
Reviewed by:	zlei
Approved by:	zlei
Differential Revision: https://reviews.freebsd.org/D38106

Fixes:          1838dec318
MFC after:      1 month
X-MFC with:     1838dec318
2023-01-18 08:50:07 +01:00
Ceri Davies
d9499d3f47 bsdconfig: correct name of the wpa_supplicant config file
Approved by:	maintainer timeout (dteske)
Differential Revision:	https://reviews.freebsd.org/D37750
2023-01-16 18:56:45 +00:00
Danilo G. Baio
591e291179 bsdconfig, bsdinstall: Refresh mirrors list
The mirrors list is in sync with the Handbook / Mirrors section [1],
which was refreshed a few months ago. Mirrors removed were not
responding or had duplicated addresses (aliases) with another mirror.

1 - https://docs.freebsd.org/en/books/handbook/mirrors/

Reviewed by:	philip (clusteradm)
Approved by:	philip
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D38014
2023-01-16 13:48:06 -03:00
Mark Johnston
5c2b216a1c mixer: Fix default_unit switching with mixers that have no devices
Apparently it's possible for a mixer to have no devices:

$ mixer -f /dev/mixer2
pcm2:mixer: <USB audio> at ? kld snd_uaudio (rec)
$

If this is the default sound device, an attempt to change the default
unit using mixer -d fails with a segfault because mod_dunit is called
with a NULL device pointer, which is dereferenced to get the parent
mixer.

ctl_dunit seems to be a dummy, i.e., we don't actually need it and can
simply pass the mixer to mod_dunit() directly.  This patch removes that
structure and associated indirection to fix the crash.

Reviewed by:	christos, hselasky
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D38060
2023-01-16 08:02:54 -05:00
Cy Schubert
06b93ef8cd unbound: Fix config.h
FreeBSD src does not support HAVE_DECL_EVSIGNAL_ASSIGN. While reviewing
the new config.h after regenerating it, this definition was not removed.

Updating config.h is a manual process of configuring the port and
copying/merging the generated config.h into src. This definition was
missed and not removed (#undef'd).

Fixes:		1838dec318
MFC after:	1 month
X-MFC with:	1838dec318
2023-01-14 23:06:40 -08:00
Cy Schubert
1838dec318 unbound: Vendor import 1.17.1
Release notes at
    https://www.nlnetlabs.nl/news/2023/Jan/12/unbound-1.17.1-released/.

MFC after:      1 month

Merge commit '7699e1386a16236002b26107ffd2dcbde375e197' into main
2023-01-14 21:39:31 -08:00
Brooks Davis
6e011d1503 makefs: don't needlessly require directories to exist
If a type=dir entry exists and all contents are directories, files
added with contents=, or symlinks with link= attributes then it doesn't
need to exist.  Just let openat fail in that case.  It's conceivable
this will make debugging some cases weird, but it's sufficent to handle
the way we add /root/.ssh in CheriBSD VM images.

This is a recommit of 794154149f with
bugfixes.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D38029
2023-01-12 19:16:14 +00:00
Brooks Davis
5e5baba880 Revert "makefs: don't needlessly require directories to exist"
I pushed prematurely and this version is broken.

This reverts commit 794154149f.
2023-01-12 18:21:27 +00:00
Brooks Davis
794154149f makefs: don't needlessly require directories to exist
If a type=dir entry exists and all contents are directories, files
added with contents=, or symlinks with link= attributes then it doesn't
need to exist.  Just let openat fail in that case.  It's conceivable
this will make debugging some cases weird, but it's sufficent to handle
the way we add /root/.ssh in CheriBSD VM images.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D38029
2023-01-12 18:19:14 +00:00
Brooks Davis
b78d5b4241 makefs: handle mtree link= for ZFS
When a link target is specified use it rather than attempting to read
a potentially non-existant file.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D38028
2023-01-12 18:18:45 +00:00
Brooks Davis
aac389a347 makefs: handle mtree contents= in zfs
When a source path is provided use it rather than constructing one.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D38027
2023-01-12 18:18:24 +00:00
Rick Macklem
24f42edcdd Revert "gssd: Fix handling of the gssname=<name> NFS mount option"
This reverts commit c33509d49a.

It turns out that the long 27 second delay I saw in the
gss_acquire_cred() call was caused by a (mis)configured
DNS.  Although I did not specify "dns" in /etc/nsswitch.conf,
I did have a /etc/resolv.conf file on the system (left
there by wpa_supplicant).  As such, with no route, it was
somehow trying to contact the DNS server, although there was none.

Once I got rid of the /etc/resolv.conf file, it worked
as expected.

Since there is now a large 5 minute timeout on the
kernel to gssd(8) upcalls, the gssd(8) daemon will not
get terminated when this delay occurs and the only affect
is a 30 second delay during the mount.

Discussed with:	bjk
2023-01-11 18:23:17 -08:00
Gordon Bergling
40bb52c89b iwmbtfw(8): Fix a typo in a kernel message
- s/succesful/successful/

MFC after:	5 days
2023-01-11 12:22:18 +01:00
Dag-Erling Smørgrav
394cf6719a tzcode: Move configuration into separate header.
MFC after:	1 week
Sponsored by:	Klara, Inc.
2023-01-11 11:39:12 +01:00
Dag-Erling Smørgrav
bc42155199 Bring our tzcode up to date.
* Replay 2010[acflm] which had been merged but not recorded.
* Merge 2010n.
* Reorganize (unsplit) the code to match the upstream layout.
* Merge 2022[cdefg].

MFC after:      1 week
Sponsored by:   Klara, Inc.
2023-01-10 16:14:27 +01:00
Rick Macklem
c33509d49a gssd: Fix handling of the gssname=<name> NFS mount option
If an NFS mount using "sec=krb5[ip],gssname=<name>" is
done, the gssd daemon fails.  There is a long delay
(several seconds) in the gss_acquire_cred() call and then
it returns success, but the credentials returned are
junk.

I have no idea how long this has been broken, due to some
change in the Heimdal gssapi library call, but I suspect
it has been quite some time.

Anyhow, it turns out that replacing the "desired_name"
argument with GSS_C_NO_NAME fixes the problem.
Replacing the argument should not be a problem, since the
TGT for the host based initiator credential in the default
keytab file should be the only TGT in the gssd'd credential
cache (which is not the one for uid 0).

I will try and determine if FreeBSD13 and/or FreeBSD12
needs this same fix and will MFC if they need the fix.

This problem only affected Kerberized NFS mounts when the
"gssname" mount option was used.  Other Kerberized NFS
mount cases already used GSS_C_NO_NAME and work ok.
A workaround if you do not have this patch is to do a
"kinit -k host/FQDN" as root on the machine, followed by
the Kerberized NFS mount without the "gssname" mount
option.

MFC after:	1 month
2023-01-07 13:49:25 -08:00
Andre Albsmeier
0deb25bd9d pwd_mkdb(8): Don't copy comments from /etc/master.passwd to /etc/passwd.
The intention of /etc/passwd was to support legacy applications that are
not yet converted to use modern API like getpwent(3). Comments are not
defined in the legacy format, so copying them could break these
applications. Plus, it could leak sensitive information (e.g. encrypted
form of password of an user that was commented out instead of deleted
or disabled).

PR:		bin/144652
MFC after:	1 month
2023-01-04 22:18:09 -08:00
David E. O'Brien
f3c043bb5f newsyslog.conf: Minor formatting fix 2022-12-28 16:26:51 -08:00
David E. O'Brien
bb6266f279 newsyslog.conf: Sort paths 2022-12-28 16:23:41 -08:00
Mateusz Guzik
65308195e8 bsdinstall: s/to small/too small/
Reported by:	Sulev-Madis Silber <ketas@si.pri.ee>
2022-12-22 17:57:08 +00:00
Rick Macklem
ab3c59a107 rpc.tlsservd: Check for a tls syscall failure.
Although the tls syscall to set up the upcall should
not normally fail, the daemon should check for such
a failure.  This patch adds a check for that failure.

MFC after:	1 week
2022-12-22 09:10:27 -08:00
Rick Macklem
3fe0cb6695 rpc.tlsclntd: Check for a tls syscall failure.
Although the tls syscall to set up the upcall should
not normally fail, the daemon should check for such
a failure.  This patch adds a check for that failure.

MFC after:	1 week
2022-12-21 15:12:06 -08:00
John Baldwin
e53fcff184 bhyve: Simplify spinup_ap_realmode slightly.
There is no reason to modify the passed in rip variable.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37647
2022-12-21 10:33:34 -08:00
John Baldwin
7224a96a55 bhyve: Tidy vCPU pthread startup.
Set the thread affinity in fbsdrun_start_thread next to where the
thread name is set.  This keeps all the pthread initialization
operations at the start of a thread in one place.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37646
2022-12-21 10:33:18 -08:00
John Baldwin
8487443792 bhyve: Don't access vcpumap[vcpu] directly in parse_cpuset().
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37645
2022-12-21 10:33:04 -08:00
John Baldwin
a20c00c60e bhyve: Allocate struct vm_exit on the stack in vm_loop.
The global vmexit[] array is no longer needed to smuggle the rip
value from fbsdrun_addcpu() to vm_loop().

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37644
2022-12-21 10:32:45 -08:00
John Baldwin
ceb0d0b0f1 bhyve: Remove some no-op code for setting RIP.
fbsdrun_addcpu() read the current vCPU's RIP register from the kernel
via vm_get_register() to pass along through some layers to vm_loop()
which then set the register via vm_set_register().  However, this is
just always setting the value back to itself.

Reviewed by:	corvink
Differential Revision:	https://reviews.freebsd.org/D37643
2022-12-21 10:32:24 -08:00
John Baldwin
461663ddba bhyve: Simplify setting vCPU capabilities.
- Enable VM_CAP_IPI_EXIT in fbsdrun_set_capabilities along with other
  capabilities enabled on all vCPUs.

- Don't call fbsdrun_set_capabilities a second time on the BSP in
  spinup_vcpu.

- To preserve previous behavior, don't unconditionally enable
  unrestricted guest mode on the BSP (this unbreaks single-vCPU guests
  on Nehalem systems, though supporting such setups is of dubious
  value).  Other places that enbale UG on the BSP are careful to check
  the result of the operation and fail if it is not available.

- Don't set any capabilities in spinup_ap().  These are now all
  redundant with earlier settings from spinup_vcpu().

- While here, axe a stale comment from fbsdrun_addcpu().  This
  function is now always called from the main thread for all vCPUs.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37642
2022-12-21 10:31:16 -08:00
John Baldwin
e7d5d2d187 bhyve: Remove unused return value from spinup_ap.
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37641
2022-12-21 10:31:02 -08:00
John Baldwin
007d9ca5dd bhyve: Remove handler for VM_EXITCODE_SPINUP_AP.
Since commit 0bda8d3e9f, bhyve always enables VM_EXITCODE_IPI exits
instead, so this handler is no longer used.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37640
2022-12-21 10:30:45 -08:00
Rick Macklem
d4b4f3b9c3 jail.8: Update the man page for allow.nfsd
Commit bba7a2e896 added "allow.nfsd" to optionally allow
mountd/nfsd to be run inside a vnet prison when the kernel
is built with "options VNET_NFSD".

This patch updates the man page for this change.

This is a content change.

Reviewed by:	jamie, bcr (manpages)
MFC after:	4 months
Differential Revision:	https://reviews.freebsd.org/D37665
2022-12-17 13:54:33 -08:00
Mark Johnston
a9e7a44c24 makefs: Add some validation of ZFS pool names
Reported by:	imp
2022-12-16 10:30:58 -05:00
Mike Karels
38d2b4db78 daily 440.status-mailq: avoid error from dma with submit queue
dma(8) supports mailq, but not mailq -Ac to print the submission
queue.  Don't try to print that queue from the daily script if
mailq -Ac returns an error.

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D37713
2022-12-16 09:13:31 -06:00
Mike Karels
c934f2a574 daily 150.clean-hoststat: suppress error when using dma
dma(8) does not have hoststat or purgestat, so this script produces
an error from the daily script.  We could disable this script, but
that would mean yet another change to switch back to sendmail.  Check
for purgestat in mailer.conf before attempting either hoststat or
purgestat.

Reviewed by:	pstef, bapt
Differential Revision:	https://reviews.freebsd.org/D37712
2022-12-16 09:13:07 -06:00
Jamie Gritton
e8d7ae918a jail: fix a NULL pointer derefence in parsing ip6.addr settings.
This is the counterpart to bd24e861b4, which did the same for ip4.
PR:		268377
Reported by:	ahkithaama at proton.me
2022-12-14 16:47:55 -08:00
John Baldwin
08b05de1e2 bhyve: Remove the unused vcpu argument from all of the I/O port handlers.
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37653
2022-12-09 10:35:44 -08:00
John Baldwin
78c2cd83ec bhyve: Remove unused vcpu argument from PCI read/write methods.
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37652
2022-12-09 10:35:28 -08:00
John Baldwin
0857e5555d bhyve: Pass a vCPU ID of 0 to vm_setup_pptdev_msi*.
These ioctls are not vCPU-specific and the ioctl now ignores the vCPU
ID.  0 is used instead of -1 to provide limited forwards
compatibility.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37651
2022-12-09 10:31:17 -08:00
John Baldwin
34781da505 bhyve: Remove unused argument from pci_nvme_handle_doorbell.
Reviewed by:	corvink, chuck, markj
Differential Revision:	https://reviews.freebsd.org/D37650
2022-12-09 10:27:36 -08:00
Doug Rabson
5eeb4f737f imgact_binmisc: Optionally pre-open the interpreter vnode
This allows the use of chroot and/or jail environments which depend on
interpreters registed with imgact_binmisc to use emulator binaries from
the host to emulate programs inside the chroot.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D37432
2022-12-08 14:32:03 +00:00
Michael Tuexen
cef3c4e0ba ppp: improve MSS clamping
ppp supports MSS clamping for TCP/IPv4. This patch
* improves MSS clamping for TCP/IPv4 by using the MSS as specified
  in RFC 6691.
* adds support for MSS clamping for TCP/IPv6.

Reported by:		Timo Voelker
Reviewed by:		thj
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D37624
2022-12-08 09:48:29 +01:00
Corvin Köhne
b972e7cbb4
bhyve: build SPCR ACPI table
OVMF ships some static ACPI tables. This worked in the past but won't
work in the future when we support devices like tpms. They require a TPM
ACPI table. So, we have to dynamically create ACPI tables depending on
the bhyve configuration.

Bhyve has much more information about the system than OVMF. Therefore,
it's easier for bhyve to build up some ACPI tables. For that reason, it
would be much better to use the ACPI tables provided by bhyve instead of
building some tables by OVMF.

At the moment, OVMF always creates a SPCR table. Maybe someone depends
on it. So, we have to build it by bhyve too before we can patch OVMF to
install the tables provided by bhyve.

Reviewed by:		markj
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37591
2022-12-06 12:58:27 +01:00
Robert Wing
5a023bd2a5 bhyveload: open guest boot disk image O_RDWR
When a boot environment has been booted via the bootonce feature,
userboot clears the bootonce value from an nvlist but fails to write the
updated nvlist back to disk.

The failure occurs because bhyveload opens the guest boot disk image
O_RDONLY, fix this by opening it O_RDWR.

Reviewed by:	imp, markj, jhb
Differential Revision:	https://reviews.freebsd.org/D37274
2022-12-05 08:22:45 -09:00
John Baldwin
aa9ce62be5 fwcontrol: Disable -Wzero-length-bounds warnings.
firewire.h includes zero length arrays in unions that trigger this
warning.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D37538
2022-12-04 16:30:20 -08:00
John Baldwin
f4432625ed acpica: Quiet a -Wdangling-pointer warning in AcpiUtInitStackPtrTrace.
This function intentionally saves a pointer to an on-stack variable in
a global as a dubious way of reading the stack pointer.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D37535
2022-12-04 16:28:59 -08:00
John Baldwin
1055bedbed pw: Don't return a pointer to an on-stack buffer from grp_set_passwd.
Make 'line' static to move it to .bss instead as that pattern is used
elsewhere in pw(8) (e.g. the static buffer in pw_pwcrypt).

Reported by:	GCC -Wdangling-pointer
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D37534
2022-12-04 16:28:22 -08:00
Alexander Motin
7467a69536 CTL: Allow userland supply tags via ioctl frontend.
Before this ioctl frontend always replaced tags with sequential ones.
It was done for ctladm, that can not keep track of global tag list.
But in case of virtio-scsi in bhyve we can pass provided tags as-is.
It should be on virtio-scsi initiator to provide us valid tags.  It
should allow proper task management, error reporting, etc.  In case
of several virtio-scsi devices, they should use different CTL ports
or initiator IDs to avoid conflicts, but this is expected by design.

PR:	267539
2022-12-03 12:05:05 -05:00
Alexander Motin
fcdcfa2189 Missed chunk of 0acc026dda. 2022-12-03 11:26:22 -05:00
Alexander Motin
0acc026dda CTL: Increase maximum SCSI tag size from 32 to 64 bits.
SAM-5 specification states maximum size of command identifier (tag),
defined by specific transports, should not be larger than 64 bits.
While most of supported transports use 32 bits or less, it was
reported that virtio-scsi uses 64 bits.  Truncation to 32 bits in
bhyve code caused false tag conflict errors reported and possibly
other issues.

This changes CTL ABI and HA protocol, so CTL_HA_VERSION is bumped.

While we make HA protocol incompatible, increase default maximum
number of ports in CTL from 256 to 1024, matching number of LUNs.
There are many reports from people who need many iSCSI targets with
only one LUN each.  Increased memory consumption should be less of
a problem these days.

PR:	267539
2022-12-03 10:23:29 -05:00
Alexander Motin
b81ac5cdc3 bhyve virtio-scsi: Fix residual reporting.
CTL does not really use residual field and it always returned zero.
Use ext_data_filled instead.

MFC after:	2 weeks
2022-12-03 10:08:20 -05:00
Gleb Smirnoff
657729a89d Retire trpt(8).
trpt(8) was utility to pull TCP debugging data from the kernel
originating back from 4.2BSD.  It is not used nowadays by TCP
developers.  We have more powerful debugging facilities, e.g.
the Dtrace probing, the TCP black box logging and siftr.

Discussed with: rscheff, tuexen, rrs, jtl and others
2022-12-02 14:10:55 -08:00
Jessica Clarke
bad602850e bsdinstall: Fix local_unbound option default on revisit
The variable used for the checklist's default value needs to correspond
to the rc.conf variable as that's what's being parsed to determine them.
In the case of local_unbound it's missing the _enable suffix and thus
always defaults to off on revisit.

Fixes:	58eb9abb31 ("Add a line to the post-installation configuration dialog to enable the local_unbound service.")
2022-11-29 03:33:47 +00:00
Jessica Clarke
91985bc5ad bsdinstall: Fix issues parsing rc.conf.services on revisit
There are a few issues here, some of which are hiding others. The first
is that we don't use double quotes around the command substitution so
every word in the conf file is treated as a separate argument to eval,
resulting in spaces being used in place of newlines and thus comments in
the file commenting out the rest of the file, not just to the end of
their line. In particular, we insert one comment just before the dumpdev
entry (the final one in the file) and so we never see dumpdev as set,
and thus set a default value of on for the menu.

The second issue is that, for dumpdev, it takes a value of AUTO not YES
when set, but we don't replace this with on when eval'ing, so then end
up giving AUTO to bsddialog which is interpreted the same as off (which
seems to match GPL dialog). Thus handle AUTO like YES otherwise it will
always appear as unchecked on revisit.

The final issue is that our case-insensitive YES/NO (and now AUTO)
replacements have no word boundaries around them so match the middle of
words too. As it happens this doesn't matter in practice at the moment,
but it could in future; currently the only effect is that it rewrites
moused_nondefault_enable to moused_offndefault_enable, but since this
variable is never read, only written based on moused(_enable) this is
harmless, but we should fix it in case a service comes along in future
that does get affected by it.
2022-11-29 03:33:47 +00:00
Jessica Clarke
1843da3edb bsdinstall: Fix ntpd_sync_on_start service option
This installer option is currently totally useless, as it ends up
creating an ntpd_sync_on_start_enable="YES" entry in rc.conf, not an
ntpd_sync_on_start="YES" entry, as is the correct name. This can also be
noticed by revisiting the services menu, which parses the previously
written rc.conf.services file to set variables governing the default
menu entry values so that selecting OK regenerates the same file, as the
menu entry will use the correct variable name and thus think the entry
was not selected last time, defaulting back to off and losing the
setting.

Thus, add a special case in the loop for this option. The only other
entry that doesn't follow the *_enable pattern is dumpdev (even moused
does, it just also sets a second variable), but that also deviates in
terms of being explicitly set either way and using AUTO rather than YES,
hence why ntpd_sync_on_start follows a different pattern here and is
special-cased rather than introducing a whole new variable that governs
behaviour outside the loop.

Fixes:	c153a35bfd ("bsdinstall: replace ntpdate by ntpd_sync_on_start")
2022-11-29 03:33:47 +00:00
John Baldwin
bc92880072 bhyve: Avoid passing a possible garbage pointer to free().
All of the error paths in pci_vtcon_sock_add free the sock pointer.
However, sock is not initialized until part way through the function.
An early error would pass stack garbage to free().

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37491
2022-11-28 17:10:30 -08:00
John Baldwin
32b21dd271 bhyve: Appease warning about a potentially unaligned pointer.
When initializing the device model for a PCI pass through device that
uses MSI-X, bhyve reads the MSI-X capability from the real device to
save a copy in the emulated PCI config space.  It also saves a copy in
a local struct msixcap on the stack.  Since struct msixcap is packed,
GCC complains that casting a pointer to the struct to a uint32_t
pointer may result in an unaligned pointer.

This path is not performance critical, so to appease the compiler,
simply change the pointer to a char * and use memcpy to copy the 4
bytes read in each iteration of the loop.

Reviewed by:	corvink, bz, markj
Differential Revision:	https://reviews.freebsd.org/D37490
2022-11-28 17:10:07 -08:00
John Baldwin
15cebe3d63 bhyve: Fix sign compare warnings in the NVMe device model.
Reviewed by:	corvink
Differential Revision:	https://reviews.freebsd.org/D37489
2022-11-28 17:09:44 -08:00
John Baldwin
5d805962ca bhyve: Avoid unlikely truncation of the blockif ident strings.
The ident string for NVMe and VirtIO block deivces do not contain the
bus, and the various fields can potentially use up to three characters
when printed as unsigned values (full range of uint8_t) even if not
likely in practice.

Reviewed by:	corvink, chuck
Differential Revision:	https://reviews.freebsd.org/D37488
2022-11-28 17:09:15 -08:00
John Baldwin
47d6116239 bhyve: Clear lid to 0 for internal device errors for NVMe AENs.
Reported by:	GCC
Reviewed by:	corvink, chuck, imp, markj
Differential Revision:	https://reviews.freebsd.org/D37487
2022-11-28 17:08:57 -08:00
John Baldwin
1d9e8a9e60 bhyve: Don't leak uninitialized bits in NVMe completion statuses.
In some cases, some bits in the 16-bit status word were never
initialized.

Reported by:	GCC
Reviewed by:	corvink, chuck, markj
Differential Revision:	https://reviews.freebsd.org/D37486
2022-11-28 17:08:36 -08:00
John Baldwin
e7cd5ffff8 bhyve: Fix sign compare warnings in the e1000 device model.
Adding a bare constant to a uint16_t promotes to a signed int which
triggers these warnings.  Changing the constant to be explicitly
unsigned instead promotes the expression to unsigned int.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37485
2022-11-28 17:08:09 -08:00
John Baldwin
0acf696151 bhyve basl: Use GCC pragmas.
These work with both clang and GCC.

Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D37484
2022-11-28 17:07:39 -08:00
Eugene Grosbein
1cbe5012cf pw(8): fix combination of modes -N and -w random
The command "pw usermod nobody -Nw random" (or useradd)
generates random password and prints it in encrypted form
but skips choosen random string that makes not much sense
and contradicts the manual page pw.8

Fix it by showing random password in plain text with -N and
without it equally. Add yet another example of how to generate
pw-style random password.

MFC after:	2 weeks
2022-11-28 21:22:39 +07:00
John Baldwin
abb9a940bb makefs: Ignore some sign comparison warnings from GCC.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D37470
2022-11-23 10:38:29 -08:00
John Baldwin
82ac811efa makefs zfs: Disable -Wunused-function for GCC as well.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D37469
2022-11-23 10:35:30 -08:00
John Baldwin
9821e24441 makefs zfs: Use signed values for both results of ?:.
Reported by:	GCC -Wsign-compare
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D37468
2022-11-23 10:35:14 -08:00
Corvin Köhne
67654ffd44
bhyve: use dynamic ACPI table offsets
Now that all ACPI tables are build by basl, basl can dynamically
calculate the offset for each table.

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/D37002
2022-11-21 09:28:01 +01:00
Corvin Köhne
03e7111fa6
bhyve: build RSDP table by basl
Building the RSDP table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

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/D37001
2022-11-21 09:28:00 +01:00
Corvin Köhne
f3dcdf8be4
bhyve: build RSDT table by basl
Building the RSDT table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

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/D37000
2022-11-21 09:27:59 +01:00
Corvin Köhne
4a60470f05
bhyve: build XSDT table by basl
Building the XSDT table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

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/D36999
2022-11-21 09:27:58 +01:00
Corvin Köhne
6a75de903b
bhyve: build FADT table by basl
Building the FADT table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

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/D36998
2022-11-21 09:27:57 +01:00
Corvin Köhne
897fe59adf
bhyve: build MADT table by basl
Building the MADT table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

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/D36997
2022-11-21 09:27:56 +01:00
Corvin Köhne
d61d712299
bhyve: build HPET table by basl
Building the HPET table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

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/D36996
2022-11-21 09:27:55 +01:00
Corvin Köhne
60277ad75e
bhyve: add helper to fill a ACPI_GENERIC_ADDRESS
Reviewed by:		jhb
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37407
2022-11-21 09:27:54 +01:00
Corvin Köhne
2c2bd15532
bhyve: build MCFG table by basl
Building the MCFG table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

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/D36995
2022-11-21 09:27:53 +01:00
Corvin Köhne
8897b562ab
bhyve: add helper to append a basl table without a header
The common style for build an ACPI table will be:

1. basl_table_create
2. basl_table_append_header
3. setup an ACPI_TABLE_* struct
4. basl_table_append_bytes (without header)

Add a helper for the last step.

Reviewed by:		jhb, markj
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37406
2022-11-21 09:27:51 +01:00
Corvin Köhne
7263419f38
bhyve: make basl_table_add_* functions public
The code will be more readable if we use struct definitions from ACPI-CA
to build ACPI tables. We can fill out the struct and append it to the
basl_table by using basl_table_append_bytes. After that, we have to
declare which checksums, length and pointers should be patched by basl.
That's done by the add_* functions.

Reviewed by:		jhb, markj
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37405
2022-11-21 09:27:50 +01:00
Corvin Köhne
bdbb1da75a
bhyve: build FACS table by basl
Building the FACS table by basl will allow it to be loaded by qemu's
ACPI table loader in the future.

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/D36994
2022-11-21 09:27:48 +01:00
Mark Johnston
71ebd11738 bhyve: Enable the default compiler warnings
Disable -Wcast-align for now since we have many instances of that
warning (I fixed some but not most of them) and platforms on which bhyve
runs don't particularly care about unaligned accesses.

Reviewed by:	corvink
Differential Revision:	https://reviews.freebsd.org/D37296
2022-11-18 14:12:51 -05:00
Mark Johnston
0705b7f4e6 bhyve: Avoid using a packed struct for xhci port registers
I believe the __packed annotation is there only because
pci_xhci_portregs_read() is treating the register set as an array of
uint32_t.  clang warns about taking the address of portregs->portsc
because it is a packed member and thus might not have expected
alignment.

Fix the problem by simply selecting the field to read with a switch
statement.  This mimics pci_xhci_portregs_write().  While here, switch
to using some symbolic constants.

There is a small semantic change here in that pci_xhci_portregs_read()
would silently truncate unaligned offsets.  For consistency with
pci_xhci_portregs_write(), which does not do that, return all ones for
unaligned reads instead.

MFC after:	2 weeks
Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37408
2022-11-18 14:11:48 -05:00
Mark Johnston
c127c61efa bhyve: Let BASL compile with raised warnings
- Make basl_dump() as unused.
- Avoid arithmetic on a void pointer.
- Avoid a signed/unsigned comparison with
  BASL_TABLE_CHECKSUM_LEN_FULL_TABLE.
- Ignore warnings about unused parameters from stuff pulled in by
  acpi.h.  In particular, any prototype wrapped by
  ACPI_DBG_DEPENDENT_RETURN_VOID() will raise such parameters unless
  ACPI_DEBUG_OUTPUT is defined.

Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37397
2022-11-18 14:11:48 -05:00
Mark Johnston
bd634fc733 bhyve: Address an unused parameter warning in the smbios code
The compiler was warning that the "size" parameter to
smbios_generic_initializer() was unused.  This parameter is apparently
used to populate the "maximum structure size" field in the SMBIOS entry
point, but we were always setting it to zero.

Implement it instead in the main loop of the smbios table builder.

MFC after:	2 weeks
Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37294
2022-11-18 14:11:48 -05:00
Mark Johnston
1a8e52391b bhyve: Disable thread safety analysis
The warnings that arise are bogus and have to be muted with
__no_lock_analysis in most cases.  As a step towards enabling the
default warning level for bhyve, just disable them.

Reviewed by:	corvink, jhb
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D37295
2022-11-18 14:11:48 -05:00
John Baldwin
2b4fe856f4 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
2022-11-18 10:25:36 -08:00
Corvin Köhne
b922cf4fe3
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
2022-11-16 12:43:41 +01:00
Corvin Köhne
2fb0f352b9
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
2022-11-16 12:42:19 +01:00
John Baldwin
fd104a6ebc bhyve: Use XHCI_PORTREG_PTR in one place that open-coded it.
Reviewed by:	corvink, markj
Differential Revision:	https://reviews.freebsd.org/D36888
2022-11-15 19:19:35 -08:00
Rick Macklem
e471259313 rpc.tlsservd.8: Update man page for new -N/--numdaemons option
Commit 1e588a9ceb 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
2022-11-15 13:30:41 -08:00
Corvin Köhne
49b947c01d
bhyve: add basl support for pointers
Some ACPI tables like XSDT contain pointers to other ACPI tables. When
an ACPI table is loaded by qemu's loader, the address in the guest
memory is unknown. For that reason, the qemu loader supports patching
those pointers. Basl keeps track of all pointers and causes the qemu
loader to patch all pointers.

The qemu ACPI table loader is unsupport yet. However, in a future commit
bhyve will use dynamic ACPI table offsets based on the size and
alignment requirements of each ACPI table. Therefore, tracking ACPI
table pointer is required too.

Reviewed by:		jhb
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D36991
2022-11-15 08:27:11 +01:00
Corvin Köhne
2957847031
bhyve: add basl support for checksums
The qemu ACPI table loader patches the ACPI tables. After patching them,
checksums aren't correct any more. It has to calculate a new checksum
for the ACPI table. For that reason, basl has to keep track of checksums
and has to cause the qemu loader to create new checksums for the tables.

The qemu ACPI table loader isn't supported yet. However, the address of
all tables is unknown as long as bhyve hasn't finished ACPI table
creation. So, the checksum of tables which include pointer to other
tables are unknown too. This requires tracking of checksums too.

Reviewed by:		jhb
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D36990
2022-11-15 08:27:10 +01:00
Corvin Köhne
3a766cd0f1
bhyve: add basl support for length fields
ACPI tables have different layouts. So, there's no common position for
the length field. When tables are build by basl, the length is unknown
at the beginning. It has to be set after building the table.

Reviewed by:		jhb
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D36989
2022-11-15 08:27:09 +01:00
Corvin Köhne
995374a655
bhyve: add basl support for generic addresses
In upcoming commits, bhyve will build some ACPI tables by it's own.
Therefore, it should be capable of appending GENERIC_ADDRESS structs to
ACPI tables.

Reviewed by:		jhb, markj
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D36988
2022-11-15 08:27:08 +01:00
Corvin Köhne
e22f5ce2bf
bhyve: add basl support for int values
In upcoming commits, bhyve will build some ACPI tables by it's own.
Therefore, it should be capable of appending int values to ACPI tables.

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/D36987
2022-11-15 08:27:07 +01:00
Corvin Köhne
22a2e94f38
bhyve: use basl to load ACPI tables
Load the blobs compiled by iasl into a basl_table. The basl_table is a
temporary buffer which copies the ACPI tables into guest memory for us.
This allows us in the future to pass the blobs over the qemu fwcfg
interface to the guest.

Reviewed by:		jhb, markj
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D36986
2022-11-15 08:27:06 +01:00
Corvin Köhne
ac3c2b3e38
bhyve: add table dump functions for basl
Developing an ACPI table compiler isn't quite easy. It's helpful if you
can take a look at the ACPI tables created by the compiler.

The dump functions can either dump a ACPI table which was copied into
guest memory or a ACPI table provided for qemu's ACPI table loader.

Reviewed by:		jhb, markj
Approved by:		manu (mentor)
MFC after:		2 weeks
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D36985
2022-11-15 08:27:04 +01:00
Corvin Köhne
21bbc28426
bhyve: add basic basl implementation
Basl is the bhyve ASL compiler. At the moment, it's just a small wrapper
to call iasl, the Intel ASL compiler. As bhyve will gain support for
qemu's ACPI table loader in the future, it has to create ACPI tables on
it's own. Therefore, it makes sense to create a new file which keeps the
code for basl.

This first implementation of basl supports creating an ACPI table by
appending raw bytes to it. It's also capable of loading all tables into
guest memory.

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/D36984
2022-11-15 08:27:01 +01:00
Corvin Köhne
eff8d03477
bhyve/kdblayout: add some missing keys to german layout
The '/' and '§' keys are missing in the german keyboard layout.

Reviewed by:		markj
Approved by:		manu (mentor)
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D37386
2022-11-15 07:48:27 +01:00
Wanpeng Qian
10846c53c4
bhyve: nvme controller obey async event setting when reporting critical temperature
Async event report is controlled by async event configuration feature
setting. When reporting a critical temperature warning, check the async
event configuration.

Approved by:		manu (mentor)
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D37355
2022-11-15 07:48:26 +01:00
Wanpeng Qian
05a21658eb
bhyve: return FEATURE_NOT_CHANGEABLE for unimplemented feature of NVMe controller
Set Feature is a feature specified function. Currently only some
features have the set procedure. For features that are not handled by
the controller, we should return a FEATURE_NOT_CHANGEABLE error message.

Approved by:		manu (mentor)
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D32802
2022-11-15 07:48:25 +01:00
Wanpeng Qian
8ab99dbea1
bhyve: abort and return FEATURE_NOT_SAVEABLE while set feature with a save flag for NVMe controller.
Currently bhyve's NVMe controller cannot save feature values cross
reboot. It should return a FEATURE_NOT_SAVEABLE error when the command
specifies a save flag.

Quote from NVMe specification, page 205:

https://nvmexpress.org/wp-content/uploads/NVM-Express-1_4-2019.06.10-Ratified.pdf

If the Feature Identifier specified in the Set Features command is not
saveable by the controller and the controller receives a Set Features
command with the Save bit set to one, then the command shall be aborted
with a status of Feature Identifier Not Saveable.

Reviewed by:		chuck (older version)
Approved by:		manu (mentor)
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D32767
2022-11-15 07:48:24 +01:00
Mark Johnston
c4c368fb3e bhyve: Simplify control flow in the xhci device model
We only need to call pci_xhci_xfer_complete() when handling a transfer
to the control endpoint, so move that code into the epid == 1 block and
eliminate a goto.  Also remove an unneeded reinitialization of
setup_trb.

No functional change intended.

MFC after:	1 week
Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37287
2022-11-14 15:08:45 -05:00
Mark Johnston
84b0b7ea4c bhyve: Fix a typo in a comment
Reported by:	Mikaël Urankar <mikael.urankar@mailo.fr>
Fixes:	719e307f80 ("bhyve: Cast away const when fetching a config nvlist")
2022-11-14 09:01:00 -05:00
Gordon Bergling
30a6c8a3a8 vipw.8: Add a FILES section
Mention passwd related files in the FILES section
of vipw(8).

Obtained from:	OpenBSD
MFC after:	3 days
2022-11-12 12:56:29 +01:00
Mark Johnston
719e307f80 bhyve: Cast away const when fetching a config nvlist
Silence a warning from the compiler about "const" being discarded.  The
warning is correct: nvlist values are supposed to be immutable.
However, fixing this properly will require some contortions on behalf of
consumers who look up a subtree of the config and modify it.  Per a
discussion on freebsd-virtualization@, the solution will probably be to
outright replace the use of nvlists for VM configuration, but until that
happens let's document the problem and silence the warning.

No functional change intended.

MFC after:	2 weeks
Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37293
2022-11-11 10:02:42 -05:00
Mark Johnston
8b1adff8bc bhyve: Drop volatile qualifiers from snapshot code
They accomplish nothing since the qualifier is casted away in calls to
memcpy() and copyin()/copyout().  No functional change intended.

MFC after:	2 weeks
Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37292
2022-11-11 10:02:26 -05:00
Mark Johnston
593200c23b bhyve: Drop volatile qualifiers from virtio rings
The qualifiers are there presumably because these rings are mapped into
the guest, but they do not appear to be required for correctness, and
bhyve generally doesn't qualify accesses to guest memory this way.
Moreover, the qualifiers are discarded by snapshot code, causing clang
to emit warnings.  Just stop using volatile here.

MFC after:	2 weeks
Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37291
2022-11-11 10:02:10 -05:00
Mark Johnston
691e23e6c5 bhyve: Drop volatile qualifiers from xhci hw struct fields
This fixes a warning raised by the removal of the volatile qualifier
from &trb->qwTrb0 in the following snippet:

	xfer_block = usb_data_xfer_append(xfer,
	     (void *)(trbflags & XHCI_TRB_3_IDT_BIT ?
		 &trb->qwTrb0 : XHCI_GADDR(sc, trb->qwTrb0)),
	     trb->dwTrb2 & 0x1FFFF, (void *)addr, ccs);

The use of volatile appears to be inherited from the kernel driver's
definitions of the same structures.  It makes some sense, since USB TRBs
and related structures live in guest memory, but bhyve device models
generally don't volatile-qualify accesses to guest memory and I can't
see how they are required for correctness here.  Moreover, XHCI_GADDR
does not return volatile pointers so we're already being inconsistent.
Just drop the qualifiers to address the warning.

MFC after:	2 weeks
Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37290
2022-11-11 10:01:52 -05:00
Mark Johnston
0ced97acb0 bhyve: Define an accessor for net backend private data
Use it to silence warnings about potential unaligned accesses.  No
functional change intended.

MFC after:	1 week
Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37289
2022-11-11 10:01:40 -05:00
Mark Johnston
f64f343809 bhyve: Address warnings about potential unaligned accesses in fwctl.c
This silences some warning about potential unaligned accesses.  No
functional change intended.

MFC after:	1 week
Reviewed by:	corvink, jhb
Differential Revision:	https://reviews.freebsd.org/D37288
2022-11-11 10:01:27 -05:00
Gordon Bergling
40b245af0f pnfs.4: Fix a typo
- s/attrbute/attribute/

MFC after:3 days
2022-11-08 14:57:06 +01:00
Navdeep Parhar
118cfb829f pciconf(8): Decode ACS extended capability.
MFC after:	1 week
Sponsored by:	Chelsio Communications
Reviewed by:	kib@
Differential Revision:	https://reviews.freebsd.org/D37271
2022-11-07 13:20:22 -08:00
Baptiste Daroussin
a67b925ff3 mail: make The Dragonfly Mail Agent (dma) the default mta.
dma accepts mail from a local Mail User Agent (MUA) and delivers it
locally or to a smarthost for delivery. dma does not accept inbound
mail (i.e., it does not listen on port 25) and is not intended to
provide the same functionality as a full MTA like postfix or sendmail.
It is intended for use cases such as delivering cron(8) mail. which
is the default configuration and usage of sendmail in the default
setup of the base system.

In order to switch the default from sendmail to dma, we teach
mailwrapper to fallback on dma directly if the mailer.conf file cannot
be opened.
We install by default a mailer.conf file which points at dma
We install a mailer.conf file for sendmail in the examples.

Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D37035
2022-11-07 12:49:56 +01:00
Wanpeng Qian
b631954ff0
bhyve: initial PowerCycles value
Currently PowerCycles field of Log Page is 0 and it is an invalid value.
This patch will initial the PowerCycles data to 1.

MFC after:		1 week
Approved by:		manu (mentor)
Reviewed By:		grehan (older version), chuck, corvink
Differential Revision:	https://reviews.freebsd.org/D32558
2022-11-04 10:13:01 +01:00
Mark Johnston
752ba1004a makefs: Fix handling of inherited mountpoints
Commit d7eec79b70 overlooked the fact that
nvlist_find(DATA_TYPE_STRING) does not provide a nul-terminated string.
Fix the leak a different way.

Fixes:	d7eec79b70 ("makefs: Plug a memory leak")
2022-10-28 17:00:22 -04:00
Jung-uk Kim
19ee8335c5 acpica: Merge ACPICA 20221020 2022-10-27 22:04:32 -04:00
Warner Losh
1d21f64149 bhyve: Implement MSR_MISC_FEATURES_ENABLES
Linux reads MISC_FEATURES_ENABLES to manage the CPUID faulting feature
(undocumented in the Intel SDM, but documented in 323850-004 (Intel
Virtualization Technology FlexMigration Application Note). Since bhyve
doesn't emulate this feature, we always return 0. Neither does bhyve
support the MONITOR/MWAIT fault bit also in this MSR (which is
documented in the sdm), so always return 0.

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D36602
2022-10-27 11:34:41 -06:00
Mark Johnston
ae71263c66 bhyve: Remove an unused parameter from pci_nvme_append_iov_req()
No functional change intended.

MFC after:	1 week
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D37116
2022-10-27 10:48:55 -04:00
Mark Johnston
a309ad7bd1 bhyve: Fix an apparent pointer arithmetic bug in the xhci emulation
Also remove the out-parameter of pci_xhci_find_stream(), since it's
unused by all callers.

MFC after:	1 week
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D37118
2022-10-27 10:48:55 -04:00
Mark Johnston
04336c0562 bhyve: Make sure that the VNC version is initialized
clang warned that "client_ver" can be left uninitialized.  This change
causes the new connection to be dropped if a version string is not
presented.

MFC after:	1 week
Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D37117
2022-10-27 10:48:55 -04:00
Emmanuel Vadot
e7a5a60ed5 pkgbase: Put devmatch in its own package
devmatch is useful on standalone machine but not on jails.
Put devinfo(8) and libdevinfo there too.

Differential Revision:	https://reviews.freebsd.org/D36229
2022-10-26 19:46:38 +02:00
Emmanuel Vadot
a7ffc94849 pkgbase: Put ufs related tools and lib in their own package
It's not really useful in a jail or in a mdroot or even if a users
wants to do a full zfs machine.

Reviewed by:	mckusick
Differential Revision:	https://reviews.freebsd.org/D36227
2022-10-26 19:46:34 +02:00
Maxim Konovalov
b620928d54 hccontrol.8: missed underscore fixed.
PR:	267343
2022-10-25 16:29:44 +00:00
Mark Johnston
ed72168431 bhyve: Address some signed/unsigned comparison warnings
MFC after:	1 week
2022-10-25 11:16:57 -04:00
Mark Johnston
cea34d0705 bhyve: Address signed/unsigned comparison warnings in the e1000 model
No functional change intended.

MFC after:	1 week
2022-10-25 11:16:57 -04:00
Mark Johnston
f0553616cf bhyve: Address signed/unsigned comparison warnings in the AHCI model
No functional change intended.

MFC after:	1 week
2022-10-25 11:16:57 -04:00
Mark Johnston
46f5c82896 bhyve: Address warnings in blockif_proc()
- Use unsigned types for all arithmetic.  Use a new signed variable for
  holding the return value of pread() and pwrite().
- Handle short I/O from pwrite().

MFC after:	1 week
2022-10-25 11:16:56 -04:00
Mark Johnston
e008f5be72 bhyve: Fix a typo in a function name
MFC after:	1 week
2022-10-25 11:16:56 -04:00
Mark Johnston
03f7ccab32 bhyve: Avoid arithmetic on void pointers
No functional change intended.

MFC after:	1 week
2022-10-25 11:16:56 -04:00
Mark Johnston
3b6cb9b436 bhyve: Avoid shadowing global variables in bhyverun.c
- Rename the global cores/sockets/threads to cpu_cores/sockets/threads.
  This way, num_vcpus_allowed() doesn't shadow them.
- The global maxcpus is unused, remove it for the same reason.

MFC after:	1 week
2022-10-25 11:16:56 -04:00
Gordon Bergling
7bef61eef3 dconschat(8): Fix a typo in an error message
- s/faild/failed/

MFC after:	1 week
2022-10-25 12:58:55 +02:00
Mark Johnston
eefd863cba bhyve: Drop a bogus const qualifier
No functional change intended.

MFC after:	1 week
2022-10-24 17:35:16 -04:00
Mark Johnston
fb7ce0a95e bhyve: Use the new vm_limit_rights() interface
This addresses a compiler warning arising from the fact that bhyve
needs to cast away a const qualifier in order to call free().

No functional change intended.

Reviewed by:	jhb
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D37099
2022-10-24 17:33:13 -04:00
Vitaliy Gusev
3b5e5ce87b bhyve: Handle snapshots of unconfigured virtio-net devices
In case of device reset or not configured - features_negotiated is not
set, calling calling pci_vtnet_neg_features is wrong and resume gets
"Segmentation fault".

Reviewed by:	markj
Sponsored by:	vStack
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D36244
2022-10-23 14:50:43 -04:00
Mark Johnston
eb805f4e0f bhyve: Annotate an unused function as such
No functional change intended.

MFC after:	1 week
2022-10-23 11:11:33 -04:00
Mark Johnston
489392feb7 bhyve: Make hda_ops function tables const
No functional change intended.

MFC after:	1 week
2022-10-23 11:11:33 -04:00
Mark Johnston
84633b9d52 bhyve: Put the prototype for vga_render() in a header
No functional change intended.

MFC after:	1 week
2022-10-23 11:11:33 -04:00
Mark Johnston
f703dc0ef0 bhyve: Put the prototype for vmexit_task_switch() in a header
No functional change intended.

MFC after:	1 week
2022-10-23 11:11:33 -04:00
Mark Johnston
c9faf69874 bhyve: Fix some warnings in the snapshot code
- Qualify unexported symbols with "static".
- Drop some unnecessary and incorrect casts.
- Avoid arithmetic on void pointers.
- Avoid signed/unsigned comparisons in loops which use nitems() as a
  bound.

No functional change intended.

MFC after:	1 week
2022-10-23 11:11:33 -04:00
Mark Johnston
63898728b5 bhyve: Avoid arithmetic on void pointers
No functional change intended.

MFC after:	1 week
2022-10-23 11:11:33 -04:00
Mark Johnston
cd49c066a3 bhyve: USB device model structures can be qualified with "static"
No functional change intended.

MFC after:	1 week
2022-10-23 11:11:33 -04:00
Mark Johnston
7039bdd535 bhyve: Use the proper type for string literals
No functional change intended.

MFC after:	1 week
2022-10-23 11:11:33 -04:00
Mark Johnston
33dfef5cf3 bhyve: Fix some warnings in the ps2 emulation code
- Include headers containing prototypes for exported functions.
- Initialize all fields of the extended translation table.
- Qualify an unexported translation table as static.
- Fix error handling for a read(2).
- Fix some style bugs.

No functional change intended.

MFC after:	1 week
2022-10-23 11:11:33 -04:00
Mark Johnston
4a1c23a708 bhyve: Address some warnings in bhyverun.c
- Annotate unused parameters as such.
- Avoid shadowing the global "vmexit".

No functional change intended.

MFC after:	1 week
2022-10-23 11:11:33 -04:00
Alan Somers
15b3e3bb7e ctld: if adding a target fails, retry it on the next reload
If the admin creates more CTL ports than kern.cam.ctl.max_ports, then
adding some will fail.  If he then removes some ports and does
"service ctld reload", he would expect that the new ports would get
added in the newly-freed port space. But they don't, because ctld
assigned them port numbers during their first creation attempts.

Fix this bug by removing newly created ports from ctld's internal list
if the kernel rejects them for any reason.  That way, a subsequent
config reload will attempt to add them again, possibly with new port
numbers.

MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	jhb, mav
Differential Revision: https://reviews.freebsd.org/D36974
2022-10-21 18:28:45 -06:00
Mitchell Horne
fc4c39c54f kldxref: handle R_RISCV_64 relocation
These are emitted in at least two kmods, and kldxref prints a warning.
While here, remove the unneeded local variable 'val'.

Reviewed by:	jrtc27, imp, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37038
2022-10-20 12:01:29 -03:00
Pawel Biernacki
a20a02abcd pmc: remove write-only variable 2022-10-19 20:59:23 +00:00
Ed Maste
b668975218 ntp: retire now-unused MIPS cases 2022-10-19 15:36:23 -04:00
Baptiste Daroussin
3467e28f3d mailwrapper: create mailwrapper symlinks for dma(8)
The Dragonfy Mail Agent (dma) can be used with mailwrapper as a
replacement for sendmail(8)

Even if mailwrapper and sendmail are disabled from the build but
dma is not create all the expect symlinks on mailwrapper and make
mailwrapper a symlink to dma, the same way it was done before when
mailwrapper is disabled by sendmail was not.

Discussed with:	emaste
2022-10-18 16:42:27 +02:00
Mitchell Horne
1e6577831d config(5): drop mention of mips
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D37019
2022-10-17 15:12:12 -03:00
Cy Schubert
865f46b255 unbound: Reapply Vendor import 1.17.0
Reapply 643f9a0581. 64d318ea98 was a
mismerge during fake rebase. Let's reapply it.

Changes include: Added ACL per interface, proxy protocol and bug fixes.

Announcement:   https://nlnetlabs.nl/news/2022/Oct/13/unbound-1.17.0-released/

Merge commit '643f9a0581e8aac7eb790ced1164748939829826' into main
2022-10-16 14:08:33 -07:00
Cy Schubert
8cee2ebac5 Revert "unbound: Vendor import 1.17.0"
This reverts commit 64d318ea98, reversing
changes made to 8063dc0320.

Revert a mismerge which reversed 8063dc0320.
2022-10-16 13:42:15 -07:00
Cy Schubert
64d318ea98 unbound: Vendor import 1.17.0
Added ACL per interface, proxy protocol and bug fixes.

Announcement:   https://nlnetlabs.nl/news/2022/Oct/13/unbound-1.17.0-released/

Merge commit '643f9a0581e8aac7eb790ced1164748939829826' into new_merge
2022-10-16 13:32:55 -07:00
Corvin Köhne
0bda8d3e9f vmm: permit some IPIs to be handled by userspace
Add VM_EXITCODE_IPI to permit returning unhandled IPIs to userland.
INIT and STARTUP IPIs are now returned to userland. Due to backward
compatibility reasons, a new capability is added for enabling
VM_EXITCODE_IPI.

Reviewed by:		jhb
Differential Revision:  https://reviews.freebsd.org/D35623
Sponsored by:           Beckhoff Automation GmbH & Co. KG
2022-10-14 12:03:05 +02:00
Kyle Evans
12b92f3ed8 bsdinstall: use the correct DISTDIR for fetching local distfiles
fetchmissingdists naturally sets BSDINSTALL_DISTDIR to a directory in
the new filesystem that it can write fetched distfiles to.  As a result,
BSDINSTALL_DISTSITE was incorrectly set to the scratch space on /mnt for
the call to distfetch when grabbing local distfiles, and it would
subsequently fail.

Switch to using the copy of BSDINSTALL_DISTDIR that we stashed off
coming into fetchmissingdists; this one is in-fact set to the path where
the local distfiles are stored.

Patch suggested by jrtc27.

Reported and tested by: Daniel O'Connor <darius dons net au>
MFC after:	1 week
2022-10-14 00:22:09 -05:00
Baptiste Daroussin
88e6c9a674 pw: remove the inaccurate anymore information from the README 2022-10-12 12:11:32 +02:00
Baptiste Daroussin
c0358afd5b pw: exit with an error in case of using an illegal option
PR:		263188
Reported by:	Dennis Clarke <dclarke@blastwave.org>
MFC After:	1 week
2022-10-12 12:06:32 +02:00
Rick Macklem
1e588a9ceb rpc.tlsservd: Add an option to run multiple daemons
During discussions with someone that was doing NFS-over-TLS
development for Solaris, we had a concern that the server might
become overloaded after rebooting, due to a large number of
TLS handshake requests from clients.

To alleviate this potential problem, this patch modifies rpc.tlsservd
so that it supports the "-N/--numdaemons" command line option,
which specifies that up to RPCTLS_SRV_MAXNPROCS (currently defined
as 16 in the patch) may be started.

When there are multiple daemons, one is selected by the patched kernel
in a round-robin fashion, to serve a TLS handshake request.

The man page update will be done in a future commit.

Reviewed by:	emaste, karels
Differential Revision:	https://reviews.freebsd.org/D35886
2022-10-08 16:06:16 -07:00
Mark Johnston
5b966d7871 bhyve: Initialize the return value in blockif_register_resize_callback()
MFC after:	1 week
2022-10-08 11:33:43 -04:00
Mark Johnston
3dddf73ee1 bhyve: Make bc_magic unsigned
This addresses a number of compiler warnings about signed/unsigned
comparisons in assertions.

MFC after:	1 week
2022-10-08 11:33:43 -04:00
Mark Johnston
07d82562d8 bhyve: Make pci_bars local to pci_emul.c
MFC after:	1 week
2022-10-08 11:33:42 -04:00
Mark Johnston
98d920d9cf bhyve: Annotate unused function parameters
MFC after:	1 week
2022-10-08 11:33:21 -04:00
Jessica Clarke
a45048565a bsdinstall: Fix race condition when shutting down after installation
Whilst reboot(8) will block whilst it runs, shutdown(8) does not,
daemonizing instead. This means that we must wait after running it,
otherwise we will exit and cause the system to attempt to go multi-user
in parallel with the shutdown daemon killing init. With the new
multi-console support in the installer, runconsoles will immediately
kill this daemon, racing with the daemon being able to signal init as
desired, and I have seen this race be lost in QEMU with a single CPU. In
the past this wasn't such an issue, since shutdown's daemon puts itself
in a new session group immediately after fork (and the parent doesn't
wait until that has happened, so whilst there's technically a race
condition in there where it could receive a SIGHUP from the death of the
parent's session leader, in practice this is very unlikely to be hit.
This means that the only consequence of this oversight before was that
you might get the beginnings of more console output on the way to
multi-user and thus the console would look a little confusing.

Reviewed by:	gjb
Fixes:		e4505364c0 ("release/rc.local: Provide option to shutdown after installation complete")
Fixes:		a09af1b7fd ("bsdinstall release: Start installer on multiple consoles")
Differential Revision:	https://reviews.freebsd.org/D36879
2022-10-06 20:04:04 +01:00
Michael Tuexen
8ff4fc03e6 traceroute6: fix capabilities for the rcv socket
On the receive socket, recvmsg() and poll()/select() is called.
Therefore, CAP_EVENT is needed in addition to CAP_RECV..

While there, check the socket for readbility before calling recvmsg().

Reviewed by:		markj@
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D36878
2022-10-04 23:40:29 +02:00
Mark Johnston
cba2fa7c5b makefs: Add a cast to placate static analyzers
"prefixlen" will always be smaller than 32 but adding a cast is
harmless.

Reported by:	Coverity
2022-10-04 13:05:54 -04:00
Mark Johnston
d7eec79b70 makefs: Plug a memory leak
nvlist_find_string() would return a copy of the found value, but callers
assumed they would have to make their own copy.  It's simpler to change
nvlist_find_string() than it is to change callers, so do that.

Reported by:	Coverity
2022-10-04 13:05:54 -04:00
John Baldwin
2fb81691b0 bhyve: Don't free an invalid pointer.
The netmap-specific data stored at be->opaque is freed by the caller
on error as part of freeing be.

Reviewed by:	markj
Reported by:	GCC -Wfree-nonheap-object
Differential Revision:	https://reviews.freebsd.org/D36828
2022-10-03 16:10:44 -07:00
John Baldwin
3b887005b4 rpc.lockd: Explicitly cast enum nlm_stats values to enum nlm4_stats.
NLM 4 status values are a superset of the older NLM protocol so these
casts are safe while pacifying -Wenum-conversion warnings from GCC.

Reviewed by:	rmacklem
Differential Revision:	https://reviews.freebsd.org/D36816
2022-10-03 16:10:42 -07:00
John Baldwin
c41b161812 ypldap: Fix mismatch in array bounds for ldapclient().
Reviewed by:	emaste
Reported by:	GCC -Warray-parameter
Differential Revision:	https://reviews.freebsd.org/D36807
2022-10-03 16:10:41 -07:00
Jessica Clarke
e571b0f8f8 etcupdate: Fix -N support for build command
Whilst febca0e643 added -N for both build and extract, it only fully
worked for extract; build would perform the actual tree build with
-DNO_ROOT and construct the intended METALOG, but the subsequent tarball
creation did not take this into account and just tarred up the the
directory as-is rather than using the METALOG. This resulted in the
permissions and ownership not being correct, as well as there being a
stray METALOG file in the tarball's root.

Reported by:	avg
Reviewed by:	avg, jhb, imp
Tested by:	avg
Fixes:		febca0e643 ("etcupdate: Add a -N flag to perform a NO_ROOT build")
Differential Revision:	https://reviews.freebsd.org/D36845
2022-10-03 17:16:19 +01:00
Jessica Clarke
a09af1b7fd bsdinstall release: Start installer on multiple consoles
Currently the installer is only started on the primary ("high level")
console. For systems where this is the video console and serial consoles
aren't of interest, and headless systems with just a serial console,
this works just fine, but for systems where both video and serial
consoles are present and meaningful this requires the user to select the
right primary console in loader, with the poor user experience of the
system appearing to hang if they leave the wrong one selected. This
notably differs from our multi-user behaviour of spawning getty on every
console, where the only issue with selecting the wrong primary console
is a quieter boot process until the login prompt appears (or the system
crashes).

Instead, use the newly-added runconsoles helper to run the installer on
every console (except for ttyv*, where only ttyv0 will be used). For
interactive installations, any of the consoles can be used, though only
one should be used at a time as no effort is made to avoid multiple
installations running at the same time clobbering each other. If the
Live CD option is selected, the other installers (which should, if the
user is well-behaved, be sitting at the welcome screen) will be killed.
If an automated install is in use, the primary console will be used to
display its output, and the others will direct the user to the primary
console.

Reviewed by:	brooks, gjb
Differential Revision:	https://reviews.freebsd.org/D36805
2022-10-03 17:09:17 +01:00
Jessica Clarke
d577d6178b bsdinstall release: Move code to a new startbsdinstall wrapper
This separates out the install media-specific environment (creating
bsdinstall_etc) from actually running the installer on a given console.
This will be used by a future change to start the installer on multiple
consoles.

Reviewed by:	brooks, gjb
Differential Revision:	https://reviews.freebsd.org/D36803
2022-10-03 17:09:16 +01:00
Jessica Clarke
a2464ee127 bsdinstall: Add a new runconsoles helper binary
This helper binary will run a given command on every on console, as
defined by /etc/ttys (except for ttyv*, where only ttyv0 will be used).
If one of the command processes exits, the rest will be killed. This
will be used by a future change to start the installer on multiple
consoles.

Reviewed by:	brooks, imp, gjb
Differential Revision:	https://reviews.freebsd.org/D36804
2022-10-03 17:09:16 +01:00
Brad Davis
03d66186f6 bsdinstall: add hooks to allow for easier customizing the install
Approved by:	allanjude
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D36459
2022-10-03 09:50:42 -06:00
Dag-Erling Smørgrav
0aa2700123 Put OPIE to rest.
Differential Revision: https://reviews.freebsd.org/D36592
2022-10-02 03:37:29 +02:00
Cy Schubert
35d60ac2e5 unbound: Adjust version string
Sync version string with contrib.

Reported by:	"Herbert J. Skuhra" <herbert@gojira.at>
Fixes:		4f5c8956cf
MFC after:	3 days
2022-10-01 06:51:30 -07:00
Michael Tuexen
a779bb4d94 tcp_sso: add support for TCP_MAXUNACKTIME
Reported by:		rscheff@
Reviewed by:		rscheff@
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D36802
2022-09-29 02:02:11 +02:00
Brooks Davis
b4cfdbfed2 manpages: Remove telnetd references
Mostly remove from the SEE ALSO section, adding a mention of the port
where not removed. Elsewhere, remove as appropriate and change from .Xr
to .Nm where a mention of telnetd continues to make sense (or removing
it would require significant reworking of the surrounding text).

Reviewed by:	imp, delphij, emaste
Differential Revision:	https://reviews.freebsd.org/D36785
2022-09-29 17:56:41 +01:00
Brooks Davis
edb5226248 inetd.conf: update telnetd paths
Follow the example of rsh and point to /usr/local.

Reviewed by:	imp, delphij, emaste
Differential Revision:	https://reviews.freebsd.org/D36783
2022-09-29 17:56:41 +01:00
Mark Johnston
65b8109b4e bhyve: Address some warnings in bhyverun.c
- Add const and __unused qualifiers where appropriate.
- Localize some global variables.
- Consistently spell vmexit state as "vme" in vmexit handlers, to avoid
  shadowing the global vm_exit state array.
- Similarly, avoid shadowing "optarg".

MFC after:	2 weeks
2022-09-29 12:36:44 -04:00
Mark Johnston
6cb261620d bhyve: Use designated initializers for virtio_consts tables
This is easier to read and addresses some compiler warnings.

One might expect these tables to be read-only but it seems that the
snapshot/restore code may modify them.

MFC after:	2 weeks
2022-09-29 12:36:44 -04:00
Mark Johnston
ee83710bc4 bhyve: Address compiler warnings in audio.c
- Avoid arithmetic on void pointers.
- Avoid a signed/unsigned comparison in loops which write or fill audio
  data buffers.

Convert while loops to for loops while here.

MFC after:	2 weeks
2022-09-29 12:36:44 -04:00
Mark Johnston
57d96d8df9 bhyve: Address -Wno-unused warnings in atkbd.c
MFC after:	2 weeks
2022-09-29 12:36:44 -04:00
Mark Johnston
889cec66d3 bhyve: Make smbios tables local to smbiostbl.c
Also flag them as const.

MFC after:	2 weeks
2022-09-29 12:36:44 -04:00
Vinícius Zavam
c153a35bfd
bsdinstall: replace ntpdate by ntpd_sync_on_start
* change current NTP services offered by the FreeBSD Installer;
  * no longer offer ntpdate to be enabled and started on boot;
  * start offering the option to make ntpd set the date and time on boot itself.

The motivation for this change comes from the ntpdate(8) manpage:

  Note: The functionality of this program is now available in the ntpd(8)
  program. See the -q command line option in the ntpd(8) page. After a
  suitable period of mourning, the ntpdate utility is to be retired from
  this distribution.

Approved by:		cy (src), dteske (src)
Differential Revision:	https://reviews.freebsd.org/D36206
2022-09-27 09:04:20 +00:00
Rick Macklem
7652321b79 rpc.tlsclntd.8: Fix the RFC number now that it exists
The RFC for this finally got published and, therefore,
now has a number.  This patch puts this RFC number
in the man page.

This is a content change.

MFC after:	1 week
2022-09-23 16:59:29 -07:00
Rick Macklem
423387bee2 rpc.tlsservd.8: Fix the RFC number now that it exists
The RFC for this finally got published and, therefore,
now has a number.  This patch puts this RFC number
in the man page.

This is a content change.

MFC after:	1 week
2022-09-23 16:53:36 -07:00
Ed Maste
06a400d76b makefs: whitespace cleanup (remove space before tab)
MFC after:	1 week
2022-09-20 10:26:24 -04:00
Jens Schweikhardt
e9e615c88a Fix dead references (wrong section) to sysctl(8). 2022-09-16 20:00:49 +02:00
Gordon Bergling
8f98a937ed uname.1: Clarify the -r option
It is some times hard to understand the difference between
kernel version and userland version. So clarify the -r option
of uname(1) in terms of a printed kernel version.

While here, add some cross references:

- cross reference freebsd-version(1) in uname(1)
- cross reference freebsd-version(1) and uname(1) in freebsd-update(8)

PR:		265594
Reported by:	rwatson
Reviewed by:	gbe, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36516
2022-09-16 13:27:54 +02:00
Gordon Bergling
59f7c7ff51 cxgbetool(8): Fix a typo in a source code comment
- s/paramter/parameter/

MFC after:	3 days
2022-09-15 10:29:54 +02:00
Brad Davis
2913e785f0 bsdinstall: fix a couple stragglers in whitelabeling the scripts
PR:		265797
Reviewed by:	allanjude, asiciliano
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D36235
2022-09-14 11:06:11 -06:00
Jens Schweikhardt
b94e192660 Capitalize title like in all other titles. 2022-09-14 13:42:43 +02:00
Filipe da Silva Santos
10c6af3441 bhyve: Fix build when BHYVE_SNAPSHOT is set
Fixes:		9cc9abf409 ("bhyve: create all vcpus on startup")
Sponsored by:	Beckhoff Automation GmbH & Co. KG
X-MFC-With:	9cc9abf409
2022-09-13 08:32:09 +02:00
Emmanuel Vadot
3fc174845c Revert "vmm: permit some IPIs to be handled by userspace"
This reverts commit a5a918b7a9.

This cause some problem with vm using bhyveload.

Reported by:	pho, kp
2022-09-09 15:55:01 +02:00
Corvin Köhne
a5a918b7a9 vmm: permit some IPIs to be handled by userspace
Add VM_EXITCODE_IPI to permit returning unhandled IPIs to userland.
INIT and Startup IPIs are now returned to userland. Due to backward
compatibility reasons, a new capability is added for enabling
VM_EXITCODE_IPI.

MFC after:              2 weeks
Differential Revision:  https://reviews.freebsd.org/D35623
Sponsored by:           Beckhoff Automation GmbH & Co. KG
2022-09-07 09:07:03 +02:00
Corvin Köhne
9cc9abf409 bhyve: create all vcpus on startup
vcpus could be restarted by the guest by sending an INIT SIPI SIPI
sequence to a vcpu. That's not supported by bhyve yet but it will be
supported in a future commit. So, create the vcpu threads only once on
startup to make restarting a vcpu easier.

MFC after:		2 weeks
Differential Revision:	https://reviews.freebsd.org/D35621
Sponsored by:		Beckhoff Automation GmbH & Co. KG
2022-09-07 09:05:36 +02:00
Gordon Bergling
5f285d5537 cd9660(5): Correct a typo in a source code comment
- s/byes/bytes/

MFC after:	3 days
2022-09-04 18:20:09 +02:00
Gordon Bergling
990878b07f pkg(8): Remove a double word in a source code comment
- s/that that/that/

MFC after:	3 days
2022-09-04 17:28:16 +02:00
Gordon Bergling
886ce99dea bhyve(4): Remove a double word in a source code comment
- s/the the/the/

MFC after:	3 days
2022-09-04 13:57:00 +02:00
Alfonso S. Siciliano
5f3ec44e7e
bsdinstall(8) hostname: Update for bsddialog 0.3
* Delete --hline info. bsddialog(1) 0.3 closes an --inputbox pressing
   only Enter (restoring the previous LGPL-dialog behavior).
 * Add dynamic width auto-sizing.
2022-09-03 22:15:12 +02:00
Gordon Bergling
b82cbe4651 cron(8): Fix a typo in a source code comment
- s/overriden/overridden/

MFC after:	3 days
2022-09-03 15:00:29 +02:00
Gleb Smirnoff
f70a2e2948 ipfwpcap: use PF_DIVERT/SOCK_RAW instead of PF_INET/SOCK_RAW/IPPROTO_DIVERT 2022-08-30 16:24:37 -07:00
John Baldwin
bb31aee26b bhyve virtio-scsi: Avoid out of bounds accesses to guest requests.
- Ignore I/O requests with insufficiently sized input or output
  buffers (those not containing compete request headers).

- Ignore control requests with improperly sized buffers.

- While here, explicitly zero the output header of an I/O request to
  avoid leaking malloc garbage from the host if the header is not
  fully populated.

PR:		264521
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	mav, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36271
2022-08-29 15:37:27 -07:00
John Baldwin
62806a7f31 bhyve virtio-scsi: Tidy warning and debug prints.
Use a consistent prefix ("virtio-scsi: ") similar to the e1000 device
model.

Reviewed by:	mav, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36270
2022-08-29 15:37:15 -07:00
John Baldwin
7afe342dcb bhyve e1000: Sanitize transmit ring indices.
When preparing to transmit pending packets, ensure that the head (TDH)
and tail (TDT) indices are in bounds.  Note that validating values
when they are written is not sufficient along as the transmit length
(TDLEN) could be changed turning a value that was valid when written
into an out of bounds value.

While here, add further restrictions to the head register (TDH).  The
manual states that writing to this value while transmit is enabled can
cause unexpected behavior and that it should only be written after a
reset.  As such, ignore attempts to write while transmit is active,
and also ignore writes of non-zero values.  Later e1000 chipsets have
this register as read-only.

Also ignore any attempts to transmit packets if the transmit ring's
size is zero.

PR:		264567
Reported by:	Robert Morris <rtm@lcs.mit.edu>
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36269
2022-08-29 15:36:57 -07:00
Mark Johnston
09a2fce092 makefs tests: Do not run ZFS tests in parallel
makefs-created pools always have the same GUID and thus cannot be
imported simultaneously.

Reported by:	olivier
2022-08-29 12:54:25 -04:00
Mark Johnston
a3b6b3ac4d makefs tests: Do not install ZFS tests if WITHOUT_ZFS is defined 2022-08-29 12:50:51 -04:00