Up to [local] / src / usr.sbin / vmd
Request diff between arbitrary revisions
Default branch: MAIN
Revision 1.157 / (download) - annotate - [select for diffs], Sat May 18 06:45:00 2024 UTC (2 weeks ago) by jsg
Branch: MAIN
CVS Tags: HEAD
Changes since 1.156: +1 -2 lines
Diff to previous 1.156 (colored)
remove prototypes with no matching function
Revision 1.156 / (download) - annotate - [select for diffs], Mon Apr 8 12:48:26 2024 UTC (7 weeks, 5 days ago) by tobhe
Branch: MAIN
Changes since 1.155: +1 -4 lines
Diff to previous 1.155 (colored)
Call daemon() only in parent and before proc_exec() to avoid orphaning child processes. Synced from relayd. ok mlarkin@ dv@
Revision 1.155 / (download) - annotate - [select for diffs], Mon Feb 5 21:58:09 2024 UTC (3 months, 3 weeks ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE,
OPENBSD_7_5
Changes since 1.154: +19 -19 lines
Diff to previous 1.154 (colored)
Cleanup fcntl(3) usage and fd lifetimes in vmd(8). Remove extraneous fcntl(3) usage for setting fd features that can be set at time of open(2), pipe2(2), or socketpair(2). Also cleans up pty creation switching to using functions from libutil instead of direct ioctl(2) calls. ok mlarkin@, original diff ok claudio@ as well.
Revision 1.154 / (download) - annotate - [select for diffs], Sun Feb 4 14:56:45 2024 UTC (3 months, 3 weeks ago) by dv
Branch: MAIN
Changes since 1.153: +3 -4 lines
Diff to previous 1.153 (colored)
Prevent null pointer deref is vm isn't found. This area of code in vmd(8) is suspect, but the null dereference is easily avoided. Found by smatch, reported by and ok jsg@
Revision 1.153 / (download) - annotate - [select for diffs], Thu Jan 18 14:49:59 2024 UTC (4 months, 1 week ago) by claudio
Branch: MAIN
Changes since 1.152: +16 -15 lines
Diff to previous 1.152 (colored)
Use imsg_get_fd() in vmd. vmd uses a lot of fd passing and does it sometimes via extra abstraction so this just tries to convert the code without any optimisations. ok dv@
Revision 1.152 / (download) - annotate - [select for diffs], Tue Sep 26 01:53:54 2023 UTC (8 months ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE,
OPENBSD_7_4
Changes since 1.151: +10 -6 lines
Diff to previous 1.151 (colored)
vmd(8): disambiguate log messages per vm and device. The logging output from vmd(8) often specifies the function performing the logging, but leaves which vm or vm device to guesswork and reading tea leaves. Change the logging formatting to prefix with information about the specific vm and potentially the device subprocess. Most of this logging is behind the "verbose" mode, but for warnings this will clarify which vm or device logged the warning. The format of vm/<name>/<device><index> is chosen to be concise and less ugly than other approaches. This adjusts the process naming for devices to match, dropping the use of brackets. In the process of this change, updating log settings dynamically via vmctl(8) is fixed by properly broadcasting that information to the device subprocesses. The "vmm" process also now updates its own state properly, so settings survive vm reboots. ok mlarkin@
Revision 1.151 / (download) - annotate - [select for diffs], Mon Jul 3 08:32:20 2023 UTC (10 months, 4 weeks ago) by jasper
Branch: MAIN
Changes since 1.150: +11 -9 lines
Diff to previous 1.150 (colored)
when shutting down a vm, handle the VM id in the same way as a VM name argument ok dv@
Revision 1.150 / (download) - annotate - [select for diffs], Sun Jun 18 11:45:11 2023 UTC (11 months, 2 weeks ago) by op
Branch: MAIN
Changes since 1.149: +2 -2 lines
Diff to previous 1.149 (colored)
relax absolute path requirement for configtest (-n) ok dv@
Revision 1.149 / (download) - annotate - [select for diffs], Sat May 13 23:15:28 2023 UTC (12 months, 2 weeks ago) by dv
Branch: MAIN
Changes since 1.148: +13 -7 lines
Diff to previous 1.148 (colored)
vmm(4)/vmd(8): switch to anonymous shared mappings. While splitting out emulated virtio network and block devices into separate processes, I originally used named mappings via shm_mkstemp(3). While this functionally achieved the desired result, it had two unintended consequences: 1) tearing down a vm process and its child processes required excessive locking as the guest memory was tied into the VFS layer. 2) it was observed by mlarkin@ that actions in other parts of the VFS layer could cause some of the guest memory to flush to storage, possibly filling /tmp. This commit adds a new vmm(4) ioctl dedicated to allowing a process request the kernel share a mapping of guest memory into its own vm space. This requires an open fd to /dev/vmm (requiring root) and both the "vmm" and "proc" pledge(2) promises. In addition, the caller must know enough about the original memory ranges to reconstruct them to make the vm's ranges. Tested with help from Mischa Peters. ok mlarkin@
Revision 1.148 / (download) - annotate - [select for diffs], Fri May 12 16:18:17 2023 UTC (12 months, 3 weeks ago) by dv
Branch: MAIN
Changes since 1.147: +5 -6 lines
Diff to previous 1.147 (colored)
vmd(8): fix segfault on vm creation. vm_instance was using the wrong vm instance for checking the vm_kernel_path member. Switch to using the value from the parent vm instance in the check for if a kernel is known. Issue reported by kn@. OK mlarkin@, kn@.
Revision 1.147 / (download) - annotate - [select for diffs], Fri May 12 14:42:30 2023 UTC (12 months, 3 weeks ago) by dv
Branch: MAIN
Changes since 1.146: +30 -16 lines
Diff to previous 1.146 (colored)
vmd(8): fix console attach from vmctl(8). Adding in the ability to override the boot kernel created an edge case in the ipc message handling logic for the parent process (vmd) when receiving a "start vm" request. Result was incorrectly responding to the control process, and as a result the vmctl client, with a bogus "start vm response" reply with an empty tty name. This commit rewrites the logic of how vmd goes about processing the "start vm" request with the aim of making it simpler to understand while addressing the edge case. Issue reported by kn@. OK mlarkin@.
Revision 1.146 / (download) - annotate - [select for diffs], Fri Apr 28 19:46:42 2023 UTC (13 months ago) by dv
Branch: MAIN
Changes since 1.145: +16 -10 lines
Diff to previous 1.145 (colored)
vmd(8)/vmctl(8): allow vm owners to override boot kernel. vmd allows non-root users to "own" a vm defined in vm.conf(5). While the user can start/stop the vm, if they break their filesystem they have no means of booting recovery media like a ramdisk kernel. This change opens the provided boot kernel via vmctl and passes the file descriptor through the control channel to vmd. The next boot of the vm will use the provided file descriptor as boot kernel/bios. Subsequent boots (e.g. a reboot) will return to using behavior defined in vm.conf or the default bios image. ok mlarkin@
Revision 1.145 / (download) - annotate - [select for diffs], Thu Apr 27 22:47:27 2023 UTC (13 months ago) by dv
Branch: MAIN
Changes since 1.144: +28 -3 lines
Diff to previous 1.144 (colored)
vmd(8): introduce multi-process model for virtio devices. Isolate virtio network and block device emulation in dedicated processes, forked and exec'd from the vm process. This allows for tightening pledge promises to just "stdio". Communication between the vcpu's and these devices now occurs via imsg channels, which adds the benefit of not always blocking the vcpu thread while emulating the device. With this commit, it's possible that vmd is the first open source hypervisor that *defaults* to a multi-process device emulation model without requiring any additional configuration from the operator. Testing help from phessler@ and Mischa Peters. ok mlarkin@
Revision 1.144 / (download) - annotate - [select for diffs], Tue Apr 25 12:46:13 2023 UTC (13 months, 1 week ago) by dv
Branch: MAIN
Changes since 1.143: +38 -38 lines
Diff to previous 1.143 (colored)
vmm(4)/vmd(8): pull struct members out of vmm ioctl create struct. The object sent to vmm(4) contained file paths and details the kernel does not need for cpu virtualization as device emulation is in userland. Effectively, "pull up" the struct members from the vm_create_params struct to the parent vmop_create_params struct. This allows us to clean up some of vmd(8) and simplify things for switching to having vmctl(8) open the "kernel" file (SeaBIOS, bsd.rd, etc.) to allow users to boot recovery ramdisk kernels. ok mlarkin@
Revision 1.143 / (download) - annotate - [select for diffs], Mon Apr 24 15:12:14 2023 UTC (13 months, 1 week ago) by kn
Branch: MAIN
Changes since 1.142: +4 -2 lines
Diff to previous 1.142 (colored)
Missing the optional default config is not an error /var/log/{messages,daemon} logs ENOENT as error on default configless vmd. Only complain on explicitly passed files and print a debug hint under `-vv' in case someone forgot to populate their /etc/vm.conf. OK dv mlarkin
Revision 1.142 / (download) - annotate - [select for diffs], Sun Apr 23 12:11:37 2023 UTC (13 months, 1 week ago) by dv
Branch: MAIN
Changes since 1.141: +29 -6 lines
Diff to previous 1.141 (colored)
vmd(8): teach vmm process how to exec. Use execvp(2) to launch vm children with new address spaces. Consequently, introduces use of unveil(2) into the vmm and vm processes. This imposes the requirement of launching vmd with absolute paths, similar to sshd(8). ok mlarkin@
Revision 1.141 / (download) - annotate - [select for diffs], Wed Apr 19 12:58:16 2023 UTC (13 months, 1 week ago) by jsg
Branch: MAIN
Changes since 1.140: +1 -2 lines
Diff to previous 1.140 (colored)
remove duplicate includes
Revision 1.140 / (download) - annotate - [select for diffs], Sun Apr 16 12:47:26 2023 UTC (13 months, 2 weeks ago) by dv
Branch: MAIN
Changes since 1.139: +27 -1 lines
Diff to previous 1.139 (colored)
vmd(8): clean up fd closing in vmm process. Some mild tidying of fd closing in the vmm process in prep for landing parts of my fork+exec diff. With input from guenther@ on the nuances of if/when EINTR may happen in a call to close(2). ok mlarkin@
Revision 1.139 / (download) - annotate - [select for diffs], Sun Apr 2 02:04:10 2023 UTC (14 months ago) by dv
Branch: MAIN
Changes since 1.138: +7 -6 lines
Diff to previous 1.138 (colored)
vmd(8): migrate vmd_vm.vm_ttyname to char array. Other structs use a fixed length array already. This allows a vmd_vm object to be transmitted over an ipc channel, too. Additionally, solves a segfault caused by a strlcpy(3) in an error path. ok mlarkin@
Revision 1.138 / (download) - annotate - [select for diffs], Sat Jan 28 14:40:53 2023 UTC (16 months ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE,
OPENBSD_7_3
Changes since 1.137: +7 -7 lines
Diff to previous 1.137 (colored)
Move some header definitions from vmm(4) to vmd(8). Part of an ongoing effort to move userland-specific information out of a kernel header and directly into vmd(8). No functional change. ok mlarkin@
Revision 1.137 / (download) - annotate - [select for diffs], Sun Jan 22 22:18:40 2023 UTC (16 months, 1 week ago) by dv
Branch: MAIN
Changes since 1.136: +22 -14 lines
Diff to previous 1.136 (colored)
vmd(8): don't remove known vm's from the config on error. Multiple error paths, specifically the one related to if a guest cannot allocate memory at start, resulted in a known vm (via vm.conf(5)) being removed from the vm list. Adjust the error paths to check if the failing vm is defined in the config before tearing it down. Tested with help from beck@ and Mischa Peters. ok beck@
Revision 1.130.2.1 / (download) - annotate - [select for diffs], Fri Jan 20 18:09:09 2023 UTC (16 months, 1 week ago) by bluhm
Branch: OPENBSD_7_1
Changes since 1.130: +4 -3 lines
Diff to previous 1.130 (colored) next main 1.131 (colored)
Restrict vmm(4) exposed cpuid extended feature flags. We don't emulate or support most of the EAX=7,ECX=0 feature bits, so restrict the mask further to just UMIP. from dv@ deraadt@ this is errata/7.1/020_vmm.patch.sig errata/7.1/021_vmd.patch.sig
Revision 1.132.2.1 / (download) - annotate - [select for diffs], Fri Jan 20 18:06:33 2023 UTC (16 months, 1 week ago) by bluhm
Branch: OPENBSD_7_2
Changes since 1.132: +4 -3 lines
Diff to previous 1.132 (colored) next main 1.133 (colored)
Restrict vmm(4) exposed cpuid extended feature flags. We don't emulate or support most of the EAX=7,ECX=0 feature bits, so restrict the mask further to just UMIP. from dv@ deraadt@ this is errata/7.2/015_vmm.patch.sig errata/7.2/016_vmd.patch.sig
Revision 1.136 / (download) - annotate - [select for diffs], Sat Jan 14 20:55:55 2023 UTC (16 months, 2 weeks ago) by dv
Branch: MAIN
Changes since 1.135: +7 -3 lines
Diff to previous 1.135 (colored)
Only open /dev/vmm once in vmd(8). Have the parent process open /dev/vmm and send the fd to the vmm child process. Only the vmm process and its resulting children (guest vms) need it for ioctl calls. ok kn@
Revision 1.135 / (download) - annotate - [select for diffs], Wed Dec 28 21:30:19 2022 UTC (17 months ago) by jmc
Branch: MAIN
Changes since 1.134: +3 -3 lines
Diff to previous 1.134 (colored)
spelling fixes; from paul tagliamonte any parts of his diff not taken are noted on tech
Revision 1.134 / (download) - annotate - [select for diffs], Thu Dec 15 16:01:40 2022 UTC (17 months, 2 weeks ago) by dv
Branch: MAIN
Changes since 1.133: +4 -4 lines
Diff to previous 1.133 (colored)
Add explicit casts to ctype functions in vmd(8). OK millert@
Revision 1.133 / (download) - annotate - [select for diffs], Mon Oct 31 14:02:11 2022 UTC (19 months ago) by dv
Branch: MAIN
Changes since 1.132: +1 -112 lines
Diff to previous 1.132 (colored)
vmd(8): remove unfinished user accounting. User accounting and enforcement was never finished. tedu the thing until someone wants to pick it up and finish it. Originally found by Matthew Martin. ok mlarkin@, kn@. input from tb@.
Revision 1.132 / (download) - annotate - [select for diffs], Tue Sep 13 10:28:19 2022 UTC (20 months, 2 weeks ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE
Branch point for: OPENBSD_7_2
Changes since 1.131: +31 -8 lines
Diff to previous 1.131 (colored)
Add (partial) support for agentx in vmd. Metrics can be found under mib-2.236 and VM-MIB (RFC7666). Stress tested by and happy noises from Mischa Peters OK dv@
Revision 1.131 / (download) - annotate - [select for diffs], Sun May 8 14:44:54 2022 UTC (2 years ago) by dv
Branch: MAIN
Changes since 1.130: +3 -2 lines
Diff to previous 1.130 (colored)
vmd: fix rebooting a received vm Rebooting a received vm resulted in vmd(8) exiting as a result of flawed state tracking in the parent process. When stopping a vm, clear the VM_RECEIVE_STATE flag. When starting a vm, make sure the parent process collapses any existing memory ranges after the vm is sent to the vmm process (responsible for launching the vm). ok mlarkin@
Revision 1.130 / (download) - annotate - [select for diffs], Tue Mar 1 21:46:19 2022 UTC (2 years, 3 months ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE
Branch point for: OPENBSD_7_1
Changes since 1.129: +3 -3 lines
Diff to previous 1.129 (colored)
vmd(8): gracefully handle hitting data limits when starting a vm With recent changes to login.conf(5) to restrict daemon datasize to a finite value, users can now hit resource limits when attempting to start a vm. This change fixes the error path when hitting the limit. vmd(8) will no longer abort and memory error messages are relayed to the user. While here, address potential under-reads/writes using atomicio when relaying data between the child vm process and vmd's vmm process. Original diff from tedu@. OK mlarkin@.
Revision 1.129 / (download) - annotate - [select for diffs], Tue Jan 4 15:18:44 2022 UTC (2 years, 4 months ago) by claudio
Branch: MAIN
Changes since 1.128: +1 -3 lines
Diff to previous 1.128 (colored)
Fix some simple -Wunused-but-set-variable warnings. OK benno@ dv@
Revision 1.128 / (download) - annotate - [select for diffs], Mon Dec 13 18:28:40 2021 UTC (2 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.127: +1 -2 lines
Diff to previous 1.127 (colored)
including sys/cdefs.h manually started as a result of netbsd trying to macro-build a replacement for sccsid, and was done without any concern for namespace damage. Unfortunately this practice started infecting other code as others were unaware they didn't need the file. ok millert guenther
Revision 1.127 / (download) - annotate - [select for diffs], Mon Nov 29 05:17:35 2021 UTC (2 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.126: +3 -3 lines
Diff to previous 1.126 (colored)
mostly avoid sys/param.h with a local nitems() ok mlarkin
Revision 1.126 / (download) - annotate - [select for diffs], Sun Jul 18 11:55:45 2021 UTC (2 years, 10 months ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE,
OPENBSD_7_0
Changes since 1.125: +6 -6 lines
Diff to previous 1.125 (colored)
vmd(8): remove invalid errno values from config_setvm Refactor config_setvm to directly return error code on failure instead of returning -1 and setting errno. It was setting unsupported values not defined in <errno.h>. OK mlarkin@
Revision 1.125 / (download) - annotate - [select for diffs], Wed May 5 21:33:11 2021 UTC (3 years ago) by dv
Branch: MAIN
Changes since 1.124: +22 -37 lines
Diff to previous 1.124 (colored)
Refactor vm_instance to return error value directly. vmd(8)'s vm_instance function set unsupported errno values. Change the api to directly return an error (either errno or custom vmd error). "go for it" -mlarkin@
Revision 1.124 / (download) - annotate - [select for diffs], Tue May 4 10:36:01 2021 UTC (3 years ago) by dv
Branch: MAIN
Changes since 1.123: +4 -4 lines
Diff to previous 1.123 (colored)
Init debug logging state before attempting to log. Error messages related to bad configuration were not flushing to stderr. OK mlarkin@
Revision 1.123 / (download) - annotate - [select for diffs], Mon Apr 26 22:58:27 2021 UTC (3 years, 1 month ago) by dv
Branch: MAIN
Changes since 1.122: +27 -29 lines
Diff to previous 1.122 (colored)
vmd(8): fix vmctl client "wait" state corruption Adds queue-based tracking of waiting client state to fix the cause of state corruption when a vmctl(8) user cancels a wait and restarts it. The socket fd value for the control process client was being used to track the waiting party, but this also prevented multiple waiting clients. This moves all the state tracking of who to notify of a vm's stopping to the control process and no longer requires the parent process to track it in the global environment state. Future work will be needed to smooth out the difference between the IMSG_VMDOP_TERMINATE_VM_{EVENT,RESPONSE} events instead of needing to translate before relaying to the vmctl(8) client. Tested by Mischa Peters (thanks!) ok mlarkin@
Revision 1.122 / (download) - annotate - [select for diffs], Mon Apr 5 11:35:26 2021 UTC (3 years, 1 month ago) by dv
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE,
OPENBSD_6_9
Changes since 1.121: +10 -4 lines
Diff to previous 1.121 (colored)
Send correct response type on unpause errors. ok pd@
Revision 1.121 / (download) - annotate - [select for diffs], Mon Mar 29 23:37:01 2021 UTC (3 years, 2 months ago) by dv
Branch: MAIN
Changes since 1.120: +21 -2 lines
Diff to previous 1.120 (colored)
Propagate host-side tap(4) lladdr to guest vm process to allow unicast dhcp and bootp renewals with vmd(8)'s built-in dhcp server. Previous behavior ignored did not intercept these packets and instead transmitted them. This should make vmd(8)'s dhcp behave more as a true dhcp server should and allows it to work properly with the new dhcpleased(8) attempting a renewal. OK mlarkin@
Revision 1.120 / (download) - annotate - [select for diffs], Wed Jan 27 07:21:54 2021 UTC (3 years, 4 months ago) by deraadt
Branch: MAIN
Changes since 1.119: +3 -1 lines
Diff to previous 1.119 (colored)
these programs (with common ancestry) had a -fno-common problem related to privsep_procid. ok mortimer
Revision 1.119 / (download) - annotate - [select for diffs], Wed Sep 23 19:18:18 2020 UTC (3 years, 8 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE,
OPENBSD_6_8
Changes since 1.118: +2 -18 lines
Diff to previous 1.118 (colored)
Revert agentx support for now, we're too close to release. requested by deraadt@
Revision 1.118 / (download) - annotate - [select for diffs], Wed Sep 23 15:52:06 2020 UTC (3 years, 8 months ago) by martijn
Branch: MAIN
Changes since 1.117: +19 -3 lines
Diff to previous 1.117 (colored)
Add support for agentx to vmd. This is based around VM-MIB from RFC7666,but does not export the full spec. People more knowledgeable of vmd are encouraged to expand on this.
Revision 1.117 / (download) - annotate - [select for diffs], Thu Dec 12 03:53:38 2019 UTC (4 years, 5 months ago) by pd
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE,
OPENBSD_6_7
Changes since 1.116: +53 -29 lines
Diff to previous 1.116 (colored)
vmd: start vms defined in vm.conf in a staggered fashion This addresses 'thundering herd' problem when a lot of vms are configured in vm.conf. A lot of vms booting in parallel can overload the host and also mess up tsc calibration in openbsd guests as it uses PIT which doesn't fire reliably if the host is overloaded. We default to starting vms with parallelism of ncpuonline and a delay 30 seconds between batches. This is configurable in vm.conf. ok mlarkin@ (also addressed comments from cheloha@)
Revision 1.116 / (download) - annotate - [select for diffs], Wed Sep 4 07:02:03 2019 UTC (4 years, 8 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_6_6_BASE,
OPENBSD_6_6
Changes since 1.115: +2 -1 lines
Diff to previous 1.115 (colored)
vmd(8): memory leak in an error path Found by Hiltjo Posthuma, thanks!
Revision 1.115 / (download) - annotate - [select for diffs], Wed Aug 14 07:34:49 2019 UTC (4 years, 9 months ago) by anton
Branch: MAIN
Changes since 1.114: +7 -2 lines
Diff to previous 1.114 (colored)
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@
Revision 1.114 / (download) - annotate - [select for diffs], Fri Jun 28 13:32:51 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.113: +2 -2 lines
Diff to previous 1.113 (colored)
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.
Revision 1.113 / (download) - annotate - [select for diffs], Mon May 20 17:04:24 2019 UTC (5 years ago) by jasper
Branch: MAIN
Changes since 1.112: +31 -15 lines
Diff to previous 1.112 (colored)
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@
Revision 1.112 / (download) - annotate - [select for diffs], Sat May 11 23:07:46 2019 UTC (5 years ago) by jasper
Branch: MAIN
Changes since 1.111: +6 -8 lines
Diff to previous 1.111 (colored)
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@
Revision 1.111 / (download) - annotate - [select for diffs], Sat May 11 19:59:32 2019 UTC (5 years ago) by jasper
Branch: MAIN
Changes since 1.110: +5 -1 lines
Diff to previous 1.110 (colored)
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@
Revision 1.110 / (download) - annotate - [select for diffs], Sat May 11 19:55:14 2019 UTC (5 years ago) by jasper
Branch: MAIN
Changes since 1.109: +21 -21 lines
Diff to previous 1.109 (colored)
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@
Revision 1.109 / (download) - annotate - [select for diffs], Sat May 11 01:05:17 2019 UTC (5 years ago) by jasper
Branch: MAIN
Changes since 1.108: +3 -1 lines
Diff to previous 1.108 (colored)
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@
Revision 1.108 / (download) - annotate - [select for diffs], Sun Dec 9 12:26:38 2018 UTC (5 years, 5 months ago) by claudio
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE,
OPENBSD_6_5
Changes since 1.107: +3 -2 lines
Diff to previous 1.107 (colored)
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@
Revision 1.107 / (download) - annotate - [select for diffs], Tue Dec 4 08:15:09 2018 UTC (5 years, 5 months ago) by claudio
Branch: MAIN
Changes since 1.106: +2 -1 lines
Diff to previous 1.106 (colored)
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@
Revision 1.106 / (download) - annotate - [select for diffs], Mon Nov 26 05:44:46 2018 UTC (5 years, 6 months ago) by ori
Branch: MAIN
Changes since 1.105: +25 -5 lines
Diff to previous 1.105 (colored)
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@
Revision 1.105 / (download) - annotate - [select for diffs], Wed Nov 21 12:31:47 2018 UTC (5 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.104: +20 -1 lines
Diff to previous 1.104 (colored)
Add support for "local inet6" interfaces. ok & test ccardenas@, additional review from kn@
Revision 1.104 / (download) - annotate - [select for diffs], Mon Oct 15 10:35:41 2018 UTC (5 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.103: +12 -1 lines
Diff to previous 1.103 (colored)
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@
Revision 1.103 / (download) - annotate - [select for diffs], Mon Oct 8 16:32:01 2018 UTC (5 years, 7 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE,
OPENBSD_6_4
Changes since 1.102: +10 -7 lines
Diff to previous 1.102 (colored)
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@
Revision 1.102 / (download) - annotate - [select for diffs], Sat Sep 29 22:33:09 2018 UTC (5 years, 8 months ago) by pd
Branch: MAIN
Changes since 1.101: +19 -2 lines
Diff to previous 1.101 (colored)
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@
Revision 1.101 / (download) - annotate - [select for diffs], Fri Sep 28 08:23:43 2018 UTC (5 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.100: +2 -2 lines
Diff to previous 1.100 (colored)
Fix copy-pasto to use maxmem instead of maxcpu Reported by Greg Steuck OK mlarkin@
Revision 1.100 / (download) - annotate - [select for diffs], Mon Sep 10 10:39:26 2018 UTC (5 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.99: +4 -4 lines
Diff to previous 1.99 (colored)
vmd(8) clould close file descriptor 0 as not all fd fields were properly initialized with -1. Also avoid closing -1. OK mlarkin@
Revision 1.99 / (download) - annotate - [select for diffs], Mon Sep 10 10:36:01 2018 UTC (5 years, 8 months ago) by bluhm
Branch: MAIN
Changes since 1.98: +3 -2 lines
Diff to previous 1.98 (colored)
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@
Revision 1.98 / (download) - annotate - [select for diffs], Sun Jul 15 14:36:54 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.97: +113 -1 lines
Diff to previous 1.97 (colored)
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@
Revision 1.97 / (download) - annotate - [select for diffs], Fri Jul 13 10:26:57 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.96: +20 -34 lines
Diff to previous 1.96 (colored)
Check the disk/kernel/cdrom file permissions after openening the fd. This prevents time of TOCTOU attacks for instances. OK mlarkin@
Revision 1.96 / (download) - annotate - [select for diffs], Fri Jul 13 08:42:49 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.95: +232 -45 lines
Diff to previous 1.95 (colored)
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@
Revision 1.95 / (download) - annotate - [select for diffs], Thu Jul 12 12:04:49 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.94: +161 -9 lines
Diff to previous 1.94 (colored)
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@
Revision 1.94 / (download) - annotate - [select for diffs], Wed Jul 11 16:37:31 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.93: +86 -81 lines
Diff to previous 1.93 (colored)
style - indent each case statement in a switch.
Revision 1.93 / (download) - annotate - [select for diffs], Wed Jul 11 13:19:47 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.92: +21 -8 lines
Diff to previous 1.92 (colored)
Add -w option to vmctl stop to wait for completion of VM termination. Use it in /etc/rc.d/vmd accordingly. OK sthen@
Revision 1.92 / (download) - annotate - [select for diffs], Wed Jul 11 10:31:45 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.91: +4 -4 lines
Diff to previous 1.91 (colored)
Rename function to vmd_check_vmh
Revision 1.91 / (download) - annotate - [select for diffs], Wed Jul 11 09:35:44 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.90: +4 -2 lines
Diff to previous 1.90 (colored)
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@
Revision 1.90 / (download) - annotate - [select for diffs], Tue Jul 10 21:12:20 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.89: +3 -4 lines
Diff to previous 1.89 (colored)
style (single-line ifs don't need braces)
Revision 1.89 / (download) - annotate - [select for diffs], Tue Jul 10 20:43:15 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.88: +3 -3 lines
Diff to previous 1.88 (colored)
vmd already had DEBUG/DPRINTF, there is no need for VMD_DEBUG/dprintf Replace all occurences of dprintf with DPRINTF (defined in proc.h).
Revision 1.88 / (download) - annotate - [select for diffs], Tue Jul 10 16:15:51 2018 UTC (5 years, 10 months ago) by reyk
Branch: MAIN
Changes since 1.87: +30 -27 lines
Diff to previous 1.87 (colored)
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@
Revision 1.87 / (download) - annotate - [select for diffs], Tue Jun 26 10:00:08 2018 UTC (5 years, 11 months ago) by reyk
Branch: MAIN
Changes since 1.86: +8 -1 lines
Diff to previous 1.86 (colored)
Add "socket owner" to allow changing the owner of the vmd control socket. This allows to open vmctl control or console access to other users that are not in group wheel. Access for non-root users still defaults to read-only actions unless you change the owner (user/group) of each individual VM. Requested by Mischa Peters OK mlarkin@
Revision 1.86 / (download) - annotate - [select for diffs], Tue Jun 19 17:12:34 2018 UTC (5 years, 11 months ago) by reyk
Branch: MAIN
Changes since 1.85: +20 -13 lines
Diff to previous 1.85 (colored)
knf
Revision 1.85 / (download) - annotate - [select for diffs], Sun May 13 22:48:11 2018 UTC (6 years ago) by pd
Branch: MAIN
Changes since 1.84: +7 -2 lines
Diff to previous 1.84 (colored)
vmd(8): enable pause / unpause for vm owners Patch from Mohamed Aslan. Thanks! ok kn@
Revision 1.84 / (download) - annotate - [select for diffs], Wed Apr 25 15:49:48 2018 UTC (6 years, 1 month ago) by mlarkin
Branch: MAIN
Changes since 1.83: +2 -3 lines
Diff to previous 1.83 (colored)
vmd(8)'s early error messages weren't visible when started via /etc/rc (such as errors relating to not having VMX/etc). Change the log_init to log to syslog so at least we have some chance of seeing these errors. requested and ok beck@
Revision 1.83 / (download) - annotate - [select for diffs], Sat Apr 21 07:03:06 2018 UTC (6 years, 1 month ago) by mlarkin
Branch: MAIN
Changes since 1.82: +3 -3 lines
Diff to previous 1.82 (colored)
spelling error in log message
Revision 1.82 / (download) - annotate - [select for diffs], Thu Mar 29 18:29:24 2018 UTC (6 years, 2 months ago) by martijn
Branch: MAIN
Changes since 1.81: +11 -9 lines
Diff to previous 1.81 (colored)
Make sure that the global config is send out immediately when it is loaded. This makes sure that the local prefix specied in the config is always used. OK ccardenas@
Revision 1.81 / (download) - annotate - [select for diffs], Wed Mar 14 07:29:34 2018 UTC (6 years, 2 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE,
OPENBSD_6_3
Changes since 1.80: +3 -2 lines
Diff to previous 1.80 (colored)
block two VMs from using the same disk image file at the same time. Also changes an error message in vmctl to reflect same.
Revision 1.80 / (download) - annotate - [select for diffs], Sun Feb 18 01:00:25 2018 UTC (6 years, 3 months ago) by pd
Branch: MAIN
Changes since 1.79: +5 -1 lines
Diff to previous 1.79 (colored)
vmd: fix vmctl pause for non existing vm ids (never returns) check if vm id is valid before sending to vmm for pausing. The 'lock' is caused by vmm sending back ENOENT for a non existent vm but vmd drops the message because it doesn't recogize the vmid vmm is talking about. This is an artifact of the 'policy' don't trust any imsg from a sibling priv sep process and do your own checking. reported by Abel Abraham Camarillo Ojeda ok mlarkin@ and ccardenas@
Revision 1.79 / (download) - annotate - [select for diffs], Wed Jan 10 14:59:59 2018 UTC (6 years, 4 months ago) by sthen
Branch: MAIN
Changes since 1.78: +4 -3 lines
Diff to previous 1.78 (colored)
Don't require "disk" or "kernel", also allow just "cdrom" instead, a VM can still be useful with only cdrom storage. ok ccardenas@
Revision 1.78 / (download) - annotate - [select for diffs], Mon Jan 8 11:58:27 2018 UTC (6 years, 4 months ago) by mpi
Branch: MAIN
Changes since 1.77: +11 -2 lines
Diff to previous 1.77 (colored)
Enable TIOCUCNTL to be able to set ns8250's break detected condition. It is now possible to send BREAK commands to vmd(8) independently of the serial terminal emulator. Happy virtual ddb(4) hacking! No objection from mlarkin@, ok nicm@, ccardenas@, deraadt@
Revision 1.77 / (download) - annotate - [select for diffs], Wed Jan 3 05:39:56 2018 UTC (6 years, 4 months ago) by ccardenas
Branch: MAIN
Changes since 1.76: +5 -0 lines
Diff to previous 1.76 (colored)
Add initial CD-ROM support to VMD via vioscsi. * Adds 'cdrom' keyword to vm.conf(5) and '-r' to vmctl(8) * Support various sized ISOs (Limitation of 4G ISOs on Linux guests) * Known working guests: OpenBSD (primary), Alpine Linux (primary), CentOS 6 (secondary), Ubuntu 17.10 (secondary). NOTE: Secondary indicates some issue(s) preventing full/reliable functionality outside the scope of the vioscsi work. * If the attached disks are non-bootable (i.e. empty), SeaBIOS (vmd's default BIOS) will boot from CD-ROM. ok mlarkin@, jca@
Revision 1.76 / (download) - annotate - [select for diffs], Wed Dec 6 13:29:02 2017 UTC (6 years, 5 months ago) by abieber
Branch: MAIN
Changes since 1.75: +4 -4 lines
Diff to previous 1.75 (colored)
Make vmd respect owner when starting non-disabled vms. OK pd@, benno@
Revision 1.75 / (download) - annotate - [select for diffs], Thu Nov 30 01:28:27 2017 UTC (6 years, 6 months ago) by ccardenas
Branch: MAIN
Changes since 1.74: +2 -2 lines
Diff to previous 1.74 (colored)
When performing vmctl reload and a previously configured vm is running, exit with an EALREADY vs EPERM. ok mlarkin@
Revision 1.74 / (download) - annotate - [select for diffs], Sat Nov 11 02:50:07 2017 UTC (6 years, 6 months ago) by mlarkin
Branch: MAIN
Changes since 1.73: +1 -14 lines
Diff to previous 1.73 (colored)
update switch handling in vmd(8). vmd now gets switch information (rdomain, etc) from underlying switch interface instead of handling this on its own. Diff from carlos cardenas, Thanks! ok reyk@
Revision 1.73 / (download) - annotate - [select for diffs], Tue Nov 7 07:38:30 2017 UTC (6 years, 6 months ago) by mlarkin
Branch: MAIN
Changes since 1.72: +2 -2 lines
Diff to previous 1.72 (colored)
typo in previous
Revision 1.72 / (download) - annotate - [select for diffs], Tue Nov 7 07:37:43 2017 UTC (6 years, 6 months ago) by mlarkin
Branch: MAIN
Changes since 1.71: +16 -1 lines
Diff to previous 1.71 (colored)
comment function vm_checkperm
Revision 1.71 / (download) - annotate - [select for diffs], Tue Oct 24 07:51:46 2017 UTC (6 years, 7 months ago) by mlarkin
Branch: MAIN
Changes since 1.70: +9 -6 lines
Diff to previous 1.70 (colored)
The VMD parent process didn't handle the case of a VM exiting with a non 0 return properly (i.e. EIO). From: Carlos Cardenas, thanks!
Revision 1.70 / (download) - annotate - [select for diffs], Sat Oct 7 02:05:31 2017 UTC (6 years, 7 months ago) by mlarkin
Branch: MAIN
Changes since 1.69: +5 -4 lines
Diff to previous 1.69 (colored)
vmd: retain ownership on vm reboot from Jesper Wallin, thanks!
Revision 1.69 / (download) - annotate - [select for diffs], Fri Sep 8 06:24:31 2017 UTC (6 years, 8 months ago) by mlarkin
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE,
OPENBSD_6_2
Changes since 1.68: +29 -4 lines
Diff to previous 1.68 (colored)
vmd: add more explanatory log_debug messages From Carlos Cardenas, many thanks!
Revision 1.68 / (download) - annotate - [select for diffs], Sun Aug 20 21:15:32 2017 UTC (6 years, 9 months ago) by pd
Branch: MAIN
Changes since 1.67: +125 -4 lines
Diff to previous 1.67 (colored)
vmd: Allow only upward migration This restricts receiving vms from hosts with more cpu features. Tested on broadwell -> skylake (works) skylake -> broadwell (don't work) ok mlarkin@
Revision 1.67 / (download) - annotate - [select for diffs], Tue Aug 15 15:10:35 2017 UTC (6 years, 9 months ago) by pd
Branch: MAIN
Changes since 1.66: +4 -4 lines
Diff to previous 1.66 (colored)
vmd: fix vm id displayed by vmctl when receiving a vm Also fix two debug messages and an IMSG type.
Revision 1.66 / (download) - annotate - [select for diffs], Mon Aug 14 17:20:59 2017 UTC (6 years, 9 months ago) by jasper
Branch: MAIN
Changes since 1.65: +14 -1 lines
Diff to previous 1.65 (colored)
validate vm names before creating them; a valid name contains alphanumeric characters, including '.', '_' and '-'. but does not start with the latter three. ok mlarkin@ pd@
Revision 1.65 / (download) - annotate - [select for diffs], Sun Aug 13 16:45:07 2017 UTC (6 years, 9 months ago) by jasper
Branch: MAIN
Changes since 1.64: +5 -1 lines
Diff to previous 1.64 (colored)
don't issue a termination command to an already stopped vm ok mlarkin@
Revision 1.64 / (download) - annotate - [select for diffs], Sat Jul 15 05:05:36 2017 UTC (6 years, 10 months ago) by pd
Branch: MAIN
Changes since 1.63: +91 -2 lines
Diff to previous 1.63 (colored)
Add vmctl send and vmctl receive ok reyk@ and mlarkin@
Revision 1.63 / (download) - annotate - [select for diffs], Sun Jul 9 00:51:40 2017 UTC (6 years, 10 months ago) by pd
Branch: MAIN
Changes since 1.62: +42 -1 lines
Diff to previous 1.62 (colored)
vmd/vmctl: Add ability to pause / unpause vms With help from Ashwin Agrawal ok reyk@ mlarkin@
Revision 1.62 / (download) - annotate - [select for diffs], Mon May 29 07:15:22 2017 UTC (7 years ago) by mlarkin
Branch: MAIN
Changes since 1.61: +6 -3 lines
Diff to previous 1.61 (colored)
vmd(8): prevent crashing when presented with a vm name argument to "vmctl stop" that doesn't exist. Diff from Pratik Vyas, thanks!
Revision 1.61 / (download) - annotate - [select for diffs], Thu May 4 19:41:58 2017 UTC (7 years ago) by reyk
Branch: MAIN
Changes since 1.60: +18 -8 lines
Diff to previous 1.60 (colored)
Report command failure back to vmctl reload, reset, load, log verbose. OK mlarkin@
Revision 1.60 / (download) - annotate - [select for diffs], Thu May 4 08:26:06 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.59: +5 -1 lines
Diff to previous 1.59 (colored)
Add support for rdomains. This allows to configure VM interfaces and switches in individual rdomains. OK mlarkin@
Revision 1.59 / (download) - annotate - [select for diffs], Tue Apr 25 16:38:23 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.58: +21 -1 lines
Diff to previous 1.58 (colored)
Generate randomized MAC addresses earlier to keep them across reboots. OK deraadt@
Revision 1.58 / (download) - annotate - [select for diffs], Fri Apr 21 07:03:26 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.57: +9 -1 lines
Diff to previous 1.57 (colored)
Add global configuration option "local prefix" to change prefix for -L. The default prefix is 100.64.0.0/10 from RFC6598. Requested by sthen@ chris@ OK mlarkin@
Revision 1.57 / (download) - annotate - [select for diffs], Wed Apr 19 15:38:32 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.56: +13 -1 lines
Diff to previous 1.56 (colored)
Add support for dynamic "NAT" interfaces (-L/local interface). When a local interface is configured, vmd configures a /31 address on the tap(4) interface of the host and provides another IP in the same subnet via DHCP (BOOTP) to the VM. vmd runs an internal BOOTP server that replies with IP, gateway, and DNS addresses to the VM. The built-in server only ever responds to the VM on the inside and cannot leak its DHCP responses to the outside. Thanks to Uwe Werler, Josh Grosse, and some others for testing! OK deraadt@
Revision 1.56 / (download) - annotate - [select for diffs], Thu Apr 6 18:07:13 2017 UTC (7 years, 1 month ago) by reyk
Branch: MAIN
Changes since 1.55: +37 -9 lines
Diff to previous 1.55 (colored)
Do not expose vmm(4) VM IDs to the user, use vmd(8)'s IDs instead. Each VM has two IDs: one from the kernel (vmm) and a different one from userland (vmd). The vmm ID is not consistent and incremented on every boot during runtimg of the host system. The vmd ID remains the same during the lifetime of a configured VM, even after reboots. Configured VMs will even get and keep their IDs when the configuration is loaded. This is more what users expect. Pointed out and tested by otto@ OK deraadt@
Revision 1.55 / (download) - annotate - [select for diffs], Wed Mar 15 19:54:52 2017 UTC (7 years, 2 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE,
OPENBSD_6_1
Changes since 1.54: +17 -8 lines
Diff to previous 1.54 (colored)
More fixes for starting and stopping VMs, fixing fallout from vm_running. - Don't start a VM that is already running - Keep the VM as running until it is powered off (and not stopping) - Don't fatal in the parent if the vmm process referenced an unknown VM - Don't stop a VM that is already stopping - Indicate that a VM is stopping in "vmctl status" The previous "vmctl stop; vmctl stop" to force-shutdown is not supported anymore - the shutdown timeout should make sure that the VM is really terminated. To force-shutdown, reference the VM by ID. We might add a flag to vmctl stop to just turn the VM off.
Revision 1.54 / (download) - annotate - [select for diffs], Wed Mar 15 17:53:10 2017 UTC (7 years, 2 months ago) by reyk
Branch: MAIN
Changes since 1.53: +9 -6 lines
Diff to previous 1.53 (colored)
Close the tty if the VM was powered down. The parent keeps a copy of each VM's tty fd to reuse it on reboot. Close this tty if the VM was stopped, and not rebooted, by calling vm_stop(vm, 0) instead of just setting vm_running to 0. Also make sure that vm_ttyname is not used after free'ing it.
Revision 1.53 / (download) - annotate - [select for diffs], Thu Mar 2 07:33:37 2017 UTC (7 years, 3 months ago) by reyk
Branch: MAIN
Changes since 1.52: +10 -2 lines
Diff to previous 1.52 (colored)
Add "locked lladdr" option to prevent VMs from spoofing MAC addresses. This is especially useful when multiple VMs share a switch, the implementation is independent from the underlying switch or bridge. no objections mlarkin@
Revision 1.52 / (download) - annotate - [select for diffs], Wed Mar 1 07:43:33 2017 UTC (7 years, 3 months ago) by reyk
Branch: MAIN
Changes since 1.51: +128 -8 lines
Diff to previous 1.51 (colored)
Add "owner" option to set a user/group ownership for pre-configured VMs This allows matching users to start or stop VMs that they "own" and to access the console accordingly. OK mlarkin@
Revision 1.51 / (download) - annotate - [select for diffs], Mon Feb 27 14:37:58 2017 UTC (7 years, 3 months ago) by reyk
Branch: MAIN
Changes since 1.50: +49 -13 lines
Diff to previous 1.50 (colored)
Replace openpty(3) with local function that uses pre-opened /dev/ptm fd This allows more flexibility for upcoming changes and better pledge. We also didn't use half of the features of libutil's openpty function. Additionally, make sure that the ttys are closed correctly on shutdown. OK gilles@
Revision 1.50 / (download) - annotate - [select for diffs], Fri Jan 13 19:21:16 2017 UTC (7 years, 4 months ago) by edd
Branch: MAIN
Changes since 1.49: +29 -8 lines
Diff to previous 1.49 (colored)
Make it possible to remove VMs from vmd(8)'s internal queue. The semantics agreed with reyk@ are: * ad-hoc created vms, created with `vmctl start`, are removed once stopped. * Stopped VMs defined in a config file are flushed before a `vmctl reload`. OK reyk@
Revision 1.49 / (download) - annotate - [select for diffs], Wed Jan 11 22:38:10 2017 UTC (7 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.48: +15 -2 lines
Diff to previous 1.48 (colored)
Add imsg communication channel between vmd and invividual VMs. For now, this is only used to forward "log verbose|brief" requests, but it will be used for better things later. OK mlarkin@
Revision 1.48 / (download) - annotate - [select for diffs], Mon Jan 9 14:49:22 2017 UTC (7 years, 4 months ago) by reyk
Branch: MAIN
Changes since 1.47: +2 -2 lines
Diff to previous 1.47 (colored)
Stop accessing verbose and debug variables from log.c directly. This replaces log_verbose() and "extern int verbose" with the two functions log_setverbose() and log_getverbose(). Pointed out by benno@ OK krw@ eric@ gilles@ (OK gilles@ for the snmpd bits as well)
Revision 1.47 / (download) - annotate - [select for diffs], Wed Dec 14 21:17:25 2016 UTC (7 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.46: +18 -3 lines
Diff to previous 1.46 (colored)
Allow to start disabled and pre-configured VMs by name, "vmctl start foo". With testing from Jon Bernard OK mlarkin@
Revision 1.46 / (download) - annotate - [select for diffs], Wed Dec 14 06:59:12 2016 UTC (7 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.45: +48 -11 lines
Diff to previous 1.45 (colored)
If a VM terminates with the result EAGAIN, close all fds except the pty and re-send it to the vmm monitor process. With additional changes in vmm.c, this will allow perform a cold reboot of VM. With testing and feedback from Jon Bernard OK mlarkin@
Revision 1.45 / (download) - annotate - [select for diffs], Sat Nov 26 20:03:42 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.44: +3 -6 lines
Diff to previous 1.44 (colored)
Implement basic support for boot.conf(8) on the disk image. Like the real boot loader, load and parse hd0a:/etc/boot.conf from the first disk and fall back to /bsd. Not all boot loader options are supported, but it at least does set device, set image, and boot -acds (eg. for booting single-user). For example, it can now boot install60.fs that includes a boot.conf with "set image /6.0/amd64/bsd.rd": vmctl start install -c -d install60.fs -d OpenBSD.img This pseudo-bootloader is only needed without BIOS and could potentially be replaced in the future. OK mlarkin@
Revision 1.44 / (download) - annotate - [select for diffs], Sat Nov 26 19:49:11 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.43: +3 -1 lines
Diff to previous 1.43 (colored)
If -m/memory is not specified, use 512M by default. Default value picked with mlarkin - not too small and not too large. OK mlarkin@
Revision 1.43 / (download) - annotate - [select for diffs], Thu Nov 24 07:58:55 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.42: +12 -6 lines
Diff to previous 1.42 (colored)
Add support for booting the kernel from the disk image. This make the kernel/-k argument optional and, if not specified, tries to find the /bsd kernel in the primary hd0a partition of the first disk image itself. It doesn't support hd0a:/etc/boot.conf yet, and it is no BIOS or full boot loader, but it makes booting and handling of VMs a bit easier - booting an external kernel is still supported. The UFS file system code ufs.c is directly from libsa which is also used by the real boot loader. The code compiles with a few signedness warning which will be fixed separately. OK mlarkin@
Revision 1.42 / (download) - annotate - [select for diffs], Tue Nov 22 21:55:54 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.41: +10 -28 lines
Diff to previous 1.41 (colored)
Fix error path of config_setvm() and its callers. This unbreaks loading of invalid kernel files. Reported by mlarkin@ OK mlarkin@
Revision 1.41 / (download) - annotate - [select for diffs], Tue Nov 22 12:55:33 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.40: +4 -5 lines
Diff to previous 1.40 (colored)
There is no need for res when there is already ret.
Revision 1.40 / (download) - annotate - [select for diffs], Tue Nov 22 11:31:38 2016 UTC (7 years, 6 months ago) by edd
Branch: MAIN
Changes since 1.39: +38 -1 lines
Diff to previous 1.39 (colored)
Insert disabled VMs into vmd(8)'s queues and allow vmctl(8) to display them. Tested by Jon Bernard and reyk@. OK reyk@, no objections mlarkin@. Thanks
Revision 1.39 / (download) - annotate - [select for diffs], Fri Nov 4 15:16:44 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.38: +7 -4 lines
Diff to previous 1.38 (colored)
Pass the internal vmid or 0 to vm_register() instead of changing it once again after setting the next available id. Suggested by edd@
Revision 1.38 / (download) - annotate - [select for diffs], Fri Nov 4 15:07:26 2016 UTC (7 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.37: +62 -5 lines
Diff to previous 1.37 (colored)
Update the config/register/get VM methods to match the config_set/get style that is used in other places. Also keep the vmid from the parent. OK edd@
Revision 1.37 / (download) - annotate - [select for diffs], Sat Oct 29 14:56:05 2016 UTC (7 years, 7 months ago) by edd
Branch: MAIN
Changes since 1.36: +70 -7 lines
Diff to previous 1.36 (colored)
Separate parsing vms and switches from starting them in vmd(8). Brings us one step closer to having disabled by default vms is vm.conf(5), which can be started with vmctl(8). Input, testing and OK reyk@. Thanks.
Revision 1.36 / (download) - annotate - [select for diffs], Mon Oct 17 16:26:20 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.35: +2 -1 lines
Diff to previous 1.35 (colored)
Add the option to specify an interface group per virtual switch as well; this group will be added to all VM tap(4) interfaces in the switch. Tested by martijn@
Revision 1.35 / (download) - annotate - [select for diffs], Sat Oct 15 14:02:11 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.34: +2 -1 lines
Diff to previous 1.34 (colored)
Allow to add an interface to an interface group; with the group keyword. Requested and tested by martijn@
Revision 1.34 / (download) - annotate - [select for diffs], Wed Oct 12 19:10:03 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.33: +25 -16 lines
Diff to previous 1.33 (colored)
Fix functionality and semantics of vmctl load/reload/reset. OK rzalamena@
Revision 1.33 / (download) - annotate - [select for diffs], Thu Oct 6 18:48:41 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.32: +2 -3 lines
Diff to previous 1.32 (colored)
Terminate VMs on shutdown of vmd instead of leaving them running as undead VM processes. OK mlarkin@
Revision 1.32 / (download) - annotate - [select for diffs], Wed Oct 5 17:30:13 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.31: +47 -8 lines
Diff to previous 1.31 (colored)
Add support for enhanced networking configuration and virtual switches. See vm.conf(5) for more details. OK mlarkin@
Revision 1.31 / (download) - annotate - [select for diffs], Tue Oct 4 17:17:30 2016 UTC (7 years, 7 months ago) by reyk
Branch: MAIN
Changes since 1.30: +31 -8 lines
Diff to previous 1.30 (colored)
Add a new "priv" process that is responsible for ioctls and restricted operations that aren't allowed under pledge. This is a companion to the "vmd" process that runs as root but with pledge. With the "priv" process, each new tap(4) interface now gets a description to indicate the vm, eg. "vm1-if0-myvm". For network configuration will be done by vmd/priv later. OK mlarkin@
Revision 1.30 / (download) - annotate - [select for diffs], Thu Sep 29 22:42:04 2016 UTC (7 years, 8 months ago) by reyk
Branch: MAIN
Changes since 1.29: +39 -63 lines
Diff to previous 1.29 (colored)
Implement fork+exec for vmd, using the same framework from httpd etc. No objections from mlarkin@ sunil@
Revision 1.29 / (download) - annotate - [select for diffs], Wed Aug 17 05:07:13 2016 UTC (7 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)
small bits of header cleanup; ok mlarkin
Revision 1.28 / (download) - annotate - [select for diffs], Fri Jul 29 16:36:51 2016 UTC (7 years, 10 months ago) by stefan
Branch: MAIN
Changes since 1.27: +18 -2 lines
Diff to previous 1.27 (colored)
Allow starting a VM again after it was terminated If a VM exits, terminate it and remove it from the list of available VMs. That allows a VM with name `foo' to be restarted after it has exited. This changes structures shared between vmd and vmctl. You need to rebuild vmctl also. ok mlarkin@
Revision 1.27 / (download) - annotate - [select for diffs], Fri Feb 5 11:40:15 2016 UTC (8 years, 3 months ago) by reyk
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE,
OPENBSD_6_0,
OPENBSD_5_9_BASE,
OPENBSD_5_9
Changes since 1.26: +23 -16 lines
Diff to previous 1.26 (colored)
Fix a possible use-after-free in vmd, forward the result to the control socket before free'ing the vm. Found by and OK jsg@
Revision 1.26 / (download) - annotate - [select for diffs], Tue Feb 2 17:51:11 2016 UTC (8 years, 4 months ago) by sthen
Branch: MAIN
Changes since 1.25: +1 -2 lines
Diff to previous 1.25 (colored)
Remove setproctitle() for the parent process. Because rc.d(8) uses process titles (including flags) to distinguish between daemons, this makes it possible to manage multiple copies of a daemon using the normal infrastructure by symlinking rc.d scripts to a new name. ok jung@ ajacoutot@, smtpd ok gilles@
Revision 1.25 / (download) - annotate - [select for diffs], Fri Dec 11 10:16:53 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.24: +45 -9 lines
Diff to previous 1.24 (colored)
The vmctl "id" argument can now be a number of or a vm name, eg. vmctl stop 3 vmctl stop "openbsd.vm"
Revision 1.24 / (download) - annotate - [select for diffs], Tue Dec 8 23:59:39 2015 UTC (8 years, 5 months ago) by jsg
Branch: MAIN
Changes since 1.23: +10 -6 lines
Diff to previous 1.23 (colored)
when checking the config file with -n don't open /dev/vmm or require root ok reyk@
Revision 1.23 / (download) - annotate - [select for diffs], Tue Dec 8 23:47:59 2015 UTC (8 years, 5 months ago) by jsg
Branch: MAIN
Changes since 1.22: +2 -2 lines
Diff to previous 1.22 (colored)
make the -f option work as intended ok reyk@
Revision 1.22 / (download) - annotate - [select for diffs], Mon Dec 7 12:52:00 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.21: +4 -4 lines
Diff to previous 1.21 (colored)
tweak initial error logging
Revision 1.21 / (download) - annotate - [select for diffs], Sun Dec 6 21:02:51 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.20: +14 -1 lines
Diff to previous 1.20 (colored)
Prevent running a VM with the same name multiple times - multiple instances of the same configuration will be handled in a different way later. It is also not a good idea to use the same writeable disk with multiple VMs at the same time. As discussed with mlarkin@
Revision 1.20 / (download) - annotate - [select for diffs], Sun Dec 6 02:26:14 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.19: +16 -4 lines
Diff to previous 1.19 (colored)
Print the TTY in the vmctl status output.
Revision 1.19 / (download) - annotate - [select for diffs], Sun Dec 6 01:58:21 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.18: +35 -13 lines
Diff to previous 1.18 (colored)
When a new vm is created with VMM_IOC_CREATE, the kernel assigns a unique id to it. This happens in the vm child process and has to be communicated to the parent processes to track the vm. Knowing the vm id in the parent and vmm processes also allows to remove vm from the daemons list on terminate requests later.
Revision 1.18 / (download) - annotate - [select for diffs], Sun Dec 6 01:16:22 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.17: +2 -2 lines
Diff to previous 1.17 (colored)
Check errno from config_getvm() correctly
Revision 1.17 / (download) - annotate - [select for diffs], Sat Dec 5 20:33:51 2015 UTC (8 years, 5 months ago) by reyk
Branch: MAIN
Changes since 1.16: +2 -2 lines
Diff to previous 1.16 (colored)
Print shorter error message if opening /dev/vmm failed. Pointed out by deraadt@
Revision 1.16 / (download) - annotate - [select for diffs], Thu Dec 3 23:32:32 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.15: +50 -3 lines
Diff to previous 1.15 (colored)
Re-add the "load" and "reload" commands to vmctl: Instead of parsing the configuration in vmctl directly, it now sends a (re)load request to vmd. The reload also resets the existing configuration status - this doesn't do much difference yet but a future change will compare if a specified VM is already running. "load" will allow to add configuration, while "reload" resets the state before loading.
Revision 1.15 / (download) - annotate - [select for diffs], Thu Dec 3 16:18:13 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.14: +9 -3 lines
Diff to previous 1.14 (colored)
Add and document -D and -f flags to vmd.
Revision 1.14 / (download) - annotate - [select for diffs], Thu Dec 3 16:13:04 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)
mlarkin's code has been moved to vmm.c, so it is ok to claim the copyright.
Revision 1.13 / (download) - annotate - [select for diffs], Thu Dec 3 16:11:32 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.12: +47 -19 lines
Diff to previous 1.12 (colored)
Add support for an optional vm.conf(5) file in vmd. This will replace vmm.conf(5) in vmmctl. For a short time, both vmd and vmmctl will support a configuration file, but vmmctl will be changed to send "load" requests to vmd instead of loading and parsing the file directly.
Revision 1.12 / (download) - annotate - [select for diffs], Thu Dec 3 13:27:14 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.11: +7 -4 lines
Diff to previous 1.11 (colored)
prepare config_getvm() for parse.y
Revision 1.11 / (download) - annotate - [select for diffs], Wed Dec 2 23:33:43 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.10: +14 -6 lines
Diff to previous 1.10 (colored)
send the tty name to vmmctl and print it as a result.
Revision 1.10 / (download) - annotate - [select for diffs], Wed Dec 2 22:19:11 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.9: +129 -9 lines
Diff to previous 1.9 (colored)
Split the fully privileged parent into two processes "parent" and "vmm" with reduced privileges: - the "parent" opens fds (disks, ifs, etc.) but runs as root but pledged as "stdio rpath wpath proc tty sendfd". - the "vmm" process handles the creation and supervision of vm processes, and the primary communication with the vmm(4) subsystem. It runs as _vmd in the chroot but does not use pledge, as the vmm ioctls are not allowed by any pledge model yet. With this change, vmd starts to track the configuration state of VMs in vmd and will allow other things later (like terminating a vm by name, moving the configuration parser to vmd, ...). More incremental changes will follow.
Revision 1.9 / (download) - annotate - [select for diffs], Wed Dec 2 09:14:25 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.8: +142 -1539 lines
Diff to previous 1.8 (colored)
Start tweaking vmd's privsep and daemon model by splitting the main process into multiple parts and adopting the "proc.c"-style from other daemons. This allows to further reduce the privileges, to give better pledge(2), and to add some upcoming changes. "please do" mlarkin@, deraadt@
Revision 1.8 / (download) - annotate - [select for diffs], Thu Nov 26 08:26:48 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.7: +1 -51 lines
Diff to previous 1.7 (colored)
Automatically start vmm(4) when the first VM is created and after the last VM is terminated. This allows to remove the explicit "vmm enable" / "vmm disable" (VMM_IOC_START / VMM_IOC_STOP) ioctls. You'll have to update kernel and userland for this change, as the kernel ABI changes. OK mpi@ mlarkin@
Revision 1.7 / (download) - annotate - [select for diffs], Wed Nov 25 22:44:21 2015 UTC (8 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)
typo: should be looking pid == -1
Revision 1.6 / (download) - annotate - [select for diffs], Mon Nov 23 21:07:29 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.5: +25 -3 lines
Diff to previous 1.5 (colored)
accept4() is restarted after signals which prevents vmd from exiting in the current control socket loop. Add a poll before the accept that is not restarted and allows to escape the loop. This code is kind of temporary, as we're planning to replace the event handling, but it allows to kill (or Ctrl+c) vmd for now. OK tedu@, discussed with many
Revision 1.5 / (download) - annotate - [select for diffs], Mon Nov 23 20:18:33 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)
I accidentally removed a newline in usage() when converting the log messages to log_*. From Cesare Gargano
Revision 1.4 / (download) - annotate - [select for diffs], Mon Nov 23 13:04:49 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.3: +100 -80 lines
Diff to previous 1.3 (colored)
Add support for logging to stderr or syslog, and to run vmd in foreground with -d. OK mlarkin@ jung@
Revision 1.3 / (download) - annotate - [select for diffs], Sun Nov 22 22:29:48 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +3 -6 lines
Diff to previous 1.2 (colored)
use PATH_MAX where needed
Revision 1.2 / (download) - annotate - [select for diffs], Sun Nov 22 21:51:32 2015 UTC (8 years, 6 months ago) by reyk
Branch: MAIN
Changes since 1.1: +2 -0 lines
Diff to previous 1.1 (colored)
Add $ Ids
Revision 1.1 / (download) - annotate - [select for diffs], Sun Nov 22 20:20:32 2015 UTC (8 years, 6 months ago) by mlarkin
Branch: MAIN
vmd(8) - virtual machine daemon. There is still a lot to be done, and fixed, in these userland components but I have received enough "it works, commit it" emails that it's time to finish those things in tree. discussed with many, tested by many.