summaryrefslogtreecommitdiff
path: root/usr.sbin/vmd/vmd.c
diff options
context:
space:
mode:
authorReyk Floeter <reyk@cvs.openbsd.org>2018-07-11 09:35:45 +0000
committerReyk Floeter <reyk@cvs.openbsd.org>2018-07-11 09:35:45 +0000
commitcbc8b5ccfbab5b0cf8e131631136e42f3b6a013d (patch)
tree9d675deb7c3bbe09a774478c15b228fb8daa57f2 /usr.sbin/vmd/vmd.c
parentddbc901276d0b67bf7e8461d43234903e1f6506b (diff)
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@
Diffstat (limited to 'usr.sbin/vmd/vmd.c')
-rw-r--r--usr.sbin/vmd/vmd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c
index ddd3cca8125..0112ea04b27 100644
--- a/usr.sbin/vmd/vmd.c
+++ b/usr.sbin/vmd/vmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.c,v 1.90 2018/07/10 21:12:20 reyk Exp $ */
+/* $OpenBSD: vmd.c,v 1.91 2018/07/11 09:35:44 reyk Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -111,6 +111,7 @@ vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg)
}
break;
case IMSG_VMDOP_TERMINATE_VM_REQUEST:
+ case IMSG_VMDOP_KILL_VM_REQUEST:
IMSG_SIZE_CHECK(imsg, &vid);
memcpy(&vid, imsg->data, sizeof(vid));
if ((id = vid.vid_id) == 0) {
@@ -119,7 +120,8 @@ vmd_dispatch_control(int fd, struct privsep_proc *p, struct imsg *imsg)
res = ENOENT;
cmd = IMSG_VMDOP_TERMINATE_VM_RESPONSE;
break;
- } else if (vm->vm_shutdown) {
+ } else if (vm->vm_shutdown &&
+ imsg->hdr.type != IMSG_VMDOP_KILL_VM_REQUEST) {
res = EALREADY;
cmd = IMSG_VMDOP_TERMINATE_VM_RESPONSE;
break;