All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] 1 of 2: default ssid to 0
@ 2005-06-26  3:20 Reiner Sailer
  2005-06-26 10:04 ` aq
  2005-06-26 13:55 ` David Hopwood
  0 siblings, 2 replies; 15+ messages in thread
From: Reiner Sailer @ 2005-06-26  3:20 UTC (permalink / raw)
  To: aq; +Cc: xen-devel, Stefan Berger

> Message: 7
> Date: Sat, 25 Jun 2005 20:39:20 -0500
> From: aq <aquynh@gmail.com>
> Subject: Re: [Xen-devel] [PATCH] 1 of 2: default ssid to 0
> To: Stefan Berger <stefanb@us.ibm.com>
> Cc: xen-devel@lists.xensource.com
> Message-ID: <9cde8bff05062518394eab73cb@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> On 6/25/05, Stefan Berger <stefanb@us.ibm.com> wrote:
> > Hello!
> > 
> > Attached is the patch that changes the default ssid from 0xffffffff to 
0
> > as discussed in previous emails.
> > 
> > Signed-off-by: Reiner Sailer <sailer@us.ibm.com>
> > Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
> > 
> >    Stefan
> > 
> 
> 
> 
> +     for(j=0; j<= CWALL_MAX_SSIDREFS; j++)
> +         if ((0 < j) &&( j <= CWALL_MAX_TYPES))
> +             ssidrefs[j*CWALL_MAX_TYPES + j - 1] = htons(1);
> +
> 
> why dont you run the loop from j=1?


because row j=0 is the new default ssid and has no types set.
We start with row j=1 and set the "diagonal" types to one.


> regards,
> aq

Thanks
Reiner

__________________________________________________________
Reiner Sailer, Research Staff Member, Secure Systems Department
IBM T J Watson Research Ctr, 19 Skyline Drive, Hawthorne NY 10532
Phone: 914 784 6280  (t/l 863)  Fax: 914 784 6205, sailer@us.ibm.com 
http://www.research.ibm.com/people/s/sailer/

^ permalink raw reply	[flat|nested] 15+ messages in thread
* [PATCH] 1 of 2: default ssid to 0
@ 2005-06-25 18:29 Stefan Berger
  2005-06-26  0:21 ` Anthony Liguori
                   ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Stefan Berger @ 2005-06-25 18:29 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]

Hello!

Attached is the patch that changes the default ssid from 0xffffffff to 0 
as discussed in previous emails. 

Signed-off-by: Reiner Sailer <sailer@us.ibm.com>
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>

   Stefan



[-- Attachment #2: def_ssid_0.diff --]
[-- Type: application/octet-stream, Size: 11110 bytes --]

diff -uprN xeno-unstable.bk.orig/tools/policy/policy_tool.c xeno-unstable.bk/tools/policy/policy_tool.c
--- xeno-unstable.bk.orig/tools/policy/policy_tool.c	2005-06-23 10:20:03.000000000 -0400
+++ xeno-unstable.bk/tools/policy/policy_tool.c	2005-06-25 14:20:02.000000000 -0400
@@ -234,14 +234,14 @@ void acm_dump_policy_buffer(void *buf, i
 /*************************** set policy ****************************/
 
 int acm_domain_set_chwallpolicy(void *bufstart, int buflen) {
-#define CWALL_MAX_SSIDREFS      	5
+#define CWALL_MAX_SSIDREFS      	6
 #define CWALL_MAX_TYPES  		10
 #define CWALL_MAX_CONFLICTSETS		2
 
      struct acm_chwall_policy_buffer *chwall_bin_pol = (struct acm_chwall_policy_buffer *)bufstart;
      domaintype_t *ssidrefs, *conflicts;
      int ret = 0;
-     int i,j;
+     int j;
 
      chwall_bin_pol->chwall_max_types = htons(CWALL_MAX_TYPES);
      chwall_bin_pol->chwall_max_ssidrefs = htons(CWALL_MAX_SSIDREFS);
@@ -261,13 +261,13 @@ int acm_domain_set_chwallpolicy(void *bu
 			   return -1; /* not enough space */
 
      ssidrefs = (domaintype_t *)(bufstart+ntohs(chwall_bin_pol->chwall_ssid_offset));
-     for(i=0; i< CWALL_MAX_SSIDREFS; i++) {
-	     for (j=0; j< CWALL_MAX_TYPES; j++)
-		     ssidrefs[i*CWALL_MAX_TYPES + j] = htons(0);
-	     /* here, set type i for ssidref i; generally, a ssidref can have multiple chwall types */
-	     if (i < CWALL_MAX_SSIDREFS)
-		     ssidrefs[i*CWALL_MAX_TYPES + i] = htons(1);
-     }
+     memset(ssidrefs, 0, CWALL_MAX_TYPES*CWALL_MAX_SSIDREFS*sizeof(domaintype_t));
+
+     /* now set type j-1 for ssidref i+1 */
+     for(j=0; j<= CWALL_MAX_SSIDREFS; j++)
+         if ((0 < j) &&( j <= CWALL_MAX_TYPES))
+             ssidrefs[j*CWALL_MAX_TYPES + j - 1] = htons(1);
+
      ret += CWALL_MAX_TYPES*CWALL_MAX_SSIDREFS*sizeof(domaintype_t);
      if ((buflen - ret) < (CWALL_MAX_CONFLICTSETS*CWALL_MAX_TYPES*sizeof(domaintype_t)))
 			   return -1; /* not enough space */
@@ -276,10 +276,10 @@ int acm_domain_set_chwallpolicy(void *bu
      conflicts = (domaintype_t *)(bufstart + 
 				  ntohs(chwall_bin_pol->chwall_conflict_sets_offset));
      memset((void *)conflicts, 0, CWALL_MAX_CONFLICTSETS*CWALL_MAX_TYPES*sizeof(domaintype_t));
-     /* just 1 conflict set [0]={2,3}, [1]={0,5,6} */
+     /* just 1 conflict set [0]={2,3}, [1]={1,5,6} */
      if (CWALL_MAX_TYPES > 3) {
 	     conflicts[2] = htons(1); conflicts[3] = htons(1); /* {2,3} */
-	     conflicts[CWALL_MAX_TYPES] = htons(1); conflicts[CWALL_MAX_TYPES+5] = htons(1); 
+	     conflicts[CWALL_MAX_TYPES+1] = htons(1); conflicts[CWALL_MAX_TYPES+5] = htons(1); 
 	     conflicts[CWALL_MAX_TYPES+6] = htons(1);/* {0,5,6} */
      }
      ret += sizeof(domaintype_t)*CWALL_MAX_CONFLICTSETS*CWALL_MAX_TYPES;
@@ -287,12 +287,12 @@ int acm_domain_set_chwallpolicy(void *bu
 }
 
 int acm_domain_set_stepolicy(void *bufstart, int buflen) {
-#define STE_MAX_SSIDREFS      	5
-#define STE_MAX_TYPES  		5
+#define STE_MAX_SSIDREFS        6
+#define STE_MAX_TYPES  	        5
 	
     struct acm_ste_policy_buffer *ste_bin_pol = (struct acm_ste_policy_buffer *)bufstart;
     domaintype_t *ssidrefs;
-    int i,j, ret = 0;
+    int j, ret = 0;
 
     ste_bin_pol->ste_max_types = htons(STE_MAX_TYPES);
     ste_bin_pol->ste_max_ssidrefs = htons(STE_MAX_SSIDREFS);
@@ -304,14 +304,14 @@ int acm_domain_set_stepolicy(void *bufst
 	    return -1; /* not enough space */
 
      ssidrefs = (domaintype_t *)(bufstart+ntohs(ste_bin_pol->ste_ssid_offset));
-     for(i=0; i< STE_MAX_SSIDREFS; i++) {
-	     for (j=0; j< STE_MAX_TYPES; j++)
-		     ssidrefs[i*STE_MAX_TYPES + j] = htons(0);
-	     /* set type i in ssidref 0 and ssidref i */
-	     ssidrefs[i] = htons(1); /* ssidref 0 has all types set */
-	     if (i < STE_MAX_SSIDREFS)
-		     ssidrefs[i*STE_MAX_TYPES + i] = htons(1);
-     }
+     memset(ssidrefs, 0, STE_MAX_TYPES*STE_MAX_SSIDREFS*sizeof(domaintype_t));
+     /* all types 1 for ssidref 1 */
+     for(j=0; j< STE_MAX_TYPES; j++)
+	 ssidrefs[1*STE_MAX_TYPES +j] = htons(1);
+     /* now set type j-1 for ssidref j */
+     for(j=0; j< STE_MAX_SSIDREFS; j++)
+	     if ((0 < j) &&( j <= STE_MAX_TYPES))
+		     ssidrefs[j*STE_MAX_TYPES + j - 1] = htons(1);
      ret += STE_MAX_TYPES*STE_MAX_SSIDREFS*sizeof(domaintype_t);
      return ret;
 }
diff -uprN xeno-unstable.bk.orig/tools/python/xen/lowlevel/xc/xc.c xeno-unstable.bk/tools/python/xen/lowlevel/xc/xc.c
--- xeno-unstable.bk.orig/tools/python/xen/lowlevel/xc/xc.c	2005-06-24 09:58:43.000000000 -0400
+++ xeno-unstable.bk/tools/python/xen/lowlevel/xc/xc.c	2005-06-25 14:18:25.000000000 -0400
@@ -78,7 +78,7 @@ static PyObject *pyxc_domain_create(PyOb
 
     u32          dom = 0;
     int          ret;
-    u32          ssidref = 0xFFFFFFFF;
+    u32          ssidref = 0x0;
 
     static char *kwd_list[] = { "dom", "ssidref", NULL };
 
diff -uprN xeno-unstable.bk.orig/tools/python/xen/xm/main.py xeno-unstable.bk/tools/python/xen/xm/main.py
--- xeno-unstable.bk.orig/tools/python/xen/xm/main.py	2005-06-22 12:07:48.000000000 -0400
+++ xeno-unstable.bk/tools/python/xen/xm/main.py	2005-06-25 14:18:25.000000000 -0400
@@ -399,9 +399,9 @@ class ProgList(Prog):
                 d['port'] = sxp.child_value(console, 'console_port')
             else:
                 d['port'] = ''
-            if ((int(sxp.child_value(info, 'ssidref', '-1'))) != -1):
-                d['ssidref1'] =  int(sxp.child_value(info, 'ssidref', '-1')) & 0xffff
-                d['ssidref2'] = (int(sxp.child_value(info, 'ssidref', '-1')) >> 16) & 0xffff
+            if ((int(sxp.child_value(info, 'ssidref', '0'))) != 0):
+                d['ssidref1'] =  int(sxp.child_value(info, 'ssidref', '0')) & 0xffff
+                d['ssidref2'] = (int(sxp.child_value(info, 'ssidref', '0')) >> 16) & 0xffff
                 print ("%(name)-16s %(dom)3d  %(mem)7d  %(cpu)3d  %(vcpus)5d   %(state)5s  %(cpu_time)7.1f     %(port)4s    s:%(ssidref2)02x/p:%(ssidref1)02x" % d)
             else:
                 print ("%(name)-16s %(dom)3d  %(mem)7d  %(cpu)3d  %(vcpus)5d   %(state)5s  %(cpu_time)7.1f     %(port)4s" % d)
diff -uprN xeno-unstable.bk.orig/xen/acm/acm_chinesewall_hooks.c xeno-unstable.bk/xen/acm/acm_chinesewall_hooks.c
--- xeno-unstable.bk.orig/xen/acm/acm_chinesewall_hooks.c	2005-06-21 11:32:08.000000000 -0400
+++ xeno-unstable.bk/xen/acm/acm_chinesewall_hooks.c	2005-06-25 14:18:25.000000000 -0400
@@ -50,7 +50,7 @@ int acm_init_chwall_policy(void)
 {
 	/* minimal startup policy; policy write-locked already */
 	chwall_bin_pol.max_types = 1;
-	chwall_bin_pol.max_ssidrefs = 1;
+	chwall_bin_pol.max_ssidrefs = 2;
 	chwall_bin_pol.max_conflictsets = 1;
 	chwall_bin_pol.ssidrefs = (domaintype_t *)xmalloc_array(domaintype_t, chwall_bin_pol.max_ssidrefs*chwall_bin_pol.max_types);
 	chwall_bin_pol.conflict_sets = (domaintype_t *)xmalloc_array(domaintype_t, chwall_bin_pol.max_conflictsets*chwall_bin_pol.max_types);
@@ -81,9 +81,10 @@ chwall_init_domain_ssid(void **chwall_ss
 	 * part of the global ssidref (same way we'll get the partial ssid pointer)
 	 */
 	chwall_ssidp->chwall_ssidref = GET_SSIDREF(ACM_CHINESE_WALL_POLICY, ssidref);
-	if (chwall_ssidp->chwall_ssidref >= chwall_bin_pol.max_ssidrefs) {
-		printkd("%s: ERROR chwall_ssidref(%x) > max(%x).\n",
-			__func__, chwall_ssidp->chwall_ssidref, chwall_bin_pol.max_ssidrefs-1);
+	if ((chwall_ssidp->chwall_ssidref >= chwall_bin_pol.max_ssidrefs) ||
+	    (chwall_ssidp->chwall_ssidref == ACM_DEFAULT_LOCAL_SSID)) {
+		printkd("%s: ERROR chwall_ssidref(%x) undefined (>max) or unset (0).\n",
+			__func__, chwall_ssidp->chwall_ssidref);
 		xfree(chwall_ssidp);
 		return ACM_INIT_SSID_ERROR;
 	}
diff -uprN xeno-unstable.bk.orig/xen/acm/acm_simple_type_enforcement_hooks.c xeno-unstable.bk/xen/acm/acm_simple_type_enforcement_hooks.c
--- xeno-unstable.bk.orig/xen/acm/acm_simple_type_enforcement_hooks.c	2005-06-23 10:20:03.000000000 -0400
+++ xeno-unstable.bk/xen/acm/acm_simple_type_enforcement_hooks.c	2005-06-25 14:18:25.000000000 -0400
@@ -73,14 +73,15 @@ int acm_init_ste_policy(void)
 {
 	/* minimal startup policy; policy write-locked already */
 	ste_bin_pol.max_types = 1;
-	ste_bin_pol.max_ssidrefs = 1;
-	ste_bin_pol.ssidrefs = (domaintype_t *)xmalloc_array(domaintype_t, 1);
-	
+	ste_bin_pol.max_ssidrefs = 2;
+	ste_bin_pol.ssidrefs = (domaintype_t *)xmalloc_array(domaintype_t, 2);
+	memset(ste_bin_pol.ssidrefs, 0, 2);
+
 	if (ste_bin_pol.ssidrefs == NULL)
 		return ACM_INIT_SSID_ERROR;
 
-	/* initialize state */
-	ste_bin_pol.ssidrefs[0] = 1;
+	/* initialize state so that dom0 can start up and communicate with itself */
+	ste_bin_pol.ssidrefs[1] = 1;
 
 	/* init stats */
 	atomic_set(&(ste_bin_pol.ec_eval_count), 0);
@@ -106,9 +107,10 @@ ste_init_domain_ssid(void **ste_ssid, ss
 
 	/* get policy-local ssid reference */
 	ste_ssidp->ste_ssidref = GET_SSIDREF(ACM_SIMPLE_TYPE_ENFORCEMENT_POLICY, ssidref);
-	if (ste_ssidp->ste_ssidref >= ste_bin_pol.max_ssidrefs) {
-		printkd("%s: ERROR ste_ssidref (%x) > max(%x).\n",
-			__func__, ste_ssidp->ste_ssidref, ste_bin_pol.max_ssidrefs-1);
+	if ((ste_ssidp->ste_ssidref >= ste_bin_pol.max_ssidrefs) ||
+	    (ste_ssidp->ste_ssidref == ACM_DEFAULT_LOCAL_SSID))	{
+		printkd("%s: ERROR ste_ssidref (%x) undefined or unset (0).\n",
+			__func__, ste_ssidp->ste_ssidref);
 		xfree(ste_ssidp);
 		return ACM_INIT_SSID_ERROR;
 	}
diff -uprN xeno-unstable.bk.orig/xen/include/acm/acm_hooks.h xeno-unstable.bk/xen/include/acm/acm_hooks.h
--- xeno-unstable.bk.orig/xen/include/acm/acm_hooks.h	2005-06-23 13:25:29.000000000 -0400
+++ xeno-unstable.bk/xen/include/acm/acm_hooks.h	2005-06-25 14:18:25.000000000 -0400
@@ -328,7 +328,7 @@ static inline int acm_pre_grant_setup(do
 }
 
 /* predefined ssidref for DOM0 used by xen when creating DOM0 */
-#define ACM_DOM0_SSIDREF        0
+#define ACM_DOM0_SSIDREF       0x00010001 
 
 static inline void acm_post_domain0_create(domid_t domid)
 {
diff -uprN xeno-unstable.bk.orig/xen/include/public/acm.h xeno-unstable.bk/xen/include/public/acm.h
--- xeno-unstable.bk.orig/xen/include/public/acm.h	2005-06-25 14:01:35.000000000 -0400
+++ xeno-unstable.bk/xen/include/public/acm.h	2005-06-25 14:18:25.000000000 -0400
@@ -41,8 +41,8 @@
 #endif
 
 /* default ssid reference value if not supplied */
-#define ACM_DEFAULT_SSID 	0xffffffff
-#define ACM_DEFAULT_LOCAL_SSID  0xffff
+#define ACM_DEFAULT_SSID 	0x0
+#define ACM_DEFAULT_LOCAL_SSID  0x0
 
 /* Internal ACM ERROR types */
 #define ACM_OK				 0
diff -uprN xeno-unstable.bk.orig/xen/include/public/policy_ops.h xeno-unstable.bk/xen/include/public/policy_ops.h
--- xeno-unstable.bk.orig/xen/include/public/policy_ops.h	2005-06-21 11:32:08.000000000 -0400
+++ xeno-unstable.bk/xen/include/public/policy_ops.h	2005-06-25 14:18:25.000000000 -0400
@@ -28,7 +28,7 @@
  * This makes sure that old versions of policy tools will stop working in a
  * well-defined way (rather than crashing the machine, for instance).
  */
-#define POLICY_INTERFACE_VERSION   0xAAAA0001
+#define POLICY_INTERFACE_VERSION   0xAAAA0002
 
 /************************************************************************/
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

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

end of thread, other threads:[~2005-06-27 18:10 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-26  3:20 [PATCH] 1 of 2: default ssid to 0 Reiner Sailer
2005-06-26 10:04 ` aq
2005-06-26 13:55 ` David Hopwood
  -- strict thread matches above, loose matches on Subject: below --
2005-06-25 18:29 Stefan Berger
2005-06-26  0:21 ` Anthony Liguori
2005-06-26  1:39 ` aq
2005-06-26  1:45 ` aq
2005-06-26  1:49   ` Mark Williamson
2005-06-26  2:18     ` aq
2005-06-26  2:24       ` Mark Williamson
2005-06-26 10:07         ` aq
2005-06-26 16:10     ` Stefan Berger
2005-06-26 16:13       ` Keir Fraser
2005-06-26 19:05         ` Chris Wright
2005-06-27 18:10       ` Josh Triplett

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.