All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "KVM: MMU: fix smap permission check" has been added to the 4.0-stable tree
@ 2015-06-02  7:22 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2015-06-02  7:22 UTC (permalink / raw)
  To: guangrong.xiao, gregkh, pbonzini; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    KVM: MMU: fix smap permission check

to the 4.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kvm-mmu-fix-smap-permission-check.patch
and it can be found in the queue-4.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From 7cbeed9bce7580479bb97457dad220cb3594b875 Mon Sep 17 00:00:00 2001
From: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Date: Thu, 7 May 2015 16:20:15 +0800
Subject: KVM: MMU: fix smap permission check

From: Xiao Guangrong <guangrong.xiao@linux.intel.com>

commit 7cbeed9bce7580479bb97457dad220cb3594b875 upstream.

Current permission check assumes that RSVD bit in PFEC is always zero,
however, it is not true since MMIO #PF will use it to quickly identify
MMIO access

Fix it by clearing the bit if walking guest page table is needed

Signed-off-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kvm/mmu.h         |    2 ++
 arch/x86/kvm/paging_tmpl.h |    7 +++++++
 2 files changed, 9 insertions(+)

--- a/arch/x86/kvm/mmu.h
+++ b/arch/x86/kvm/mmu.h
@@ -166,6 +166,8 @@ static inline bool permission_fault(stru
 	int index = (pfec >> 1) +
 		    (smap >> (X86_EFLAGS_AC_BIT - PFERR_RSVD_BIT + 1));
 
+	WARN_ON(pfec & PFERR_RSVD_MASK);
+
 	return (mmu->permissions[index] >> pte_access) & 1;
 }
 
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -718,6 +718,13 @@ static int FNAME(page_fault)(struct kvm_
 					      mmu_is_nested(vcpu));
 		if (likely(r != RET_MMIO_PF_INVALID))
 			return r;
+
+		/*
+		 * page fault with PFEC.RSVD  = 1 is caused by shadow
+		 * page fault, should not be used to walk guest page
+		 * table.
+		 */
+		error_code &= ~PFERR_RSVD_MASK;
 	};
 
 	r = mmu_topup_memory_caches(vcpu);


Patches currently in stable-queue which might be from guangrong.xiao@linux.intel.com are

queue-4.0/kvm-mmu-fix-smap-permission-check.patch
queue-4.0/kvm-mmu-fix-cr4.smep-1-cr0.wp-0-with-shadow-pages.patch
queue-4.0/kvm-mmu-fix-smap-virtualization.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-02  7:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02  7:22 Patch "KVM: MMU: fix smap permission check" has been added to the 4.0-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.