Commit Graph

19786 Commits

Author SHA1 Message Date
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