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.


more paranoid error checking
Kyle Hale [Mon, 7 Oct 2013 20:29:12 +0000 (15:29 -0500)]
These changes handle the case in which v3_free_vm is called
before several subsystems have been initialized. The ones that are particularly
prone are the non-pointers in the v3_vm_info struct that have list_head elements.

palacios/src/palacios/vmm_dev_mgr.c
palacios/src/palacios/vmm_intr.c
palacios/src/palacios/vmm_shadow_paging.c
palacios/src/palacios/vmm_time.c

index 976f41d..c75e633 100644 (file)
@@ -129,7 +129,7 @@ int v3_free_vm_devices(struct v3_vm_info * vm) {
     struct vm_device * dev;
     struct vm_device * tmp;
 
-    if (mgr) { 
+    if (mgr && mgr->num_devs > 0) { 
        list_for_each_entry_safe(dev, tmp, &(mgr->dev_list), dev_link) {
            v3_remove_device(dev);
        }
index ee54bef..fa8c69f 100644 (file)
@@ -69,11 +69,13 @@ void v3_deinit_intr_controllers(struct guest_info * core) {
     struct intr_controller * tmp;
 
     // clear out any controllers that were left around
-    list_for_each_entry_safe(ctrlr, tmp, &(intr_state->controller_list), ctrl_node) {
-       v3_remove_intr_controller(core, ctrlr);
-    }
+    if (*(void**)&intr_state->controller_list) {
+        list_for_each_entry_safe(ctrlr, tmp, &(intr_state->controller_list), ctrl_node) {
+        v3_remove_intr_controller(core, ctrlr);
+        }
 
-    v3_lock_deinit(&(intr_state->irq_lock));
+        v3_lock_deinit(&(intr_state->irq_lock));
+    }
 
 }
 
@@ -92,12 +94,14 @@ void v3_deinit_intr_routers(struct v3_vm_info * vm) {
     struct intr_router * rtr = NULL;
     struct intr_router * tmp = NULL;
 
-    // clear out any controllers that were left around
-    list_for_each_entry_safe(rtr, tmp, &(vm->intr_routers.router_list), router_node) {
-       v3_remove_intr_router(vm, rtr);
-    }  
+    // clear out any routers that were left around
+    if (*(void**)&vm->intr_routers.router_list) {
+        list_for_each_entry_safe(rtr, tmp, &(vm->intr_routers.router_list), router_node) {
+        v3_remove_intr_router(vm, rtr);
+        }  
 
-    v3_lock_deinit(&(vm->intr_routers.irq_lock));
+        v3_lock_deinit(&(vm->intr_routers.irq_lock));
+    }
 }
 
 void * v3_register_intr_controller(struct guest_info * info, struct intr_ctrl_ops * ops, void * priv_data) {
index 444af7d..38dcc64 100644 (file)
@@ -170,9 +170,15 @@ int v3_init_shdw_pg_state(struct guest_info * core) {
 
 
 int v3_deinit_shdw_pg_state(struct guest_info * core) {
-    struct v3_shdw_pg_impl * impl = core->vm_info->shdw_impl.current_impl;
+    struct v3_shdw_pg_impl * impl = NULL;
+
+    if (!core || !core->vm_info) {
+        return -1;
+    }
+
+    impl = core->vm_info->shdw_impl.current_impl;
 
-    if (impl->local_deinit(core) == -1) {
+    if (impl && impl->local_deinit(core) == -1) {
        PrintError(core->vm_info, core, "Error deinitializing shadow paging state\n");
        return -1;
     }
index b2f31a4..f7cbb9e 100644 (file)
@@ -530,7 +530,9 @@ void v3_deinit_time_core(struct guest_info * core) {
     struct v3_timer * tmr = NULL;
     struct v3_timer * tmp = NULL;
 
-    list_for_each_entry_safe(tmr, tmp, &(time_state->timers), timer_link) {
-       v3_remove_timer(core, tmr);
+    if (*(void**)&time_state->timers) {
+        list_for_each_entry_safe(tmr, tmp, &(time_state->timers), timer_link) {
+        v3_remove_timer(core, tmr);
+        }
     }
 }