* [PATCH] KVM: MMU: fix check the reserved bits on the gpte of L2
@ 2013-08-05 4:59 Xiao Guangrong
2013-08-05 6:03 ` Gleb Natapov
2013-08-07 14:06 ` Paolo Bonzini
0 siblings, 2 replies; 3+ messages in thread
From: Xiao Guangrong @ 2013-08-05 4:59 UTC (permalink / raw)
To: Gleb Natapov; +Cc: Paolo Bonzini, Jan Kiszka, LKML, KVM
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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: MMU: fix check the reserved bits on the gpte of L2
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
2013-08-07 14:06 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Gleb Natapov @ 2013-08-05 6:03 UTC (permalink / raw)
To: Xiao Guangrong; +Cc: Paolo Bonzini, Jan Kiszka, LKML, KVM
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] KVM: MMU: fix check the reserved bits on the gpte of L2
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
@ 2013-08-07 14:06 ` Paolo Bonzini
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2013-08-07 14:06 UTC (permalink / raw)
To: Xiao Guangrong; +Cc: Gleb Natapov, Jan Kiszka, LKML, KVM
On 08/05/2013 06:59 AM, 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>
> ---
> 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;
> }
>
Applied, thanks.
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-08-07 14:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2013-08-07 14:06 ` Paolo Bonzini
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).