@@ -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"
@@ -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
@@ -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.
@@ -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 )
@@ -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;
}
Let Kconfig set the XSM_MAGIC value for us. Signed-off-by: Doug Goldstein <cardoe@cardoe.com> --- CC: Daniel De Graaf <dgdegra@tycho.nsa.gov> --- 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(-)