Merge remote-tracking branch 'remotes/sstabellini/tags/cve-2015-5166-tag' into staging

cve-2015-5166

# gpg: Signature made Mon 03 Aug 2015 15:27:44 BST using RSA key ID 70E1AE90
# gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>"

* remotes/sstabellini/tags/cve-2015-5166-tag:
  Fix release_drive on unplugged devices (pci_piix3_xen_ide_unplug)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
diff --git a/configure b/configure
index 704b34c..cd219d8 100755
--- a/configure
+++ b/configure
@@ -1337,7 +1337,6 @@
   vnc-sasl        SASL encryption for VNC server
   vnc-jpeg        JPEG lossy compression for VNC server
   vnc-png         PNG compression for VNC server
-  vnc-ws          Websockets support for VNC server
   cocoa           Cocoa UI (Mac OS X only)
   virtfs          VirtFS
   xen             xen backend driver support
diff --git a/include/migration/migration.h b/include/migration/migration.h
index a2f8ed0..8334621 100644
--- a/include/migration/migration.h
+++ b/include/migration/migration.h
@@ -203,4 +203,5 @@
 void global_state_set_optional(void);
 void savevm_skip_configuration(void);
 int global_state_store(void);
+void global_state_store_running(void);
 #endif
diff --git a/migration/migration.c b/migration/migration.c
index fd4f99b..662e77e 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -122,6 +122,13 @@
     return 0;
 }
 
+void global_state_store_running(void)
+{
+    const char *state = RunState_lookup[RUN_STATE_RUNNING];
+    strncpy((char *)global_state.runstate,
+           state, sizeof(global_state.runstate));
+}
+
 static bool global_state_received(void)
 {
     return global_state.received;
diff --git a/migration/savevm.c b/migration/savevm.c
index 81dbe58..6071215 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -1394,6 +1394,7 @@
 
     saved_vm_running = runstate_is_running();
     vm_stop(RUN_STATE_SAVE_VM);
+    global_state_store_running();
 
     f = qemu_fopen(filename, "wb");
     if (!f) {
diff --git a/xen-common.c b/xen-common.c
index 56359ca..0dcdbc3 100644
--- a/xen-common.c
+++ b/xen-common.c
@@ -12,6 +12,7 @@
 #include "qmp-commands.h"
 #include "sysemu/char.h"
 #include "sysemu/accel.h"
+#include "migration/migration.h"
 
 //#define DEBUG_XEN
 
@@ -119,6 +120,10 @@
     }
     qemu_add_vm_change_state_handler(xen_change_state_handler, NULL);
 
+    global_state_set_optional();
+    savevm_skip_configuration();
+    savevm_skip_section_footers();
+
     return 0;
 }