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>,
"Dmitry Vyukov" <dvyukov@google.com>
Subject: Re: [PATCH] KVM: X86: Fix SMRAM accessing even if VM is shutdown
Date: Wed, 7 Feb 2018 15:16:49 +0100 [thread overview]
Message-ID: <233cfca3-971e-c3c2-f0fe-b50dd69d2546@redhat.com> (raw)
In-Reply-To: <1517984706-47244-1-git-send-email-wanpengli@tencent.com>
On 07/02/2018 07:25, Wanpeng Li wrote:
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 786cd00..445e702 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -7458,6 +7458,11 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
> goto out;
> }
>
> + if (unlikely(vcpu->run->exit_reason == KVM_EXIT_SHUTDOWN)) {
> + r = -EINVAL;
> + goto out;
> + }
> +
> if (vcpu->run->kvm_dirty_regs) {
> r = sync_regs(vcpu);
> if (r != 0)
>
This most likely breaks triple faults in the usual case where they
should result in resetting the system; the KVM API doesn't say that you
should clear vcpu->run->exit_reason before entering.
What exactly causes the EPT misconfig to reach the WARN? That is, how
does kvm_mmu_page_fault end up returning a negative errno value? If I
read the code correctly only tdp_page_fault can do so, so my guess would
be kvm_handle_bad_page:
if (pfn == KVM_PFN_ERR_RO_FAULT)
return RET_PF_EMULATE;
if (pfn == KVM_PFN_ERR_HWPOISON) {
kvm_send_hwpoison_signal(kvm_vcpu_gfn_to_hva(vcpu, gfn),
current);
return RET_PF_RETRY;
}
/* KVM_PFN_ERR_FAULT */
return -EFAULT;
Maybe it should return RET_PF_EMULATE, which would cause an emulation
failure and then an exit with KVM_EXIT_INTERNAL_ERROR.
Thanks,
Paolo
next prev parent reply other threads:[~2018-02-07 14:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-07 6:25 [PATCH] KVM: X86: Fix SMRAM accessing even if VM is shutdown Wanpeng Li
2018-02-07 6:41 ` Dmitry Vyukov
2018-02-07 14:16 ` Paolo Bonzini [this message]
2018-02-08 7:35 ` Wanpeng Li
2018-02-08 8:57 ` Xiao Guangrong
2018-02-08 10:31 ` Paolo Bonzini
2018-02-09 3:22 ` Xiao Guangrong
2018-02-09 12:42 ` Paolo Bonzini
2018-02-11 3:20 ` Xiao Guangrong
2018-02-11 8:56 ` Wanpeng Li
2018-02-11 10:57 ` 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=233cfca3-971e-c3c2-f0fe-b50dd69d2546@redhat.com \
--to=pbonzini@redhat.com \
--cc=dvyukov@google.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rkrcmar@redhat.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).