Avoid using /tmp for qemu state files since an unprivileged user

in dom0 could potentially exploit the fact.

Thanks to Dan Berrange <berrange@redhat.com>

Signed-off-by: Steven Hand
This commit is contained in:
Steven Hand committed 2007-06-08 17:37:58 +01:00
1 parent 31cc2c0efd
commit c056297fe7
3 files changed
+6 -5

No files matched your search

+4 -3
View File
@@ -111,7 +111,8 @@ def save(fd, dominfo, network, live, dst, checkpoint=False):
# 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, checkpoint=False):
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, paused = False):
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)
+1 -1
View File
@@ -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:
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.