mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>, stable@vger.kernel.org
Subject: Re: [PATCH] KVM: VMX: Raise #GP when guest read/write forbidden IA32_XSS
Date: Thu, 20 Jun 2019 14:24:33 +0200	[thread overview]
Message-ID: <8ed08acd-6427-cb34-65b8-6d850eee1683@redhat.com> (raw)
In-Reply-To: <1561021202-13789-1-git-send-email-wanpengli@tencent.com>

On 20/06/19 11:00, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
> 
> Raise #GP when guest read/write forbidden IA32_XSS.  
> 
> Fixes: 203000993de5 (kvm: vmx: add MSR logic for XSAVES) 
> Reported-by: Xiaoyao Li <xiaoyao.li@linux.intel.com>
> Reported-by: Tao Xu <tao3.xu@intel.com>
> Cc: Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>

Queued, thanks.

Paolo

> ---
>  arch/x86/kvm/vmx/vmx.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index b939a68..d174b62 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -1732,7 +1732,10 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>  		return vmx_get_vmx_msr(&vmx->nested.msrs, msr_info->index,
>  				       &msr_info->data);
>  	case MSR_IA32_XSS:
> -		if (!vmx_xsaves_supported())
> +		if (!vmx_xsaves_supported() ||
> +			(!msr_info->host_initiated &&
> +			!(guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) &&
> +			guest_cpuid_has(vcpu, X86_FEATURE_XSAVES))))
>  			return 1;
>  		msr_info->data = vcpu->arch.ia32_xss;
>  		break;
> @@ -1962,7 +1965,10 @@ static int vmx_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
>  			return 1;
>  		return vmx_set_vmx_msr(vcpu, msr_index, data);
>  	case MSR_IA32_XSS:
> -		if (!vmx_xsaves_supported())
> +		if (!vmx_xsaves_supported() ||
> +			(!msr_info->host_initiated &&
> +			!(guest_cpuid_has(vcpu, X86_FEATURE_XSAVE) &&
> +			guest_cpuid_has(vcpu, X86_FEATURE_XSAVES))))
>  			return 1;
>  		/*
>  		 * The only supported bit as of Skylake is bit 8, but
> -- 2.7.4
> 


      reply	other threads:[~2019-06-20 12:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-20  9:00 Wanpeng Li
2019-06-20 12:24 ` Paolo Bonzini [this message]

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=8ed08acd-6427-cb34-65b8-6d850eee1683@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kernellwp@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rkrcmar@redhat.com \
    --cc=stable@vger.kernel.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

all inboxes | Powered by JetHome®