Skip to contentSkip to conversation

xen/xsm: Introduce new boot parameter xsm

PATCH In review Xin Li 2 participants 4 messages Sep 28, 2018

lore
Share & tools
lore

Xin Li

author
#0 lore raw

PATCH 1/2 xen/xsm: Introduce new boot parameter xsm

Introduce new boot parameter xsm to choose which xsm module is enabled, and set default to dummy.

---
CC: Daniel De Graaf <[email protected]>
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Wei Liu <[email protected]>
CC: Sergey Dyasli <[email protected]>
CC: Andrew Cooper <[email protected]>
CC: Ming Lu <[email protected]>

v3: change the default XSM boot parameter name from "dummy" to "default".

---
 docs/misc/xen-command-line.markdown | 13 +++++++++
 xen/xsm/xsm_core.c                  | 41 ++++++++++++++++++++++++++++-
 2 files changed, 53 insertions(+), 1 deletion(-)
docs/misc/xen-command-line.markdown +13 -0
index 1ffd586224..6a3c0e71c7 100644
@@ -899,6 +899,19 @@ hardware domain is architecture dependent.
 Note that specifying zero as domU value means zero, while for dom0 it means
 to use the default.
 
+### xsm
+> `= default | flask`
+
+> Default: `default`
+
+Specify which XSM module should be enabled.  This option is only available if
+the hypervisor was compiled with XSM support.
+
+* `default`: this is the default choice.  Basic restriction for common deployment
+  (the dummy module) will be applied.  it's also used when XSM is compiled out.
+* `flask`: this is the policy based access control.  To choose this, the
+  separated option in kconfig must also be enabled.
+
 ### flask
 > `= permissive | enforcing | late | disabled`
 
xen/xsm/xsm_core.c +40 -1

53 lines not on this page · raw message

Signature · 7 lines
2.18.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#1 lore raw

PATCH 2/2 xen/xsm: Add new SILO mode for XSM

When SILO is enabled, there would be no page-sharing or event notifications between unprivileged VMs (no grant tables or event channels).

---
CC: Daniel De Graaf <[email protected]>
CC: George Dunlap <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Konrad Rzeszutek Wilk <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Tim Deegan <[email protected]>
CC: Wei Liu <[email protected]>
CC: Sergey Dyasli <[email protected]>
CC: Andrew Cooper <[email protected]>
CC: Ming Lu <[email protected]>

v3: make copies of dummy functions to avoid indirect call.

---
 docs/misc/xen-command-line.markdown |   5 +-
 xen/common/Kconfig                  |  12 +++
 xen/include/xsm/xsm.h               |   6 ++
 xen/xsm/Makefile                    |   1 +
 xen/xsm/silo.c                      | 123 ++++++++++++++++++++++++++++
 xen/xsm/xsm_core.c                  |   9 ++
 6 files changed, 155 insertions(+), 1 deletion(-)
 create mode 100644 xen/xsm/silo.c
docs/misc/xen-command-line.markdown +4 -1
index 6a3c0e71c7..e0a9b4d268 100644
@@ -900,7 +900,7 @@ Note that specifying zero as domU value means zero, while for dom0 it means
 to use the default.
 
 ### xsm
-> `= default | flask`
+> `= default | flask | silo`
 
 > Default: `default`
 
@@ -911,6 +911,9 @@ the hypervisor was compiled with XSM support.
   (the dummy module) will be applied.  it's also used when XSM is compiled out.
 * `flask`: this is the policy based access control.  To choose this, the
   separated option in kconfig must also be enabled.
+* `silo`: this will deny any unmediated communication channels between
+  unprivileged VMs.  To choose this, the separated option in kconfig must also
+  be enabled.
 
 ### flask
 > `= permissive | enforcing | late | disabled`
xen/common/Kconfig +12 -0
index 1a6d6281c1..2fe668ba5a 100644
@@ -154,6 +154,18 @@ config XSM_FLASK_POLICY
 
 	  If unsure, say Y.
 
+config XSM_SILO
+	def_bool y
+	prompt "SILO support"
+	depends on XSM
+	---help---
+	  Enables SILO as the access control mechanism used by the XSM framework.
+	  This is not the default module, add boot parameter xsm=silo to choose
+	  it. This will deny any unmediated communication channels (grant tables
+	  and event channels) between unprivileged VMs.
+
+	  If unsure, say Y.
+
 config LATE_HWDOM
 	bool "Dedicated hardware domain"
 	default n
xen/include/xsm/xsm.h +6 -0
index 3d67962493..3b192b5c31 100644
@@ -733,6 +733,12 @@ extern const unsigned char xsm_flask_init_policy[];
 extern const unsigned int xsm_flask_init_policy_size;
 #endif
 
+#ifdef CONFIG_XSM_SILO
+extern void silo_init(void);
+#else
+static inline void silo_init(void) {}
+#endif
+
 #else /* CONFIG_XSM */
 
 #include <xsm/dummy.h>
xen/xsm/Makefile +1 -0
index 8bb4a24f09..e4d581e065 100644
@@ -1,5 +1,6 @@
 obj-y += xsm_core.o
 obj-$(CONFIG_XSM) += xsm_policy.o
 obj-$(CONFIG_XSM) += dummy.o
+obj-$(CONFIG_XSM_SILO) += silo.o
 
 subdir-$(CONFIG_XSM_FLASK) += flask
xen/xsm/silo.c new file +123 -0

123 lines not on this page · raw message

xen/xsm/xsm_core.c +9 -0
index 658af40c6e..58409eb0c7 100644
@@ -34,6 +34,7 @@ struct xsm_operations *xsm_ops;
 enum xsm_bootparam {
     XSM_BOOTPARAM_DUMMY,
     XSM_BOOTPARAM_FLASK,
+    XSM_BOOTPARAM_SILO,
 };
 
 static enum xsm_bootparam __initdata xsm_bootparam = XSM_BOOTPARAM_DUMMY;
@@ -47,6 +48,10 @@ static int __init parse_xsm_param(const char *s)
 #ifdef CONFIG_XSM_FLASK
     else if ( !strcmp(s, "flask") )
         xsm_bootparam = XSM_BOOTPARAM_FLASK;
+#endif
+#ifdef CONFIG_XSM_SILO
+    else if ( !strcmp(s, "silo") )
+        xsm_bootparam = XSM_BOOTPARAM_SILO;
 #endif
     else {
         printk("XSM: can't parse boot parameter xsm=%s\n", s);
@@ -93,6 +98,10 @@ static int __init xsm_core_init(const void *policy_buffer, size_t policy_size)
         flask_init(policy_buffer, policy_size);
         break;
 
+    case XSM_BOOTPARAM_SILO:
+        silo_init();
+        break;
+
     default:
         printk("XSM: Invalid value for xsm= boot parameter\n");
         break;
Signature · 7 lines
2.18.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

Re: [PATCH 2/2] xen/xsm: Add new SILO mode for XSM

Quoted 6 lines · Xin Li

When SILO is enabled, there would be no page-sharing or event notifications between unprivileged VMs (no grant tables or event channels).

v3: make copies of dummy functions to avoid indirect call.

This still makes indirect calls. You will need to #include xsm/dummy.h, and a third case in line 44's #ifdef CONFIG_XSM / #else may be required to adjust XSM_INLINE to avoid compiler warnings.

The function xsm_fixup_ops() will already set the unused parts of your xsm_operations struct to the dummy functions; you don't need to do that in silo_init by copying dummy_xsm_ops. You should use register_xsm to assign to xsm_ops instead of doing it yourself.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
In reply to Xin Li
Quoted 4 lines · Xin Li

Introduce new boot parameter xsm to choose which xsm module is enabled, and set default to dummy.

This changes the default behavior of a hypervisor compiled with XSM+FLASK when booted with no command line arguments from enabling FLASK to enabling the dummy module. I think the default value of the "xsm=" parameter should be settable in Kconfig to allow existing systems to continue working after an upgrade.

If not, this new command line argument needs to be mentioned in more locations in the documentation; at least docs/misc/xsm-flask "Setting up FLASK" will need to mention it. I think a mention in the release notes for the next version is also a good idea (in addition to or as part of the note on the new SILO feature), but that's not a part of the patch.

Untested Kconfig snippet:

choice
prompt "Default XSM implementation"
default XSM_FLASK_DEFAULT if XSM_FLASK default XSM_SILO_DEFAULT if XSM_SILO
default XSM_DUMMY_DEFAULT
config XSM_DUMMY_DEFAULT
bool "Match non-XSM behavior"
config XSM_FLASK_DEFAULT
bool "FLux Advanced Security Kernel" if XSM_FLASK
config XSM_SILO_DEFAULT
bool "SILO" if XSM_SILO
endchoice

The multiple "default" statements are intended to cause the default to be the chosen enabled system, or dummy if there are no existing Kconfig settings.

I also think the question for XSM_FLASK should be removed from EXPERT now that there is a reason to enable XSM without FLASK.

The name "default" might end up being misleading in this case; "none", "off", or "dummy" might be better.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel