diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2014-09-12 15:16:00 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-09-14 16:26:05 +0200 |
commit | 85c8555ff07ef09261bd50d603cd4290cff5a8cc (patch) | |
tree | 34a42659b3e0cbb905c3083b37a62d4e9594d206 /virt | |
parent | 0b70068e47e8f0c813a902dc3d6def601fd15acb (diff) | |
download | lwn-85c8555ff07ef09261bd50d603cd4290cff5a8cc.tar.gz lwn-85c8555ff07ef09261bd50d603cd4290cff5a8cc.zip |
KVM: check for !is_zero_pfn() in kvm_is_mmio_pfn()
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: b88657674d39 ("ARM: KVM: user_mem_abort: support stage 2 MMIO page mapping")
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 33712fb26eb1..96ec6226e4ab 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -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; } |