kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Jan Kiszka <jan.kiszka@siemens.com>,
	LKML <linux-kernel@vger.kernel.org>, KVM <kvm@vger.kernel.org>
Subject: Re: [PATCH] KVM: MMU: fix check the reserved bits on the gpte of L2
Date: Mon, 5 Aug 2013 09:03:24 +0300	[thread overview]
Message-ID: <20130805060324.GA1550@redhat.com> (raw)
In-Reply-To: <51FF3127.5030206@linux.vnet.ibm.com>

On Mon, Aug 05, 2013 at 12:59:19PM +0800, Xiao Guangrong wrote:
> Current code always uses arch.mmu to check the reserved bits on guest gpte
> which is valid only for L1 guest, we should use arch.nested_mmu instead when
> we translate gva to gpa for the L2 guest
> 
> Fix it by using @mmu instead since it is adapted to the current mmu mode
> automatically
> 
> The bug can be triggered when nested npt is used and L1 guest and L2 guest
> use different mmu mode
> 
> Reported-by: Jan Kiszka <jan.kiszka@siemens.com>
> Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
Reviewed-by: Gleb Natapov <gleb@redhat.com>

> ---
>  arch/x86/kvm/paging_tmpl.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
> index 7769699..3a75828 100644
> --- a/arch/x86/kvm/paging_tmpl.h
> +++ b/arch/x86/kvm/paging_tmpl.h
> @@ -218,8 +218,7 @@ retry_walk:
>  		if (unlikely(!is_present_gpte(pte)))
>  			goto error;
> 
> -		if (unlikely(is_rsvd_bits_set(&vcpu->arch.mmu, pte,
> -					      walker->level))) {
> +		if (unlikely(is_rsvd_bits_set(mmu, pte, walker->level))) {
>  			errcode |= PFERR_RSVD_MASK | PFERR_PRESENT_MASK;
>  			goto error;
>  		}
> -- 
> 1.8.1.4

--
			Gleb.

  reply	other threads:[~2013-08-05  6:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05  4:59 [PATCH] KVM: MMU: fix check the reserved bits on the gpte of L2 Xiao Guangrong
2013-08-05  6:03 ` Gleb Natapov [this message]
2013-08-07 14:06 ` Paolo Bonzini

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=20130805060324.GA1550@redhat.com \
    --to=gleb@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=xiaoguangrong@linux.vnet.ibm.com \
    /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).