]> www.infradead.org Git - users/dwmw2/linux.git/commit
KVM: x86: fix overlap between SPTE_MMIO_MASK and generation
authorPaolo Bonzini <pbonzini@redhat.com>
Sat, 18 Jan 2020 19:09:03 +0000 (20:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Feb 2020 12:37:12 +0000 (04:37 -0800)
commita8dd6917f4f043bf1f0e18683aa274f036e40f8c
treefe910af2da91bedb7717f3511c32c74f965f9951
parenteea53c94f03fd4cb114f298c9660933575067dd1
KVM: x86: fix overlap between SPTE_MMIO_MASK and generation

commit 56871d444bc4d7ea66708775e62e2e0926384dbc upstream.

The SPTE_MMIO_MASK overlaps with the bits used to track MMIO
generation number.  A high enough generation number would overwrite the
SPTE_SPECIAL_MASK region and cause the MMIO SPTE to be misinterpreted.

Likewise, setting bits 52 and 53 would also cause an incorrect generation
number to be read from the PTE, though this was partially mitigated by the
(useless if it weren't for the bug) removal of SPTE_SPECIAL_MASK from
the spte in get_mmio_spte_generation.  Drop that removal, and replace
it with a compile-time assertion.

Fixes: 6eeb4ef049e7 ("KVM: x86: assign two bits to track SPTE kinds")
Reported-by: Ben Gardon <bgardon@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kvm/mmu/mmu.c