libxl: Exposed Flask XSM functionality
PATCH 1/1 libxl: Exposed Flask XSM functionality
Adds support for assigning a label to domains, obtaining and setting the current enforcing mode, and loading a policy with xl command when the Flask XSM is in use.
tools/libxl/libxl.c | 1 tools/libxl/libxl.idl | 3 tools/libxl/xl.h | 3 tools/libxl/xl_cmdimpl.c | 171 ++++++++++++++++++++++++++++++++++++++++++++-- tools/libxl/xl_cmdtable.c | 18 ++++ xen/include/xsm/xsm.h | 6 + xen/xsm/flask/flask_op.c | 3 7 files changed, 195 insertions(+), 10 deletions(-)
Signature · 2 lines
Machon Gregory National Information Assurance Research Lab (NIARL)
tools/libxl/libxl.c +1 -0
@@ -333,6 +333,7 @@ {memcpy (&(xlinfo->uuid), xcinfo->handle,sizeof (xen_domain_handle_t)); xlinfo->domid = xcinfo->domain; + xlinfo->ssidref = xcinfo->ssidref; xlinfo->dying = !!(xcinfo->flags&XEN_DOMINF_dying); xlinfo->shutdown = !!(xcinfo->flags&XEN_DOMINF_shutdown);
tools/libxl/libxl.idl +2 -1
@@ -28,6 +28,7 @@ libxl_dominfo = Struct("dominfo",[ ("uuid", libxl_uuid), ("domid", domid), + ("ssidref", uint32), ("running", BitField(uint8, 1)), ("blocked", BitField(uint8, 1)), ("paused", BitField(uint8, 1)),
@@ -77,7 +78,7 @@ ("hvm", bool), ("hap", bool), ("oos", bool), - ("ssidref", integer), + ("ssidref", uint32), ("name", string), ("uuid", libxl_uuid), ("xsdata", libxl_key_value_list),
tools/libxl/xl.h +3 -0
@@ -87,6 +87,9 @@int main_cpupoolcpuremove (int argc,char **argv);int main_cpupoolmigrate (int argc,char **argv);int main_cpupoolnumasplit (int argc,char **argv); +int main_getenforce (int argc,char **argv); +int main_setenforce (int argc,char **argv); +int main_loadpolicy (int argc,char **argv);void help (const char *command);
tools/libxl/xl_cmdimpl.c +164 -7
227 lines not on this page · raw message
tools/libxl/xl_cmdtable.c +17 -1
@@ -36,7 +36,8 @@"List information about all/some domains" ,"[options] [Domain]\n" ,"-l, --long Output all VM details\n" -"-v, --verbose Prints out UUIDs" , +"-v, --verbose Prints out UUIDs and security context\n" +"-Z, --context Prints out security context" }, { "destroy", &main_destroy,
@@ -382,6 +383,21 @@ "Splits up the machine into one CPU pool per NUMA node", "", }, + {"getenforce" , + &main_getenforce, +"Returns the current enforcing mode of the Flask Xen security module" , +"" , + }, + { "setenforce", + &main_setenforce, +"Sets the current enforcing mode of the Flask Xen security module" , +"<1|0|Enforcing|Permissive>" , + }, + { "loadpolicy", + &main_loadpolicy, +"Loads a new policy int the Flask Xen security module" , + "<policy file>", + }, };int cmdtable_len =sizeof (cmd_table)/sizeof (struct cmd_spec );
xen/include/xsm/xsm.h +5 -1
@@ -427,7 +427,11 @@static inline long __do_xsm_op (XEN_GUEST_HANDLE (xsm_op_t) op) { -return xsm_call (__do_xsm_op (op)); +#ifdef XSM_ENABLE +return xsm_ops->__do_xsm_op (op); +#else +return -ENOSYS ; +#endif }#ifdef XSM_ENABLE
xen/xsm/flask/flask_op.c +3 -0
@@ -485,6 +485,9 @@if ( length <0 ) goto out; +if (len > count) +return -ERANGE ; +memset (buf,0 , count);memcpy (buf, context, len); length = len;
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Looks like the hypervisor changes belong in a separate bug-fix patch?
-- Keir
Quoted 15 lines · Machon Gregory
Adds support for assigning a label to domains, obtaining and setting the current enforcing mode, and loading a policy with xl command when the Flask XSM is in use.
Signed-off-by [email protected]tools/libxl/libxl.c | 1 tools/libxl/libxl.idl | 3 tools/libxl/xl.h | 3 tools/libxl/xl_cmdimpl.c | 171 ++++++++++++++++++++++++++++++++++++++++++++-- tools/libxl/xl_cmdtable.c | 18 ++++ xen/include/xsm/xsm.h | 6 + xen/xsm/flask/flask_op.c | 3 7 files changed, 195 insertions(+), 10 deletions(-)
Quoted 5 lines · Machon Gregory
Adds support for assigning a label to domains, obtaining and setting the current enforcing mode, and loading a policy with xl command when the Flask XSM is in use.
Signed-off-by [email protected]
The libxl/xl part of the patch looks OK to me.
Thanks!
- Stefano