Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Added host interface for selective system call exiting utility
Kyle Hale [Tue, 29 May 2012 18:19:07 +0000 (13:19 -0500)]
linux_module/Makefile
linux_module/iface-syscall.c [new file with mode: 0644]
linux_module/iface-syscall.h [new file with mode: 0644]
linux_module/ioctls.txt

index b2e73df..98416cb 100644 (file)
@@ -40,6 +40,8 @@ v3vee-$(V3_CONFIG_VNET) +=    palacios-vnet.o \
 v3vee-$(V3_CONFIG_HOST_HYPERCALL) += iface-host-hypercall.o
 v3vee-$(V3_CONFIG_EXT_CODE_INJECT) += iface-code-inject.o
 v3vee-$(V3_CONFIG_EXT_ENV_INJECT) += iface-env-inject.o
+v3vee-$(V3_CONFIG_EXT_SELECTIVE_SYSCALL_EXIT) += iface-syscall.o
+
 
 v3vee-objs := $(v3vee-y) ../libv3vee.a
 obj-m := v3vee.o
diff --git a/linux_module/iface-syscall.c b/linux_module/iface-syscall.c
new file mode 100644 (file)
index 0000000..0ed6231
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * Linux interface for control of the fast system call
+ * exiting utility
+ *
+ * (c) Kyle C. Hale 2012
+ *
+ */
+
+#include <linux/uaccess.h>
+#include <linux/module.h>
+
+#include <gears/syscall_hijack.h>
+
+#include "palacios.h"
+#include "vm.h"
+#include "linux-exts.h"
+
+#include "iface-syscall.h"
+
+
+static int vm_syscall_ctrl (struct v3_guest * guest, unsigned int cmd, unsigned long arg, void * priv_data) {
+    struct v3_syscall_cmd syscall_cmd;
+    int ret;
+
+    if (copy_from_user(&syscall_cmd, (void __user *)arg, sizeof(struct v3_syscall_cmd))) {
+        printk("Palacios: error copying syscall command from userspace\n");
+        return -EFAULT;
+    }
+    
+    switch (syscall_cmd.cmd) {
+
+        case SYSCALL_OFF: {
+            ret = v3_syscall_off(guest->v3_ctx, syscall_cmd.syscall_nr);
+            if (ret < 0) {
+                printk("Palacios: error deactivating syscall exiting for syscall nr: %d\n", syscall_cmd.syscall_nr);
+            }
+            break;
+        }
+        case SYSCALL_ON: {
+            ret = v3_syscall_on(guest->v3_ctx, syscall_cmd.syscall_nr);
+            if (ret < 0) {
+                printk("Palacios: error activating syscall exiting for syscall nr: %d\n", syscall_cmd.syscall_nr);
+            }
+            break;
+        }
+        case SYSCALL_STAT: {
+            ret = v3_syscall_stat(guest->v3_ctx, syscall_cmd.syscall_nr);  
+            if (ret == SYSCALL_OFF)
+                printk("Palacios: exiting for syscall #%d is OFF\n", syscall_cmd.syscall_nr);
+            else if (ret == SYSCALL_ON) 
+                printk("Palacios: exiting for syscall #%d is ON\n", syscall_cmd.syscall_nr);
+            else 
+                printk("Palacios: error stating syscall nr: %d\n", syscall_cmd.syscall_nr);
+            break;
+        }
+        default:
+            printk("Palacios: error - invalid syscall command\n");
+            return -1;
+    }
+      
+    return ret;
+}
+
+
+static int init_syscall_ctrl (void) {
+    return 0;
+}
+
+
+static int deinit_syscall_ctrl (void) { 
+    return 0;
+}
+
+
+static int guest_init_syscall_ctrl (struct v3_guest * guest, void ** vm_data) {
+    add_guest_ctrl(guest, V3_VM_SYSCALL_CTRL, vm_syscall_ctrl, NULL);
+    return 0;
+}
+
+
+static int guest_deinit_syscall_ctrl (struct v3_guest * guest, void * vm_data) {
+    return 0;
+}
+
+
+static struct linux_ext syscall_ctrl_ext = {
+    .name = "SYSCALL_CTRL",
+    .init = init_syscall_ctrl,
+    .deinit = deinit_syscall_ctrl,
+    .guest_init = guest_init_syscall_ctrl,
+    .guest_deinit = guest_deinit_syscall_ctrl
+};
+
+register_extension(&syscall_ctrl_ext);
diff --git a/linux_module/iface-syscall.h b/linux_module/iface-syscall.h
new file mode 100644 (file)
index 0000000..8118235
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef __IFACE_SYSCALL_H__
+#define __IFACE_SYSCALL_H__
+
+#define SYSCALL_OFF   0
+#define SYSCALL_ON    1
+#define SYSCALL_STAT  2
+
+#define V3_VM_SYSCALL_CTRL 0x5CA11
+
+struct v3_syscall_cmd {
+    int cmd;
+    int syscall_nr;
+};
+
+
+#endif
index 322dd5a..661a2fe 100644 (file)
@@ -30,3 +30,4 @@ VM Commands (/dev/v3-vm*)
 
 13125 -- (EXT) Inject Environment Variables into Guest Process
 
+5CA11 -- (EXT) Get/Set System call exiting status