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] [xen-unstable] [XEN] Add more checking when reusing an a

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN] Add more checking when reusing an active grant reference.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 05 Sep 2006 15:40:18 +0000
Delivery-date: Tue, 05 Sep 2006 08:41:00 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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 ssmith@xxxxxxxxxxxxxxxxxxxxxxxxxx
# Node ID 3f568dd6bda6ee77b5343c855f896b6f94a105da
# Parent  ba39c2da5e84b11dd49fb38bb26b29ed585532bc
[XEN] Add more checking when reusing an active grant reference.

Signed-off-by: Steven Smith <sos22@xxxxxxxxx>
Based-on-a-patch-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
---
 xen/common/grant_table.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff -r ba39c2da5e84 -r 3f568dd6bda6 xen/common/grant_table.c
--- a/xen/common/grant_table.c  Tue Sep 05 13:57:30 2006 +0100
+++ b/xen/common/grant_table.c  Tue Sep 05 14:27:05 2006 +0100
@@ -175,12 +175,13 @@ __gnttab_map_grant_ref(
 
     spin_lock(&rd->grant_table->lock);
 
+    sdom = sha->domid;
+
     if ( !act->pin ||
          (!(op->flags & GNTMAP_readonly) &&
           !(act->pin & (GNTPIN_hstw_mask|GNTPIN_devw_mask))) )
     {
         sflags = sha->flags;
-        sdom   = sha->domid;
 
         /*
          * This loop attempts to set the access (reading/writing) flags
@@ -235,6 +236,10 @@ __gnttab_map_grant_ref(
             act->frame = gmfn_to_mfn(rd, sha->frame);
         }
     }
+    else if ( unlikely(sdom != ld->domain_id) )
+        PIN_FAIL(unlock_out, GNTST_general_error,
+                 "Bad domain (%d). (NB. expected dom %d)\n",
+                 sdom, ld->domain_id);
     else if ( (act->pin & 0x80808080U) != 0 )
         PIN_FAIL(unlock_out, ENOSPC,
                  "Risk of counter overflow %08x\n", act->pin);
@@ -771,11 +776,12 @@ __acquire_grant_for_copy(
 
     spin_lock(&rd->grant_table->lock);
     
+    sdom = sha->domid;
+
     if ( !act->pin ||
          (!readonly && !(act->pin & GNTPIN_hstw_mask)) )
     {
         sflags = sha->flags;
-        sdom = sha->domid;
 
         for ( ; ; )
         {
@@ -819,6 +825,10 @@ __acquire_grant_for_copy(
             act->frame = gmfn_to_mfn(rd, sha->frame);
         }
     }
+    else if ( unlikely(sdom != current->domain->domain_id) )
+        PIN_FAIL(unlock_out, GNTST_general_error,
+                 "Bad domain (%d). (NB. expected dom %d)\n",
+                 sdom, current->domain->domain_id);
     else if ( (act->pin & 0x80808080U) != 0 )
         PIN_FAIL(unlock_out, ENOSPC,
                  "Risk of counter overflow %08x\n", act->pin);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XEN] Add more checking when reusing an active grant reference., Xen patchbot-unstable <=