All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Abd-El-Malek <mabdelmalek@cmu.edu>
To: xen-devel <xen-devel@lists.xensource.com>
Subject: [PATCH] Replace hypervisor assert
Date: Fri, 11 Apr 2008 02:04:13 -0400	[thread overview]
Message-ID: <47FEFF5D.8070704@cmu.edu> (raw)

[-- Attachment #1: Type: text/plain, Size: 327 bytes --]

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@cmu.edu>

[-- Attachment #2: vmm-grant-fix.txt --]
[-- Type: text/plain, Size: 1610 bytes --]

diff -r 304d4c6b3bfe -r 2a1818b9d63a xen/common/compat/grant_table.c
--- a/xen/common/compat/grant_table.c	Mon Mar 31 15:54:41 2008 -0400
+++ b/xen/common/compat/grant_table.c	Fri Apr 11 01:58:35 2008 -0400
@@ -109,12 +109,19 @@ 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) {
+                    printk("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 )
             {

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

                 reply	other threads:[~2008-04-11  6:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47FEFF5D.8070704@cmu.edu \
    --to=mabdelmalek@cmu.edu \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.