From: Tim Deegan Subject: Re: Xen-unstable, stubdom causes hypervisor crash Date: Wed, 20 May 2015 17:25:47 +0100 Message-ID: <20150520162547.GD12015@deinos.phlegethon.org> References: <20150520153952.GC23128@zion.uk.xensource.com> <555CABBF.1040204@citrix.com> <555CAC15.5000405@citrix.com> <555CCB8B020000780007C5A7@mail.emea.novell.com> <555CB073.3040705@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yv6ob-0005AP-8c for xen-devel@lists.xenproject.org; Wed, 20 May 2015 16:25:53 +0000 Content-Disposition: inline In-Reply-To: <555CB073.3040705@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Roger Pau =?iso-8859-1?Q?Monn=E9?= Cc: Andrew Cooper , Wei Liu , Jan Beulich , xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org At 18:04 +0200 on 20 May (1432145043), Roger Pau Monn=E9 wrote: > El 20/05/15 a les 17.59, Jan Beulich ha escrit: > >>>> On 20.05.15 at 17:45, wrote: > >> Try this: It appears that vfree(NULL) isn't safe. > > > > And intentionally so (I think this was even mentioned while discussing > > the patch), matching vunmap(). > = > Yes, but previous versions of vfree where able to cope with NULL. The > following fixes the callers: I'd much rather make vfree(NULL) safe than add guards to all its callers. Tim. > Signed-off-by: Roger Pau Monn=E9 > --- > diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c > index cea7990..0316b59 100644 > --- a/xen/arch/x86/mm/hap/hap.c > +++ b/xen/arch/x86/mm/hap/hap.c > @@ -174,7 +174,8 @@ int hap_track_dirty_vram(struct domain *d, > p2m_ram_logdirty, p2m_ram_rw); > } > out: > - vfree(dirty_bitmap); > + if ( dirty_bitmap ) > + vfree(dirty_bitmap); > = > return rc; > } > diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/com= mon.c > index 9e9d19f..88e0f7e 100644 > --- a/xen/arch/x86/mm/shadow/common.c > +++ b/xen/arch/x86/mm/shadow/common.c > @@ -3707,7 +3707,8 @@ out: > paging_unlock(d); > rc =3D -EFAULT; > } > - vfree(dirty_bitmap); > + if ( dirty_bitmap ) > + vfree(dirty_bitmap); > p2m_unlock(p2m_get_hostp2m(d)); > return rc; > } > = > =