Discussion:
[Xen-changelog] [xen staging] x86/vvmx: add VMX_INSN_VMPTRLD_WITH_VMXON_PTR errno
p***@xen.org
2018-11-14 18:56:06 UTC
Permalink
commit cd0476249729d37f9db1c01fbe50485ab30a5144
Author: Sergey Dyasli <***@citrix.com>
AuthorDate: Wed Nov 14 10:23:20 2018 +0000
Commit: Andrew Cooper <***@citrix.com>
CommitDate: Wed Nov 14 18:42:48 2018 +0000

x86/vvmx: add VMX_INSN_VMPTRLD_WITH_VMXON_PTR errno

And make nvmx_handle_vmptrld() return the new errno in case the provided
address is the same as vmxon region address.

While at it, correct the return value for not-4KB-aligned case.

Signed-off-by: Sergey Dyasli <***@citrix.com>
Acked-by: Kevin Tian <***@intel.com>
---
xen/arch/x86/hvm/vmx/vvmx.c | 10 ++++++++--
xen/include/asm-x86/hvm/vmx/vmcs.h | 1 +
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 206a4a44fb..4391cd314a 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1650,9 +1650,15 @@ static int nvmx_handle_vmptrld(struct cpu_user_regs *regs)
if ( rc != X86EMUL_OKAY )
return rc;

- if ( gpa == vcpu_2_nvmx(v).vmxon_region_pa || gpa & 0xfff )
+ if ( gpa & 0xfff )
{
- vmfail_invalid(regs);
+ vmfail(regs, VMX_INSN_VMPTRLD_INVALID_PHYADDR);
+ goto out;
+ }
+
+ if ( gpa == vcpu_2_nvmx(v).vmxon_region_pa )
+ {
+ vmfail(regs, VMX_INSN_VMPTRLD_WITH_VMXON_PTR);
goto out;
}

diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h
index 6d0ae56fc1..eae4e5397e 100644
--- a/xen/include/asm-x86/hvm/vmx/vmcs.h
+++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
@@ -534,6 +534,7 @@ enum vmx_insn_errno
VMX_INSN_INVALID_CONTROL_STATE = 7,
VMX_INSN_INVALID_HOST_STATE = 8,
VMX_INSN_VMPTRLD_INVALID_PHYADDR = 9,
+ VMX_INSN_VMPTRLD_WITH_VMXON_PTR = 10,
VMX_INSN_VMPTRLD_INCORRECT_VMCS_ID = 11,
VMX_INSN_UNSUPPORTED_VMCS_COMPONENT = 12,
VMX_INSN_VMXON_IN_VMX_ROOT = 15,
--
generated by git-patchbot for /home/xen/git/xen.git#staging

Loading...