xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Krish Sadhukhan <krish.sadhukhan@oracle.com>
To: Sergey Dyasli <sergey.dyasli@citrix.com>, xen-devel@lists.xen.org
Subject: Re: [PATCH v1 1/3] x86/vvmx: add mov-ss blocking check to vmentry
Date: Thu, 16 Mar 2017 11:23:53 -0700	[thread overview]
Message-ID: <0b61ea60-8766-d669-769e-3de28cae9cc6@oracle.com> (raw)
In-Reply-To: <20170313105143.20842-2-sergey.dyasli@citrix.com>

The Intel SDM also mentions POP-SS. Are you planning to do it via 
another patch ?

Also, I was wondering if it makes more sense to rename the new enum code as

     VMX_INSN_VMENTRY_BLOCKED

since it can then also be used for POP-SS.


-Krish

On 03/13/2017 03:51 AM, Sergey Dyasli wrote:
> Intel SDM states that if there is a current VMCS and there is MOV-SS
> blocking, VMFailValid occurs and control passes to the next instruction.
>
> Implement such behaviour for nested vmlaunch and vmresume.
>
> Signed-off-by: Sergey Dyasli <sergey.dyasli@citrix.com>
> ---
>   xen/arch/x86/hvm/vmx/vvmx.c        | 16 ++++++++++++++++
>   xen/include/asm-x86/hvm/vmx/vmcs.h |  1 +
>   2 files changed, 17 insertions(+)
>
> diff --git a/xen/arch/x86/hvm/vmx/vvmx.c b/xen/arch/x86/hvm/vmx/vvmx.c
> index e2c0951..09e4250 100644
> --- a/xen/arch/x86/hvm/vmx/vvmx.c
> +++ b/xen/arch/x86/hvm/vmx/vvmx.c
> @@ -1572,6 +1572,7 @@ int nvmx_handle_vmresume(struct cpu_user_regs *regs)
>       bool_t launched;
>       struct vcpu *v = current;
>       struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
> +    unsigned long intr_shadow;
>       int rc = vmx_inst_check_privilege(regs, 0);
>   
>       if ( rc != X86EMUL_OKAY )
> @@ -1583,6 +1584,13 @@ int nvmx_handle_vmresume(struct cpu_user_regs *regs)
>           return X86EMUL_OKAY;
>       }
>   
> +    __vmread(GUEST_INTERRUPTIBILITY_INFO, &intr_shadow);
> +    if ( intr_shadow & VMX_INTR_SHADOW_MOV_SS )
> +    {
> +        vmfail_valid(regs, VMX_INSN_VMENTRY_BLOCKED_BY_MOV_SS);
> +        return X86EMUL_OKAY;
> +    }
> +
>       launched = vvmcs_launched(&nvmx->launched_list,
>                                 PFN_DOWN(v->arch.hvm_vmx.vmcs_shadow_maddr));
>       if ( !launched )
> @@ -1598,6 +1606,7 @@ int nvmx_handle_vmlaunch(struct cpu_user_regs *regs)
>       bool_t launched;
>       struct vcpu *v = current;
>       struct nestedvmx *nvmx = &vcpu_2_nvmx(v);
> +    unsigned long intr_shadow;
>       int rc = vmx_inst_check_privilege(regs, 0);
>   
>       if ( rc != X86EMUL_OKAY )
> @@ -1609,6 +1618,13 @@ int nvmx_handle_vmlaunch(struct cpu_user_regs *regs)
>           return X86EMUL_OKAY;
>       }
>   
> +    __vmread(GUEST_INTERRUPTIBILITY_INFO, &intr_shadow);
> +    if ( intr_shadow & VMX_INTR_SHADOW_MOV_SS )
> +    {
> +        vmfail_valid(regs, VMX_INSN_VMENTRY_BLOCKED_BY_MOV_SS);
> +        return X86EMUL_OKAY;
> +    }
> +
>       launched = vvmcs_launched(&nvmx->launched_list,
>                                 PFN_DOWN(v->arch.hvm_vmx.vmcs_shadow_maddr));
>       if ( launched )
> diff --git a/xen/include/asm-x86/hvm/vmx/vmcs.h b/xen/include/asm-x86/hvm/vmx/vmcs.h
> index f465fff..dc5d91f 100644
> --- a/xen/include/asm-x86/hvm/vmx/vmcs.h
> +++ b/xen/include/asm-x86/hvm/vmx/vmcs.h
> @@ -515,6 +515,7 @@ enum vmx_insn_errno
>       VMX_INSN_VMPTRLD_INCORRECT_VMCS_ID     = 11,
>       VMX_INSN_UNSUPPORTED_VMCS_COMPONENT    = 12,
>       VMX_INSN_VMXON_IN_VMX_ROOT             = 15,
> +    VMX_INSN_VMENTRY_BLOCKED_BY_MOV_SS     = 26,
>       VMX_INSN_FAIL_INVALID                  = ~0,
>   };
>   


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  parent reply	other threads:[~2017-03-16 18:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-13 10:51 [PATCH v1 0/3] x86/vvmx: fixes for mov-ss and shadow vmcs handling Sergey Dyasli
2017-03-13 10:51 ` [PATCH v1 1/3] x86/vvmx: add mov-ss blocking check to vmentry Sergey Dyasli
2017-03-13 10:59   ` Andrew Cooper
2017-03-14  9:00   ` Tian, Kevin
2017-03-16 18:23   ` Krish Sadhukhan [this message]
2017-03-17  9:00     ` Sergey Dyasli
2017-03-13 10:51 ` [PATCH v1 2/3] x86/vvmx: correct nested shadow VMCS handling Sergey Dyasli
2017-03-14  9:11   ` Tian, Kevin
2017-03-13 10:51 ` [PATCH v1 3/3] x86/vvmx: add a shadow vmcs check to vmlaunch Sergey Dyasli
2017-03-14  9:11   ` Tian, Kevin
2017-03-16 18:24   ` Krish Sadhukhan
2017-03-16 18:32     ` Krish Sadhukhan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b61ea60-8766-d669-769e-3de28cae9cc6@oracle.com \
    --to=krish.sadhukhan@oracle.com \
    --cc=sergey.dyasli@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).