All of lore.kernel.org
 help / color / mirror / Atom feed
From: Doug Goldstein <cardoe@cardoe.com>
To: xen-devel@lists.xen.org
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>,
	Doug Goldstein <cardoe@cardoe.com>
Subject: [PATCH 1/2] xsm: move the XSM_MAGIC value to Kconfig
Date: Mon,  7 Mar 2016 12:42:40 -0600	[thread overview]
Message-ID: <1457376161-24982-1-git-send-email-cardoe@cardoe.com> (raw)

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(-)

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@lists.xen.org
http://lists.xen.org/xen-devel

             reply	other threads:[~2016-03-07 18:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-07 18:42 Doug Goldstein [this message]
2016-03-07 18:42 ` [PATCH 2/2] xsm: move FLASK_AVC_STATS to Kconfig Doug Goldstein
2016-03-08  9:46   ` Jan Beulich
2016-03-08 16:22     ` Daniel De Graaf
2016-03-08 16:51       ` Jan Beulich
2016-03-08 18:01         ` Daniel De Graaf
2016-03-14 14:05           ` Doug Goldstein
2016-03-16 16:09             ` Doug Goldstein
2016-03-08  9:44 ` [PATCH 1/2] xsm: move the XSM_MAGIC value " Jan Beulich
2016-03-08 16:22 ` Daniel De Graaf

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=1457376161-24982-1-git-send-email-cardoe@cardoe.com \
    --to=cardoe@cardoe.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=xen-devel@lists.xen.org \
    /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.