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 user-space utilities for controlling the selective syscall exiting utility
Kyle Hale [Tue, 29 May 2012 18:20:38 +0000 (13:20 -0500)]
linux_usr/Makefile
linux_usr/v3_syscall.c [new file with mode: 0644]

index f69af46..232ee09 100644 (file)
@@ -40,7 +40,8 @@ EXAMPLE_EXECS = v3_user_host_dev_example \
 EXPERIMENTAL_EXECS =   v3_simulate  \
                        v3_inject_ecc_scrubber_mce  \
                         v3_top_inject \
-                        v3_env_inject 
+                        v3_env_inject \
+                                               v3_syscall
 
 
 
diff --git a/linux_usr/v3_syscall.c b/linux_usr/v3_syscall.c
new file mode 100644 (file)
index 0000000..5127219
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * V3 Selective System Call Exiting Control
+ * (c) Kyle C. Hale, 2012
+ *
+ */
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+
+#include "iface-syscall.h"
+
+#define CMD_MAX 10
+#define SYSCALL_MAX 256
+
+static void usage () {
+       fprintf(stderr, "\nUsage: v3_syscall <vm device> <syscall_nr> <on|off|status>\n");
+       exit(0);
+}
+
+
+int main (int argc, char * argv[]) {
+
+       int vm_fd, ret, syscall_nr;
+       char * vm_dev = NULL;
+       struct v3_syscall_cmd syscall_cmd;
+
+       if (argc < 4 || argc > 4) {
+               fprintf(stderr, "Invalid number of arguments.\n");
+               usage();
+       }
+
+       vm_dev = argv[1];
+       syscall_nr = strtol(argv[2], NULL, 0);
+
+       if (strncmp(argv[3], "on", CMD_MAX) == 0) {
+               syscall_cmd.cmd = SYSCALL_ON;
+       } else if (strncmp(argv[3], "off", CMD_MAX) == 0) {
+               syscall_cmd.cmd = SYSCALL_OFF;
+       } else if (strncmp(argv[3], "status", CMD_MAX) == 0) {
+               syscall_cmd.cmd = SYSCALL_STAT;
+       } else {
+               fprintf(stderr, "Invalid command.\n");
+               usage();
+       }
+
+    if (syscall_nr < 0 || syscall_nr > SYSCALL_MAX) {
+        fprintf(stderr, "Invalid syscall number.\n");
+        return -1;
+    }
+
+    syscall_cmd.syscall_nr = syscall_nr;
+
+       vm_fd = open(vm_dev, O_RDONLY);
+
+       if (vm_fd < 0) { 
+               fprintf(stderr, "Error opening VM device: %s\n", vm_dev);
+               return -1;
+       }
+
+       ret = ioctl(vm_fd, V3_VM_SYSCALL_CTRL, &syscall_cmd);
+
+    if (ret < 0) {
+        fprintf(stderr, "Error with syscall control\n");
+        return -1;
+    }
+
+    if (syscall_cmd.cmd == SYSCALL_STAT) {
+        if (ret == SYSCALL_ON) 
+            printf("Selective exiting for syscall #%d is currently ON\n", syscall_cmd.syscall_nr);
+        else if (ret == SYSCALL_OFF) 
+            printf("Selective exiting for syscall #%d is currently OFF\n", syscall_cmd.syscall_nr);
+    } else if (syscall_cmd.cmd == SYSCALL_ON) {
+       printf("Selective exiting for syscall #%d ACTIVATED\n", syscall_cmd.syscall_nr);
+    } else if (syscall_cmd.cmd == SYSCALL_OFF) {
+        printf("Selective exiting for syscall #%d DEACTIVATED\n", syscall_cmd.syscall_nr);
+    }
+
+       return 0;
+}