From: Anthony Liguori <anthony@codemonkey.ws>
To: Eric Blake <eblake@redhat.com>
Cc: "qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
Stefan Berger <stefanb@linux.vnet.ibm.com>
Subject: Re: [Qemu-devel] virtio-rng and fd passing
Date: Fri, 01 Mar 2013 21:13:38 -0600 [thread overview]
Message-ID: <87txouv6hp.fsf@codemonkey.ws> (raw)
In-Reply-To: <513147E4.5030005@redhat.com>
Eric Blake <eblake@redhat.com> writes:
> On 03/01/2013 04:59 PM, Anthony Liguori wrote:
>> I said this when seccomp was first introduced and I'll say it again.
>> blacklisting open() is a bad idea. DAC and MAC already exist and solve
>> this problem. We've got filesystem namespaces too.
>
> Let's explore that idea a bit further. What happens if libvirt decides
> to create a new filesystem namespace for qemu, where libvirt unmounts
> all non-local filesystems, as well as any file system that does not
> support SELinux labeling. Then all remaining filesystems, seen by qemu,
> will enforce SELinux semantics, and we can let qemu open() at will
> because the open will then be guarded by SELinux. The only remaining
> access is to files to the unmounted file systems, where fd passing from
> libvirt bypasses the fact that qemu can't see the file system. I could
> see that working, and it would still let us get rid of the selinux
> virt_use_nfs bool while still providing secure NFS out-of-the-box. And
> your argument is that virtio-rng should be pointed to a character
> device, never an NFS file, and therefore not using qemu_open() is no
> real loss because open() will not be blacklisted, just NFS file systems.
> Okay, maybe that will work.
A simpler version would be to chroot the QEMU process but sure.
> Still, I think I can come up with a scenario where fd passing makes
> sense. Consider the case of forensic analysis, where a guest image is
> cloned, and then slight modifications are done on forks of the guest, to
> play out some what-if scenarios. Let's suppose that I _want_ to have an
> accurate replay of all inputs to the guest - that means that I capture a
> fixed chunk of a true random source once, but then on each variation of
> a guest, I want to replay the _same_ stream of data. Yes, that is not
> random from the host's perspective - but in forensic analysis, you want
> to eliminate as many variables as possible. And from the guest's
> perspective, as long as the data was _originally_ captured from a true
> random source, replaying the data once per guest won't violate the
> random expectations within the guest. Now that means that I want to
> feed virtio-rng with a regular file, not a character device. Now, where
> do I store that file? Why not store it alongside my disk images - in
> NFS? That will only work if qemu can access the random data file; in
> other words, if fd passing is enforced, then accessing a replay stream
> of previously captured random content from NFS storage requires the use
> of qemu_open().
This doesn't work. /dev/random can return partial reads whereas you
will likely return full reads. The guest also whitens input from a
hardware rng and that involves using additional sources of entropy.
Basically, you would need 100% deterministic execution for this to work.
There is no valid use-case of rng-random other than using /dev/random.
In fact, it was probably a mistake to even allow a filename to be
specified because it lets people do silly things (like /dev/urandom).
If you want anything other than /dev/random, you should use rng-egd.
Regards,
Anthony Liguori
>
> Maybe you are right that we don't need to blacklist ALL open(), but the
> moment we blacklist NFS open() (such as by the alternative of unmounting
> NFS in the qemu process), then consistency argues that it should still
> be possible to do fd passing. Should libvirt do fd passing for EVERY
> file? By your argument, no - only for files living in file systems that
> were blacklisted. But the point remains - who are you to say that I
> have no valid business opening a guest but feeding that guest's random
> hardware from a file that I store on host's NFS?
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
next prev parent reply other threads:[~2013-03-02 3:13 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <512FF819.7050505@redhat.com>
2013-03-01 9:51 ` [Qemu-devel] virtio-rng and fd passing Paolo Bonzini
2013-03-04 4:29 ` Amit Shah
2013-03-06 6:20 ` Amit Shah
2013-03-01 19:37 ` H. Peter Anvin
2013-03-01 20:13 ` Stefan Berger
2013-03-01 20:15 ` H. Peter Anvin
2013-03-01 20:41 ` Paolo Bonzini
2013-03-01 20:04 ` Anthony Liguori
2013-03-01 20:34 ` Stefan Berger
2013-03-01 21:08 ` Anthony Liguori
2013-03-01 21:13 ` Eric Blake
2013-03-01 23:05 ` Anthony Liguori
2013-03-01 23:14 ` Eric Blake
2013-03-01 23:59 ` Anthony Liguori
2013-03-02 0:29 ` Eric Blake
2013-03-02 3:13 ` Anthony Liguori [this message]
2013-03-02 12:23 ` Paolo Bonzini
2013-03-03 21:05 ` Anthony Liguori
2013-03-04 21:57 ` Eric Blake
2013-03-04 22:24 ` Anthony Liguori
2013-03-04 22:35 ` Eric Blake
2013-03-05 4:44 ` H. Peter Anvin
2013-03-04 21:54 ` Eric Blake
2013-03-02 0:34 ` Stefan Berger
2013-03-02 3:17 ` Anthony Liguori
2013-03-02 3:34 ` Stefan Berger
2013-03-03 21:06 ` Anthony Liguori
2013-03-04 15:27 ` Corey Bryant
2013-03-04 10:29 ` Daniel P. Berrange
2013-03-04 15:55 ` Corey Bryant
2013-03-01 22:59 ` Peter Krempa
2013-03-01 23:14 ` Anthony Liguori
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=87txouv6hp.fsf@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanb@linux.vnet.ibm.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).