From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
"Wanpeng Li" <wanpeng.li@hotmail.com>,
"Brijesh Singh" <brijesh.singh@amd.com>
Subject: Re: [PATCH] KVM: MMU: Fix guest stuck during boot due to read/write emulation against GVA
Date: Fri, 11 Aug 2017 08:13:50 +0200 [thread overview]
Message-ID: <fda84686-898c-e073-4887-e08e2bcfefd0@redhat.com> (raw)
In-Reply-To: <1502431194-3636-1-git-send-email-wanpeng.li@hotmail.com>
On 11/08/2017 07:59, Wanpeng Li wrote:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
>
> Commit c016004494b0 (KVM: x86: Avoid guest page table walk when gpa_available
> is set) avoids the page table walk when cr2 has already contained a valid GPA.
> However, that is not the truth if ept == 0 and shadow page table is used. In
> this scenario cr2 can just contains a valid GVA. The commit results in guest
> stuck during boot due to read/write emulation against GVA instead of GPA of
> the guest.
>
> This patch fixes it by not setting the gpa_available flag if the shadow page table
> is used.
Yup, I got these on my overnight tests too. A better fix that I was
going to commit today is:
if (vcpu->arch.mmu.direct_map) {
vcpu->arch.gpa_available = true;
vcpu->arch.gpa_val = fault_address;
}
because AMD gets here even if npt=1.
Paolo
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Radim Krčmář <rkrcmar@redhat.com>
> Cc: Brijesh Singh <brijesh.singh@amd.com>
> Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
> ---
> arch/x86/kvm/mmu.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index 849312d..e4ce20b 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -3791,8 +3791,6 @@ int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code,
>
> if (need_unprotect && kvm_event_needs_reinjection(vcpu))
> kvm_mmu_unprotect_page_virt(vcpu, fault_address);
> - vcpu->arch.gpa_available = true;
> - vcpu->arch.gpa_val = fault_address;
> r = kvm_mmu_page_fault(vcpu, fault_address, error_code, insn,
> insn_len);
> break;
>
next prev parent reply other threads:[~2017-08-11 6:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-11 5:59 Wanpeng Li
2017-08-11 6:13 ` Paolo Bonzini [this message]
2017-08-11 6:15 ` Wanpeng Li
2017-08-11 6:40 ` David Hildenbrand
2017-08-11 6:47 ` Wanpeng Li
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=fda84686-898c-e073-4887-e08e2bcfefd0@redhat.com \
--to=pbonzini@redhat.com \
--cc=brijesh.singh@amd.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rkrcmar@redhat.com \
--cc=wanpeng.li@hotmail.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
all inboxes | Powered by JetHome®