public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: "Mihai Donțu" <mdontu@bitdefender.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Radim Krčmář" <rkrcmar@redhat.com>,
	"Adalbert Lazar" <alazar@bitdefender.com>,
	kvm@vger.kernel.org
Subject: Re: [RFC PATCH 00/19] Guest introspection
Date: Fri, 16 Jun 2017 18:59:04 +0300	[thread overview]
Message-ID: <1497628744.10504.12.camel@bitdefender.com> (raw)
In-Reply-To: <4c48494d-ee5e-ddd5-ce92-c29c25316ca3@siemens.com>

On Fri, 2017-06-16 at 17:34 +0200, Jan Kiszka wrote:
> On 2017-06-16 17:18, Mihai Donțu wrote:
> > On Fri, 2017-06-16 at 16:45 +0200, Jan Kiszka wrote:
> > > On 2017-06-16 15:43, Adalbert Lazar wrote:
> > > > This patch series proposes an interface that will allow a guest
> > > > introspection tool to monitor and control other guests, in order to
> > > > protect them against different forms of exploits. This type of interface
> > > > is already present in the XEN hypervisor.
> > > > 
> > > > With the current implementation, the introspection tool connects to
> > > > the KVMi (the introspection subsystem from KVM) using a vsock socket,
> > > > establishes a main communication channel, used for a few messages
> > > > (KVMI_EVENT_GUEST_ON, KVMI_EVENT_GUEST_OFF, KVMI_GET_GUESTS and
> > > > KVMI_GET_VERSION).
> > > > 
> > > > Every KVMI_EVENT_GUEST_ON notification, makes the introspection tool
> > > > establish a new connection, used to monitor and control that guest.
> > 
> > Thank you very much for taking a look over this series!
> > 
> > > What prevented building this on top of the already existing guest debug
> > > interfaces of KVM, maybe extending it where needed? Could be win-win.
> > 
> > I might be mistaking, but this would require the application using the
> > introspection capabilities to run on the host. If so, what we are
> > trying to do is to isolate the application into its own VM. This is why
> > we use vSock to communicate with the host.
> 
> Communication alone does not require isolation. Interpretation of what
> can be sees may benefit from that, though.
> 
> > If instead you are suggesting we integrate the kernel-side API into the
> > debug framework, I see no problem with that right now. We'll need a bit
> > more time to look into what that entails.
> 
> The hypervisor process could terminate your link, providing that other
> VM the introspection access. Or you even have a gdb-speaking process
> running on the host, just reusing the existing gdbstub of QEMU. Just
> wild ideas, I didn't look into details, and you may further elaborate on
> your requirements.
> 
> > > Also, this looks like as if it can easily work against the userspace
> > > part of the hypervisor - bad idea.
> > 
> > The way it is implemented right now, it works behind its back (qemu
> > specifically), in that it intercepts and handles certain events before
> > it. It should be possible to put some code in qemu and move part of the
> > logic in it, but we're trying hard to avoid context switches as guest
> > exits themselves are currently quite expensive. The experience comes
> > from working with Xen. We have no benchmark numbers for KVM.
> 
> Even if you don't run the hot-paths through QEMU, you should inform it
> about what is going on. Starting/stopping behind its back it bad, so is
> fiddling with guest stats. Keep in mind that your introspection VM is,
> well, just another VM that could be scheduled, suspended or even
> migrated away, and then you leave the original VM rather clueless behind.
> 
> Migration is actually an interesting topic of its own...

On this topic specifically, a complete security solution using guest
introspection interfaces will need to tap into the management
application and be notified when a migration is taking place. The
reason being, and I'm talking from our perspective only, that the
introspected guest is patched and those patches „talk” with the
security solution. A guest that reaches the destination in this state
will remain in limbo and (so far) can only be recovered through a
reboot.

> > > API/ABI documentation is missing.
> > 
> > Understood. We will try to put something together in the coming weeks.
> > 
> > > Did you check if the concept is portable to other architectures? Another
> > > reason to try hard to reuse existing interfaces.
> > 
> > The API that we propose is the result of work done for x86 and ARM,
> > though for the latter we're still working on a PoC. It's fairly
> > generic.
> > 
> > > Last but not least: LGPL slipped into your kernel parts - the kernel is GPL.
> > 
> > Good catch! We'll make the adjustment.
> > 
> > Thank-you!
> > 
> 
> BTW, I remember that there was/is some larger research community
> interested in such kind of interfaces as well, or they even have their
> own out-of-tree tooling. Hope they will speak up and review your
> proposals as well so that the result is of general use.

-- 
Mihai Donțu

  reply	other threads:[~2017-06-16 15:59 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-16 13:43 [RFC PATCH 00/19] Guest introspection Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 01/19] kvm: x86: mmu: Add kvm_mmu_get_spte() and kvm_mmu_set_spte() Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 02/19] kvm: x86: Add kvm_arch_vcpu_set_regs() Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 03/19] mm: Add vm_replace_page() Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 04/19] kvm: Add kvm_enum() Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 05/19] kvm: Add uuid member in struct kvm + support for KVM_CAP_VM_UUID Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 06/19] kvm: Add kvm_vm_shutdown() Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 07/19] kvm: x86: Add kvm_arch_msr_intercept() Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 08/19] kvm: Add the introspection subsystem Adalbert Lazar
2017-06-21 11:54   ` Paolo Bonzini
2017-06-21 12:36     ` Mihai Donțu
2017-06-21 12:57       ` Paolo Bonzini
2017-06-16 13:43 ` [RFC PATCH 09/19] kvm: Hook in kvmi on VM on/off events Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 10/19] kvm: vmx: Hook in kvmi_page_fault() Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 11/19] kvm: x86: Hook in kvmi_breakpoint_event() Adalbert Lazar
2017-06-21 11:48   ` Paolo Bonzini
2017-06-21 12:37     ` Mihai Donțu
2017-06-16 13:43 ` [RFC PATCH 12/19] kvm: x86: Hook in kvmi_trap_event() Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 13/19] kvm: x86: Hook in kvmi_cr_event() Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 14/19] kvm: x86: Hook in kvmi_xsetbv_event() Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 15/19] kvm: x86: Hook in kvmi_msr_event() Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 16/19] kvm: x86: Change the emulation context Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 17/19] kvm: x86: Hook in kvmi_vmcall_event() Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 18/19] kvm: x86: Set the new spte flags before entering the guest Adalbert Lazar
2017-06-16 13:43 ` [RFC PATCH 19/19] kvm: x86: Handle KVM_REQ_INTROSPECTION Adalbert Lazar
2017-06-16 14:45 ` [RFC PATCH 00/19] Guest introspection Jan Kiszka
2017-06-16 15:18   ` Mihai Donțu
2017-06-16 15:34     ` Jan Kiszka
2017-06-16 15:59       ` Mihai Donțu [this message]
2017-06-19  9:39       ` Stefan Hajnoczi
2017-06-20 14:58         ` alazar
2017-06-20 15:03           ` Jan Kiszka
2017-06-21 11:04           ` Stefan Hajnoczi
2017-06-21 13:25             ` Paolo Bonzini
2017-06-27 16:12               ` Mihai Donțu
2017-06-27 16:23                 ` Paolo Bonzini
2017-06-16 17:05     ` Paolo Bonzini
2017-06-16 17:27       ` Jan Kiszka

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=1497628744.10504.12.camel@bitdefender.com \
    --to=mdontu@bitdefender.com \
    --cc=alazar@bitdefender.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@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