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

[Xen-changelog] [xen stable-4.2] libxl: handle read-only drives with qemu-xen



commit e4f09370f24a2226125659973655b9bae384f903
Author:     Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
AuthorDate: Tue Sep 22 16:56:35 2015 +0100
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Tue Sep 22 17:03:04 2015 +0100

    libxl: handle read-only drives with qemu-xen
    
    The current libxl code doesn't deal with read-only drives at all.
    
    Upstream QEMU and qemu-xen only support read-only cdrom drives: make
    sure to specify "readonly=on" for cdrom drives and return error in case
    the user requested a non-cdrom read-only drive.
    
    This is XSA-142, discovered by Lin Liu
    (https://bugzilla.redhat.com/show_bug.cgi?id=1257893).
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
    
    Backport to Xen 4.5 and earlier, apropos of report and review from
    Michael Young.
    
    Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
    
    (cherry picked from commit 998424e33db121270690586320e899a03c88b4aa)
    (Backport to 4.2 and earlier.)
    Conflicts:
        tools/libxl/libxl_dm.c
    Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/libxl_dm.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index 6a1b91f..ea2ba01 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -574,12 +574,18 @@ static char ** 
libxl__build_device_model_args_new(libxl__gc *gc,
             if (disks[i].is_cdrom) {
                 if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY)
                     drive = libxl__sprintf
-                        (gc, "if=ide,index=%d,media=cdrom,cache=writeback", 
disk);
+                        (gc, 
"if=ide,index=%d,readonly=%s,media=cdrom,cache=writeback",
+                         disk, disks[i].readwrite ? "off" : "on");
                 else
                     drive = libxl__sprintf
-                        (gc, 
"file=%s,if=ide,index=%d,media=cdrom,format=%s,cache=writeback",
-                         disks[i].pdev_path, disk, format);
+                        (gc, 
"file=%s,if=ide,index=%d,readonly=%s,media=cdrom,format=%s,cache=writeback",
+                         disks[i].pdev_path, disk, disks[i].readwrite ? "off" 
: "on", format);
             } else {
+                if (!disks[i].readwrite) {
+                    LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "qemu-xen doesn't 
support read-only disk drivers");
+                    return NULL;
+                }
+
                 if (disks[i].format == LIBXL_DISK_FORMAT_EMPTY) {
                     LIBXL__LOG(ctx, LIBXL__LOG_WARNING, "cannot support"
                                " empty disk format for %s", disks[i].vdev);
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.2

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.