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-3.2-testing] x86/64 compat: Replace hypervisor BUG_

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.2-testing] x86/64 compat: Replace hypervisor BUG_ON() with a cleaner hypercall failure.
From: "Xen patchbot-3.2-testing" <patchbot-3.2-testing@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 11 Apr 2008 01:30:39 -0700
Delivery-date: Fri, 11 Apr 2008 01:30:50 -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 1207901921 -3600
# Node ID f39b20085a3d18ff4801fafe1f4b5d029709b971
# Parent  b1339df987e90878b23a97d911bfed90cf893cfd
x86/64 compat: Replace hypervisor BUG_ON() with a cleaner hypercall failure.

While trying to run a 32-bit PV domU on a 64-bit hypervisor, I
triggered an assert in the hypervisor.  The assert dealt with the
maximum number of grants that a domU can have.  I made the hypervisor
a bit more graceful by returning an error rather than asserting.

Signed-off-by: Michael Abd-El-Malek <mabdelmalek@xxxxxxx>
xen-unstable changeset:   17438:115a1720e976a184b2c044541a99b413b2bf844e
xen-unstable date:        Fri Apr 11 09:10:58 2008 +0100
---
 xen/common/compat/grant_table.c |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diff -r b1339df987e9 -r f39b20085a3d xen/common/compat/grant_table.c
--- a/xen/common/compat/grant_table.c   Fri Apr 11 09:18:08 2008 +0100
+++ b/xen/common/compat/grant_table.c   Fri Apr 11 09:18:41 2008 +0100
@@ -109,12 +109,24 @@ int compat_grant_table_op(unsigned int c
                 rc = -EFAULT;
             else
             {
-                BUG_ON((COMPAT_ARG_XLAT_SIZE - sizeof(*nat.setup)) / 
sizeof(*nat.setup->frame_list.p) < max_nr_grant_frames);
+                unsigned int max_frame_list_size_in_page =
+                    (COMPAT_ARG_XLAT_SIZE - sizeof(*nat.setup)) /
+                    sizeof(*nat.setup->frame_list.p);
+                if ( max_frame_list_size_in_page < max_nr_grant_frames )
+                {
+                    gdprintk(XENLOG_WARNING,
+                             "max_nr_grant_frames is too large (%u,%u)\n",
+                             max_nr_grant_frames, max_frame_list_size_in_page);
+                    rc = -EINVAL;
+                }
+                else
+                {
 #define XLAT_gnttab_setup_table_HNDL_frame_list(_d_, _s_) \
-                set_xen_guest_handle((_d_)->frame_list, (unsigned long 
*)(nat.setup + 1))
-                XLAT_gnttab_setup_table(nat.setup, &cmp.setup);
+                    set_xen_guest_handle((_d_)->frame_list, (unsigned long 
*)(nat.setup + 1))
+                    XLAT_gnttab_setup_table(nat.setup, &cmp.setup);
 #undef XLAT_gnttab_setup_table_HNDL_frame_list
-                rc = gnttab_setup_table(guest_handle_cast(nat.uop, 
gnttab_setup_table_t), 1);
+                    rc = gnttab_setup_table(guest_handle_cast(nat.uop, 
gnttab_setup_table_t), 1);
+                }
             }
             if ( rc == 0 )
             {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.2-testing] x86/64 compat: Replace hypervisor BUG_ON() with a cleaner hypercall failure., Xen patchbot-3.2-testing <=