stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] KVM: x86/mmu: Fix struct guest_walker arrays for 5-level" failed to apply to 5.4-stable tree
@ 2020-02-17 19:14 gregkh
  2020-02-18 17:44 ` Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2020-02-17 19:14 UTC (permalink / raw)
  To: sean.j.christopherson, pbonzini; +Cc: stable


The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From f6ab0107a4942dbf9a5cf0cca3f37e184870a360 Mon Sep 17 00:00:00 2001
From: Sean Christopherson <sean.j.christopherson@intel.com>
Date: Fri, 7 Feb 2020 09:37:42 -0800
Subject: [PATCH] KVM: x86/mmu: Fix struct guest_walker arrays for 5-level
 paging

Define PT_MAX_FULL_LEVELS as PT64_ROOT_MAX_LEVEL, i.e. 5, to fix shadow
paging for 5-level guest page tables.  PT_MAX_FULL_LEVELS is used to
size the arrays that track guest pages table information, i.e. using a
"max levels" of 4 causes KVM to access garbage beyond the end of an
array when querying state for level 5 entries.  E.g. FNAME(gpte_changed)
will read garbage and most likely return %true for a level 5 entry,
soft-hanging the guest because FNAME(fetch) will restart the guest
instead of creating SPTEs because it thinks the guest PTE has changed.

Note, KVM doesn't yet support 5-level nested EPT, so PT_MAX_FULL_LEVELS
gets to stay "4" for the PTTYPE_EPT case.

Fixes: 855feb673640 ("KVM: MMU: Add 5 level EPT & Shadow page table support.")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

diff --git a/arch/x86/kvm/mmu/paging_tmpl.h b/arch/x86/kvm/mmu/paging_tmpl.h
index 4e1ef0473663..e4c8a4cbf407 100644
--- a/arch/x86/kvm/mmu/paging_tmpl.h
+++ b/arch/x86/kvm/mmu/paging_tmpl.h
@@ -33,7 +33,7 @@
 	#define PT_GUEST_ACCESSED_SHIFT PT_ACCESSED_SHIFT
 	#define PT_HAVE_ACCESSED_DIRTY(mmu) true
 	#ifdef CONFIG_X86_64
-	#define PT_MAX_FULL_LEVELS 4
+	#define PT_MAX_FULL_LEVELS PT64_ROOT_MAX_LEVEL
 	#define CMPXCHG cmpxchg
 	#else
 	#define CMPXCHG cmpxchg64


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] KVM: x86/mmu: Fix struct guest_walker arrays for 5-level" failed to apply to 5.4-stable tree
  2020-02-17 19:14 FAILED: patch "[PATCH] KVM: x86/mmu: Fix struct guest_walker arrays for 5-level" failed to apply to 5.4-stable tree gregkh
@ 2020-02-18 17:44 ` Sasha Levin
  2020-02-18 17:47   ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2020-02-18 17:44 UTC (permalink / raw)
  To: gregkh; +Cc: sean.j.christopherson, pbonzini, stable

On Mon, Feb 17, 2020 at 08:14:31PM +0100, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 5.4-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From f6ab0107a4942dbf9a5cf0cca3f37e184870a360 Mon Sep 17 00:00:00 2001
>From: Sean Christopherson <sean.j.christopherson@intel.com>
>Date: Fri, 7 Feb 2020 09:37:42 -0800
>Subject: [PATCH] KVM: x86/mmu: Fix struct guest_walker arrays for 5-level
> paging
>
>Define PT_MAX_FULL_LEVELS as PT64_ROOT_MAX_LEVEL, i.e. 5, to fix shadow
>paging for 5-level guest page tables.  PT_MAX_FULL_LEVELS is used to
>size the arrays that track guest pages table information, i.e. using a
>"max levels" of 4 causes KVM to access garbage beyond the end of an
>array when querying state for level 5 entries.  E.g. FNAME(gpte_changed)
>will read garbage and most likely return %true for a level 5 entry,
>soft-hanging the guest because FNAME(fetch) will restart the guest
>instead of creating SPTEs because it thinks the guest PTE has changed.
>
>Note, KVM doesn't yet support 5-level nested EPT, so PT_MAX_FULL_LEVELS
>gets to stay "4" for the PTTYPE_EPT case.
>
>Fixes: 855feb673640 ("KVM: MMU: Add 5 level EPT & Shadow page table support.")
>Cc: stable@vger.kernel.org
>Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

File name is different in 5.4 and 4.19. Fixed and queued up for both.

-- 
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FAILED: patch "[PATCH] KVM: x86/mmu: Fix struct guest_walker arrays for 5-level" failed to apply to 5.4-stable tree
  2020-02-18 17:44 ` Sasha Levin
@ 2020-02-18 17:47   ` Sean Christopherson
  0 siblings, 0 replies; 3+ messages in thread
From: Sean Christopherson @ 2020-02-18 17:47 UTC (permalink / raw)
  To: Sasha Levin; +Cc: gregkh, pbonzini, stable

On Tue, Feb 18, 2020 at 12:44:51PM -0500, Sasha Levin wrote:
> On Mon, Feb 17, 2020 at 08:14:31PM +0100, gregkh@linuxfoundation.org wrote:
> >
> >The patch below does not apply to the 5.4-stable tree.
> >If someone wants it applied there, or to any other stable or longterm
> >tree, then please email the backport, including the original git commit
> >id to <stable@vger.kernel.org>.
> >
> >thanks,
> >
> >greg k-h
> >
> >------------------ original commit in Linus's tree ------------------
> >
> >From f6ab0107a4942dbf9a5cf0cca3f37e184870a360 Mon Sep 17 00:00:00 2001
> >From: Sean Christopherson <sean.j.christopherson@intel.com>
> >Date: Fri, 7 Feb 2020 09:37:42 -0800
> >Subject: [PATCH] KVM: x86/mmu: Fix struct guest_walker arrays for 5-level
> >paging
> >
> >Define PT_MAX_FULL_LEVELS as PT64_ROOT_MAX_LEVEL, i.e. 5, to fix shadow
> >paging for 5-level guest page tables.  PT_MAX_FULL_LEVELS is used to
> >size the arrays that track guest pages table information, i.e. using a
> >"max levels" of 4 causes KVM to access garbage beyond the end of an
> >array when querying state for level 5 entries.  E.g. FNAME(gpte_changed)
> >will read garbage and most likely return %true for a level 5 entry,
> >soft-hanging the guest because FNAME(fetch) will restart the guest
> >instead of creating SPTEs because it thinks the guest PTE has changed.
> >
> >Note, KVM doesn't yet support 5-level nested EPT, so PT_MAX_FULL_LEVELS
> >gets to stay "4" for the PTTYPE_EPT case.
> >
> >Fixes: 855feb673640 ("KVM: MMU: Add 5 level EPT & Shadow page table support.")
> >Cc: stable@vger.kernel.org
> >Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
> >Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> 
> File name is different in 5.4 and 4.19. Fixed and queued up for both.

Thanks!  Backporting the non-trivial conflicts is on my todo list,
unfortunately my todo list is rather long right now...

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-02-18 17:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 19:14 FAILED: patch "[PATCH] KVM: x86/mmu: Fix struct guest_walker arrays for 5-level" failed to apply to 5.4-stable tree gregkh
2020-02-18 17:44 ` Sasha Levin
2020-02-18 17:47   ` Sean Christopherson

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).