All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	gleb@kernel.org, marc.zyngier@arm.com,
	christoffer.dall@linaro.org, kvm@vger.kernel.org,
	kvmarm@lists.cs.columbia.edu, steve.capper@linaro.org
Cc: lersek@redhat.com, fu.wei@linaro.org, peter.maydell@linaro.org
Subject: Re: [PATCH] KVM: check for !is_zero_pfn() in kvm_is_mmio_pfn()
Date: Fri, 12 Sep 2014 15:36:55 +0200	[thread overview]
Message-ID: <5412F6F7.8000903@redhat.com> (raw)
In-Reply-To: <1410527760-19737-1-git-send-email-ard.biesheuvel@linaro.org>

Il 12/09/2014 15:16, Ard Biesheuvel ha scritto:
> Read-only memory ranges may be backed by the zero page, so avoid
> misidentifying it a a MMIO pfn.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Fixes: b88657674d39 ("ARM: KVM: user_mem_abort: support stage 2 MMIO page mapping")
> ---
> 
> 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.
> 
>  virt/kvm/kvm_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 36b887dd0c84..f8adaabeac13 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;
>  }
> 

Thanks, applying to kvm/master.

Paolo

      reply	other threads:[~2014-09-12 13:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-12 13:16 [PATCH] KVM: check for !is_zero_pfn() in kvm_is_mmio_pfn() Ard Biesheuvel
2014-09-12 13:36 ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5412F6F7.8000903@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=christoffer.dall@linaro.org \
    --cc=fu.wei@linaro.org \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=lersek@redhat.com \
    --cc=marc.zyngier@arm.com \
    --cc=peter.maydell@linaro.org \
    --cc=steve.capper@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.