diff mbox series

[v3,3/3] x86/mm: Fix p2m_set_suppress_ve

Message ID 20190409120324.13940-3-aisaila@bitdefender.com (mailing list archive)
State New, archived
Headers show
Series [v3,1/3] x86/mm: Introduce altp2m_get_gfn_type_access | expand

Commit Message

Alexandru Stefan ISAILA April 9, 2019, 12:04 p.m. UTC
On a new altp2m view the p2m_set_suppress_ve() func will fail with invalid mfn
from p2m->get_entry() if p2m->set_entry() was not called before.

This patch solves the problem by getting the mfn from hostp2m.

Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
---
 xen/arch/x86/mm/p2m.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index d38d7c29ca..aee82f814d 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2982,6 +2982,7 @@  int p2m_set_suppress_ve(struct domain *d, gfn_t gfn, bool suppress_ve,
     p2m_access_t a;
     p2m_type_t t;
     int rc;
+    bool found_in_hostp2m;
 
     if ( altp2m_idx > 0 )
     {
@@ -2999,7 +3000,7 @@  int p2m_set_suppress_ve(struct domain *d, gfn_t gfn, bool suppress_ve,
     if ( ap2m )
         p2m_lock(ap2m);
 
-    mfn = p2m->get_entry(p2m, gfn, &t, &a, 0, NULL, NULL);
+    mfn = altp2m_get_gfn_type_access(p2m, gfn, &t, &a, NULL, &found_in_hostp2m);
     if ( !mfn_valid(mfn) )
     {
         rc = -ESRCH;