From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Christopherson Subject: Re: [PATCH] KVM: x86: never trap MSR_KERNEL_GS_BASE Date: Mon, 24 Sep 2018 09:04:57 -0700 Message-ID: <1537805097.8731.2.camel@intel.com> References: <1537803519-17941-1-git-send-email-pbonzini@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Return-path: In-Reply-To: <1537803519-17941-1-git-send-email-pbonzini@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Mon, 2018-09-24 at 17:38 +0200, Paolo Bonzini wrote: > KVM has an old optimization whereby accesses to the kernel GS base MSR > are trapped when the guest is in 32-bit and not when it is in 64-bit mode. > The idea is that swapgs is not available in 32-bit mode and thus the > guest has no reason to access the MSR unless in 64-bit mode.  Therefore > 32-bit applications need not pay the price of switching the kernel GS > base between the host and the guest values, 64-bit applications. > > However, this optimization adds complexity to the code for little > benefit (these days most guests are going to be 64-bit anyway) and in fact > broke after commit 678e315e78a7 ("KVM: vmx: add dedicated utility to > access guest's kernel_gs_base", 2018-08-06); the guest kernel GS base > can be corrupted across SMIs and UEFI Secure Boot is therefore broken > (a secure boot Linux guest, for example, fails to reach the login prompt > about half the time).  This patch just removes the optimization; the > kernel GS base MSR is now never trapped by KVM, similarly to the FS and > GS base MSRs. > > Fixes: 678e315e78a780dbef384b92339c8414309dbc11 > Cc: Sean Christopherson > Signed-off-by: Paolo Bonzini Reviewed-by: Sean Christopherson