From: David Vrabel <david.vrabel@citrix.com>
To: Juergen Gross <jgross@suse.com>, <linux-kernel@vger.kernel.org>,
<xen-devel@lists.xensource.com>, <konrad.wilk@oracle.com>
Subject: Re: [PATCH] xen: avoid race in p2m handling
Date: Thu, 16 Oct 2014 16:50:24 +0100 [thread overview]
Message-ID: <543FE940.60901@citrix.com> (raw)
In-Reply-To: <1413439997-32344-1-git-send-email-jgross@suse.com>
On 16/10/14 07:13, Juergen Gross wrote:
> When a new p2m leaf is allocated this leaf is linked into the p2m tree
> via cmpxchg. Unfortunately the compare value for checking the success
> of the update is read after checking for the need of a new leaf. It is
> possible that a new leaf has been linked into the tree concurrently
> in between. This could lead to a leaked memory page and to the loss of
> some p2m entries.
>
> Avoid the race by using the read compare value for checking the need
> of a new p2m leaf.
[...]
> @@ -579,11 +580,10 @@ static bool alloc_p2m(unsigned long pfn)
> }
> }
>
> - if (p2m_top[topidx][mididx] == p2m_identity ||
> - p2m_top[topidx][mididx] == p2m_missing) {
> + p2m_orig = p2m_top[topidx][mididx];
Do you need to use ACCESS_ONCE() here?
David
WARNING: multiple messages have this Message-ID (diff)
From: David Vrabel <david.vrabel@citrix.com>
To: Juergen Gross <jgross@suse.com>,
linux-kernel@vger.kernel.org, xen-devel@lists.xensource.com,
konrad.wilk@oracle.com
Subject: Re: [PATCH] xen: avoid race in p2m handling
Date: Thu, 16 Oct 2014 16:50:24 +0100 [thread overview]
Message-ID: <543FE940.60901@citrix.com> (raw)
In-Reply-To: <1413439997-32344-1-git-send-email-jgross@suse.com>
On 16/10/14 07:13, Juergen Gross wrote:
> When a new p2m leaf is allocated this leaf is linked into the p2m tree
> via cmpxchg. Unfortunately the compare value for checking the success
> of the update is read after checking for the need of a new leaf. It is
> possible that a new leaf has been linked into the tree concurrently
> in between. This could lead to a leaked memory page and to the loss of
> some p2m entries.
>
> Avoid the race by using the read compare value for checking the need
> of a new p2m leaf.
[...]
> @@ -579,11 +580,10 @@ static bool alloc_p2m(unsigned long pfn)
> }
> }
>
> - if (p2m_top[topidx][mididx] == p2m_identity ||
> - p2m_top[topidx][mididx] == p2m_missing) {
> + p2m_orig = p2m_top[topidx][mididx];
Do you need to use ACCESS_ONCE() here?
David
next prev parent reply other threads:[~2014-10-16 15:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-16 6:13 [PATCH] xen: avoid race in p2m handling Juergen Gross
2014-10-16 15:50 ` David Vrabel [this message]
2014-10-16 15:50 ` David Vrabel
2014-10-17 4:23 ` Juergen Gross
2014-10-17 10:15 ` [Xen-devel] " David Vrabel
2014-10-17 10:15 ` 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=543FE940.60901@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.