Skip to content

Commit

Permalink
KVM: check for !is_zero_pfn() in kvm_is_mmio_pfn()
Browse files Browse the repository at this point in the history
Read-only memory ranges may be backed by the zero page, so avoid
misidentifying it a a MMIO pfn.

This fixes another issue I identified when testing QEMU+KVM_UEFI, where
a read to an uninitialized emulated NOR flash brought in the zero page,
but mapped as a read-write device region, because kvm_is_mmio_pfn()
misidentifies it as a MMIO pfn due to its PG_reserved bit being set.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Fixes: b886576 ("ARM: KVM: user_mem_abort: support stage 2 MMIO page mapping")
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
Ard Biesheuvel authored and Paolo Bonzini committed Sep 14, 2014
1 parent 0b70068 commit 85c8555
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ static bool largepages_enabled = true;
bool kvm_is_mmio_pfn(pfn_t pfn)
{
if (pfn_valid(pfn))
return PageReserved(pfn_to_page(pfn));
return !is_zero_pfn(pfn) && PageReserved(pfn_to_page(pfn));

return true;
}
Expand Down

0 comments on commit 85c8555

Please sign in to comment.