WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Initial MAC (sHype) support from IBM.

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Initial MAC (sHype) support from IBM.
From: BitKeeper Bot <riel@xxxxxxxxxxx>
Date: Mon, 20 Jun 2005 22:28:08 +0000
Delivery-date: Mon, 20 Jun 2005 23:00:31 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: Xen Development List <xen-devel@xxxxxxxxxxxxxxxxxxx>
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
ChangeSet 1.1725, 2005/06/20 23:28:08+01:00, smh22@xxxxxxxxxxxxxxxxxxxx

        Initial MAC (sHype) support from IBM. 
        Defaults to NULL policy for now. 
        
        Signed-off-by: Reiner Sailer <sailer@xxxxxxxxxx>
        Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
        Signed-off-by: Steven Hand <steven@xxxxxxxxxxxxx>



 tools/Makefile                               |    1 
 tools/libxc/xc.h                             |    2 
 tools/libxc/xc_domain.c                      |    3 
 tools/policy/Makefile                        |   36 +
 tools/policy/policy_tool.c                   |  557 +++++++++++++++++++++++
 tools/python/xen/lowlevel/xc/xc.c            |   10 
 tools/python/xen/xend/XendDomainInfo.py      |   16 
 tools/python/xen/xend/image.py               |    6 
 tools/python/xen/xend/server/SrvDomainDir.py |    1 
 tools/python/xen/xm/create.py                |    7 
 tools/python/xen/xm/main.py                  |   10 
 tools/python/xen/xm/opts.py                  |    7 
 xen/Makefile                                 |    4 
 xen/Rules.mk                                 |    1 
 xen/acm/Makefile                             |   15 
 xen/acm/acm_chinesewall_hooks.c              |  503 +++++++++++++++++++++
 xen/acm/acm_core.c                           |  205 ++++++++
 xen/acm/acm_null_hooks.c                     |   76 +++
 xen/acm/acm_policy.c                         |  197 ++++++++
 xen/acm/acm_simple_type_enforcement_hooks.c  |  638 +++++++++++++++++++++++++++
 xen/arch/x86/setup.c                         |    6 
 xen/arch/x86/x86_32/entry.S                  |    1 
 xen/common/dom0_ops.c                        |   15 
 xen/common/event_channel.c                   |    4 
 xen/common/grant_table.c                     |    6 
 xen/common/policy_ops.c                      |  117 ++++
 xen/include/acm/acm_core.h                   |  117 ++++
 xen/include/acm/acm_endian.h                 |   88 +++
 xen/include/acm/acm_hooks.h                  |  337 ++++++++++++++
 xen/include/public/acm.h                     |  161 ++++++
 xen/include/public/acm_dom0_setup.h          |   34 +
 xen/include/public/dom0_ops.h                |    3 
 xen/include/public/policy_ops.h              |   74 +++
 xen/include/public/xen.h                     |    1 
 xen/include/xen/sched.h                      |    2 
 35 files changed, 3244 insertions(+), 17 deletions(-)


diff -Nru a/tools/Makefile b/tools/Makefile
--- a/tools/Makefile    2005-06-20 19:01:37 -04:00
+++ b/tools/Makefile    2005-06-20 19:01:37 -04:00
@@ -12,6 +12,7 @@
 SUBDIRS += xcutils
 SUBDIRS += pygrub
 SUBDIRS += firmware
+SUBDIRS += policy
 
 .PHONY: all install clean check check_clean ioemu eioemuinstall ioemuclean
 
diff -Nru a/tools/libxc/xc.h b/tools/libxc/xc.h
--- a/tools/libxc/xc.h  2005-06-20 19:01:36 -04:00
+++ b/tools/libxc/xc.h  2005-06-20 19:01:36 -04:00
@@ -110,6 +110,7 @@
 
 typedef struct {
     u32           domid;
+    u32           ssidref;
     unsigned int  dying:1, crashed:1, shutdown:1, 
                   paused:1, blocked:1, running:1;
     unsigned int  shutdown_reason; /* only meaningful if shutdown==1 */
@@ -124,6 +125,7 @@
 
 typedef dom0_getdomaininfo_t xc_domaininfo_t;
 int xc_domain_create(int xc_handle, 
+                     u32 ssidref,
                      u32 *pdomid);
 
 
diff -Nru a/tools/libxc/xc_domain.c b/tools/libxc/xc_domain.c
--- a/tools/libxc/xc_domain.c   2005-06-20 19:01:36 -04:00
+++ b/tools/libxc/xc_domain.c   2005-06-20 19:01:36 -04:00
@@ -9,6 +9,7 @@
 #include "xc_private.h"
 
 int xc_domain_create(int xc_handle,
+                     u32 ssidref,
                      u32 *pdomid)
 {
     int err;
@@ -16,6 +17,7 @@
 
     op.cmd = DOM0_CREATEDOMAIN;
     op.u.createdomain.domain = (domid_t)*pdomid;
+    op.u.createdomain.ssidref = ssidref;
     if ( (err = do_dom0_op(xc_handle, &op)) != 0 )
         return err;
 
@@ -101,6 +103,7 @@
             info->crashed  = 1;
         }
 
+        info->ssidref  = op.u.getdomaininfo.ssidref;
         info->nr_pages = op.u.getdomaininfo.tot_pages;
         info->max_memkb = op.u.getdomaininfo.max_pages<<(PAGE_SHIFT);
         info->shared_info_frame = op.u.getdomaininfo.shared_info_frame;
diff -Nru a/tools/policy/Makefile b/tools/policy/Makefile
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/tools/policy/Makefile     2005-06-20 19:01:37 -04:00
@@ -0,0 +1,36 @@
+XEN_ROOT = ../..
+include $(XEN_ROOT)/tools/Rules.mk
+
+SRCS     = policy_tool.c
+CFLAGS   += -static
+CFLAGS   += -Wall
+CFLAGS   += -Werror
+CFLAGS   += -O3
+CFLAGS   += -fno-strict-aliasing
+CFLAGS   += -I.
+
+all: build
+build: mk-symlinks
+       $(MAKE) policy_tool
+
+default: all
+
+install: all
+
+policy_tool : policy_tool.c
+       $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
+
+clean:
+       rm -rf policy_tool xen
+
+
+LINUX_ROOT := $(wildcard $(XEN_ROOT)/linux-2.6.*-xen-sparse)
+mk-symlinks:
+       [ -e xen/linux ] || mkdir -p xen/linux
+       [ -e xen/io ]    || mkdir -p xen/io
+       ( cd xen >/dev/null ; \
+         ln -sf ../$(XEN_ROOT)/xen/include/public/*.h . )
+       ( cd xen/io >/dev/null ; \
+         ln -sf ../../$(XEN_ROOT)/xen/include/public/io/*.h . )
+       ( cd xen/linux >/dev/null ; \
+         ln -sf ../../$(LINUX_ROOT)/include/asm-xen/linux-public/*.h . )
diff -Nru a/tools/policy/policy_tool.c b/tools/policy/policy_tool.c
--- /dev/null   Wed Dec 31 16:00:00 196900
+++ b/tools/policy/policy_tool.c        2005-06-20 19:01:37 -04:00
@@ -0,0 +1,557 @@
+/****************************************************************
+ * policy_tool.c
+ * 
+ * Copyright (C) 2005 IBM Corporation
+ *
+ * Authors:
+ * Reiner Sailer <sailer@xxxxxxxxxxxxxx>
+ * Stefan Berger <stefanb@xxxxxxxxxxxxxx>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, version 2 of the
+ * License. 
+ *
+ * sHype policy management tool. This code runs in a domain and
+ *     manages the Xen security policy by interacting with the
+ *     Xen access control module via a /proc/xen/policycmd proc-ioctl, 
+ *     which is translated into a policy_op hypercall into Xen.
+ * 
+ * todo: implement setpolicy to dynamically set a policy cache.
+ */
+#include <unistd.h>
+#include <stdio.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <string.h>
+#include <stdint.h>
+#include <netinet/in.h>
+
+typedef uint8_t            u8;
+typedef uint16_t           u16;
+typedef uint32_t           u32;
+typedef uint64_t           u64;
+typedef int8_t             s8;
+typedef int16_t            s16;
+typedef int32_t            s32;
+typedef int64_t            s64;
+
+#include <xen/acm.h>
+
+#include <xen/policy_ops.h>
+
+#include <xen/linux/privcmd.h>
+
+#define ERROR(_m, _a...)       \
+       fprintf(stderr, "ERROR: " _m "\n" , ## _a )
+
+#define PERROR(_m, _a...) \
+       fprintf(stderr, "ERROR: " _m " (%d = %s)\n" , ## _a ,   \
+            errno, strerror(errno))
+
+static inline int do_policycmd(int xc_handle,
+                             unsigned int cmd, 
+                             unsigned long data)
+{
+    return ioctl(xc_handle, cmd, data);
+}
+
+static inline int do_xen_hypercall(int xc_handle,
+                                   privcmd_hypercall_t *hypercall)
+{
+    return do_policycmd(xc_handle,
+                      IOCTL_PRIVCMD_HYPERCALL, 
+                      (unsigned long)hypercall);
+}
+
+static inline int do_policy_op(int xc_handle, policy_op_t *op)
+{
+    int ret = -1;
+    privcmd_hypercall_t hypercall;
+
+    op->interface_version = POLICY_INTERFACE_VERSION;
+
+    hypercall.op     = __HYPERVISOR_policy_op;
+    hypercall.arg[0] = (unsigned long)op;
+
+    if ( mlock(op, sizeof(*op)) != 0 )
+    {
+        PERROR("Could not lock memory for Xen policy hypercall");
+        goto out1;
+    }
+
+    if ( (ret = do_xen_hypercall(xc_handle, &hypercall)) < 0 )
+    {
+        if ( errno == EACCES )
+            fprintf(stderr, "POLICY operation failed -- need to"
+                    " rebuild the user-space tool set?\n");
+        goto out2;
+    }
+
+ out2: (void)munlock(op, sizeof(*op));
+ out1: return ret;
+}
+
+/*************************** DUMPS *******************************/
+
+void acm_dump_chinesewall_buffer(void *buf, int buflen) {
+
+       struct acm_chwall_policy_buffer *cwbuf = (struct 
acm_chwall_policy_buffer *)buf;
+       domaintype_t *ssids, *conflicts, *running_types, *conflict_aggregate;
+       int i,j;
+
+       
+       if (htons(cwbuf->policy_code) != ACM_CHINESE_WALL_POLICY) {
+               printf("CHINESE WALL POLICY CODE not found ERROR!!\n");
+               return;
+       }
+       printf("\n\nChinese Wall policy:\n");
+       printf("====================\n");
+       printf("Max Types     = %x.\n", ntohs(cwbuf->chwall_max_types));
+       printf("Max Ssidrefs  = %x.\n", ntohs(cwbuf->chwall_max_ssidrefs));
+       printf("Max ConfSets  = %x.\n", ntohs(cwbuf->chwall_max_conflictsets));
+       printf("Ssidrefs Off  = %x.\n", ntohs(cwbuf->chwall_ssid_offset));
+       printf("Conflicts Off = %x.\n", 
ntohs(cwbuf->chwall_conflict_sets_offset));
+       printf("Runing T. Off = %x.\n", 
ntohs(cwbuf->chwall_running_types_offset));
+       printf("C. Agg. Off   = %x.\n", 
ntohs(cwbuf->chwall_conflict_aggregate_offset));
+       printf("\nSSID To CHWALL-Type matrix:\n");
+
+       ssids = (domaintype_t *)(buf + ntohs(cwbuf->chwall_ssid_offset));
+       for(i=0; i< ntohs(cwbuf->chwall_max_ssidrefs); i++) {
+               printf("\n   ssidref%2x:  ", i);
+               for(j=0; j< ntohs(cwbuf->chwall_max_types); j++)
+                       printf("%02x ", 
ntohs(ssids[i*ntohs(cwbuf->chwall_max_types) + j]));
+       }
+       printf("\n\nConfict Sets:\n");
+       conflicts = (domaintype_t *)(buf + 
ntohs(cwbuf->chwall_conflict_sets_offset));
+       for(i=0; i< ntohs(cwbuf->chwall_max_conflictsets); i++) {
+               printf("\n   c-set%2x:    ", i);
+               for(j=0; j< ntohs(cwbuf->chwall_max_types); j++)
+                       printf("%02x ", 
ntohs(conflicts[i*ntohs(cwbuf->chwall_max_types) +j]));
+       }
+       printf("\n");
+
+       printf("\nRunning\nTypes:         ");
+       if (ntohs(cwbuf->chwall_running_types_offset)) {
+               running_types = (domaintype_t *)(buf + 
ntohs(cwbuf->chwall_running_types_offset));
+               for(i=0; i< ntohs(cwbuf->chwall_max_types); i++) {
+                       printf("%02x ", ntohs(running_types[i]));
+               }
+               printf("\n");
+       } else {
+               printf("Not Reported!\n");
+       }
+       printf("\nConflict\nAggregate Set: ");

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Initial MAC (sHype) support from IBM., BitKeeper Bot <=