]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: Mark CR4.TSD as being possibly owned by the guest
authorSean Christopherson <sean.j.christopherson@intel.com>
Fri, 3 Jul 2020 04:04:21 +0000 (21:04 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 3 Jul 2020 16:16:28 +0000 (12:16 -0400)
commite833b87f2f6060d8dc47ce01b240a8e3b9ba84c9
treecbef83178dccda56bce36c2387959803ed8275d4
parent9ee232c7798885959fecd430835c6a974b12e545
KVM: x86: Mark CR4.TSD as being possibly owned by the guest

Mark CR4.TSD as being possibly owned by the guest as that is indeed the
case on VMX.  Without TSD being tagged as possibly owned by the guest, a
targeted read of CR4 to get TSD could observe a stale value.  This bug
is benign in the current code base as the sole consumer of TSD is the
emulator (for RDTSC) and the emulator always "reads" the entirety of CR4
when grabbing bits.

Add a build-time assertion in to ensure VMX doesn't hand over more CR4
bits without also updating x86.

Fixes: ab3dade50ecb ("x86,kvm,vmx: Don't trap writes to CR4.TSD")
Cc: stable@vger.kernel.org
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Message-Id: <20200703040422.31536-2-sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/kvm_cache_regs.h
arch/x86/kvm/vmx/vmx.c