From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Vrabel Subject: Re: [PATCH] xen: privcmd: do not return pages which we have failed to unmap Date: Wed, 4 Dec 2013 15:58:10 +0000 Message-ID: <529F5112.3020206@citrix.com> References: <1386172341-12110-1-git-send-email-ian.campbell@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1386172341-12110-1-git-send-email-ian.campbell@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: Ian Campbell Cc: xen-devel@lists.xenproject.org, Boris Ostrovsky , Stefano Stabellini , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 04/12/13 15:52, Ian Campbell wrote: > This failure represents a hypervisor issue, but if it does occur then nothing > good can come of returning pages which still refer to a foreign owned page > into the general allocation pool. > > Instead we are foced to leak them. Log that we have done so. ^forced > > The potential for failure only exists for autotranslated guest (e.g. ARM and > x86 PVH). [...] > --- a/drivers/xen/privcmd.c > +++ b/drivers/xen/privcmd.c > @@ -533,11 +533,17 @@ static void privcmd_close(struct vm_area_struct *vma) > { > struct page **pages = vma->vm_private_data; > int numpgs = (vma->vm_end - vma->vm_start) >> PAGE_SHIFT; > + int rc; > > if (!xen_feature(XENFEAT_auto_translated_physmap) || !numpgs || !pages) > return; > > - xen_unmap_domain_mfn_range(vma, numpgs, pages); > + rc = xen_unmap_domain_mfn_range(vma, numpgs, pages); > + if (rc < 0) { > + pr_crit("unable to unmap MFN range: leaking %d pages\n", > + numpgs); kfree(pages) here? I think that would be safe. Although at this point it probably doesn't really matter. David