From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F845C3A589 for ; Tue, 20 Aug 2019 11:43:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DF89A216F4 for ; Tue, 20 Aug 2019 11:43:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729674AbfHTLnj (ORCPT ); Tue, 20 Aug 2019 07:43:39 -0400 Received: from mx01.bbu.dsd.mx.bitdefender.com ([91.199.104.161]:59344 "EHLO mx01.bbu.dsd.mx.bitdefender.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729611AbfHTLnj (ORCPT ); Tue, 20 Aug 2019 07:43:39 -0400 Received: from smtp.bitdefender.com (smtp01.buh.bitdefender.com [10.17.80.75]) by mx01.bbu.dsd.mx.bitdefender.com (Postfix) with ESMTPS id 1651E30644B8; Tue, 20 Aug 2019 14:43:37 +0300 (EEST) Received: from [192.168.1.34] (unknown [146.66.138.137]) by smtp.bitdefender.com (Postfix) with ESMTPSA id 30A373011E05; Tue, 20 Aug 2019 14:43:35 +0300 (EEST) Message-ID: <72df8b3ea66bb5bc7bb9c17e8bf12e12320358e1.camel@bitdefender.com> Subject: Re: [RFC PATCH v6 55/92] kvm: introspection: add KVMI_CONTROL_MSR and KVMI_EVENT_MSR From: Mihai =?UTF-8?Q?Don=C8=9Bu?= To: Nicusor CITU , Sean Christopherson Cc: Adalbert =?UTF-8?Q?Laz=C4=83r?= , "kvm@vger.kernel.org" , "linux-mm@kvack.org" , "virtualization@lists.linux-foundation.org" , Paolo Bonzini , Radim =?UTF-8?Q?Kr=C4=8Dm=C3=A1=C5=99?= , Konrad Rzeszutek Wilk , Tamas K Lengyel , Mathieu Tarral , Samuel =?ISO-8859-1?Q?Laur=E9n?= , Patrick Colp , Jan Kiszka , Stefan Hajnoczi , Weijiang Yang , "Zhang@vger.kernel.org" , Yu C Date: Tue, 20 Aug 2019 14:43:32 +0300 In-Reply-To: <6854bfcc2bff3ffdaadad8708bd186a071ad682c.camel@bitdefender.com> References: <20190809160047.8319-1-alazar@bitdefender.com> <20190809160047.8319-56-alazar@bitdefender.com> <20190812210501.GD1437@linux.intel.com> <20190819183643.GB1916@linux.intel.com> <6854bfcc2bff3ffdaadad8708bd186a071ad682c.camel@bitdefender.com> Organization: Bitdefender Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Tue, 2019-08-20 at 08:44 +0000, Nicusor CITU wrote: > > > > > +static void vmx_msr_intercept(struct kvm_vcpu *vcpu, unsigned > > > > > int > > > > > msr, > > > > > + bool enable) > > > > > +{ > > > > > + struct vcpu_vmx *vmx = to_vmx(vcpu); > > > > > + unsigned long *msr_bitmap = vmx->vmcs01.msr_bitmap; > > > > Is KVMI intended to play nice with nested virtualization? Unconditionally > > updating vmcs01.msr_bitmap is correct regardless of whether the vCPU > > is in L1 or L2, but if the vCPU is currently in L2 then the effective > > bitmap, i.e. vmcs02.msr_bitmap, won't be updated until the next nested VM- > > Enter. > > Our initial proof of concept was running with success in nested > virtualization. But most of our tests were done on bare-metal. > We do however intend to make it fully functioning on nested systems > too. > > Even thought, from KVMI point of view, the MSR interception > configuration would be just fine if it gets updated before the vcpu is > actually entering to nested VM. > I believe Sean is referring here to the case where the guest being introspected is a hypervisor (eg. Windows 10 with device guard). Even though we are looking at how to approach this scenario, the introspection tools we have built will refuse to attach to a hypervisor. Regards, -- Mihai Donțu