Always compile in litevm and make sure it won't crash the kernel
authorRonald G. Minnich <rminnich@google.com>
Wed, 8 Jan 2014 17:48:17 +0000 (09:48 -0800)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 17 Jan 2014 22:35:30 +0000 (14:35 -0800)
litevm is always built in now, it builds and you can boot.

We don't call litevm_init until you attach '#V'. At that point,
if you don't have a working vmxon instruction, you'll get a
panic. This makes #V very useful for crashing all the cores
at once. Unfortunately, once this bug is fixed, you will no longer
have this option for crashing the kernel.

Signed-off-by: Ronald G. Minnich <rminnich@google.com>
kern/arch/x86/Kbuild
kern/arch/x86/vm.c
kern/drivers/dev/vm.c

index c7f36da..1b61cf8 100644 (file)
@@ -22,5 +22,5 @@ obj-y                                         += smp_boot.o
 obj-y                                          += smp_entry$(BITS).o
 obj-y                                          += trap.o trap$(BITS).o
 obj-y                                          += trapentry$(BITS).o
-#obj-y                                         += vm.o
-#obj-y                                         += vm_mmu.o
+obj-y                                          += vm.o
+obj-y                                          += vm_mmu.o
index 249d3c1..28ace51 100644 (file)
@@ -3342,12 +3342,11 @@ static int litevm_reboot(struct notifier_block *notifier, unsigned long val,
 
 hpa_t bad_page_address;
 
-static int litevm_init(void)
+int litevm_init(void)
 {
        static struct page *bad_page;
        int r = 0;
 
-#if 0
        if (!cpu_has_litevm_support()) {
                printk("litevm: no hardware support\n");
                return -EOPNOTSUPP;
@@ -3356,7 +3355,6 @@ static int litevm_init(void)
                printk("litevm: disabled by bios\n");
                return -EOPNOTSUPP;
        }
-#endif
 
        setup_vmcs_descriptor();
        r = alloc_litevm_area();
index 984f664..d167873 100644 (file)
@@ -186,8 +186,12 @@ static void vminit(void)
 
 static struct chan *vmattach(char *spec)
 {
+       int i;
+       int litevm_init(void);
        struct chan *c = devattach('V', spec);
        mkqid(&c->qid, Qtopdir, 0, QTDIR);
+       i = litevm_init();
+       printk("vminit: litevm_init returns %d\n", i);
        return c;
 }