From: Ian Jackson Subject: Re: [PATCH] ioemu: Disable format auto-probing in monitor command change Date: Wed, 18 Jun 2008 11:22:49 +0100 Message-ID: <18520.57849.817605.160590@mariner.uk.xensource.com> References: <200805081800.24064.turkay.eren@gmail.com> <18467.12572.126574.502777@mariner.uk.xensource.com> <20080508171255.GA31908@redhat.com> <18467.13858.203078.97403@mariner.uk.xensource.com> <20080508172304.GB31908@redhat.com> <18467.14318.921215.768838@mariner.uk.xensource.com> <20080508173023.GC31908@redhat.com> <18468.29633.937355.26121@mariner.uk.xensource.com> <18473.52451.967004.377867@mariner.uk.xensource.com> <8763sw9nfx.fsf@pike.pond.sub.org> <18496.793.632548.533855@mariner.uk.xensource.com> <18514.36535.961030.856448@mariner.uk.xensource.com> <87tzfto0ep.fsf@pike.pond.sub.org> <18518.35502.522506.191854@mariner.uk.xensource.com> <87prqhnxoi.fsf@pike.pond.sub.org> <18518.39663.74413.329755@mariner.uk.xensource.com> <878wx4knf6.fsf_-_@pike.pond.sub.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <878wx4knf6.fsf_-_@pike.pond.sub.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Markus Armbruster Cc: Eren =?utf-8?Q?T=C3=BCrkay?= , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Markus Armbruster writes ("[Xen-devel] [PATCH] ioemu: Disable format auto-probing in monitor command change"): > Format auto-probing of writable images is a security hole. The last > known remaining instance is monitor command change. Disable probing > there and use raw. This breaks change for images in all other > formats. > > Signed-off-by: Markus Armbruster For the avoidance of any doubt, re Markus's patch: Acked-By: Ian Jackson But this should be applied together with the patch I posted earlier, which I assume Markus is also now happy with. So here is that one again for your comfort and convenience. Signed-off-by: Ian Jackson Ian. diff -r a88e19526770 tools/ioemu/hw/usb-msd.c --- a/tools/ioemu/hw/usb-msd.c Fri Jun 13 15:31:35 2008 +0100 +++ b/tools/ioemu/hw/usb-msd.c Fri Jun 13 16:08:34 2008 +0100 @@ -510,7 +510,7 @@ static void usb_msd_handle_destroy(USBDe qemu_free(s); } -USBDevice *usb_msd_init(const char *filename) +USBDevice *usb_msd_init(const char *filename, BlockDriver *drv) { MSDState *s; BlockDriverState *bdrv; @@ -520,7 +520,7 @@ USBDevice *usb_msd_init(const char *file return NULL; bdrv = bdrv_new("usb"); - if (bdrv_open(bdrv, filename, 0) < 0) + if (bdrv_open2(bdrv, filename, 0, drv) < 0) goto fail; s->bs = bdrv; diff -r a88e19526770 tools/ioemu/hw/usb.h --- a/tools/ioemu/hw/usb.h Fri Jun 13 15:31:35 2008 +0100 +++ b/tools/ioemu/hw/usb.h Fri Jun 13 16:08:05 2008 +0100 @@ -217,7 +217,7 @@ USBDevice *usb_tablet_init(void); USBDevice *usb_tablet_init(void); /* usb-msd.c */ -USBDevice *usb_msd_init(const char *filename); +USBDevice *usb_msd_init(const char *filename, BlockDriver *drv); /* usb.c */ void generic_usb_save(QEMUFile* f, void *opaque); diff -r a88e19526770 tools/ioemu/vl.c --- a/tools/ioemu/vl.c Fri Jun 13 15:31:35 2008 +0100 +++ b/tools/ioemu/vl.c Fri Jun 13 16:08:51 2008 +0100 @@ -4260,7 +4260,9 @@ static int usb_device_add(const char *de } else if (!strcmp(devname, "tablet")) { dev = usb_tablet_init(); } else if (strstart(devname, "disk:", &p)) { - dev = usb_msd_init(p); + dev = usb_msd_init(p, &bdrv_raw); + } else if (strstart(devname, "disk-qcow:", &p)) { + dev = usb_msd_init(p, 0); } else { return -1; }