[PATCH] KVM: x86: Avoid NULL dereference in kvm_apic_accept_pic_intr()

2012-02-06 Thread Michael Ellerman
A test case which does the following: ioctl(vmfd, KVM_CREATE_VCPU, 0); ioctl(vmfd, KVM_CREATE_IRQCHIP); ioctl(cpufd, KVM_RUN); Can oops in kvm_apic_accept_pic_intr() because vcpu->arch.apic == NULL. Because irqchip_in_kernel() is false when we create the vcpu we leave vcpu->arch.apic uninitia

Re: [PATCH] KVM: x86: Avoid NULL dereference in kvm_apic_accept_pic_intr()

2012-02-07 Thread Marcelo Tosatti
On Tue, Feb 07, 2012 at 05:32:07PM +1100, Michael Ellerman wrote: > A test case which does the following: > > ioctl(vmfd, KVM_CREATE_VCPU, 0); > ioctl(vmfd, KVM_CREATE_IRQCHIP); > ioctl(cpufd, KVM_RUN); > > Can oops in kvm_apic_accept_pic_intr() because vcpu->arch.apic == NULL. > > Because ir

Re: [PATCH] KVM: x86: Avoid NULL dereference in kvm_apic_accept_pic_intr()

2012-02-08 Thread Michael Ellerman
On Tue, 2012-02-07 at 17:38 -0200, Marcelo Tosatti wrote: > On Tue, Feb 07, 2012 at 05:32:07PM +1100, Michael Ellerman wrote: > > A test case which does the following: > > > > ioctl(vmfd, KVM_CREATE_VCPU, 0); > > ioctl(vmfd, KVM_CREATE_IRQCHIP); > > ioctl(cpufd, KVM_RUN); > > > > Can oops in k

Re: [PATCH] KVM: x86: Avoid NULL dereference in kvm_apic_accept_pic_intr()

2012-02-08 Thread Michael Ellerman
On Wed, 2012-02-08 at 21:41 +1100, Michael Ellerman wrote: > On Tue, 2012-02-07 at 17:38 -0200, Marcelo Tosatti wrote: > > On Tue, Feb 07, 2012 at 05:32:07PM +1100, Michael Ellerman wrote: > > > A test case which does the following: > > > > > > ioctl(vmfd, KVM_CREATE_VCPU, 0); > > > ioctl(vmfd,

Re: [PATCH] KVM: x86: Avoid NULL dereference in kvm_apic_accept_pic_intr()

2012-03-04 Thread Avi Kivity
On 02/08/2012 02:13 PM, Michael Ellerman wrote: > On Wed, 2012-02-08 at 21:41 +1100, Michael Ellerman wrote: > > On Tue, 2012-02-07 at 17:38 -0200, Marcelo Tosatti wrote: > > > On Tue, Feb 07, 2012 at 05:32:07PM +1100, Michael Ellerman wrote: > > > > A test case which does the following: > > > > >

Re: [PATCH] KVM: x86: Avoid NULL dereference in kvm_apic_accept_pic_intr()

2012-03-04 Thread Avi Kivity
On 03/04/2012 11:51 AM, Avi Kivity wrote: > However kvm_arch_vcpu_init(), which creates the lapic, _is_ called > without either the vcpu->mutex or kvm->lock held. This is irrelevant, the important bit is when it becomes visible. > Patch coming up. I'll add explicit variables for irqchip_in_ker