[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Avoid using /tmp for qemu state files since an unprivileged user



# HG changeset patch
# User Steven Hand <steven@xxxxxxxxxxxxx>
# Date 1181320678 -3600
# Node ID b0109d3dc3dd962e6555d2fc588033d1f4cc9e2e
# Parent  55230846b2f47147c65a54fb10825455f5e02c48
Avoid using /tmp for qemu state files since an unprivileged user
in dom0 could potentially exploit the fact.

Thanks to Dan Berrange <berrange@xxxxxxxxxx>

Signed-off-by: Steven Hand
---
 tools/ioemu/target-i386-dm/helper2.c    |    2 +-
 tools/python/xen/xend/XendCheckpoint.py |    7 ++++---
 tools/python/xen/xend/image.py          |    2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff -r 55230846b2f4 -r b0109d3dc3dd tools/ioemu/target-i386-dm/helper2.c
--- a/tools/ioemu/target-i386-dm/helper2.c      Fri Jun 08 11:21:21 2007 +0100
+++ b/tools/ioemu/target-i386-dm/helper2.c      Fri Jun 08 17:37:58 2007 +0100
@@ -635,7 +635,7 @@ int main_loop(void)
     main_loop_wait(1); /* For the select() on events */
 
     /* Save the device state */
-    sprintf(qemu_file, "/tmp/xen.qemu-dm.%d", domid);
+    sprintf(qemu_file, "/var/lib/xen/qemu-save.%d", domid);
     do_savevm(qemu_file);
 
     return 0;
diff -r 55230846b2f4 -r b0109d3dc3dd tools/python/xen/xend/XendCheckpoint.py
--- a/tools/python/xen/xend/XendCheckpoint.py   Fri Jun 08 11:21:21 2007 +0100
+++ b/tools/python/xen/xend/XendCheckpoint.py   Fri Jun 08 17:37:58 2007 +0100
@@ -111,7 +111,8 @@ def save(fd, dominfo, network, live, dst
         # put qemu device model state
         if hvm:
             write_exact(fd, QEMU_SIGNATURE, "could not write qemu signature")
-            qemu_fd = os.open("/tmp/xen.qemu-dm.%d" % dominfo.getDomid(), 
os.O_RDONLY)
+            qemu_fd = os.open("/var/lib/xen/qemu-save.%d" % dominfo.getDomid(),
+                              os.O_RDONLY)
             while True:
                 buf = os.read(qemu_fd, dm_batch)
                 if len(buf):
@@ -119,7 +120,7 @@ def save(fd, dominfo, network, live, dst
                 else:
                     break
             os.close(qemu_fd)
-            os.remove("/tmp/xen.qemu-dm.%d" % dominfo.getDomid())
+            os.remove("/var/lib/xen/qemu-save.%d" % dominfo.getDomid())
 
         if checkpoint:
             dominfo.resumeDomain()
@@ -238,7 +239,7 @@ def restore(xd, fd, dominfo = None, paus
             if qemu_signature != QEMU_SIGNATURE:
                 raise XendError("not a valid device model state: found '%s'" %
                                 qemu_signature)
-            qemu_fd = os.open("/tmp/xen.qemu-dm.%d" % dominfo.getDomid(),
+            qemu_fd = os.open("/var/lib/xen/qemu-save.%d" % dominfo.getDomid(),
                               os.O_WRONLY | os.O_CREAT | os.O_TRUNC)
             while True:
                 buf = os.read(fd, dm_batch)
diff -r 55230846b2f4 -r b0109d3dc3dd tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Fri Jun 08 11:21:21 2007 +0100
+++ b/tools/python/xen/xend/image.py    Fri Jun 08 17:37:58 2007 +0100
@@ -429,7 +429,7 @@ class HVMImageHandler(ImageHandler):
                              (self.getRequiredInitialReservation() / 1024) ])
         args = args + self.dmargs
         if restore:
-            args = args + ([ "-loadvm", "/tmp/xen.qemu-dm.%d" %
+            args = args + ([ "-loadvm", "/var/lib/xen/xen.qemu-dm.%d" %
                              self.vm.getDomid() ])
         env = dict(os.environ)
         if self.display:

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.