From cbc8b5ccfbab5b0cf8e131631136e42f3b6a013d Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Wed, 11 Jul 2018 09:35:45 +0000 Subject: 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@ --- usr.sbin/vmd/vmd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'usr.sbin/vmd/vmd.c') 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 @@ -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; -- cgit v1.2.3