Skip to contentSkip to conversation

init-xenstore-domain: Add optional ramdisk argument.

PATCH In review James Bielman 2 participants 4 messages Jul 7, 2014 – Jul 10, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 init-xenstore-domain: Add optional ramdisk argument.

- Added an optional argument to allow passing a ramdisk to the Xenstore domain built by init-xenstore-domain.
- This is needed for Xenstore/MAC to pass initial security policy.

---
 tools/xenstore/init-xenstore-domain.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
tools/xenstore/init-xenstore-domain.c +10 -4
index 56a3c72..0d12169 100644
@@ -13,7 +13,7 @@
 
 static uint32_t domid = -1;
 
-static int build(xc_interface *xch, char** argv)
+static int build(xc_interface *xch, int argc, char** argv)
 {
 	char cmdline[512];
 	uint32_t ssid;
@@ -44,6 +44,12 @@ static int build(xc_interface *xch, char** argv)
 	dom = xc_dom_allocate(xch, cmdline, NULL);
 	rv = xc_dom_kernel_file(dom, argv[1]);
 	if (rv) goto err;
+
+	if (argc > 4) {
+		rv = xc_dom_ramdisk_file(dom, argv[4]);
+		if (rv) goto err;
+	}
+
 	rv = xc_dom_boot_xen_init(dom, xch, domid);
 	if (rv) goto err;
 	rv = xc_dom_parse_image(dom);
@@ -81,15 +87,15 @@ int main(int argc, char** argv)
 	char buf[16];
 	int rv, fd;
 
-	if (argc != 4) {
-		printf("Use: %s <xenstore-kernel> <memory_mb> <flask-label>\n", argv[0]);
+	if (argc < 4 || argc > 5) {
+		printf("Use: %s <xenstore-kernel> <memory_mb> <flask-label> [<ramdisk-file>]\n", argv[0]);
 		return 2;
 	}
 
 	xch = xc_interface_open(NULL, NULL, 0);
 	if (!xch) return 1;
 
-	rv = build(xch, argv);
+	rv = build(xch, argc, argv);
 
 	xc_interface_close(xch);
 
Signature · 1 line
1.9.1
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · James Bielman

- Added an optional argument to allow passing a ramdisk to the Xenstore domain built by init-xenstore-domain.
- This is needed for Xenstore/MAC to pass initial security policy.

Is this used to pass a filesystem containing a policy binary, or is the policy binary passed raw as the "ramdisk" itself?

Quoted 1 line
#2 lore raw
Quoted 8 lines · Ian Campbell
Quoted 4 lines · James Bielman

- Added an optional argument to allow passing a ramdisk to the Xenstore domain built by init-xenstore-domain.
- This is needed for Xenstore/MAC to pass initial security policy.

Is this used to pass a filesystem containing a policy binary, or is the policy binary passed raw as the "ramdisk" itself?

Hi Ian,

Our Xenstore security module needs a few support databases in addition to the binary policy itself, so our ramdisk is an (uncompressed) CPIO archive.

Thanks,
James

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

#3 lore raw
Quoted 7 lines · James Bielman
Quoted 6 lines · Ian Campbell
Quoted 4 lines · James Bielman

- Added an optional argument to allow passing a ramdisk to the Xenstore domain built by init-xenstore-domain.
- This is needed for Xenstore/MAC to pass initial security policy.

Quoted 8 lines
Quoted 2 lines

Is this used to pass a filesystem containing a policy binary, or is the policy binary passed raw as the "ramdisk" itself?

Hi Ian,

Our Xenstore security module needs a few support databases in addition to the binary policy itself, so our ramdisk is an (uncompressed) CPIO archive.

Great. Applied, thanks!

Ian.