diff options
author | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2019-05-11 19:59:33 +0000 |
---|---|---|
committer | Jasper Lievisse Adriaanse <jasper@cvs.openbsd.org> | 2019-05-11 19:59:33 +0000 |
commit | a41e393c6cad4294c08d326cab70095f5903250d (patch) | |
tree | 556bea71b5d16cb2189e7ef1116f1d09ecfaa753 | |
parent | 7925b9d1dcd45a9a7a76054ea861fcca603c41ec (diff) |
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@
-rw-r--r-- | usr.sbin/vmd/vm.c | 5 | ||||
-rw-r--r-- | usr.sbin/vmd/vmd.c | 6 |
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__); |