]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: x86: revalidate steal time cache if MSR value changes
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 4 Aug 2022 13:28:32 +0000 (15:28 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 10 Aug 2022 19:08:22 +0000 (15:08 -0400)
commit31507e41392728af9554fd723ce1e3f4fad71c91
tree361fcc8ac49845c255c86f34b495e070963844d4
parent861a92f58308776fe06989930feb6751a125e28a
KVM: x86: revalidate steal time cache if MSR value changes

Commit a4317b8a36c4 ("KVM: x86: Fix recording of guest steal time
/ preempted status", 2021-11-11) open coded the previous call to
kvm_map_gfn, but in doing so it dropped the comparison between the cached
guest physical address and the one in the MSR.  This cause an incorrect
cache hit if the guest modifies the steal time address while the memslots
remain the same.  This can happen with kexec, in which case the steal
time data is written at the address used by the old kernel instead of
the old one.

While at it, rename the variable from gfn to gpa since it is a plain
physical address and not a right-shifted one.

Reported-by: Dave Young <ruyang@redhat.com>
Reported-by: Xiaoying Yan <yiyan@redhat.com>
Analyzed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Cc: David Woodhouse <dwmw@amazon.co.uk>
Cc: stable@vger.kernel.org
Fixes: a4317b8a36c4 ("KVM: x86: Fix recording of guest steal time / preempted status")
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/x86.c