IABSD.fr/src/usr.sbin/vmd

Branch :


Log

Author Commit Date CI Message
f2cc1b42 2019-11-10 20:51:52 Consistently use _rcctl enable foo_ in examples, it's simpler and less error prone than manually editing rc.conf.local, and also works to enable ipsec and accounting. tweak from schwarze@ to use the \(dq\(dq syntax for quotes in '.Dl foo_flags="" lines' instead of \&"\&". while at it, fix a reference to a bogus /dev/dhclient.conf file that recently snuck in. ok jmc@ deraadt@ schwarze@
4d52d473 2019-10-25 09:57:33 ifname in opentap() is not optional The function argument is not checked at all and the only caller in config.c always passes a buffer valid buffer. Defer the error case's default value to the end to avoid rewriting in case a node is opened. Feedback and OK reyk
8e646ea0 2019-10-16 02:47:34 vmd(8): provide some additional info in a debug msg Print the guest %rip when it tries to do I/O to a nonexistent port. Also convert the message to a DPRINTF so that it doesn't leak guest address information into any logging the host might be doing under normal non-debug conditions.
1f85abb3 2019-10-11 15:25:40 use sizeof(struct) not sizeof(pointer) in calloc call ok deraadt@
1e93267c 2019-09-24 12:14:54 vmd(8): fix memory leak in virtio network TX path. ok reyk, mpi, benno, tb
d961d7d8 2019-09-24 12:12:46 vmd(8): virtio.c whitespace removal
083b9ea2 2019-09-07 09:11:14 Remove unused VMD_DISK_INVALID message type and mark it obsolete. ok mlarkin@
670ad819 2019-09-04 07:02:03 vmd(8): memory leak in an error path Found by Hiltjo Posthuma, thanks!
baf88fe3 2019-08-14 07:34:49 Improve the error message when supplying an invalid template to vmctl start. Favoring 'invalid template' over 'permission denied' should give the user a better hint on what went wrong. ok kn@ mlarkin@
cbd2a590 2019-07-17 05:51:07 vmm/vmd: Fix migration with pvclock Implement VMM_IOC_READVMPARAMS and VMM_IOC_WRITEVMPARAMS ioctls to read and write pvclock state. reads ok mlarkin@
df69c215 2019-06-28 13:32:41 When system calls indicate an error they return -1, not some arbitrary value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
5837d48b 2019-05-28 07:36:37 Make vmd(8)'s ns8250 emulation more correct Remove the scratch register (8250s don't have this), and reorganize some constants to be able to more easily support more than one serial port in the future. ok deraadt Diff from Katherine Rohl, thanks!
f49c495a 2019-05-28 03:20:59 vmd: unset CR0_CD and CR0_NW in default flat64 register values These never got unset on AMD/SVM guests when booted via vmctl start -b causing them to run very slow ok mlarkin@
a50a4aa6 2019-05-27 19:21:43 only reschedule the periodic interrupt after updating register A if something changed in register A. when updating register A we were checking in register B if the PIE bit was set in order to decide if rtc_reschedule_per needed to be called. if that bit was changed then the timer rate would already have been adjusted by rtc_update_regb so the call from rtc_update_rega is not needed. this now matches what qemu and other emulators are doing too. ok mlarkin@
9ac1699a 2019-05-20 17:04:24 drop fatalx calls when claiming a new vm id; otherwise it's possible to crash vmd and take all other vms with it. this required a little shuffling to get the error value reported back to the caller to handle the error properly. ok mlarkin@
65d68140 2019-05-16 21:16:04 Unbreak vmctl start foo -b /bsd -d disk.img -cL Define a local definition of LOADADDR() instead of pulling in machine/loadfile_machdep.h. vmd -b requires the addresses to be masked and the new bootloader no longer does that. OK pd@ kettenis@
50ed37b0 2019-05-14 12:47:17 Delete some .Sx macros that were used in a wrong way. Part of a patch from Stephen Gregoratto <dev at sgregoratto dot me>.
c5ee7fb3 2019-05-14 06:05:45 Add support for `boot device' to vm.conf grammar which is the `-B device' counterpart from vmctl. ok mlarkin@
c5043439 2019-05-12 20:56:34 vmm: add a x86 page table walker Add a first cut of x86 page table walker to vmd(8) and vmm(4). This function is not used right now but is a building block for future features like HPET, OUTSB and INSB emulation, nested virtualisation support, etc. With help from Mike Larkin ok mlarkin@
3f77225d 2019-05-11 23:07:46 report vm state through 'vmctl status'; whereas previously this would display the state of the vcpu (which is why it got removed), it now actually reports the correct state (running, stopped, disabled, paused, etc) ok ccardenas@ mlarkin@
8de23201 2019-05-11 19:59:32 vm_dump_header allocated space for a signature but it was never set; set it to VMM_HV_SIGNATURE and check for it upon restoring a vm image ok mlarkin@ pd@
68b3b297 2019-05-11 19:58:02 add missing comment about VM_STATE_SHUTDOWN; as discussed with ccardenas@
19700f36 2019-05-11 19:55:14 track the state of the vm (running, paused, etc) using a single bitfield instead of a handful of separate variables. this will makes it easier for vmd to report and check on the individual vm states no functional change intended ok ccardenas@ mlarkin@
e737b9bf 2019-05-11 01:05:17 sync the vm state in vmd too when (un)pausing a vm, otherwise the vm process knows the vm is paused, but vmd does not. ok mlarkin@ pd@
d84214ae 2019-05-10 18:11:27 remove receive_vm prototype for the function does not exist (anymore) ok pd@
783667e4 2019-03-11 17:08:52 Do not unconditionally wait for read events on the pty associated with a vm console. Instead, wait for the controlling end of the pty to become writeable, which implies that the slave end is connected. A recent change to the kqueue pty implementation caused vmd to hammer the log due to constantly hitting EOF while reading from the pty since the slave end was disconnected. Issue found the hard way by mlarkin@ and tb@ ok mlarkin@
f34f2a88 2019-03-07 18:54:05 Clarify that VM names must start with a letter `start' requires an alphanumeric VM name, must not be a number and in fact must not start with a digit. Improve and simplify the current requirements as starting with a letter directly implies all of the above. OK mlarkin, feedback jmc
6fc949a7 2019-03-01 07:32:29 vmd(8): remove some i386 remnants that missed the original cleanup ok pd, kn, deraadt
044145c8 2019-02-20 07:00:25 vmd(8): initialize guest %drX registers to power-on defaults on launch Initializes the %drX registers to power on defaults, and bump the VM send/recieve header to reflect same discussed with deraadt@
915c3f33 2019-02-13 22:57:07 (unsigned) means (unsigned int) which on ptrdiff_t or size_t or other larger types really is a range reduction... Almost any cast to (unsigned) is a bug. ok millert tb benno
93622bc9 2019-01-22 10:12:36 vmd: reorder PCI device assignment to fix Linux network interface numbering On some recent Linux guests, the virtio network interface is named based on its PCI slot assignment, eg "enp0s3". Prior to this change, vmd assigned disks first, meaning if you used a disk image to install Linux and then removed it after install, the network interface name would change from "enp0s3" to "enp0s2" (for example). This broke any autoconfiguration script config files written during the install and generally led to users just being confused about what was going on. This change reorders the vmd PCI device assignment to put network interfaces before disks, as disk devices don't seem to have the same naming issue. This means the slot for network interfaces won't change. IMPORTANT NOTE - if you have existing Linux guest VMs, you'll need to manually fixup your config files (once). ok ajacoutot, phessler, ccardenas, deraadt@
bbbb23fd 2019-01-18 01:24:07 disable vmd/vmctl for i386 Next commit will delete vmm(4) for i386. Reasons to delete i386 vmm: - Been broken for a while, almost no one complained. - Had been falling out of sync from amd64 while it worked. - If your machine has vmx, you most probably can run amd64, so why not run that? ok mlarkin@ deraadt@
fb6f09fa 2019-01-10 19:21:02 an alloca() snuck into the tree. We don't use alloca() in our tree unless it is entirely unavoidable (for example libc/*/exec.c), because any erroneous size controlled by an attacker turns into a known-location object placement in a very dangerous region. So use malloc() instead.
11b9cb3b 2019-01-10 18:59:56 unbreak vmd build include new virtio_pcireg.h header
c16b9d5a 2018-12-27 19:51:30 When netbooting a vm using the `-B net' option, set the hostname DHCP option in the lease to the name of the vm. Makes it easier to use dedicated autoinstall response files for different vms. ok ccardenas@
c4bec800 2018-12-12 21:20:57 Simplify mbzero() by using mem_write with a NULL buf which does zero out all memory at once without having to use a zero buffer. OK mlarkin@
fa2284ec 2018-12-12 21:19:22 Set the com speed to 115200 like we do in our bootloader when using SeaBIOS. OK mlarkin@
622c1441 2018-12-10 21:30:33 Implement the fw_cfg interface basics and use it to set the bootorder if a bootdevice was forced. This implements both the pure IO port interface and also the new DMA interface, a few direct commands are implemented which are needed but in general the "file" interface should be used. There is no write support for the guest. Tested against the latest vmm-firmware port. This requires also a -current kernel to pass the IO ports to vmd(8). OK mlarkin@ ccardenas@
6dc2ac0b 2018-12-10 21:24:22 No need to \n in log_debug. Part of a larger diff. OK mlarkin@ ccardenas@
471d533f 2018-12-09 12:26:38 When -B is used to specify a specific boot device also change the reboot behaviour of vmd to stop / exit at guest reboot. OK ccardenas@
cc104512 2018-12-06 09:20:06 Make it possible to define the bootdevice in vmd. This information is used currently only when booting a OpenBSD kernel. If VMBOOTDEV_NET is used the internal dhcp server will pass "auto_install" as boot file to the client and the boot loader passes the MAC of the first interface to the kernel to indicate PXE booting. Adding boot order support to SeaBIOS is not yet implemented. Ok ccardenas@
95176482 2018-12-04 08:15:09 Introduce IMSG_VMDOP_WAIT_VM_REQUEST a control message that registers a vmctl peerid that should be informed when the VM is stopped (like when the guest does a shutdown). Uses the same logic as using the VMOP_WAIT flag on IMSG_VMDOP_TERMINATE_VM_REQUEST. Ok ccardenas@, reyk@
62df93ee 2018-11-26 10:39:30 Move the {qcow2,raw} create functions from vmctl into vmd/vio{qcow2,raw}.c This way they are in the appropriate place and code can be shared with vmd. Ok ori@ mlarkin@ ccardenas@
b503c8f5 2018-11-26 05:44:46 Keep a list of known vms, and reuse the VM IDs. This means that when using '-L', the IP addresses of the VMs are stable. ok reyk@
07e1a8ca 2018-11-24 04:51:55 Improve error handling and logging in qcow2 This turns most warn + returns that should never happen into hard failures, and improves the user directed error messages. ok @mlarkin, @reyk
5fa32589 2018-11-21 13:48:20 avoid unwanted double space;
723f86d2 2018-11-21 12:31:47 Add support for "local inet6" interfaces. ok & test ccardenas@, additional review from kn@
a1533359 2018-11-01 00:18:44 - odd condition/test in PF lexer (and other lexers too) This commit rectifies earlier change: in the lex... even inside quotes, a \ followed by space or tab should expand to space or tab, and a \ followed by newline should be ignored (as a line continuation). compatible with the needs of hoststated (which has the most strict quoted string requirements), and ifstated (where one commonly does line continuations in strings). OK deraadt@, OK millert@
1a888db5 2018-10-30 17:56:54 add missing Pf macro; ok jmc@
a7eff89f 2018-10-26 11:24:45 I broke base images with my previous commit by missing a line. The disk path wasn't updated so vmd tried to open the derived disk image for each base over and over again. OK ori@ mlarkin@
ed9943e8 2018-10-24 05:19:03 Fix qcow2 disk images for data sizes greater than 4 gigs. We used to truncate the disk end by anding it with a 32 bit value. The 32 bit value was not sign extended, which causes the disk size to wrap at 4 gigabytes: disk->end = (disk->end + disk->clustersz - 1) & ~(disk->clustersz - 1); This change converts the clustersz to an off_t in order to remove the class of errors by avoiding type conversions entirely.
29d9fdba 2018-10-22 16:45:24 The recent switch to realpath(3) for the boot string in vmd(8) broke vmd-fail-boot-name-too-long regress. Use a relative existing path for this test. Print the error message in vmd config parser. OK ccardenas@ reyk@
4d2a1fb2 2018-10-19 10:12:39 Add support to create and convert disk images from existing images The -i option to vmctl create (eg. vmctl create output.qcow2 -i input.img) lets you create a new image from an input file and convert it if it is a different format. This allows to convert qcow2 images from raw images, raw from qcow2, or even qcow2 from qcow2 and raw from raw to re-optimize the disk. This re-uses Ori's vioqcow2.c from vmd by reaching into it and compiling it in. The API has been adjust to be used from both vmctl and vmd accordingly. OK mlarkin@
4a91d1ff 2018-10-18 08:36:11 Use realpath(3) on the "boot" config option as well. This fixes code that detects if boot and the first disk are identical. OK mlarkin@
75cf143a 2018-10-15 10:35:41 Prevent VM reboot loops by rate-limiting the interval a VM can reboot. This looping has been experienced by people who run VMs with a broken kernel or boot loader that trigger a very fast reboot loop (triple fault) of a VM that ends up using a lot of CPU and resources on the host. Some fixes in vmm(4) and vmd(8) helped to avoid such conditions but it can still occur if something is wrong in the guest VM itself. If the VM restarts after less than VM_START_RATE_SEC (6) seconds, we increment the limit counter. After VM_START_RATE_LIMIT (3) of suchs fast reboots the VM is stopped. There are only very few people who intentionally want to reboot-loop a VM very quickly (many times within a second); mostly for fuzzing. They will have to recompile and adjust the stated #defines in the code as we don't have a config option to disable it. OK mlarkin@
73613953 2018-10-08 16:32:01 Add support for qcow2 base images (external snapshots). This works is from Ori Bernstein, committing on his behalf: Add support to vmd for external snapshots. That is, snapshots that are derived from a base image. Data lookups start in the derived image, and if the derived image does not contain some data, the search proceeds ot the base image. Multiple derived images may exist off of a single base image. A limitation of this format is that modifying the base image will corrupt the derived image. This change also adds support for creating disk derived disk images to vmctl. To use it: vmctl create derived.qcow2 -s 16G -b base.qcow2 From Ori Bernstein OK mlarkin@ reyk@
32cbe138 2018-10-04 16:21:59 vmd(8): don't forget to set TXRDY in the case when the rate limiter isn't going to be used. Issue caused by yesterday's commit, affected certain guests' consoles after interrupts had been enabled. spotted by bluhm@, thanks.
a95a03db 2018-10-03 20:35:32 Add check to ensure vioscsi pointer if valid implicit ok from pd@ since he came up with the same diff
43965b22 2018-10-03 20:13:33 vmd(8): avoid a divide by zero when the user specified a low baud rate Low baud rates would result in a 0 "rate limiter pause count" in the serial port output code. This pause counter is used to implement a delay in what otherwise is an instantaneous serial port output path, and is needed by some guest OS kernels. This fix only enables the rate limiter pause if the count is > 0 ("pause after 0 characters" makes no sense anyway). Note that this will result in skipping the limiter on unusually low baud rates, but since nobody is using a low baud rate console in vmd, I don't think this is going to be a problem. ok pd
4fe3c8f7 2018-10-01 17:34:56 Fix potential double-free in error path qc2_open() calls qc2_close() on error which already frees diskp. OK ccardenas@
e2ceadc1 2018-10-01 09:31:15 Try to derive the qcow2 file format from an image file automatically. This makes the "-d qcow2:" and "format qcow" arguments optional as vmctl and vmd will read the magic bytes at the beginning of a file to guess if it is a raw or a qcow image file. The "vmctl create" command has been changed by removing the -f qcow2 option and replacing it with the same syntax as -d: "vmctl create qcow2:foo.img". In a slightly ununixy but intended way, the create command now also considers the file extension for the format as "vmctl create foo.qcow2" creates a qcow2 disk and not a raw image file. Ok mlarkin@ (and ccardenas@ on an earlier version of the diff)
eb13a308 2018-09-30 19:13:55 Add size limitation of group-name and a reference to ifconfig about it ok mlarkin@ jmc@ jca@
b9c4a1f5 2018-09-29 22:33:09 vmd: don't remove vm if sending failed Fix a bug where a vm was removed in vmd.c after vmctl send even if sending failed. spotted by solene@ ok mlarkin@
f6c09be3 2018-09-28 12:35:32 Support vmd-internal's vmboot with qcow2 disk images. OK mlarkin@
e2d3e60d 2018-09-28 08:29:06 Compress qcow2 open debug messages into a single line Please avoid tabs and excessive multi-line information with log_debug as it also goes to syslog. No functional change.
6ad02438 2018-09-28 08:23:43 Fix copy-pasto to use maxmem instead of maxcpu Reported by Greg Steuck OK mlarkin@
50bebf2c 2018-09-19 04:29:21 Various clean up items for disks. - qcow2: general cleanup - vioraw: check malloc - virtio: add function to sync disks - vm: call virtio_shutdown to sync disks when vm is finished executing Thanks to Ori Bernstein. Ok miko@
353e9815 2018-09-13 04:23:36 vmd: set irq and vm_id in virtio dev structs on restore This unbreaks vmctl receive. ok ccardenas@
0e71c2c7 2018-09-11 13:45:29 Be consistent in logging messages. Change "fmt" to "format". Ok kn@
2919bad8 2018-09-11 04:06:32 Fail fast when we are unable to determine disk format. While here, minor cleanup on logging.
7e662252 2018-09-10 10:39:26 vmd(8) clould close file descriptor 0 as not all fd fields were properly initialized with -1. Also avoid closing -1. OK mlarkin@
a9955862 2018-09-10 10:36:01 During the fork+exec implementation, daemon(3) was moved after proc_init(). As a consequence vmd(8) child processes did not detach from the terminal anymore. Dup /dev/null to the stdio file descriptors in the children. OK mlarkin@ reyk@
f224f92a 2018-09-09 04:09:32 Add initial qcow2 image support. Users are able to declare disk images as 'raw' or 'qcow2' using either vmctl and vm.conf. The default disk image format is 'raw' if not specified. Examples of using disk format: vmctl start bsd -Lc -r cd64.iso -d qcow2:current.qc2 or vmctl start bsd -Lc -r cd64.iso -d raw:current.raw is equivalent to vmctl start bsd -Lc -r cd64.iso -d current.raw in vm.conf vm "current" { disable memory 2G disk "/home/user/vmm/current.qc2" format "qcow2" interface { switch "external" } } or vm "current" { disable memory 2G disk "/home/user/vmm/current.raw" format "raw" interface { switch "external" } } is equivlanet to vm "current" { disable memory 2G disk "/home/user/vmm/current.raw" interface { switch "external" } } Tested by many. Big Thanks to Ori Bernstein.
ed1b9eb8 2018-09-07 07:35:30 replace malloc()+strlcpy() with strndup() in cmdline_symset(). "looks good" gilles@ halex@
9617633b 2018-08-25 04:16:09 Rework disks to have pluggable backends. This is prep work for adding qcow2 image support. From Ori Bernstein. Many thanks! Tested by many. OK ccardenas@
982bb4f3 2018-08-17 07:12:28 No need to send the same nameserver twice. OK ccardenas@
ea102623 2018-08-07 14:49:05 Post-g2k18 fix: unbreak the optional vmd-internal vmboot loader. The new vm_checkaccess() call didn't account for the vmboot case. OK ccardenas@ mikeb@
3495a04b 2018-08-07 11:28:29 Fix paste error in "no read access to" debug message, tweak messages. Found by mikeb@
13184223 2018-08-05 08:20:54 Remove cpath pledge(2) promise. We decided that not deleting the unix control sockets cause no harm and this way we close another attack surface by not allowing the daemon to create/delete any more files. OK florian@
57544062 2018-07-17 13:47:06 vmd(8): fix vmctl -b option for i386 kernels. ok pd@
2d03c861 2018-07-15 20:25:52 vioscsi driver has been stable enough so we can move a good portion of these log_debug messages to be DPRINTF (compile time). Prompted by reyk@. Ok reyk@.
c5c1249f 2018-07-15 14:42:04 Revert unrelated change to vioscsi.c (I had this in my tree to silence vioscsi.c log_debug, but Carlos already has a better diff for that)
382b7e55 2018-07-15 14:36:54 Track resources and enforce cpu/memory/interface limits for non-root users. The limits are currently hard-coded and undocumented (4 CPUs/VMs, 2G memory, 8 interfaces) but will be configurable in an upcoming diff. These limits are tracked in total usage; for example, a user will be able to run up to 4 VMs with 512M of memory or a single VM with 2G. OK ccardenas@ mlarkin@
564e11e4 2018-07-13 17:48:30 tweak previous; ok reyk
73a6ddde 2018-07-13 15:18:59 network -> interface; ok reyk@
a882c86a 2018-07-13 10:26:57 Check the disk/kernel/cdrom file permissions after openening the fd. This prevents time of TOCTOU attacks for instances. OK mlarkin@
476d73d1 2018-07-13 08:42:49 Add "allow instance" option. This allows users to create VM instances and change desired options, for example a user can be allowed to run a VM with all the pre-configured options but specify an own disk image. (mlarkin@ was fine with iterating over it) OK ccardenas@
6429e633 2018-07-12 12:04:49 Allow to use configured/running VMs as templates for other VM instances. This introduces new grammar and the -t optional in vmctl start. (For now, only root can create VM instances; but it is planned to allow users to create their own VMs based on permissions and quota.) OK ccardenas@ mlarkin@ jmc@
02ee787f 2018-07-12 10:15:44 vmm(8)/vmm(4): send a copy of the guest register state to vmd on exit, avoiding multiple readregs ioctls back to vmm in case register content is needed subsequently. ok phessler
85e2c21e 2018-07-11 16:43:24 sort tokens
f1a97e0a 2018-07-11 16:37:31 style - indent each case statement in a switch.
3be9785f 2018-07-11 13:19:47 Add -w option to vmctl stop to wait for completion of VM termination. Use it in /etc/rc.d/vmd accordingly. OK sthen@
05ccfefc 2018-07-11 10:31:45 Rename function to vmd_check_vmh
f6e5c9eb 2018-07-11 09:35:44 Add -f option to vmctl stop to forcefully kill a VM. This also fixes a bug in vmm_sighdlr where it might have missed forwarding the TERMINATE_EVENT to the vmd parent after a VM child died, leading to an abandoned VM in the vmd parent process. OK ccardenas@ mlarkin@ benno@ kn@
a062aa9d 2018-07-11 07:39:22 Do for most running out of memory err() what was done for most running out of memory log_warn(). i.e. ("%s", __func__) instead of manual function names and redundant verbiage about which wrapper detected the out of memory condition. ok henning@
e1d2f2de 2018-07-10 21:12:20 style (single-line ifs don't need braces)
a014dd99 2018-07-10 20:52:51 Return the VM pid to the vmd parent. This pid field already existed in the result but wasn't filled in by the vmm process. No functional change.
426e2d59 2018-07-10 20:46:50 Remove a debug message
1f5e00e0 2018-07-10 20:43:15 vmd already had DEBUG/DPRINTF, there is no need for VMD_DEBUG/dprintf Replace all occurences of dprintf with DPRINTF (defined in proc.h).
ddadf993 2018-07-10 16:15:51 Tweak debug log messages - Turn tracing messages into DPRINTF (only compiled with DEBUG). - Pass __func__ to vm_stop and vm_remove: this way we can track who called the function in the async context. It replaces the manual log_debug in front of each vm_stop/vm_remove. This debug logging trick can be removed in the future once we are more confident about it. OK ccardenas@ mlarkin@