public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Joanna Rutkowska <joanna@invisiblethingslab.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Avi Kivity <avi@redhat.com>, kvm@vger.kernel.org
Subject: Re: A few KVM security questions
Date: Mon, 07 Dec 2009 18:58:11 +0100	[thread overview]
Message-ID: <4B1D4233.1070105@invisiblethingslab.com> (raw)
In-Reply-To: <4B1D3C54.6030305@codemonkey.ws>

[-- Attachment #1: Type: text/plain, Size: 3253 bytes --]

Anthony Liguori wrote:
> Joanna Rutkowska wrote:
>> Anthony Liguori wrote:
>>  
>>> Avi Kivity wrote:
>>>    
>>>> No.  Paravirtualization just augments the standard hardware interface,
>>>> it doesn't replace it as in Xen.
>>>>       
>>> NB, unlike Xen, we can (and do) run qemu as non-root.  Things like
>>> RHEV-H and oVirt constrain the qemu process with SELinux.
>>>
>>>     
>>
>> On Xen you can get rid of the qemu entirely, if you run only PV domains.
>>
>>  
>>> Also, you can use qemu to provide the backends to a Xen PV guest (see -M
>>> xenpv).  The effect is that you are moving that privileged code from the
>>> kernel (netback/blkback) to userspace (qemu -M xenpv).
>>>
>>> In general, KVM tends to keep code in userspace unless absolutely
>>> necessary.  That's a fundamental difference from Xen which tends to do
>>> the opposite.
>>>
>>>     
>>
>> But the difference is that in case of Xen one can *easily* move the
>> backends to small unprivileged VMs. In that case it doesn't matter the
>> code is in kernel mode, it's still only in an unprivileged domain.
>>   
> 
> Right, in KVM, Linux == hypervisor.  A process is our "unprivileged
> domain".  Putting an unprivileged domain within an unprivileged domain
> is probably not helpful from a security perspective since the exposure
> surface is identical.
> 
>> Sandboxing a process in a monolithic OS, like Linux, is generally
>> considered unfeasible, for anything more complex than a hello world
>> program. The process <-> kernel interface seem to be just too fat. See
>> e.g. the recent Linux kernel overflows by Spender.
>>   
> 
> That's the point of mandatory access control.  Of course, you need the
> right policy and Spender highlighted an issue with the standard RHEL
> SELinux policy, but that should be addressed now upstream.
> 
>> Also, SELinux seems to me like a step into the wrong direction. It not
>> only adds complexity to the already-too-complex kernel, but requires
>> complex configuration. See e.g. this paper[1] for a nice example of how
>> to escape SE-sandboxed qemu on FC8 due to SELinux policy
>> misconfiguration.
>>
>> When some people tried to add SELinux-like-thing to Xen hypervisor, it
>> only resulted in an exploitable heap overflow in Xen [2].
>>   
> 
> It's certainly fair to argue the merits of SELinux as a mandatory access
> control mechanism.
> 
> Again though, that's the point of MLS.  Our first line of defense is
> qemu.  Our second line of defense is traditional Posix direct access
> control.  Our third line of defense is namespace isolation (ala lxc). 
> Our fourth line of defense is mandatory access control (ala SELinux and
> AppArmor).
> 
> If you take a somewhat standard deployment like RHEV-H, an awful lot of
> things have to go wrong before you can successfully exploit the system. 
> And 5.4 doesn't even implement all of what's possible.  If you're really
> looking to harden, you can be much more aggressive about privileges and
> namespace isolation.
> 

I think this ultimately comes down to the question: is the
built-from-scratch minimal PV interface (as in Xen) more secure than the
Linux's fat-but-sandboxed interface?

joanna.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

  reply	other threads:[~2009-12-07 17:58 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-07 13:05 A few KVM security questions Joanna Rutkowska
2009-12-07 13:17 ` Avi Kivity
2009-12-07 13:30   ` Joanna Rutkowska
2009-12-07 13:38     ` Avi Kivity
2009-12-07 14:06       ` Joanna Rutkowska
2009-12-07 14:09         ` Avi Kivity
2009-12-07 16:44       ` Anthony Liguori
2009-12-07 17:09         ` Joanna Rutkowska
2009-12-07 17:13           ` Avi Kivity
2009-12-07 17:15             ` Joanna Rutkowska
2009-12-07 17:18               ` Avi Kivity
2009-12-07 17:33                 ` Joanna Rutkowska
2009-12-07 18:34                   ` Avi Kivity
2009-12-09 10:43                   ` Pasi Kärkkäinen
2009-12-07 17:38               ` Anthony Liguori
2009-12-07 17:45                 ` Joanna Rutkowska
     [not found]                 ` <20091207181556.GM4679@tyrion.haifa.ibm.com>
2009-12-07 19:58                   ` Anthony Liguori
2009-12-07 17:33           ` Anthony Liguori
2009-12-07 17:58             ` Joanna Rutkowska [this message]
2009-12-07 17:47           ` Daniel P. Berrange
2009-12-07 13:55   ` Joanna Rutkowska
2009-12-07 14:01     ` Avi Kivity
2009-12-07 16:47     ` 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=4B1D4233.1070105@invisiblethingslab.com \
    --to=joanna@invisiblethingslab.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    /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