WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Prevent a guest from specifying its own domain id when

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Prevent a guest from specifying its own domain id when
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 08 Feb 2006 18:36:11 +0000
Delivery-date: Wed, 08 Feb 2006 18:48:18 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID b246f429f683cce73bf7486c37bf6842983fa49f
# Parent  6ba371536f5cbc2f0973c0e86881fec337828638
Prevent a guest from specifying its own domain id when
making a 'foreign' page mapping. It must use DOMID_SELF.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r 6ba371536f5c -r b246f429f683 xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Wed Feb  8 16:25:14 2006
+++ b/xen/arch/x86/mm.c Wed Feb  8 16:26:20 2006
@@ -1641,14 +1641,18 @@
     struct domain *e, *d = current->domain;
     int okay = 1;
 
-    if ( (e = percpu_info[cpu].foreign) != NULL )
-        put_domain(e);
-    percpu_info[cpu].foreign = NULL;
-    
-    if ( domid == DOMID_SELF )
+    ASSERT(percpu_info[cpu].foreign == NULL);
+
+    if ( likely(domid == DOMID_SELF) )
         goto out;
 
-    if ( !IS_PRIV(d) )
+    if ( domid == d->domain_id )
+    {
+        MEM_LOG("Dom %u tried to specify itself as foreign domain",
+                d->domain_id);
+        okay = 0;
+    }
+    else if ( !IS_PRIV(d) )
     {
         switch ( domid )
         {
@@ -1734,7 +1738,7 @@
 
     if ( !set_foreigndom(cpu, foreigndom) )
     {
-        rc = -EINVAL;
+        rc = -ESRCH;
         goto out;
     }
 
@@ -1993,7 +1997,7 @@
 
     if ( !set_foreigndom(cpu, foreigndom) )
     {
-        rc = -EINVAL;
+        rc = -ESRCH;
         goto out;
     }
 
@@ -2580,18 +2584,13 @@
                                      domid_t domid)
 {
     unsigned int cpu = smp_processor_id();
-    struct domain *d;
     int rc;
 
     if ( unlikely(!IS_PRIV(current->domain)) )
         return -EPERM;
 
-    percpu_info[cpu].foreign = d = find_domain_by_id(domid);
-    if ( unlikely(d == NULL) )
-    {
-        MEM_LOG("Unknown domain '%u'", domid);
+    if ( !set_foreigndom(cpu, domid) )
         return -ESRCH;
-    }
 
     rc = do_update_va_mapping(va, val64, flags);
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Prevent a guest from specifying its own domain id when, Xen patchbot -unstable <=