[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 1/2] xsm: move the XSM_MAGIC value to Kconfig



Let Kconfig set the XSM_MAGIC value for us.

Signed-off-by: Doug Goldstein <cardoe@xxxxxxxxxx>
---
CC: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
---
 xen/common/Kconfig       | 8 ++++++++
 xen/include/xen/config.h | 1 -
 xen/include/xsm/xsm.h    | 5 +----
 xen/xsm/xsm_core.c       | 4 ++--
 xen/xsm/xsm_policy.c     | 6 +++---
 5 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 8fbc46d..d661da3 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -113,6 +113,14 @@ config XSM
 
          If unsure, say N.
 
+# XSM magic for policy detection
+config XSM_MAGIC
+    hex
+    default 0xf97cff8c if FLASK
+    default 0 if !FLASK
+    ---help---
+      Identifies a FLASK XSM policy start point
+
 # Enable schedulers
 menu "Schedulers"
        visible if EXPERT = "y"
diff --git a/xen/include/xen/config.h b/xen/include/xen/config.h
index 96f5539..3f8c53d 100644
--- a/xen/include/xen/config.h
+++ b/xen/include/xen/config.h
@@ -79,7 +79,6 @@
 #define STR(...) __STR(__VA_ARGS__)
 
 #ifdef CONFIG_FLASK
-#define XSM_MAGIC 0xf97cff8c
 /* Maintain statistics on the access vector cache */
 #define FLASK_AVC_STATS 1
 #endif
diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h
index 3afed70..7f313ad 100644
--- a/xen/include/xsm/xsm.h
+++ b/xen/include/xsm/xsm.h
@@ -21,11 +21,8 @@
 typedef void xsm_op_t;
 DEFINE_XEN_GUEST_HANDLE(xsm_op_t);
 
-/* policy magic number (defined by XSM_MAGIC) */
+/* policy magic number (defined by CONFIG_XSM_MAGIC) */
 typedef u32 xsm_magic_t;
-#ifndef XSM_MAGIC
-#define XSM_MAGIC 0x00000000
-#endif
 
 /* These annotations are used by callers and in dummy.h to document the
  * default actions of XSM hooks. They should be compiled out otherwise.
diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c
index 5e432de..d6965ba 100644
--- a/xen/xsm/xsm_core.c
+++ b/xen/xsm/xsm_core.c
@@ -67,7 +67,7 @@ int __init xsm_multiboot_init(unsigned long *module_map,
 
     printk("XSM Framework v" XSM_FRAMEWORK_VERSION " initialized\n");
 
-    if ( XSM_MAGIC )
+    if ( CONFIG_XSM_MAGIC )
     {
         ret = xsm_multiboot_policy_init(module_map, mbi, bootstrap_map);
         if ( ret )
@@ -92,7 +92,7 @@ int __init xsm_dt_init(void)
 
     printk("XSM Framework v" XSM_FRAMEWORK_VERSION " initialized\n");
 
-    if ( XSM_MAGIC )
+    if ( CONFIG_XSM_MAGIC )
     {
         ret = xsm_dt_policy_init();
         if ( ret )
diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c
index b60d822..52aa4a9 100644
--- a/xen/xsm/xsm_policy.c
+++ b/xen/xsm/xsm_policy.c
@@ -54,7 +54,7 @@ int __init xsm_multiboot_policy_init(unsigned long 
*module_map,
         _policy_start = bootstrap_map(mod + i);
         _policy_len   = mod[i].mod_end;
 
-        if ( (xsm_magic_t)(*_policy_start) == XSM_MAGIC )
+        if ( (xsm_magic_t)(*_policy_start) == CONFIG_XSM_MAGIC )
         {
             policy_buffer = (char *)_policy_start;
             policy_size = _policy_len;
@@ -89,10 +89,10 @@ int __init xsm_dt_policy_init(void)
 
     copy_from_paddr(&magic, paddr, sizeof(magic));
 
-    if ( magic != XSM_MAGIC )
+    if ( magic != CONFIG_XSM_MAGIC )
     {
         printk(XENLOG_ERR "xsm: Invalid magic for XSM blob got 0x%x "
-               "expected 0x%x\n", magic, XSM_MAGIC);
+               "expected 0x%x\n", magic, CONFIG_XSM_MAGIC);
         return -EINVAL;
     }
 
-- 
2.4.10


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.