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

[Xen-changelog] [xen master] xen/arm: Allow a privileged domain to map foreign page from DOMID_XEN



commit 615897bc6c01c862a4136816f1354acbab2d40c2
Author:     Julien Grall <julien.grall@xxxxxxx>
AuthorDate: Fri Dec 21 16:26:47 2018 +0000
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Fri Dec 21 09:44:33 2018 -0800

    xen/arm: Allow a privileged domain to map foreign page from DOMID_XEN
    
    For auto-translated domain, the only way to map a page to itself is the
    using the foreign map API. The current code does not allow mapping page from
    special page (such as DOMID_XEN).
    
    As xentrace buffers are shared using DOMID_XEN, it is not possible to use
    tracing for Arm.
    
    This could be solved by using the helper get_pg_owner(). This helper will
    be able to get a reference on DOMID_XEN and therefore allow mapping for
    privileged domain.
    
    This patch replace the call to rcu_lock_domain_by_any_id() with
    get_pg_owner(). For consistency, all the call to rcu_unlock_domain are
    replaced by put_pg_owner().
    
    Signed-off-by: Julien grall <julien.grall@xxxxxxx>
    Reviewed-by: Andrii Anisov <andrii_anisov@xxxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/arch/arm/mm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index 3bf11eec4f..01ae2cccc0 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1233,20 +1233,20 @@ int xenmem_add_to_physmap_one(
         struct domain *od;
         p2m_type_t p2mt;
 
-        od = rcu_lock_domain_by_any_id(extra.foreign_domid);
+        od = get_pg_owner(extra.foreign_domid);
         if ( od == NULL )
             return -ESRCH;
 
         if ( od == d )
         {
-            rcu_unlock_domain(od);
+            put_pg_owner(od);
             return -EINVAL;
         }
 
         rc = xsm_map_gmfn_foreign(XSM_TARGET, d, od);
         if ( rc )
         {
-            rcu_unlock_domain(od);
+            put_pg_owner(od);
             return rc;
         }
 
@@ -1255,7 +1255,7 @@ int xenmem_add_to_physmap_one(
         page = get_page_from_gfn(od, idx, &p2mt, P2M_ALLOC);
         if ( !page )
         {
-            rcu_unlock_domain(od);
+            put_pg_owner(od);
             return -EINVAL;
         }
 
@@ -1264,13 +1264,13 @@ int xenmem_add_to_physmap_one(
         else
         {
             put_page(page);
-            rcu_unlock_domain(od);
+            put_pg_owner(od);
             return -EINVAL;
         }
 
         mfn = page_to_mfn(page);
 
-        rcu_unlock_domain(od);
+        put_pg_owner(od);
         break;
     }
     case XENMAPSPACE_dev_mmio:
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

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