summaryrefslogtreecommitdiffstats
path: root/usr.sbin/vmd
diff options
context:
space:
mode:
authorjasper <jasper@openbsd.org>2019-05-11 19:59:32 +0000
committerjasper <jasper@openbsd.org>2019-05-11 19:59:32 +0000
commit8de23201b100c483ce99b6fd4f3dd078448430ca (patch)
treeef43e02cf805b385ca4cdeb7f97c2f6f32e6d643 /usr.sbin/vmd
parentwxneeded binaries on wxallowed filesystems were refused execution. We have (diff)
downloadwireguard-openbsd-8de23201b100c483ce99b6fd4f3dd078448430ca.tar.xz
wireguard-openbsd-8de23201b100c483ce99b6fd4f3dd078448430ca.zip
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@
Diffstat (limited to 'usr.sbin/vmd')
-rw-r--r--usr.sbin/vmd/vm.c5
-rw-r--r--usr.sbin/vmd/vmd.c6
2 files changed, 9 insertions, 2 deletions
diff --git a/usr.sbin/vmd/vm.c b/usr.sbin/vmd/vm.c
index 2b2acac51fd..dd3915ae726 100644
--- a/usr.sbin/vmd/vm.c
+++ b/usr.sbin/vmd/vm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vm.c,v 1.46 2019/05/11 19:55:14 jasper Exp $ */
+/* $OpenBSD: vm.c,v 1.47 2019/05/11 19:59:32 jasper Exp $ */
/*
* Copyright (c) 2015 Mike Larkin <mlarkin@openbsd.org>
@@ -585,6 +585,9 @@ dump_send_header(int fd) {
struct vm_dump_header vmh;
int i;
+ memcpy(&vmh.vmh_signature, VM_DUMP_SIGNATURE,
+ sizeof(vmh.vmh_signature));
+
vmh.vmh_cpuids[0].code = 0x00;
vmh.vmh_cpuids[0].leaf = 0x00;
diff --git a/usr.sbin/vmd/vmd.c b/usr.sbin/vmd/vmd.c
index 5e86a4c6d93..197566df4ef 100644
--- a/usr.sbin/vmd/vmd.c
+++ b/usr.sbin/vmd/vmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmd.c,v 1.110 2019/05/11 19:55:14 jasper Exp $ */
+/* $OpenBSD: vmd.c,v 1.111 2019/05/11 19:59:32 jasper Exp $ */
/*
* Copyright (c) 2015 Reyk Floeter <reyk@openbsd.org>
@@ -553,6 +553,10 @@ vmd_check_vmh(struct vm_dump_header *vmh)
unsigned int code, leaf;
unsigned int a, b, c, d;
+ if (strncmp(vmh->vmh_signature, VM_DUMP_SIGNATURE, strlen(VM_DUMP_SIGNATURE)) != 0) {
+ log_warnx("%s: incompatible dump signature", __func__);
+ return (-1);
+ }
if (vmh->vmh_version != VM_DUMP_VERSION) {
log_warnx("%s: incompatible dump version", __func__);