WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Avoid using /tmp for qemu state files sin

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Avoid using /tmp for qemu state files since an unprivileged user
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Jun 2007 02:22:36 -0700
Delivery-date: Tue, 12 Jun 2007 05:07:11 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# 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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Avoid using /tmp for qemu state files since an unprivileged user, Xen patchbot-unstable <=