diff options
author | Mike Larkin <mlarkin@cvs.openbsd.org> | 2015-12-15 02:18:35 +0000 |
---|---|---|
committer | Mike Larkin <mlarkin@cvs.openbsd.org> | 2015-12-15 02:18:35 +0000 |
commit | 2dc7ea954f46554891c727ab1e852dfe4920d84e (patch) | |
tree | 74b0978e598f5c3c1b58823ad01d42de19f9e2d2 /usr.sbin/vmd | |
parent | 2a249dcc9744ee764cee33a679c0c4911e340fb2 (diff) |
if a vcpu run thread in vmd exits unexpectedly, teardown the VM's kernel
components as well.
ok deraadt@
Diffstat (limited to 'usr.sbin/vmd')
-rw-r--r-- | usr.sbin/vmd/vmm.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/vmd/vmm.c b/usr.sbin/vmd/vmm.c index 7e4eace4494..481b655540e 100644 --- a/usr.sbin/vmd/vmm.c +++ b/usr.sbin/vmd/vmm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmm.c,v 1.12 2015/12/07 16:02:09 reyk Exp $ */ +/* $OpenBSD: vmm.c,v 1.13 2015/12/15 02:18:34 mlarkin Exp $ */ /* * Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org> @@ -638,6 +638,7 @@ run_vm(int *child_disks, int *child_taps, struct vm_create_params *vcp) pthread_t *tid; void *exit_status; struct vm_run_params **vrp; + struct vm_terminate_params vtp; ret = 0; @@ -699,6 +700,13 @@ run_vm(int *child_disks, int *child_taps, struct vm_create_params *vcp) if (exit_status != NULL) { log_warnx("%s: vm %d vcpu run thread %zd exited " "abnormally", __progname, vcp->vcp_id, i); + /* Terminate the VM if we can */ + bzero(&vtp, sizeof(vtp)); + vtp.vtp_vm_id = vcp->vcp_id; + if (terminate_vm(&vtp)) { + log_warnx("%s: could not terminate vm %d", + __progname, vcp->vcp_id); + } ret = EIO; } } |