summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormlarkin <mlarkin@openbsd.org>2017-02-20 08:12:47 +0000
committermlarkin <mlarkin@openbsd.org>2017-02-20 08:12:47 +0000
commit1aae5fe19ebb009d3a2bd1369e3be16b1ceaa712 (patch)
tree894975a914dd8c8ff88293a4eab499587ec9c96c
parentSVM: asm support for SVM/RVI (diff)
downloadwireguard-openbsd-1aae5fe19ebb009d3a2bd1369e3be16b1ceaa712.tar.xz
wireguard-openbsd-1aae5fe19ebb009d3a2bd1369e3be16b1ceaa712.zip
VMX: assert that the supplied instruction length matches what is expected for
HLT exits
-rw-r--r--sys/arch/amd64/amd64/vmm.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/arch/amd64/amd64/vmm.c b/sys/arch/amd64/amd64/vmm.c
index cad7f1eac77..54b52034b07 100644
--- a/sys/arch/amd64/amd64/vmm.c
+++ b/sys/arch/amd64/amd64/vmm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vmm.c,v 1.114 2017/02/20 07:22:50 mlarkin Exp $ */
+/* $OpenBSD: vmm.c,v 1.115 2017/02/20 08:12:47 mlarkin Exp $ */
/*
* Copyright (c) 2014 Mike Larkin <mlarkin@openbsd.org>
*
@@ -3723,10 +3723,13 @@ vmx_handle_hlt(struct vcpu *vcpu)
uint64_t insn_length;
if (vmread(VMCS_INSTRUCTION_LENGTH, &insn_length)) {
- printf("vmx_handle_hlt: can't obtain instruction length\n");
+ printf("%s: can't obtain instruction length\n", __func__);
return (EINVAL);
}
+ /* All HLT insns are 1 byte */
+ KASSERT(insn_length == 1);
+
vcpu->vc_gueststate.vg_rip += insn_length;
return (EAGAIN);
}