From: Jeff Cody <jcody@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Max Reitz <mreitz@redhat.com>,
Markus Armbruster <armbru@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] Image probing: how it can be insecure, and what we could do about it
Date: Thu, 6 Nov 2014 10:52:03 -0500 [thread overview]
Message-ID: <20141106155203.GE23802@localhost.localdomain> (raw)
In-Reply-To: <545B823B.50705@redhat.com>
On Thu, Nov 06, 2014 at 03:14:19PM +0100, Eric Blake wrote:
> On 11/06/2014 02:57 PM, Markus Armbruster wrote:
>
> >> Yes, you can override the backing file driver (backing.driver=raw should
> >> do the trick). Not really user-friendly, especially with long backing
> >> file chains, but it happens to be there.
> >>
> >> And of course, libvirt should be using it for non-qcow2 or qcow2 without
> >> the backing format header extension (but doesn't yet).
> >
> > I'm glad it's there. Too bad libvirt doesn't use it, yet. Supports my
> > point that secure usage is too hard now.
>
> Indeed, libvirt is still lacking on enforcing the backing type that it
> probed vs. letting qemu re-probe a (possibly different) backing type.
> Were libvirt to actually enforce this (that is, libvirt's default
> out-of-the-box policy is to avoid all probes, and treat anything without
> a type as raw) means that a user that forgets to use -obacking_fmt and
> creates a chain base<-mid<-top will have the following conflicting view:
>
> libvirt: mid[raw]<-top[qcow2]
> qemu: base[qcow2]<-mid[qcow2]<-top[qcow2]
>
> Right now, if the chain is only 2 deep, qemu happily boots the guest
> with qcow2 format (in spite of libvirt treating mid as raw); but when
> the chain is 3 deep, because libvirt failed to give SELinux permissions
> to base, then qemu fails to open base, and fails to boot, but the
> failure message is very cryptic.
>
> On the other hand, if libvirt were to ENFORCE its view that mid is raw,
> by passing appropriate drive options, then qemu would always boot, but
> now the top image would be visibly corrupted (treating a qcow2 file as
> raw leads to MUCH different data visible in the guest) and the guest
> will likely fail to boot completely, but with no error message from qemu
> (rather more likely that things just hang in a 100% cpu loop in the
> guest). Although the existing error message is cryptic, this new
> behavior of enforcing a probed image to be raw feels like it will be
> even more user-unfriendly.
>
> At any rate, I've certainly been working on getting libvirt to output
> the ENTIRE backing chain that it has determined, rather than its old
> behavior of keeping that information in memory only; this at least helps
> libvirt developers diagnose bug reports ("show me what libvirt thought
> your backing chain was, then go fix your XML to tell libvirt the truth
> and your problem will go away, if you didn't corrupt the backing files
> in the meantime with something like a 'commit' operation").
>
> [I mentioned libvirt's default policy is to forbid probing and treat
> untyped disks as raw; but both of those knobs can be tweaked, to either
> allow probing, or treat the default type as qcow2, or both]
>
>
> >>
> >> .img is not as clear, I've seen people using it for other formats. It's
> >> still a disk image, but not a raw one.
> >
> > Is this usage common?
>
> At least on my laptop - yes. I have several qcow2 files with an image
> suffix of .img (perhaps because I was lazy when I created them, or
> sometimes because I was quickly hacking a script to add a -fqcow2 to a
> qemu-img line without changing the file name, because changing the name
> would have a ripple effect on the rest of the script). But I don't know
> if my usage is typical, and I also don't mind adjusting my naming
> conventions to silence a warning if qemu starts getting picky about
> confusing name-vs-contents issues. And if I consistently use
> format=qcow2, I shouldn't be penalized with the warning, right?
If you look at the QEMU "startup" documentation[1] we link to from the
wiki[2], it uses .img for many of the QEMU image creation and usage
examples. That leads me to think that '.img' usage as a generic
extension may be fairly common. But, [1] seems outdated, as well.
[1] http://en.wikibooks.org/wiki/QEMU/Images
[2] http://wiki.qemu.org/Manual
next prev parent reply other threads:[~2014-11-06 15:52 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-04 18:45 [Qemu-devel] Image probing: how it can be insecure, and what we could do about it Markus Armbruster
2014-11-04 20:33 ` Jeff Cody
2014-11-05 7:04 ` Markus Armbruster
2014-11-05 7:30 ` Markus Armbruster
2014-11-05 8:38 ` Max Reitz
2014-11-05 10:18 ` Eric Blake
2014-11-06 12:43 ` Markus Armbruster
2014-11-06 13:02 ` Eric Blake
2014-11-05 11:15 ` Kevin Wolf
2014-11-06 12:26 ` Markus Armbruster
2014-11-06 12:53 ` Max Reitz
2014-11-06 14:56 ` Jeff Cody
2014-11-06 15:00 ` Max Reitz
2014-11-07 14:52 ` Markus Armbruster
2014-11-07 15:17 ` Max Reitz
2014-11-10 7:58 ` Markus Armbruster
2014-11-07 9:57 ` Markus Armbruster
2014-11-06 13:02 ` Kevin Wolf
2014-11-07 14:50 ` Markus Armbruster
2014-11-05 10:12 ` Gerd Hoffmann
2014-11-05 10:33 ` Eric Blake
2014-11-06 12:52 ` Markus Armbruster
2014-11-05 11:01 ` Kevin Wolf
2014-11-06 13:57 ` Markus Armbruster
2014-11-06 14:14 ` Eric Blake
2014-11-06 15:52 ` Jeff Cody [this message]
2014-11-06 14:35 ` Jeff Cody
2014-11-06 15:01 ` Kevin Wolf
2014-11-07 15:21 ` Markus Armbruster
2014-11-07 17:33 ` Jeff Cody
2014-11-10 8:12 ` Markus Armbruster
2014-11-10 9:14 ` Kevin Wolf
2014-11-10 10:30 ` Markus Armbruster
2014-11-10 14:24 ` Jeff Cody
2014-11-11 8:28 ` Markus Armbruster
2014-11-10 8:13 ` Markus Armbruster
2014-11-05 15:24 ` Dr. David Alan Gilbert
2014-11-06 13:04 ` Markus Armbruster
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141106155203.GE23802@localhost.localdomain \
--to=jcody@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).