All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Ian Campbell <ian.campbell@citrix.com>
Cc: xen-devel@lists.xenproject.org,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	xen-devel@lists.xen.org
Subject: Re: [PATCH] xen: privcmd: do not return pages which we have failed to unmap
Date: Wed, 4 Dec 2013 15:58:10 +0000	[thread overview]
Message-ID: <529F5112.3020206@citrix.com> (raw)
In-Reply-To: <1386172341-12110-1-git-send-email-ian.campbell@citrix.com>

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

  reply	other threads:[~2013-12-04 15:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-04 15:52 [PATCH] xen: privcmd: do not return pages which we have failed to unmap Ian Campbell
2013-12-04 15:58 ` David Vrabel [this message]
2013-12-04 16:03   ` Ian Campbell
2013-12-04 16:12     ` David Vrabel
2013-12-06 17:58     ` Stefano Stabellini
2013-12-06 20:08       ` Konrad Rzeszutek Wilk
2013-12-06 20:43         ` Stefano Stabellini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=529F5112.3020206@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.