diff mbox series

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

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

Commit Message

Alexandru Stefan ISAILA April 5, 2019, 1:25 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 1f852694ff..6dee0052f8 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -2974,6 +2974,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 )
     {
@@ -2991,7 +2992,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;