All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Ian Campbell <Ian.Campbell@eu.citrix.com>
Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	Jeremy Fitzhardinge <Jeremy.Fitzhardinge@citrix.com>,
	Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Subject: Re: [PATCH] xen/p2m/m2p/gnttab: do not add failed grant maps to m2p override
Date: Wed, 9 Mar 2011 11:44:18 -0500	[thread overview]
Message-ID: <20110309164418.GA8049@dumpdata.com> (raw)
In-Reply-To: <1299260828.17339.21.camel@zakaz.uk.xensource.com>

On Fri, Mar 04, 2011 at 05:47:08PM +0000, Ian Campbell wrote:
> On Fri, 2011-03-04 at 17:38 +0000, Ian Campbell wrote:
> > The caller will not undo a mapping which failed and therefore the
> > override will not be removed.
> > 
> > This is especially bad in the case of GNTMAP_contains_pte mapping type
> > mappings where m2p_add_override will destroy the kernel mapping of the
> > page.
> > 
> > This was observed via a failure of map_grant_pages in gntdev_mmap (due
> > to userspace using a bad grant reference), which left the page in
> > question unmapped (because it was a GNTMAP_contains_pte mapping) which
> > led to a crash later on.
> 
> My original motivation for looking into this was a dom0 kernel crash in
> gntdev exposed by using the qemu disk backend on 2.6.32 (by mistake due
> to not loading blktap). The crash was in mn_release but was root caused
> by a map_grant_pages() failing (due to a bogus grant ref).
> 
> It seems that Daniel's "xen-gntdev: Add reference counting to maps" +

This one:
http://article.gmane.org/gmane.comp.emulators.xen.devel/100076 ?

> "xen/p2m/m2p/gnttab: do not add failed grant maps to m2p override" +
> this fix are sufficient to fix it for 2.6.38-rc7+ but I wonder if we

Can you point me to the "this fix" ? You mention three patches but
the last one is the same as 
"xen/p2m/m2p/gnttab: do not add failed grant maps to m2p override"

so that looks to be two patches.

> also want it fixed for 2.6.32? I think in that case backporting Daniel's
> patches is the best bet. (this fix won't be necessary, no m2p overlay in
> 2.6.32).
> 
> Ian.
> 
> > 
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> > Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> > Cc: Daniel De Graaf <dgdegra@tycho.nsa.gov>
> > Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> > Cc: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
> > ---
> >  drivers/xen/grant-table.c |    4 ++++
> >  1 files changed, 4 insertions(+), 0 deletions(-)
> > 
> > diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
> > index 1a9bc2b..d0e30ce 100644
> > --- a/drivers/xen/grant-table.c
> > +++ b/drivers/xen/grant-table.c
> > @@ -462,6 +462,10 @@ int gnttab_map_refs(struct gnttab_map_grant_ref *map_ops,
> >  		return ret;
> >  
> >  	for (i = 0; i < count; i++) {
> > +		/* Do not add to override if the map failed. */
> > +		if (map_ops[i].status)
> > +			continue;
> > +
> >  		if (map_ops[i].flags & GNTMAP_contains_pte) {
> >  			pte = (pte_t *) (mfn_to_virt(PFN_DOWN(map_ops[i].host_addr)) +
> >  				(map_ops[i].host_addr & ~PAGE_MASK));
> 

  reply	other threads:[~2011-03-09 16:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-04 17:38 [PATCH] xen/p2m/m2p/gnttab: do not add failed grant maps to m2p override Ian Campbell
2011-03-04 17:47 ` Ian Campbell
2011-03-09 16:44   ` Konrad Rzeszutek Wilk [this message]
2011-03-09 16:54     ` Ian Campbell

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=20110309164418.GA8049@dumpdata.com \
    --to=konrad.wilk@oracle.com \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=Jeremy.Fitzhardinge@citrix.com \
    --cc=Stefano.Stabellini@eu.citrix.com \
    --cc=dgdegra@tycho.nsa.gov \
    --cc=xen-devel@lists.xensource.com \
    /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.