From: Sergey Dyasli Date: Wed, 14 Nov 2018 10:23:20 +0000 (+0000) Subject: x86/vvmx: add VMX_INSN_VMPTRLD_WITH_VMXON_PTR errno X-Git-Tag: archive/raspbian/4.14.0+80-gd101b417b7-1+rpi1^2~63^2~2958 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=cd0476249729d37f9db1c01fbe50485ab30a5144;p=xen.git 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 Acked-by: Kevin Tian --- 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,