mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
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:
1 parent
31cc2c0efd
commit
c056297fe7
3 files changed
+6
-5
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||