diff mbox

[v1,3/3] x86/vvmx: add a shadow vmcs check to vmlaunch

Message ID 20170313105143.20842-4-sergey.dyasli@citrix.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sergey Dyasli March 13, 2017, 10:51 a.m. UTC
Intel SDM states that if the current VMCS is a shadow VMCS,
VMFailInvalid occurs and control passes to the next instruction.

Implement such behaviour for nested vmlaunch.

Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
---
 xen/arch/x86/hvm/vmx/vvmx.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Tian, Kevin March 14, 2017, 9:11 a.m. UTC | #1
> From: Sergey Dyasli [mailto:sergey.dyasli@citrix.com]
> Sent: Monday, March 13, 2017 6:52 PM
> 
> Intel SDM states that if the current VMCS is a shadow VMCS, VMFailInvalid
> occurs and control passes to the next instruction.
> 
> Implement such behaviour for nested vmlaunch.
> 
> Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
> ---

Acked-by: Kevin Tian <kevin.tian@intel.com>
Krish Sadhukhan March 16, 2017, 6:24 p.m. UTC | #2
This one looks good to me.

-Krish

On 03/13/2017 03:51 AM, Sergey Dyasli wrote:
> Intel SDM states that if the current VMCS is a shadow VMCS,
> VMFailInvalid occurs and control passes to the next instruction.
>
> Implement such behaviour for nested vmlaunch.
>
> Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
> ---
>   xen/arch/x86/hvm/vmx/vvmx.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
> index 3017849..173ec74 100644
> --- a/xen/arch/x86/hvm/vmx/vvmx.c
> +++ b/xen/arch/x86/hvm/vmx/vvmx.c
> @@ -1630,6 +1630,13 @@ int nvmx_handle_vmlaunch(struct cpu_user_regs *regs)
>           return X86EMUL_OKAY;
>       }
>   
> +    /* Check that guest is not using a shadow vmcs for vmentry */
> +    if ( nvmx->shadow_vmcs )
> +    {
> +        vmfail_invalid(regs);
> +        return X86EMUL_OKAY;
> +    }
> +
>       __vmread(GUEST_INTERRUPTIBILITY_INFO, &intr_shadow);
>       if ( intr_shadow & VMX_INTR_SHADOW_MOV_SS )
>       {
Krish Sadhukhan March 16, 2017, 6:32 p.m. UTC | #3
Acknowledging it formally...

Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>

The review was based on Intel SDM chapters 24 and 30.

-Krish

On 03/16/2017 11:24 AM, Krish Sadhukhan wrote:
> This one looks good to me.
>
> -Krish
>
> On 03/13/2017 03:51 AM, Sergey Dyasli wrote:
>> Intel SDM states that if the current VMCS is a shadow VMCS,
>> VMFailInvalid occurs and control passes to the next instruction.
>>
>> Implement such behaviour for nested vmlaunch.
>>
>> Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
>> ---
>>   xen/arch/x86/hvm/vmx/vvmx.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
>> index 3017849..173ec74 100644
>> --- a/xen/arch/x86/hvm/vmx/vvmx.c
>> +++ b/xen/arch/x86/hvm/vmx/vvmx.c
>> @@ -1630,6 +1630,13 @@ int nvmx_handle_vmlaunch(struct cpu_user_regs 
>> *regs)
>>           return X86EMUL_OKAY;
>>       }
>>   +    /* Check that guest is not using a shadow vmcs for vmentry */
>> +    if ( nvmx->shadow_vmcs )
>> +    {
>> +        vmfail_invalid(regs);
>> +        return X86EMUL_OKAY;
>> +    }
>> +
>>       __vmread(GUEST_INTERRUPTIBILITY_INFO, &intr_shadow);
>>       if ( intr_shadow & VMX_INTR_SHADOW_MOV_SS )
>>       {
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
diff mbox

Patch

diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
index 3017849..173ec74 100644
--- a/xen/arch/x86/hvm/vmx/vvmx.c
+++ b/xen/arch/x86/hvm/vmx/vvmx.c
@@ -1630,6 +1630,13 @@  int nvmx_handle_vmlaunch(struct cpu_user_regs *regs)
         return X86EMUL_OKAY;
     }
 
+    /* Check that guest is not using a shadow vmcs for vmentry */
+    if ( nvmx->shadow_vmcs )
+    {
+        vmfail_invalid(regs);
+        return X86EMUL_OKAY;
+    }
+
     __vmread(GUEST_INTERRUPTIBILITY_INFO, &intr_shadow);
     if ( intr_shadow & VMX_INTR_SHADOW_MOV_SS )
     {