Skip to contentSkip to conversation

xsm: Add support for HVMOP_track_dirty_vram.

PATCH In review Jean Guyader 2 participants 3 messages Nov 7, 2011 – Nov 17, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xsm: Add support for HVMOP_track_dirty_vram.

Xen try to inforce the xsm policy when a HVMOP_track_dirty_vram is received (xen/arch/x86/hvm/hvm.c:3637). It was failing because in flask_hvmcontext, xsm didn't have any case for this operation.

---
 tools/flask/policy/policy/flask/access_vectors |    1 +
 tools/flask/policy/policy/modules/xen/xen.if   |    2 +-
 xen/xsm/flask/hooks.c                          |    3 +++
 xen/xsm/flask/include/av_perm_to_string.h      |    1 +
 xen/xsm/flask/include/av_permissions.h         |    1 +
 5 files changed, 7 insertions(+), 1 deletions(-)
tools/flask/policy/policy/flask/access_vectors +1 -0
index 27fb9d7..9d09c5b 100644
@@ -90,6 +90,7 @@ class hvm
     pciroute
 	bind_irq
 	cacheattr
+    trackdirtyvram
 }
 
 class event
tools/flask/policy/policy/modules/xen/xen.if +1 -1
index 99afad6..bf3b794 100644
@@ -22,7 +22,7 @@ define(`create_domain', `
 ################################################################################
 define(`create_hvm_dom', `
 	create_domain($1, $2, $3)
-	allow $1 $2:hvm { setparam getparam cacheattr pciroute irqlevel	pcilevel };
+	allow $1 $2:hvm { setparam getparam cacheattr pciroute irqlevel	pcilevel trackdirtyvram };
 	allow $2 $2:hvm setparam;
 ')	
 
xen/xsm/flask/hooks.c +3 -0
index 30c91e5..e70feda 100644
@@ -816,6 +816,9 @@ static int flask_hvmcontext(struct domain *d, uint32_t cmd)
     case XEN_DOMCTL_gethvmcontext_partial:
         perm = HVM__GETHVMC;
         break;
+    case HVMOP_track_dirty_vram:
+        perm = HVM__TRACKDIRTYVRAM;
+        break;
     default:
         return -EPERM;
     }
xen/xsm/flask/include/av_perm_to_string.h +1 -0
index b10a252..c32488e 100644
@@ -56,6 +56,7 @@
    S_(SECCLASS_HVM, HVM__GETHVMC, "gethvmc")
    S_(SECCLASS_HVM, HVM__SETPARAM, "setparam")
    S_(SECCLASS_HVM, HVM__GETPARAM, "getparam")
+   S_(SECCLASS_HVM, HVM__TRACKDIRTYVRAM, "trackdirtyvram")
    S_(SECCLASS_HVM, HVM__PCILEVEL, "pcilevel")
    S_(SECCLASS_HVM, HVM__IRQLEVEL, "irqlevel")
    S_(SECCLASS_HVM, HVM__PCIROUTE, "pciroute")
xen/xsm/flask/include/av_permissions.h +1 -0
index 14bd053..f5dcc6f 100644
@@ -63,6 +63,7 @@
 #define HVM__PCIROUTE                             0x00000040UL
 #define HVM__BIND_IRQ                             0x00000080UL
 #define HVM__CACHEATTR                            0x00000100UL
+#define HVM__TRACKDIRTYVRAM                       0x00000200UL
 
 #define EVENT__BIND                               0x00000001UL
 #define EVENT__SEND                               0x00000002UL

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 6 lines · Jean Guyader

Xen try to inforce the xsm policy when a HVMOP_track_dirty_vram is received (xen/arch/x86/hvm/hvm.c:3637). It was failing because in flask_hvmcontext, xsm didn't have any case for this operation.

Can this patch go to 4.1 as well?

Thanks,
Jean

#2 lore raw
Quoted 9 lines · Jean Guyader
Quoted 6 lines · Jean Guyader

Xen try to inforce the xsm policy when a HVMOP_track_dirty_vram is received (xen/arch/x86/hvm/hvm.c:3637). It was failing because in flask_hvmcontext, xsm didn't have any case for this operation.

Can this patch go to 4.1 as well?

Done.

Quoted 7 lines

Thanks,
Jean

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel