All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] libxl: assigned a default ssid_label (XSM label) to guests
@ 2015-05-14 10:33 Ian Campbell
  2015-05-14 11:21 ` Julien Grall
  2015-05-14 11:58 ` Wei Liu
  0 siblings, 2 replies; 16+ messages in thread
From: Ian Campbell @ 2015-05-14 10:33 UTC (permalink / raw)
  To: xen-devel, ian.jackson, wei.liu2; +Cc: Daniel De Graaf, Wei.Liu2, Ian Campbell

system_u:system_r:domU_t is defined in the default policy and makes as
much sense as anything for a default.

This change required moving the call to domain_create_info_setdefault
to be before the ssid_label is translated into ssidref, which also
moves it before some other stuff which consumes things from c_info,
which is correct since setdefault should always be called first. Apart
from the SSID handling there should be no functional change (since
setdefault doesn't actually act on anything which that other stuff
uses).

There is no need to set exec_ssid_label since the default is to leave
the domain using the ssid_label after build.

I haven't done anything with the device model ssid.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Cc: Wei.Liu2@citrix.com
---
 docs/man/xl.cfg.pod.5      |    4 +++-
 tools/libxl/libxl_create.c |   11 ++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/docs/man/xl.cfg.pod.5 b/docs/man/xl.cfg.pod.5
index 8e4154f..fcca1cc 100644
--- a/docs/man/xl.cfg.pod.5
+++ b/docs/man/xl.cfg.pod.5
@@ -437,7 +437,9 @@ UUID will be generated.
 
 =item B<seclabel="LABEL">
 
-Assign an XSM security label to this domain.
+Assign an XSM security label to this domain. By default a domain is
+assigned the label B<system_u:system_r:domU_t>, which is defined in
+the default policy.
 
 =item B<init_seclabel="LABEL">
 
diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c
index f0da7dc..4dd2ec2 100644
--- a/tools/libxl/libxl_create.c
+++ b/tools/libxl/libxl_create.c
@@ -42,6 +42,11 @@ int libxl__domain_create_info_setdefault(libxl__gc *gc,
     libxl_defbool_setdefault(&c_info->run_hotplug_scripts, true);
     libxl_defbool_setdefault(&c_info->driver_domain, false);
 
+    if (!c_info->ssid_label) {
+        c_info->ssid_label = libxl__strdup(NOGC, "system_u:system_r:domU_t");
+        LOG(INFO, "Using default ssid_label: %s", c_info->ssid_label);
+    }
+
     return 0;
 }
 
@@ -802,6 +807,9 @@ static void initiate_domain_create(libxl__egc *egc,
 
     domid = 0;
 
+    ret = libxl__domain_create_info_setdefault(gc, &d_config->c_info);
+    if (ret) goto error_out;
+
     if (d_config->c_info.ssid_label) {
         char *s = d_config->c_info.ssid_label;
         ret = libxl_flask_context_to_sid(ctx, s, strlen(s),
@@ -887,9 +895,6 @@ static void initiate_domain_create(libxl__egc *egc,
         goto error_out;
     }
 
-    ret = libxl__domain_create_info_setdefault(gc, &d_config->c_info);
-    if (ret) goto error_out;
-
     ret = libxl__domain_make(gc, d_config, &domid, &state->config);
     if (ret) {
         LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "cannot make domain: %d", ret);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2015-05-19 10:43 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-14 10:33 [PATCH] libxl: assigned a default ssid_label (XSM label) to guests Ian Campbell
2015-05-14 11:21 ` Julien Grall
2015-05-14 11:54   ` Ian Campbell
2015-05-14 14:18     ` Julien Grall
2015-05-14 23:09     ` Daniel De Graaf
2015-05-15  9:39       ` Ian Campbell
2015-05-15 17:09         ` Daniel De Graaf
2015-05-18 10:56           ` Ian Campbell
2015-05-18 12:38         ` Ian Campbell
2015-05-18 22:37           ` Daniel De Graaf
2015-05-19 10:43             ` Ian Campbell
2015-05-14 11:58 ` Wei Liu
2015-05-14 12:32   ` Ian Campbell
2015-05-14 12:39     ` Wei Liu
2015-05-14 14:05       ` Julien Grall
2015-05-14 14:11         ` Ian Campbell

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.