From mboxrd@z Thu Jan 1 00:00:00 1970 From: Radim =?utf-8?B?S3LEjW3DocWZ?= Subject: Re: [PATCH 2/2] KVM: x86: map/unmap private slots in __x86_set_memory_region Date: Tue, 13 Oct 2015 18:45:01 +0200 Message-ID: <20151013164500.GC6877@potion.brq.redhat.com> References: <1444651758-6926-1-git-send-email-pbonzini@redhat.com> <1444651758-6926-3-git-send-email-pbonzini@redhat.com> <20151013153957.GA9987@potion.brq.redhat.com> <561D3126.8060402@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, aderumier@odiso.com, stable@vger.kernel.org To: Paolo Bonzini Return-path: Content-Disposition: inline In-Reply-To: <561D3126.8060402@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org 2015-10-13 18:28+0200, Paolo Bonzini: > On 13/10/2015 17:39, Radim Kr=C4=8Dm=C3=A1=C5=99 wrote: >> 2015-10-12 14:09+0200, Paolo Bonzini: >>> Otherwise, two copies (one of them never used and thus bogus) are >>> allocated for the regular and SMM address spaces. This breaks >>> SMM with EPT but without unrestricted guest support, because the >>> SMM copy of the identity page map is all zeros. >>=20 >> (Have you found out why EPT+unrestricted didn't use the alternative = SMM >> mapping as well?) >=20 > Yes, that I already knew; EPT+unrestricted uses CR0.PG=3D0 directly s= o > it doesn't use the identity page at all. (CR0.PG=3D0 w/o unrestricte= d > instead runs with CR0.PG=3D1. CR3 load and store exits are enabled, > and the guest CR3 always points to the identity page map while the > guest runs). Thank you. >>> + } else { >>> + if (!slot->npages) >>> + return 0; >>> + >>> + hva =3D 0; >>> + } >>> + >>> + old =3D *slot; >>=20 >> (Assignment could be in the 'else' =3D=3D !size branch, GCC would ha= ve fun.) >=20 > It would have fun _and_ warn, which is why it's not in the else branc= h. :) I wondered if its "used uninitialized" analyzer got any better :)