From: "Jan Beulich" Subject: Re: [V9 PATCH 7/8] pvh dom0: check for vioapic null ptr in vioapic_range Date: Wed, 16 Apr 2014 17:05:57 +0100 Message-ID: <534EC6850200007800009B08@nat28.tlf.novell.com> References: <1397607172-32065-1-git-send-email-mukesh.rathor@oracle.com> <1397607172-32065-8-git-send-email-mukesh.rathor@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WaSLY-0006oy-2q for xen-devel@lists.xenproject.org; Wed, 16 Apr 2014 16:06:00 +0000 In-Reply-To: <1397607172-32065-8-git-send-email-mukesh.rathor@oracle.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Mukesh Rathor Cc: George.Dunlap@eu.citrix.com, tim@xen.org, eddie.dong@intel.com, keir.xen@gmail.com, jun.nakajima@intel.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 16.04.14 at 02:12, wrote: > pvh doesn't use apic emulation, as a result vioapic_init is not called > and vioapic ptr in struct hvm_domain is not initialized. One path that > would access the ptr for pvh is : > > hvm_hap_nested_page_fault -> handle_mmio -> hvmemul_do_io -> > hvm_mmio_intercept -> vioapic_range Given this I'm not sure the guard belongs here. The majority of the handle_mmio() logic should never be used for Dom0. Perhaps you should simply have a pvh_mmio_handlers[] paralleling hvm_mmio_handlers[], but (presumably) only having HPET and MSI-X entries for now? Jan > --- a/xen/arch/x86/hvm/vioapic.c > +++ b/xen/arch/x86/hvm/vioapic.c > @@ -238,10 +238,11 @@ static int vioapic_write( > > static int vioapic_range(struct vcpu *v, unsigned long addr) > { > - struct hvm_hw_vioapic *vioapic = domain_vioapic(v->domain); > + struct hvm_vioapic *vioapic = v->domain->arch.hvm_domain.vioapic; > + struct hvm_hw_vioapic *hwapic = domain_vioapic(v->domain); > > - return ((addr >= vioapic->base_address && > - (addr < vioapic->base_address + VIOAPIC_MEM_LENGTH))); > + return (vioapic && (addr >= hwapic->base_address && > + (addr < hwapic->base_address + VIOAPIC_MEM_LENGTH))); > } > > const struct hvm_mmio_handler vioapic_mmio_handler = { > -- > 1.8.3.1