All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] Fix p2m_set_suppress_ve
@ 2019-04-03 14:29 Alexandru Stefan ISAILA
  2019-04-03 14:58 ` Jan Beulich
  0 siblings, 1 reply; 27+ messages in thread
From: Alexandru Stefan ISAILA @ 2019-04-03 14:29 UTC (permalink / raw)
  To: xen-devel
  Cc: wei.liu2, george.dunlap, andrew.cooper3, jbeulich,
	Alexandru Stefan ISAILA, roger.pau

On a new altp2m view the p2m_set_suppress_ve() func will fail with invalid mfn
from p2m->get_entry() if the p2m->set_entry() was not called before.

This patch solves the problem by getting the mfn from __get_gfn_type_access()
and then returning error if the mfn is invalid.

Signed-off-by: Alexandru Isaila <aisaila@bitdefender.com>
---
 xen/arch/x86/mm/p2m.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c
index b9bbb8f485..3e6e5ef152 100644
--- a/xen/arch/x86/mm/p2m.c
+++ b/xen/arch/x86/mm/p2m.c
@@ -3011,8 +3011,16 @@ int p2m_set_suppress_ve(struct domain *d, gfn_t gfn, bool suppress_ve,
     mfn = p2m->get_entry(p2m, gfn, &t, &a, 0, NULL, NULL);
     if ( !mfn_valid(mfn) )
     {
-        rc = -ESRCH;
-        goto out;
+        unsigned int page_order;
+
+        mfn = __get_gfn_type_access(host_p2m, gfn_x(gfn), &t, &a,
+                                    P2M_ALLOC | P2M_UNSHARE, &page_order, 0);
+
+        if ( !mfn_valid(mfn) )
+        {
+            rc = -ESRCH;
+            goto out;
+        }
     }
 
     rc = p2m->set_entry(p2m, gfn, mfn, PAGE_ORDER_4K, t, a, suppress_ve);
-- 
2.17.1


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2019-04-05 14:00 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-03 14:29 [PATCH v1] Fix p2m_set_suppress_ve Alexandru Stefan ISAILA
2019-04-03 14:58 ` Jan Beulich
2019-04-03 15:17   ` Razvan Cojocaru
2019-04-03 15:30     ` Jan Beulich
2019-04-03 15:48       ` Razvan Cojocaru
2019-04-03 16:04         ` Jan Beulich
2019-04-03 16:16           ` Tamas K Lengyel
2019-04-03 17:07             ` Razvan Cojocaru
2019-04-03 17:12               ` Tamas K Lengyel
2019-04-04 10:16             ` Jan Beulich
2019-04-03 17:41           ` Razvan Cojocaru
2019-04-04 10:47             ` Jan Beulich
2019-04-04 12:46       ` Razvan Cojocaru
2019-04-04 12:49         ` Andrew Cooper
2019-04-04 13:15           ` Tamas K Lengyel
2019-04-04 12:50         ` Razvan Cojocaru
2019-04-04 13:09           ` Tamas K Lengyel
2019-04-04 14:36             ` Jan Beulich
2019-04-04 14:43               ` Tamas K Lengyel
2019-04-04 14:51                 ` Jan Beulich
2019-04-04 15:06                   ` Tamas K Lengyel
2019-04-04 14:54               ` George Dunlap
2019-04-05  7:36                 ` Jan Beulich
2019-04-05  7:36                   ` [Xen-devel] " Jan Beulich
2019-04-05 13:59                   ` Tamas K Lengyel
2019-04-05 13:59                     ` [Xen-devel] " Tamas K Lengyel
2019-04-04 14:32           ` Jan Beulich

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.