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

[Xen-changelog] [xen-unstable] xsm/flask: avoid struct page lookup in mmu_normal_update


  • To: xen-changelog@xxxxxxxxxxxxxxxxxxx
  • From: Xen patchbot-unstable <patchbot@xxxxxxx>
  • Date: Mon, 09 Jul 2012 19:00:18 +0000
  • Delivery-date: Mon, 09 Jul 2012 19:00:30 +0000
  • List-id: "Change log for Mercurial \(receive only\)" <xen-changelog.lists.xen.org>

# HG changeset patch
# User Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
# Date 1341825027 -3600
# Node ID 9950f2dc2ee6dfd172258a5a4ee29809b0ff8263
# Parent  7d3401621bb5af42a48cac94ca5b8434e4e547cc
xsm/flask: avoid struct page lookup in mmu_normal_update

Since the mmu_normal_update hook is called even when mapping MFNs
without an associated struct page, attempting to use the struct page
to map between GFN and MFN will cause crashes. Use get_gfn_query
instead.

Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Committed-by: Keir Fraser <keir@xxxxxxx>
---


diff -r 7d3401621bb5 -r 9950f2dc2ee6 xen/xsm/flask/hooks.c
--- a/xen/xsm/flask/hooks.c     Mon Jul 09 10:09:44 2012 +0100
+++ b/xen/xsm/flask/hooks.c     Mon Jul 09 10:10:27 2012 +0100
@@ -1314,11 +1314,11 @@ static int flask_mmu_normal_update(struc
 {
     int rc = 0;
     u32 map_perms = MMU__MAP_READ;
-    unsigned long fmfn;
+    unsigned long fgfn, fmfn;
     struct domain_security_struct *dsec;
     u32 fsid;
     struct avc_audit_data ad;
-    struct page_info *page = NULL;
+    p2m_type_t p2mt;
 
     if (d != t)
         rc = domain_has_perm(d, t, SECCLASS_MMU, MMU__REMOTE_REMAP);
@@ -1334,9 +1334,9 @@ static int flask_mmu_normal_update(struc
         map_perms |= MMU__MAP_WRITE;
 
     AVC_AUDIT_DATA_INIT(&ad, MEMORY);
-    page = get_page_from_gfn(f, l1e_get_pfn(l1e_from_intpte(fpte)),
-                             NULL, P2M_ALLOC);
-    fmfn = page ? page_to_mfn(page) : INVALID_MFN;
+    fgfn = l1e_get_pfn(l1e_from_intpte(fpte));
+    fmfn = mfn_x(get_gfn_query(f, fgfn, &p2mt));
+
     ad.sdom = d;
     ad.tdom = f;
     ad.memory.pte = fpte;
@@ -1344,8 +1344,7 @@ static int flask_mmu_normal_update(struc
 
     rc = get_mfn_sid(fmfn, &fsid);
 
-    if ( page )
-        put_page(page);
+    put_gfn(f, fgfn);
 
     if ( rc )
         return rc;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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