All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] grant table and bogus mfns
Date: Fri, 9 Nov 2007 15:13:09 +0000	[thread overview]
Message-ID: <20071109151309.GE3841@implementation.uk.xensource.com> (raw)

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

Hi,

While developping a frontend, I noticed that if I gave a grant on mfn 0
to a backend (which is bogus), that backend would happily be allowed to
map it, and hence Oops...

This is because mfn 0 is considered as iomem, and in that case
gnttab_map_grant_ref only checks that the target domain is allowed to
access it.  The patch below makes it check that the source domain was
allowed to access it (and then give the target access to it).

Samuel

Signed-Off-By: Samuel Thibault <samuel.thibault@eu.citrix.com>

diff -r 4bf62459d45a xen/common/grant_table.c
--- a/xen/common/grant_table.c	Wed Nov 07 11:29:38 2007 +0000
+++ b/xen/common/grant_table.c	Fri Nov 09 15:01:57 2007 +0000
@@ -335,7 +335,8 @@ __gnttab_map_grant_ref(
         if ( iomem_page_test(frame, mfn_to_page(frame)) )
         {
             is_iomem = 1;
-            if ( iomem_permit_access(ld, frame, frame) )
+            if ( !iomem_access_permitted(rd, frame, frame)
+                  || iomem_permit_access(ld, frame, frame) )
             {
                 gdprintk(XENLOG_WARNING, 
                          "Could not permit access to grant frame "

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 617 bytes --]

diff -r 4bf62459d45a xen/common/grant_table.c
--- a/xen/common/grant_table.c	Wed Nov 07 11:29:38 2007 +0000
+++ b/xen/common/grant_table.c	Fri Nov 09 15:01:57 2007 +0000
@@ -335,7 +335,8 @@ __gnttab_map_grant_ref(
         if ( iomem_page_test(frame, mfn_to_page(frame)) )
         {
             is_iomem = 1;
-            if ( iomem_permit_access(ld, frame, frame) )
+            if ( !iomem_access_permitted(rd, frame, frame)
+                  || iomem_permit_access(ld, frame, frame) )
             {
                 gdprintk(XENLOG_WARNING, 
                          "Could not permit access to grant frame "

[-- 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:[~2007-11-09 15:13 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-09 15:13 Samuel Thibault [this message]
2007-11-10  9:28 ` [PATCH] grant table and bogus mfns Keir Fraser
2007-11-12  9:35   ` Kieran Mansley
2007-11-12 12:23     ` Kieran Mansley
2007-11-13  4:48     ` Keir Fraser
2007-11-13 16:40       ` Kieran Mansley
2007-11-13 16:45         ` Keir Fraser
2007-11-13 17:06           ` Kieran Mansley
2007-11-13 17:12             ` Keir Fraser
2007-11-14 16:47               ` Kieran Mansley
2007-11-14  6:50         ` about parallex fs tgh
2007-12-02  5:18           ` Mark Williamson
2007-12-02  5:25             ` Andrew Warfield
2007-12-02 16:17               ` Mark Williamson

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=20071109151309.GE3841@implementation.uk.xensource.com \
    --to=samuel.thibault@eu.citrix.com \
    --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.