All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Vrabel <david.vrabel@citrix.com>
To: Juergen Gross <jgross@suse.com>,
	David Vrabel <david.vrabel@citrix.com>,
	<linux-kernel@vger.kernel.org>, <xen-devel@lists.xensource.com>,
	<konrad.wilk@oracle.com>
Subject: Re: [Xen-devel] [PATCH] xen: avoid writing to freed memory after race in p2m handling
Date: Tue, 14 Oct 2014 17:43:49 +0100	[thread overview]
Message-ID: <543D52C5.3010903@citrix.com> (raw)
In-Reply-To: <543CF19B.3040305@suse.com>

On 14/10/14 10:49, Juergen Gross wrote:
> On 10/14/2014 11:30 AM, David Vrabel wrote:
>> On 14/10/14 10:00, Juergen Gross wrote:
>>> In case a race was detected during allocation of a new p2m tree
>>> element in alloc_p2m() the new allocated mid_mfn page is freed without
>>> updating the pointer to the found value in the tree. This will result
>>> in overwriting the just freed page with the mfn of the p2m leaf.
>>
>> Can this race actually happen?  i.e., does this need tagging for stable?
> 
> Good question. I just stumbled over it while writing the linear p2m-list
> patch.
> 
> Is it possible for gnttab_map_refs() to call set_foreign_p2m_mapping()
> specifying a pfn which has been invalid before? In this case the race
> could happen in dom0.

Yes, if two backends map into ballooned pages from a region of
untouched,  pre-ballooned memory.  But these seems super rare and I
don't think there have been any bug reports that could be attributed to
this, so I don't think a stable backport is needed.

> I think ballooning alone can't trigger this race, as it is calling
> set_phys_to_machine() under lock only.

Agreed.

Applied to stable/for-linus-3.18.

Thanks.

David

WARNING: multiple messages have this Message-ID (diff)
From: David Vrabel <david.vrabel@citrix.com>
To: Juergen Gross <jgross@suse.com>,
	David Vrabel <david.vrabel@citrix.com>,
	linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com,
	konrad.wilk@oracle.com
Subject: Re: [Xen-devel] [PATCH] xen: avoid writing to freed memory after race in p2m handling
Date: Tue, 14 Oct 2014 17:43:49 +0100	[thread overview]
Message-ID: <543D52C5.3010903@citrix.com> (raw)
In-Reply-To: <543CF19B.3040305@suse.com>

On 14/10/14 10:49, Juergen Gross wrote:
> On 10/14/2014 11:30 AM, David Vrabel wrote:
>> On 14/10/14 10:00, Juergen Gross wrote:
>>> In case a race was detected during allocation of a new p2m tree
>>> element in alloc_p2m() the new allocated mid_mfn page is freed without
>>> updating the pointer to the found value in the tree. This will result
>>> in overwriting the just freed page with the mfn of the p2m leaf.
>>
>> Can this race actually happen?  i.e., does this need tagging for stable?
> 
> Good question. I just stumbled over it while writing the linear p2m-list
> patch.
> 
> Is it possible for gnttab_map_refs() to call set_foreign_p2m_mapping()
> specifying a pfn which has been invalid before? In this case the race
> could happen in dom0.

Yes, if two backends map into ballooned pages from a region of
untouched,  pre-ballooned memory.  But these seems super rare and I
don't think there have been any bug reports that could be attributed to
this, so I don't think a stable backport is needed.

> I think ballooning alone can't trigger this race, as it is calling
> set_phys_to_machine() under lock only.

Agreed.

Applied to stable/for-linus-3.18.

Thanks.

David

  reply	other threads:[~2014-10-14 16:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-14  9:00 [PATCH] xen: avoid writing to freed memory after race in p2m handling Juergen Gross
2014-10-14  9:30 ` [Xen-devel] " David Vrabel
2014-10-14  9:30   ` David Vrabel
2014-10-14  9:49   ` Juergen Gross
2014-10-14 16:43     ` David Vrabel [this message]
2014-10-14 16:43       ` David Vrabel

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=543D52C5.3010903@citrix.com \
    --to=david.vrabel@citrix.com \
    --cc=jgross@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --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.