From: Paolo Bonzini Subject: Re: [PATCH v2 3/6] KVM: nVMX: fix SMI injection in guest mode Date: Wed, 20 Sep 2017 12:14:43 +0200 Message-ID: <21c06ca2-4bbd-a8eb-c593-45fe55134e64@redhat.com> References: <20170919153708.9019-1-lprosek@redhat.com> <20170919153708.9019-4-lprosek@redhat.com> <10e421ad-958d-3fa8-6dc1-3ed8a5e4b278@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: KVM list , Radim Krcmar To: Ladi Prosek Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42446 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751488AbdITKOq (ORCPT ); Wed, 20 Sep 2017 06:14:46 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E7AD280F90 for ; Wed, 20 Sep 2017 10:14:45 +0000 (UTC) In-Reply-To: Content-Language: en-US Sender: kvm-owner@vger.kernel.org List-ID: On 20/09/2017 10:52, Ladi Prosek wrote: >> Therefore, storing such hidden state or a subset of it in >> vmx->nested.smm is merely a convenience that lets you keep >> vmx->nested.vmxon == false while in SMM. This is different from nSVM, >> and I think it's an acceptable difference for the sake of convenience. > So for nSVM, you'd save to and restore from the state save area? I can > certainly do that but it would be hard to guarantee that KVM won't > blow up if the SMM handler pokes at these fields. It feels safer to > keep it internal or just save, not restore from it. I know that this > comment belongs to the nSVM patch but it looks similar to your > suggestion to protect CR4.VMXE on Intel. If we want to prevent SMM > from wreaking havoc by trying to enable VMX, shouldn't we use the same > measures on AMD and prevent it from switching VMCB while the nested > guest is running. Thanks! The difference is that on AMD you're actually allowed to do that. The SMM handler can also poke the general purpose register or even the descriptor cache, so I think we should stay close to what the manual says---even if it does two opposite things on Intel vs. AMD. Thanks! Paolo