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] Introduce guest_handle_subrange_okay() fo

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Introduce guest_handle_subrange_okay() for checking sub-sections of an
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 13 Jun 2008 14:10:40 -0700
Delivery-date: Fri, 13 Jun 2008 14:11:48 -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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1213361396 -3600
# Node ID 6e92603ed9f29d8599d330af7b69d443d1155340
# Parent  08fb9a4489f7b076e6177de7fc9dc746855a39a6
Introduce guest_handle_subrange_okay() for checking sub-sections of an
argument array. Needed where a compat shim is splitting up a 32-bit
guest's larger argument array, and only the currently-active part of
the translated array is contained within the compat_arg_xlat_area.

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/memory.c                |   13 ++++++++-----
 xen/include/asm-x86/guest_access.h |    5 +++++
 xen/include/xen/xencomm.h          |    1 +
 3 files changed, 14 insertions(+), 5 deletions(-)

diff -r 08fb9a4489f7 -r 6e92603ed9f2 xen/common/memory.c
--- a/xen/common/memory.c       Fri Jun 13 13:48:13 2008 +0100
+++ b/xen/common/memory.c       Fri Jun 13 13:49:56 2008 +0100
@@ -47,7 +47,8 @@ static void increase_reservation(struct 
     unsigned int node = domain_to_node(d);
 
     if ( !guest_handle_is_null(a->extent_list) &&
-         !guest_handle_okay(a->extent_list, a->nr_extents) )
+         !guest_handle_subrange_okay(a->extent_list, a->nr_done,
+                                     a->nr_extents-1) )
         return;
 
     if ( (a->extent_order != 0) &&
@@ -94,7 +95,8 @@ static void populate_physmap(struct memo
     struct domain *d = a->domain;
     unsigned int node = domain_to_node(d);
 
-    if ( !guest_handle_okay(a->extent_list, a->nr_extents) )
+    if ( !guest_handle_subrange_okay(a->extent_list, a->nr_done,
+                                     a->nr_extents-1) )
         return;
 
     if ( (a->extent_order != 0) &&
@@ -179,7 +181,8 @@ static void decrease_reservation(struct 
     unsigned long i, j;
     xen_pfn_t gmfn;
 
-    if ( !guest_handle_okay(a->extent_list, a->nr_extents) )
+    if ( !guest_handle_subrange_okay(a->extent_list, a->nr_done,
+                                     a->nr_extents-1) )
         return;
 
     for ( i = a->nr_done; i < a->nr_extents; i++ )
@@ -219,8 +222,8 @@ static long translate_gpfn_list(
     if ( op.nr_gpfns > (ULONG_MAX >> MEMOP_EXTENT_SHIFT) )
         return -EINVAL;
 
-    if ( !guest_handle_okay(op.gpfn_list, op.nr_gpfns) ||
-         !guest_handle_okay(op.mfn_list,  op.nr_gpfns) )
+    if ( !guest_handle_subrange_okay(op.gpfn_list, *progress, op.nr_gpfns-1) ||
+         !guest_handle_subrange_okay(op.mfn_list, *progress, op.nr_gpfns-1) )
         return -EFAULT;
 
     if ( op.domid == DOMID_SELF )
diff -r 08fb9a4489f7 -r 6e92603ed9f2 xen/include/asm-x86/guest_access.h
--- a/xen/include/asm-x86/guest_access.h        Fri Jun 13 13:48:13 2008 +0100
+++ b/xen/include/asm-x86/guest_access.h        Fri Jun 13 13:49:56 2008 +0100
@@ -79,6 +79,11 @@
 #define guest_handle_okay(hnd, nr)                      \
     (shadow_mode_external(current->domain) ||           \
      array_access_ok((hnd).p, (nr), sizeof(*(hnd).p)))
+#define guest_handle_subrange_okay(hnd, first, last)    \
+    (shadow_mode_external(current->domain) ||           \
+     array_access_ok((hnd).p + (first),                 \
+                     (last)-(first)+1,                  \
+                     sizeof(*(hnd).p)))
 
 #define __copy_to_guest_offset(hnd, off, ptr, nr) ({    \
     const typeof(*(ptr)) *_s = (ptr);                   \
diff -r 08fb9a4489f7 -r 6e92603ed9f2 xen/include/xen/xencomm.h
--- a/xen/include/xen/xencomm.h Fri Jun 13 13:48:13 2008 +0100
+++ b/xen/include/xen/xencomm.h Fri Jun 13 13:49:56 2008 +0100
@@ -62,6 +62,7 @@ static inline unsigned long xencomm_inli
 /* Since we run in real mode, we can safely access all addresses. That also
  * means our __routines are identical to our "normal" routines. */
 #define guest_handle_okay(hnd, nr) 1
+#define guest_handle_subrange_okay(hnd, first, last) 1
 
 /*
  * Copy an array of objects to guest context via a guest handle.

_______________________________________________
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] Introduce guest_handle_subrange_okay() for checking sub-sections of an, Xen patchbot-unstable <=