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

[Xen-devel] [PATCH 1/2] xsm/flask: remove get_page call from update_va_mapping hook



This fixes the issue fixed by changeset 25605:9950f2dc2ee6, in another
function: GFN to MFN translation should not be done via a struct page
when possibly handling frames without an associated struct page.

Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
---
 xen/xsm/flask/hooks.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 23b84f3..f2e198e 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1372,8 +1372,9 @@ static int flask_update_va_mapping(struct domain *d, 
struct domain *f,
     int rc = 0;
     u32 psid;
     u32 map_perms = MMU__MAP_READ;
-    struct page_info *page = NULL;
     struct domain_security_struct *dsec;
+    unsigned long fgfn, fmfn;
+    p2m_type_t p2mt;
 
     if ( !(l1e_get_flags(pte) & _PAGE_PRESENT) )
         return 0;
@@ -1382,11 +1383,11 @@ static int flask_update_va_mapping(struct domain *d, 
struct domain *f,
         map_perms |= MMU__MAP_WRITE;
 
     dsec = d->ssid;
+    fgfn = l1e_get_pfn(pte);
+    fmfn = mfn_x(get_gfn_query(f, fgfn, &p2mt));
+    rc = get_mfn_sid(fmfn, &psid);
+    put_gfn(f, fgfn);
 
-    page = get_page_from_gfn(f, l1e_get_pfn(pte), NULL, P2M_ALLOC);
-    rc = get_mfn_sid(page ? page_to_mfn(page) : INVALID_MFN, &psid);
-    if ( page )
-        put_page(page);
     if ( rc )
         return rc;
 
-- 
1.7.11.2


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

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