From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <wanpeng.li@linux.intel.com>,
Jan Kiszka <jan.kiszka@siemens.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
Gleb Natapov <gleb@kernel.org>, Bandan Das <bsd@redhat.com>,
Zhang Yang <yang.z.zhang@intel.com>,
Hu Robert <robert.hu@intel.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] KVM: nVMX: Fix vmptrld fail and vmwrite error when L1 goes down
Date: Thu, 17 Jul 2014 10:56:09 +0200 [thread overview]
Message-ID: <53C78FA9.5000303@redhat.com> (raw)
In-Reply-To: <1405573011-41330-3-git-send-email-wanpeng.li@linux.intel.com>
Il 17/07/2014 06:56, Wanpeng Li ha scritto:
> This bug can be trigger by L1 goes down directly w/ enable_shadow_vmcs.
>
> [ 6413.158950] kvm: vmptrld (null)/780000000000 failed
> [ 6413.158954] vmwrite error: reg 401e value 4 (err 1)
> [ 6413.158957] CPU: 0 PID: 4840 Comm: qemu-system-x86 Tainted: G OE 3.16.0kvm+ #2
> [ 6413.158958] Hardware name: Dell Inc. OptiPlex 9020/0DNKMN, BIOS A05 12/05/2013
> [ 6413.158959] 0000000000000003 ffff880210c9fb58 ffffffff81741de9 ffff8800d7433f80
> [ 6413.158960] ffff880210c9fb68 ffffffffa059fa08 ffff880210c9fb78 ffffffffa05938bf
> [ 6413.158962] ffff880210c9fba8 ffffffffa059a97f ffff8800d7433f80 0000000000000003
> [ 6413.158963] Call Trace:
> [ 6413.158968] [<ffffffff81741de9>] dump_stack+0x45/0x56
> [ 6413.158972] [<ffffffffa059fa08>] vmwrite_error+0x2c/0x2e [kvm_intel]
> [ 6413.158974] [<ffffffffa05938bf>] vmcs_writel+0x1f/0x30 [kvm_intel]
> [ 6413.158976] [<ffffffffa059a97f>] free_nested.part.73+0x5f/0x170 [kvm_intel]
> [ 6413.158978] [<ffffffffa059ab13>] vmx_free_vcpu+0x33/0x70 [kvm_intel]
> [ 6413.158991] [<ffffffffa0360324>] kvm_arch_vcpu_free+0x44/0x50 [kvm]
> [ 6413.158998] [<ffffffffa0360f92>] kvm_arch_destroy_vm+0xf2/0x1f0 [kvm]
>
> Commit 26a865 (KVM: VMX: fix use after free of vmx->loaded_vmcs) fix the use
> after free bug by move free_loaded_vmcs() before free_nested(), however, this
> lead to free loaded_vmcs->vmcs premature and vmptrld load a NULL pointer during
> sync shadow vmcs to vmcs12. In addition, vmwrite which used to disable shadow
> vmcs and reset VMCS_LINK_POINTER failed since there is no valid current-VMCS.
> This patch fix it by skipping sync shadow vmcs and reset vmcs field for L1
> destroy since they will be reinitialized after L1 recreate.
>
> Signed-off-by: Wanpeng Li <wanpeng.li@linux.intel.com>
> ---
> arch/x86/kvm/vmx.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index fbce89e..2b28da7 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -6113,9 +6113,9 @@ static void free_nested(struct vcpu_vmx *vmx)
> return;
> vmx->nested.vmxon = false;
> if (vmx->nested.current_vmptr != -1ull) {
> - nested_release_vmcs12(vmx);
> vmx->nested.current_vmptr = -1ull;
> vmx->nested.current_vmcs12 = NULL;
> + nested_release_vmcs12(vmx);
> }
> if (enable_shadow_vmcs)
> free_vmcs(vmx->nested.current_shadow_vmcs);
>
This looks good, I'll apply it to kvm/master.
Paolo
next prev parent reply other threads:[~2014-07-17 8:56 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-17 4:56 [PATCH 1/3] KVM: nVMX: Fix virtual interrupt delivery injection Wanpeng Li
2014-07-17 4:56 ` [PATCH 2/3] KVM: nVMX: Fix fail to get nested ack intr's vector during nested vmexit Wanpeng Li
2014-07-17 5:15 ` Zhang, Yang Z
2014-07-17 8:49 ` Paolo Bonzini
2014-07-17 9:13 ` Zhang, Yang Z
2014-07-17 10:01 ` Wanpeng Li
2014-07-17 10:43 ` Paolo Bonzini
2014-07-17 10:03 ` Wanpeng Li
2014-07-17 4:56 ` [PATCH 3/3] KVM: nVMX: Fix vmptrld fail and vmwrite error when L1 goes down Wanpeng Li
2014-07-17 8:56 ` Paolo Bonzini [this message]
2014-07-17 9:04 ` Paolo Bonzini
2014-07-17 8:55 ` [PATCH 1/3] KVM: nVMX: Fix virtual interrupt delivery injection Paolo Bonzini
2014-07-17 9:03 ` Zhang, Yang Z
2014-07-17 9:11 ` Wanpeng Li
2014-07-17 10:43 ` Paolo Bonzini
2014-07-17 11:08 ` 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=53C78FA9.5000303@redhat.com \
--to=pbonzini@redhat.com \
--cc=bsd@redhat.com \
--cc=gleb@kernel.org \
--cc=jan.kiszka@siemens.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=robert.hu@intel.com \
--cc=wanpeng.li@linux.intel.com \
--cc=yang.z.zhang@intel.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