Skip to contentSkip to conversation

2/3: make ACM architecture independent (Xen part)

PATCH In review Stefan Berger 2 participants 4 messages Oct 18, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2/3: make ACM architecture independent (Xen part)

This patch moves the multiboot-specific part of the ACM initialization into its own file. Any architecture that implements the multiboot specification should be able to reuse this function for booting a machine with an ACM policy.
It also moves the x86-specific functions into an x86 include file.

xen-unstable.hg/xen/acm/Makefile +2 -0
Index: root/xen-unstable.hg/xen/acm/Makefile
===================================================================
@@ -3,3 +3,5 @@ obj-y += acm_policy.o
 obj-y += acm_simple_type_enforcement_hooks.o
 obj-y += acm_chinesewall_hooks.o
 obj-y += acm_null_hooks.o
+obj-$(x86_32) += acm_multiboot.o
+obj-$(x86_64) += acm_multiboot.o
xen-unstable.hg/xen/acm/acm_multiboot.c new file +54 -0

54 lines not on this page · raw message

xen-unstable.hg/xen/include/asm-x86/acm.h new file +41 -0

41 lines not on this page · raw message

xen-unstable.hg/xen/acm/acm_chinesewall_hooks.c +2 -0
Index: root/xen-unstable.hg/xen/acm/acm_chinesewall_hooks.c
===================================================================
@@ -154,6 +154,8 @@ static int chwall_dump_policy(u8 * buf, 
     ret = ntohl(chwall_buf->chwall_conflict_aggregate_offset) +
         sizeof(domaintype_t) * chwall_bin_pol.max_types;
 
+    ret = (ret + 7) & ~7;
+
     if (buf_size < ret)
         return -EINVAL;
 
xen-unstable.hg/xen/acm/acm_simple_type_enforcement_hooks.c +2 -0
Index: root/xen-unstable.hg/xen/acm/acm_simple_type_enforcement_hooks.c
===================================================================
@@ -150,6 +150,8 @@ ste_dump_policy(u8 *buf, u32 buf_size) {
     ret = ntohl(ste_buf->ste_ssid_offset) +
         sizeof(domaintype_t)*ste_bin_pol.max_ssidrefs*ste_bin_pol.max_types;
 
+    ret = (ret + 7) & ~7;
+
     if (buf_size < ret)
         return -EINVAL;
 
xen-unstable.hg/xen/arch/x86/setup.c +2 -55

82 lines not on this page · raw message

xen-unstable.hg/xen/include/acm/acm_hooks.h +5 -5
Index: root/xen-unstable.hg/xen/include/acm/acm_hooks.h
===================================================================
@@ -143,15 +143,10 @@ static inline int acm_pre_grant_map_ref(
 { return 0; }
 static inline int acm_pre_grant_setup(domid_t id) 
 { return 0; }
-static inline int acm_init(unsigned int *initrdidx,
-                           const multiboot_info_t *mbi,
-                           unsigned long start)
-{ return 0; }
 static inline void acm_post_domain0_create(domid_t domid) 
 { return; }
 static inline int acm_sharing(ssidref_t ssidref1, ssidref_t ssidref2)
 { return 0; }
-
 #else
 
 static inline int acm_pre_domain_create(void *subject_ssid, ssidref_t ssidref)
@@ -375,6 +370,11 @@ extern int acm_init(char *policy_start, 
 /* Return true iff buffer has an acm policy magic number.  */
 extern int acm_is_policy(char *buf, unsigned long len);
 
+void extract_acm_policy(multiboot_info_t *mbi,
+                        unsigned int *initrdidx,
+                        unsigned long initial_images_start,
+                        char **_policy_start, unsigned long *_policy_len);
+
 #endif
 
 #endif

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 7 lines · Stefan Berger

This patch moves the multiboot-specific part of the ACM initialization into its own file. Any architecture that implements the multiboot specification should be able to reuse this function for booting a machine with an ACM policy.
It also moves the x86-specific functions into an x86 include file.

Hmm... It's a single small function with a fairly nasty interface. I don't think making it arch-independent is a good idea. I already shrunk the function down a bit when applying Tristan's patch so it's not actually very big.

My main issue is that it is intertwined with the variables that setup.c maintains to track multiboot modules. It would be cleaner to make more of setup.c arch-independent and carry the acm_multiboot function with it. All the while the rest is inside arch/x86, I think acm_multiboot should stay there too.

I did take your third patch, by the way (tools alignment change).

-- Keir

#2 lore raw

[email protected] wrote on 10/18/2006 12:35:59 PM:

Quoted 10 lines · Stefan Berger
Quoted 7 lines

This patch moves the multiboot-specific part of the ACM initialization into its own file. Any architecture that implements the multiboot specification should be able to reuse this function for booting a machine with an ACM policy.
It also moves the x86-specific functions into an x86 include file.

Quoted 3 lines
Quoted 1 line

Hmm... It's a single small function with a fairly nasty interface. I

don't

Quoted 2 lines

think making it arch-independent is a good idea. I already shrunk the function down a bit when applying Tristan's patch so it's not actually

very

Quoted 4 lines

big.

My main issue is that it is intertwined with the variables that setup.c maintains to track multiboot modules. It would be cleaner to make more

of

Quoted 1 line

setup.c arch-independent and carry the acm_multiboot function with it.

All

Quoted 2 lines

the while the rest is inside arch/x86, I think acm_multiboot should stay there too.

I'll see what I can do.

Quoted 2 lines

I did take your third patch, by the way (tools alignment change).

You took parts 1 and 3, but not 2? In that case I would have to rip out some of the alignment parts from the 2nd part and send them again.

Stefan

Quoted 9 lines

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 4 lines · Stefan Berger
Quoted 1 line
Quoted 1 line

I did take your third patch, by the way (tools alignment change).

You took parts 1 and 3, but not 2? In that case I would have to rip out some of the alignment parts from the 2nd part and send them again.

Isn¹t it rather gross that the two parts are so tightly coupled?

-- Keir

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel