[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] x86: don't override INVALID_M2P_ENTRY with SHARED_M2P_ENTRY



While in most cases code ahead of the invocation of set_gpfn_from_mfn()
deals with shared pages, at least in set_typed_p2m_entry() I can't spot
such handling (it's entirely possible there's code missing there). Let's
try to play safe and add an extra check.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/include/asm-x86/mm.h
+++ b/xen/include/asm-x86/mm.h
@@ -525,9 +525,14 @@ extern const unsigned int *const compat_
 #endif /* CONFIG_PV32 */
 
 #define _set_gpfn_from_mfn(mfn, pfn) ({                        \
-    struct domain *d = page_get_owner(mfn_to_page(_mfn(mfn))); \
-    unsigned long entry = (d && (d == dom_cow)) ?              \
-        SHARED_M2P_ENTRY : (pfn);                              \
+    unsigned long entry = (pfn);                               \
+    if ( entry != INVALID_M2P_ENTRY )                          \
+    {                                                          \
+        const struct domain *d;                                \
+        d = page_get_owner(mfn_to_page(_mfn(mfn)));            \
+        if ( d && (d == dom_cow) )                             \
+            entry = SHARED_M2P_ENTRY;                          \
+    }                                                          \
     set_compat_m2p(mfn, (unsigned int)(entry));                \
     machine_to_phys_mapping[mfn] = (entry);                    \
 })




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.