On Mon, 2012-03-05 at 14:29 +0200, Avi Kivity wrote:
> If some vcpus are created before KVM_CREATE_IRQCHIP, then
> irqchip_in_kernel() and vcpu->arch.apic will be inconsistent, leading
> to potential NULL pointer dereferences.
> 
> Fix by:
> - ensuring that no vcpus are installed when KVM_CREATE_IRQCHIP is called
> - ensuring that a vcpu has an apic if it is installed after KVM_CREATE_IRQCHIP
> 
> This is somewhat long winded because vcpu->arch.apic is created without
> kvm->lock held.

Hi Avi,

Thanks for following up on this. This looks OK to me.

I wonder if we will end up needing to add other sanity tests at the same
point, ie. when we install the vcpu, in which case we might need a
generic "sanity hook". But better to keep it specific until we need
something generalised.

When we do irqchip-in-kernel on powerpc we'll need to rework the #ifdef
in kvm_host.h, because we don't want CONFIG_KVM_APIC_ARCHITECTURE, but
we will need our own kvm_vcpu_compatible(). But again we'll do that at
the time.

cheers

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to