KVM: x86/mmu: Use 64-bit address to invalidate to fix a subtle bug
authorLai Jiangshan <jiangshan.ljs@antgroup.com>
Thu, 16 Feb 2023 15:41:07 +0000 (23:41 +0800)
committerSean Christopherson <seanjc@google.com>
Thu, 16 Mar 2023 19:41:05 +0000 (12:41 -0700)
commit753b43c9d1b73337610861a6e644f8df3635d656
tree9471a03ef47d1192b52cc052bd5f35b2d2510488
parentd8708b80fa0e6e21bc0c9e7276ad0bccef73b6e7
KVM: x86/mmu: Use 64-bit address to invalidate to fix a subtle bug

FNAME(invlpg)() and kvm_mmu_invalidate_gva() take a gva_t, i.e. unsigned
long, as the type of the address to invalidate.  On 32-bit kernels, the
upper 32 bits of the GPA will get dropped when an L2 GPA address is
invalidated in the shadowed nested TDP MMU.

Convert it to u64 to fix the problem.

Reported-by: Sean Christopherson <seanjc@google.com>
Signed-off-by: Lai Jiangshan <jiangshan.ljs@antgroup.com>
Link: https://lore.kernel.org/r/20230216154115.710033-2-jiangshanlai@gmail.com
[sean: tweak changelog]
Signed-off-by: Sean Christopherson <seanjc@google.com>
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/mmu/paging_tmpl.h
arch/x86/kvm/x86.c