kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wanpeng Li <wanpeng.li@linux.intel.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: kvm <kvm@vger.kernel.org>, Paolo Bonzini <pbonzini@redhat.com>,
	Bandan Das <bsd@redhat.com>
Subject: Re: nVMX: Shadowing of CPU_BASED_VM_EXEC_CONTROL broken
Date: Wed, 8 Oct 2014 17:25:39 +0800	[thread overview]
Message-ID: <20141008092539.GA16561@kernel> (raw)
In-Reply-To: <5434F5F9.3030803@siemens.com>

Hi Jan,
On Wed, Oct 08, 2014 at 10:29:45AM +0200, Jan Kiszka wrote:
>Hi all,
>
>after migrating a Jailhouse VM to a newer host platform with shadow VMCS
>support I found a bug. As you may know, Jailhouse doesn't intercept
>interrupts, thus also never requests an interrupt window. Nevertheless:
>
> qemu-system-x86-5777  [001] 74970.625324: kvm_mmio:             mmio write len 4 gpa 0xfebf5008 val 0x20 qemu-system-x86-5777  [001] 74970.625325: kvm_userspace_exit:   reason KVM_EXIT_MMIO (6)
> qemu-system-x86-5777  [001] 74970.625330: kvm_entry:            vcpu 1
> qemu-system-x86-5777  [001] 74970.625333: kvm_exit:             reason PENDING_INTERRUPT rip 0xffffffff81043e54 info 0 0
> qemu-system-x86-5777  [001] 74970.625333: kvm_nested_vmexit:    rip: 0xffffffff81043e54 reason: PENDING_INTERRUPT ext_inf1: 0x0000000000000000 ext_inf2: 0x0000000000000000 ext_int: 0x00000000 ext_int_err: 0x00000000
> qemu-system-x86-5777  [001] 74970.625334: kvm_nested_vmexit_inject: reason: PENDING_INTERRUPT ext_inf1: 0x0000000000000000 ext_inf2: 0x0000000000000000 ext_int: 0x00000000 ext_int_err: 0x00000000
> qemu-system-x86-5777  [001] 74970.625339: kvm_entry:            vcpu 1
> qemu-system-x86-5777  [001] 74970.625341: kvm_exit:             reason EPT_MISCONFIG rip 0xfffffffff0002307 info 0 0
> qemu-system-x86-5777  [001] 74970.625343: kvm_emulate_insn:     0:fffffffff0002307:8b 40 20 (prot64)
>
>And then Jailhouse crashes (which is also interesting to understand why
>- L1 host state is corrupt). Anyway, the point is that we leak
>CPU_BASED_VIRTUAL_INTR_PENDING from L0 into vmcs12. L0 sets it before
																					
In prepare_vmcs02:

exec_control = vmx_exec_control(vmx); /* L0's desires */
exec_control &= ~CPU_BASED_VIRTUAL_INTR_PENDING;
exec_control &= ~CPU_BASED_VIRTUAL_NMI_PENDING;
exec_control &= ~CPU_BASED_TPR_SHADOW;
exec_control |= vmcs12->cpu_based_vm_exec_control;

Could you point out where the other places L0 sets
CPU_BASED_VIRTUAL_INTR_PENDING before entering L2?

Regards,
Wanpeng Li 

>entering L2, and then we transfer it from the hardware state to vmc12 on
>exit because that VMCS field is shadowed. The crash disappears when
>disabling VMCS shadowing.
>
>Can we simply stop shadowing CPU_BASED_VM_EXEC_CONTROL when
>CPU_BASED_VIRTUAL_INTR_PENDING is injected to L2?
>
>Jan
>
>-- 
>Siemens AG, Corporate Technology, CT RTC ITP SES-DE
>Corporate Competence Center Embedded Linux
>--
>To unsubscribe from this list: send the line "unsubscribe kvm" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-10-08  9:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-08  8:29 nVMX: Shadowing of CPU_BASED_VM_EXEC_CONTROL broken Jan Kiszka
2014-10-08  8:47 ` Paolo Bonzini
2014-10-08  8:54   ` Jan Kiszka
2014-10-08  9:25 ` Wanpeng Li [this message]
2014-10-08  9:51   ` Jan Kiszka
2014-10-08 10:20     ` Paolo Bonzini
2014-10-08 10:29       ` Jan Kiszka
2014-10-08 10:34         ` Paolo Bonzini
2014-10-08 15:07           ` Jan Kiszka
2014-10-08 15:44             ` Paolo Bonzini
2014-10-08 16:07               ` Jan Kiszka
2014-10-08 23:34             ` Wanpeng Li
2014-10-08 23:58               ` 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=20141008092539.GA16561@kernel \
    --to=wanpeng.li@linux.intel.com \
    --cc=bsd@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@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).