From: Anthony Liguori <anthony@codemonkey.ws>
To: Sasha Levin <levinsasha928@gmail.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>,
Cyrill Gorcunov <gorcunov@gmail.com>,
Rusty Russell <rusty@rustcorp.com.au>, kvm <kvm@vger.kernel.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
Corentin Chary <corentincj@iksaif.net>,
Asias He <asias.hejun@gmail.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>,
Pekka Enberg <penberg@kernel.org>, Avi Kivity <avi@redhat.com>,
Ingo Molnar <mingo@elte.hu>
Subject: Re: [Qemu-devel] Secure KVM
Date: Mon, 07 Nov 2011 11:37:03 -0600 [thread overview]
Message-ID: <4EB8173F.9090008@codemonkey.ws> (raw)
In-Reply-To: <1320612020.3299.22.camel@lappy>
On 11/06/2011 02:40 PM, Sasha Levin wrote:
> Hi all,
>
> I'm planning on doing a small fork of the KVM tool to turn it into a
> 'Secure KVM' enabled hypervisor. Now you probably ask yourself, Huh?
>
> The idea was discussed briefly couple of months ago, but never got off
> the ground - which is a shame IMO.
>
> It's easy to explain the problem: If an attacker finds a security hole
> in any of the devices which are exposed to the guest, the attacker would
> be able to either crash the guest, or possibly run code on the host
> itself.
>
> The solution is also simple to explain: Split the devices into different
> processes and use seccomp to sandbox each device into the exact set of
> resources it needs to operate, nothing more and nothing less.
>
> Since I'll be basing it on the KVM tool, which doesn't really emulate
> that many legacy devices, I'll focus first on the virtio family for the
> sake of simplicity (and covering 90% of the options).
>
> This is my basic overview of how I'm planning on implementing the
> initial POC:
>
> 1. First I'll focus on the simple virtio-rng device, it's simple enough
> to allow us to focus on the aspects which are important for the POC
> while still covering most bases (i.e. sandbox to single file
> - /dev/urandom and such).
>
> 2. Do it on a one process per device concept, where for each device
> (notice - not device *type*) requested, a new process which handles it
> will be spawned.
>
> 3. That process will be limited exactly to the resources it needs to
> operate, for example - if we run a virtio-blk device, it would be able
> to access only the image file which it should be using.
>
> 4. Connection between hypervisor and devices will be based on unix
> sockets, this should allow for better separation compared to other
> approaches such as shared memory.
>
> 5. While performance is an aspect, complete isolation is more important.
> Security is primary, performance is secondary.
>
> 6. Share as much code as possible with current implementation of virtio
> devices, make it possible to run virtio devices either like it's being
> done now, or by spawning them as separate processes - the amount of
> specific code for the separate process case should be minimal.
>
>
> Thats all I have for now, comments are *very* welcome.
I thought about this a bit and have some ideas that may or may not help.
1) If you add device save/load support, then it's something you can potentially
use to give yourself quite a bit of flexibility in changing the sandbox. At any
point in run time, you can save the device model's state in the sandbox, destroy
the sandbox, and then build a new sandbox and restore the device to its former
state.
This might turn out to be very useful in supporting things like device hotplug
and/or memory hot plug.
2) I think it's largely possible to implement all device emulation without doing
any dynamic memory allocation. Since memory allocation DoS is something you
have to deal with anyway, I suspect most device emulation already uses a fixed
amount of memory per device. This can potentially dramatically simplify things.
3) I think virtio can/should be used as a generic "backend to frontend"
transport between the device model and the tool.
4) Lack of select() is really challenging. I understand why it's not there
since it can technically be emulated but it seems like a no-risk syscall to
whitelist and it would make programming in a sandbox so much easier. Maybe
Andrea has some comments here? I might be missing something here.
Regards,
Anthony Liguori
>
next parent reply other threads:[~2011-11-07 17:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1320612020.3299.22.camel@lappy>
2011-11-07 17:37 ` Anthony Liguori [this message]
2011-11-07 17:52 ` [Qemu-devel] Secure KVM Sasha Levin
2011-11-07 18:03 ` Anthony Liguori
2011-11-07 23:06 ` Rusty Russell
2011-11-08 19:51 ` Will Drewry
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=4EB8173F.9090008@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=aarcange@redhat.com \
--cc=asias.hejun@gmail.com \
--cc=avi@redhat.com \
--cc=corentincj@iksaif.net \
--cc=gorcunov@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=mingo@elte.hu \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=penberg@kernel.org \
--cc=qemu-devel@nongnu.org \
--cc=rusty@rustcorp.com.au \
/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).