aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
Commit message (Collapse)AuthorAgeFilesLines
* bhyve: fix spelling mistake of pcireg optionCorvin Köhne2023-03-291-1/+1
| | | | | | | | The option is spelled "pcireg" not "pcir". MFC after: 1 week Fixes: f4ceaff56ddaacc151df07d2d205a2d7fcb736a8 Sponsored by: Beckhoff Automation GmbH & Co. KG
* sesutil: fix "fault all" with zoned jbodsAlan Somers2023-03-271-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Some SAS JBODs support zoning. This feature allows individual SAS targets to be accessible by only some initiator ports. One application would be connecting two servers to the same JBOD, but they wouldn't be able to see each other's disks. A zoned JBOD should also prohibit initiators from accessing SES elements corresponding to inaccessible SAS targets. It reports that by setting the element's status code to 0x8 (No Access Allowed). The bug is that when doing "sesutil (fault|locate) all ...", sesutil will attempt a ENCIOC_SETELMSTAT ioctl for every single element, even the inaccessible ones. The enclosure will reject the command, the kernel will return EINVAL, and sesutil will exit. The solution is to check the element's status, and skip trying to set it if the status is 0x8. But if the user actually supplied a ses ID, then assume that he knows what he's doing and try to set it anyway. PR: 270093 MFC after: 1 week Sponsored by: Axcient Reviewed by: mav, trasz Differential Revision: https://reviews.freebsd.org/D39017
* bhyve: add config option to modify LPC IDsCorvin Köhne2023-03-272-3/+57
| | | | | | | | | | | | | | | | | The Intel GOP driver checks the LPC IDs to detect the platform it's running on. The GOP driver only works on the platforms it's written for. Maybe other Intel driver have the same behaviour. For that reason, we should use the LPC IDs of the FreeBSD host for GPU passthrough to work properly. We don't know if setting different LPC IDs have any side effect. Therefore, don't use the host LPC IDs by default on Intel system. Give the user the opportunity to modify the LPC IDs. Reviewed by: jhb MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D28280
* bhyve: make use of helper to read PCI IDs from bhyve configCorvin Köhne2023-03-272-6/+22
| | | | | | | | | For compatibilty reasons, the old config values are still supported. Reviewed by: jhb MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D38403
* bhyve: add helper to read PCI IDs from bhyve configCorvin Köhne2023-03-272-0/+47
| | | | | | | | | | | | | | | Changing the PCI IDs is valuable in some situations. The Intel GOP driver requires that some PCI IDs of the LPC bridge are aligned with the physical values of the host LPC bridge. Another use case are oracles virtio driver. They require different subvendor ID than the default one. For that reason, create a helper which makes it easy to read PCI IDs from bhyve config. Additionally, this helper ensures that all emulation devices are using the same config keys. Reviewed by: jhb MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D38402
* rarpd(8): Fix a typo in a source code commentGordon Bergling2023-03-271-1/+1
| | | | | | | - s/combinataion/combination/ Obtained from: NetBSD MFC after: 3 days
* pwd_mkdb: Sort options and update usage message.Dag-Erling Smørgrav2023-03-252-24/+24
| | | | | | Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D39266
* makefs: emit NM records for all directory entriesEd Maste2023-03-251-15/+1
| | | | | | | | | | | | | | | | | | | | | | We previously attempted to emit Rock Ridge NM records only when the name represented by the Rock Ridge extensions would actually differ. We would omit the record for an all-upper-case directory name, however Linux (and perhaps other operating systems) map names with no NM record to lowercase. This affected only directories, as file names have an implicit ";1" version number appended and thus always differ. To solve, just emit NM records for all entries other than DOT and DOTDOT . We could continue to omit the NM record for directories that would avoid mapping (for example, one named 1234.567) but this does not seem worth the complexity. PR: 203531 Reported by: Thomas Schmitt <scdbackup@gmx.net Reviewed by: kevans Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39258
* local-unbound-setup: Disable the libc subscriber.Dag-Erling Smørgrav2023-03-241-1/+1
| | | | | | | This is the correct way to prevent resolvconf from updating resolv.conf. Reviewed by: cy Differential Revision: https://reviews.freebsd.org/D39262
* bhyve: Remove vmctx member from struct vm_snapshot_meta.John Baldwin2023-03-247-49/+72
| | | | | | | | | | | | | | | | | | This is a userland-only pointer that isn't relevant to the kernel and doesn't belong in the ioctl structure shared between userland and the kernel. For the kernel, the old structure for the ioctl is still supported under COMPAT_FREEBSD13. This changes vm_snapshot_req() in libvmmapi to accept an explicit vmctx argument. It also changes vm_snapshot_guest2host_addr to take an explicit vmctx argument. As part of this change, move the declaration for this function and its wrapper macro from vmm_snapshot.h to snapshot.h as it is a userland-only API. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D38125
* libvmmapi: Add a struct vcpu and use it in most APIs.John Baldwin2023-03-2422-720/+729
| | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces the 'struct vm, int vcpuid' tuple passed to most API calls and is similar to the changes recently made in vmm(4) in the kernel. struct vcpu is an opaque type managed by libvmmapi. For now it stores a pointer to the VM context and an integer id. As an immediate effect this removes the divergence between the kernel and userland for the instruction emulation code introduced by the recent vmm(4) changes. Since this is a major change to the vmmapi API, bump VMMAPI_VERSION to 0x200 (2.0) and the shared library major version. While here (and since the major version is bumped), remove unused vcpu argument from vm_setup_pptdev_msi*(). Add new functions vm_suspend_all_cpus() and vm_resume_all_cpus() for use by the debug server. The underyling ioctl (which uses a vcpuid of -1) remains unchanged, but the userlevel API now uses separate functions for global CPU suspend/resume. Reviewed by: corvink, markj Differential Revision: https://reviews.freebsd.org/D38124
* pmcstat: Warn about text output format stability.Joseph Koshy2023-03-241-1/+5
| | | | | | | | | The formats for pmcstat(8)'s human-readable output are not part of its user interface definition, and may change in the future. Highlight this in its manual page. Approved by: gnn (mentor) Differential Revision: https://reviews.freebsd.org/D39249
* makefs: correct El Torito bood recordEd Maste2023-03-231-2/+2
| | | | | | | | | | | | | | The boot catalog pointer is a DWord, but we previously populated it via cd9660_bothendian_dword which overwrote four unused bytes following it. See El Torito 1.0 (1995) Figure 7 for details. PR: 203531 Reported by: Coverity Scan Reported by: Thomas Schmitt <scdbackup@gmx.net> Reviewed by: kevans CID: 977470 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39231
* makefs: correct iso9660 Rock Ridge NM valuesEd Maste2023-03-231-3/+3
| | | | | | | | | | These are not actually used by makefs (yet), but ought to match the spec. See RRIP 4.1.4 Description of the "NM" System Use Entry for details. PR: 203531 Sponsored by: The FreeBSD Foundation
* makefs: correct iso9660 Rock Ridge TF timestampsEd Maste2023-03-232-10/+10
| | | | | | | | | | | | | The bit definitions for the TF_* timestamp bits (TF_MODIFY, etc.) were incorrect, and timestamps were written in the wrong order. See RRIP 4.1.6 Description of the "TF" System Use Entry for details. PR: 203531 Reported by: Thomas Schmitt <scdbackup@gmx.net> Reviewed by: jrtc27, kevans Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39221
* daemon: reformat longoptsKyle Evans2023-03-231-17/+17
| | | | | Use a single tab instead of eight spaces, these aren't line continuations.
* daemon: decouple init logic from main loopIhor Antonov2023-03-231-86/+109
| | | | | | | | | | | | | main() func contained both initialization and main loop logic. This made certain operations like restarting problematic and required dirty hacks in form of goto jumps. This commit moves the main loop logic into daemon_eventloop(), cleans up main, and makes restart logic clear: daemon_mainloop() is run in a loop with a restart condition checked at the end. Reviewed by: kevans Pull Request: https://github.com/freebsd/freebsd-src/pull/699
* bhyve: Don't return -ENOMEM from qemu_fwcfg_add_file.John Baldwin2023-03-221-1/+1
| | | | | Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D39212
* bhyve: Accept a variable-length string name for qemu_fwcfg_add_file.John Baldwin2023-03-222-3/+5
| | | | | | | | | | It is illegal (UB?) to pass a shorter array to a function argument that takes a fixed-length array. Do a runtime check for names that are too long via strlen() instead. Reviewed by: markj Reported by: GCC -Wstringop-overread Differential Revision: https://reviews.freebsd.org/D39211
* bhyve: Sleep briefly in the VMEXIT_DEBUG handlerMark Johnston2023-03-221-0/+5
| | | | | | | | | | | | | | | | | | | | As of commit 0bda8d3e9f7a ("vmm: permit some IPIs to be handled by userspace") and commit 9cc9abf409cc ("bhyve: create all vcpus on startup"), we have a misbehaviour where AP vCPU threads spin until they receive a SIPI. In particular, since they are "suspended", they simply call the VMEXIT_DEBUG handler in a loop, but the handler is a no-op by default. This is tricky to fix since the gdb stub isn't aware of whether a given vCPU is supposed to be running. For 13.2's sake, introduce a simple workaround wherein the VMEXIT_DEBUG handler sleeps for a short period. This ensures that host CPU usage remains sane when VMs are starting without penalizing users of VMEXIT_DEBUG too much. Reviewed by: corvink, jhb MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39174
* daemon: move signal setup into a functionIhor Antonov2023-03-211-63/+79
| | | | | | No functional change intended. Reviewed by: kevans
* mountd.8: Update for mountd running in jailsRick Macklem2023-03-201-2/+27
| | | | | | | | | | | | | | Mountd can now be run in an appropriately configured vnet jail. This man page update adds some information for this case. This is a content change. Reviewed by: markj MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D39168
* daemon: kill off some stray blank linesKyle Evans2023-03-181-3/+0
| | | | | | Overlooked in review; mea culpa. Reported by: jrtc27
* daemon: remove unnecessary memset in daemon_state_init()Ihor Antonov2023-03-181-1/+0
| | | | Pull Request: https://github.com/freebsd/freebsd-src/pull/694
* daemon: repace goto exit with daemon_terminate()Ihor Antonov2023-03-181-25/+40
| | | | | | | | | Start breaking down big main() Remove goto exit label and replace it with a function that does cleanup. Comment re-worded by kevans@. Pull Request: https://github.com/freebsd/freebsd-src/pull/694
* bhyve: add cmdline option to enable qemu's fwcfgCorvin Köhne2023-03-177-33/+111
| | | | | | | | | | | | | Let the user decide if he wants to use bhyve's fwctl or qemu's fwcfg. He can set the interface by adding a fwcfg option to bootrom: -l bootrom,<path/to/rom>,fwcfg=bhyve -l bootrom,<path/to/rom>,fwcfg=qemu Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D38337
* bhyve: add helper for adding fwcfg filesCorvin Köhne2023-03-172-0/+92
| | | | | | | | | | | | Fwcfg items without a fixed index are reported by the file_dir. They have an index of 0x20 and above. This helper simplifies the addition of such fwcfg items. It selects a new free index, assigns it to the fwcfg items and creates an proper entry in the file_dir. Reviewed by: markj MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D38336
* sendmail: silence K&R warnsMateusz Guzik2023-03-161-0/+2
| | | | Sponsored by: Rubicon Communications, LLC ("Netgate")
* ppp: Remove trailing semicolonElyes Haouas2023-03-151-2/+2
| | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/654
* pmccontrol: Remove trailing semicolonElyes Haouas2023-03-151-1/+1
| | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/654
* lpr: Remove trailing semicolonElyes Haouas2023-03-151-1/+1
| | | | | | Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/654
* bhyve: Remove trailing semicolonElyes Haouas2023-03-156-7/+7
| | | | | | | | Macros shouldn't use trailing semicolon. Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/654
* jail.8: Update the allow.nfsd sectionRick Macklem2023-03-141-10/+44
| | | | | | | | | | | This patch updates the information for "allow.nfsd" and adds configuration information. This is a content change. Reviewed by: karels, markj, pauamma (manpages) MFC after: 3 months Differential Revision: https://reviews.freebsd.org/D39033
* makefs: do not call brelse if bread returns an errorEd Maste2023-03-142-6/+0
| | | | | | | | | | | If bread returns an error there is no bp to brelse. One of these changes was taken from NetBSD commit 0a62dad69f62 ("This works well enough to populate..."), the rest were found by looking for the same pattern. Reviewed by: imp Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D39069
* makefs: make msdos creation go fastWarner Losh2023-03-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | Add missing brelse(bp). Without it the cache grows and we have a n^2 lookup. I'm not entirely sure why we read the block before we write it back out, since the only side effect of that is to allocate memory, clear the memory, read it in from disk, throw it away with the contents of the file being written out. We likely should just do a getblk() here instead, but even with all that, this takes the time it takes to create a 150MB msdos fs image down from 5 minutes to 30 seconds. Old: 317.663u 0.685s 5:18.34 100.0% 198+360k 0+19io 1009pf+0w New: 7.330u 23.841s 0:31.17 100.0% 198+360k 0+250522io 4pf+0w See code review for how we got this. tl;dr: netbsd move brelse into bwrite and we picked up msdos code after that, but not the move. That change should be picked up later. Sponsored by: Netflix Reviewed by: emaste MFC After: 1 day (13.2 is coming fast) Differential Revision: https://reviews.freebsd.org/D39025
* daemon: move variables into struct daemon_stateIhor Antonov2023-03-121-134/+154
| | | | | | | | | | | | | | | The fact that most of the daemon's state is stored on the stack of the main() makes it hard to split the logic smaller chunks. Which in turn leads to huge main func that does a a lot of things. struct log_params existed because some variables need to be passed into other functions together. This change renames struct log_params into daemon_state and moves the rest of the variables into it. This is a necessary preparation step for further refactroing. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/687
* pkg(7): now that we do use libmd, use it completlyBaptiste Daroussin2023-03-093-77/+16
| | | | | | | | Use SHA256_Fd and SHA256_Data instead of home made equivalent. wrap those functions into hash.c to avoid header collition between openssl and libmd Suggested by: kevans
* pkg(7): use libmd for sha256 instead of opensslBaptiste Daroussin2023-03-094-79/+147
| | | | | | | | | | | | OpenSSL 3.0 has deprecated the sha256 api, let's use libmd which has the same API instead. In order to avoid the collision in definitions (sha256.h cannot be included in the same file as a file where openssl headers has been included) let's move the sha256 related code in its own file PR: 270023 Reported by: ngie
* Revert "grep: remove tautological condition"Kyle Evans2023-03-093-61/+0
| | | | | | This reverts commit f6d6c66889001208aee7b0c46efe1c8ddffda57c. Gremlins snuck into my tree and injected some WIP.
* grep: remove tautological conditionKyle Evans2023-03-093-0/+61
| | | | | | st_size is an off_t, it cannot hold values larger than OFF_MAX. CID: 1008931
* bhyve: Move libcasper dependecy to lib9pVitaliy Gusev2023-03-071-8/+0
| | | | | | | | | | libcasper(3) is not used in bhyve. So move dependency to the appropriate place. Reviewed by: markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38905
* bhyvectl: don't permit using --suspend and --checkpoint at same timeVitaliy Gusev2023-03-061-14/+9
| | | | | | | | | | | When using the --suspend and --checkpoint parameter, bhyvectl will produce two checkpoint images and the exits. This is slightly ambiguous. So, permit only one of theses parameters at the same time. Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38887
* bhyve: init checkput before caph_enterVitaliy Gusev2023-03-061-9/+11
| | | | | | | | | | init_checkpoint_thread binds to a socket. Bhyve isn't allowed to do that after caph_enter. Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38857
* bhyve: exit with EX_OSERR if init checkpoint or restore time failedVitaliy Gusev2023-03-061-3/+4
| | | | | | | Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38872
* bhyve: add cap limits for ipc socketVitaliy Gusev2023-03-061-0/+10
| | | | | | | Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38856
* bhyve: don't flush readonly device at blockif_pauseVitaliy Gusev2023-03-061-1/+1
| | | | | | | Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38855
* bhyvectl: don't leak nvlist in send_messageVitaliy Gusev2023-03-061-1/+1
| | | | | | | Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38900
* bhyvectl: correct socket_fd closing in send_messageVitaliy Gusev2023-03-061-1/+1
| | | | | | | Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38889
* bhyvectl: do not return garbage from send_messageVitaliy Gusev2023-03-061-3/+5
| | | | | | | | | err is used uninitialized in some cases. Reviewed by: corvink, markj MFC after: 1 week Sponsored by: vStack Differential Revision: https://reviews.freebsd.org/D38886
* bhyveload: Address compiler warnings and bump WARNSMark Johnston2023-03-032-34/+36
| | | | | | | | | | Mostly sprinkle __unused. Also duplicate strings passed to addenv() so that constant string literals can be passed. No functional change intended. Reviewed by: corvink, rew, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D38840