]> xenbits.xensource.com Git - xen.git/commitdiff
xen/p2m: Fix p2m_flush_table for non-nested cases
authorGeorge Dunlap <george.dunlap@citrix.com>
Mon, 20 Feb 2017 15:02:12 +0000 (16:02 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 20 Feb 2017 15:02:12 +0000 (16:02 +0100)
Commit 71bb7304e7a7a35ea6df4b0cedebc35028e4c159 added flushing of
nested p2m tables whenever the host p2m table changed.  Unfortunately
in the process, it added a filter to p2m_flush_table() function so
that the p2m would only be flushed if it was being used as a nested
p2m.  This meant that the p2m was not being flushed at all for altp2m
callers.

Only check np2m_base if p2m_class for nested p2m's.

NB that this is not a security issue: The only time this codepath is
called is in cases where either nestedp2m or altp2m is enabled, and
neither of them are in security support.

Reported-by: Matt Leinhos <matt@starlab.io>
Signed-off-by: George Dunlap <george.dunlap@citrix.com>
Reviewed-by: Tim Deegan <tim@xen.org>
Tested-by: Tamas K Lengyel <tamas@tklengyel.com>
master commit: 6192e6378e094094906950120470a621d5b2977c
master date: 2017-02-15 17:15:56 +0000

xen/arch/x86/mm/p2m.c

index 9b19769abe36e917537336783d8ab044e2df8d2f..d289c1cf3c5d27d695c8daf0ec54f01f7b12350c 100644 (file)
@@ -1965,7 +1965,8 @@ p2m_flush_table(struct p2m_domain *p2m)
     ASSERT(page_list_empty(&p2m->pod.super));
     ASSERT(page_list_empty(&p2m->pod.single));
 
-    if ( p2m->np2m_base == P2M_BASE_EADDR )
+    /* No need to flush if it's already empty */
+    if ( p2m_is_nestedp2m(p2m) && p2m->np2m_base == P2M_BASE_EADDR )
     {
         p2m_unlock(p2m);
         return;