]> Git Repo - linux.git/commitdiff
KVM: check for !is_zero_pfn() in kvm_is_mmio_pfn()
authorArd Biesheuvel <[email protected]>
Fri, 12 Sep 2014 13:16:00 +0000 (15:16 +0200)
committerPaolo Bonzini <[email protected]>
Sun, 14 Sep 2014 14:26:05 +0000 (16:26 +0200)
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 <[email protected]>
Fixes: b88657674d39 ("ARM: KVM: user_mem_abort: support stage 2 MMIO page mapping")
Signed-off-by: Paolo Bonzini <[email protected]>
virt/kvm/kvm_main.c

index 33712fb26eb11caa0f14bbf3b21a9e459c18252a..96ec6226e4ab61fd62ef418a0a92011c57129a59 100644 (file)
@@ -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;
 }
This page took 0.050233 seconds and 4 git commands to generate.