From: Kai Huang <kai.huang@intel.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Maxim Levitsky <mlevitsk@redhat.com>,
Ben Gardon <bgardon@google.com>,
David Matlack <dmatlack@google.com>
Subject: Re: [PATCH] KVM: x86/mmu: Do not create SPTEs for GFNs that exceed host.MAXPHYADDR
Date: Mon, 02 May 2022 23:12:52 +1200 [thread overview]
Message-ID: <2d10ff16d3f5fa03886721c24f2db10d79759ed2.camel@intel.com> (raw)
In-Reply-To: <20220428233416.2446833-1-seanjc@google.com>
On Thu, 2022-04-28 at 23:34 +0000, Sean Christopherson wrote:
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index 904f0faff218..c10ae25135e3 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -3010,9 +3010,15 @@ static bool handle_abnormal_pfn(struct kvm_vcpu *vcpu, struct kvm_page_fault *fa
> /*
> * If MMIO caching is disabled, emulate immediately without
> * touching the shadow page tables as attempting to install an
> - * MMIO SPTE will just be an expensive nop.
> + * MMIO SPTE will just be an expensive nop. Do not cache MMIO
> + * whose gfn is greater than host.MAXPHYADDR, any guest that
> + * generates such gfns is either malicious or in the weeds.
> + * Note, it's possible to observe a gfn > host.MAXPHYADDR if
> + * and only if host.MAXPHYADDR is inaccurate with respect to
> + * hardware behavior, e.g. if KVM itself is running as a VM.
> */
> - if (unlikely(!enable_mmio_caching)) {
> + if (unlikely(!enable_mmio_caching) ||
> + unlikely(fault->gfn > kvm_mmu_max_gfn_host())) {
Shouldn't we check fault->gfn against cpuid_maxphyaddr(vcpu) instead of
kvm_mmu_max_gfn_host() here?
> *ret_val = RET_PF_EMULATE;
> return true;
> }
--
Thanks,
-Kai
next prev parent reply other threads:[~2022-05-02 11:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-28 23:34 [PATCH] KVM: x86/mmu: Do not create SPTEs for GFNs that exceed host.MAXPHYADDR Sean Christopherson
2022-04-29 10:36 ` Paolo Bonzini
2022-04-29 14:24 ` Sean Christopherson
2022-04-29 14:37 ` Paolo Bonzini
2022-04-29 14:42 ` Sean Christopherson
2022-04-29 14:50 ` Paolo Bonzini
2022-04-29 16:01 ` Sean Christopherson
2022-05-01 14:28 ` Maxim Levitsky
2022-05-01 14:32 ` Maxim Levitsky
2022-05-02 7:59 ` Maxim Levitsky
2022-05-02 8:56 ` Maxim Levitsky
2022-05-02 16:51 ` Sean Christopherson
2022-05-03 9:12 ` Maxim Levitsky
2022-05-03 15:12 ` Maxim Levitsky
2022-05-03 20:30 ` Sean Christopherson
2022-05-04 12:08 ` Maxim Levitsky
2022-05-04 14:47 ` Sean Christopherson
2022-05-04 19:11 ` Paolo Bonzini
2022-05-02 11:12 ` Kai Huang [this message]
2022-05-02 11:52 ` Paolo Bonzini
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=2d10ff16d3f5fa03886721c24f2db10d79759ed2.camel@intel.com \
--to=kai.huang@intel.com \
--cc=bgardon@google.com \
--cc=dmatlack@google.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mlevitsk@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).