xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: David Scott <dave.scott@eu.citrix.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Xen Devel <xen-devel@lists.xen.org>,
	Andres Lagar Cavilla <andres@lagarcavilla.org>,
	Dushyant Behl <myselfdushyantbehl@gmail.com>
Subject: Re: [PATCH v2 3/3] [GSOC14] FIX:- Race condition between initializing shared ring and mempaging.
Date: Wed, 23 Jul 2014 11:46:45 +0100	[thread overview]
Message-ID: <53CF9295.9000308@citrix.com> (raw)
In-Reply-To: <1406111711.17482.0.camel@kazak.uk.xensource.com>

On 23/07/14 11:35, Ian Campbell wrote:
> On Wed, 2014-07-23 at 11:32 +0100, Andrew Cooper wrote:
>> On 23/07/14 11:14, Ian Campbell wrote:
>>> On Mon, 2014-07-21 at 15:40 +0100, Andrew Cooper wrote:
>>>
>>>>> Note that the XSA commmit, 6ae2df93c27, does exactly that. Enable
>>>>> paging/access/sharing, and only after that decrease reservation (and
>>>>> after that unpause). So the window is open ... methinks?
>>>> No - it does a domain pause around this set of critical operations, so
>>>> the guest is guaranteed not to be running, and therefore cannot
>>>> interfere.
>>> Shouldn't there be a memset in here somewhere? To clear out any bogus
>>> material in the ring? (maybe the caller of this code always clears the
>>> ring itself, I didn't check that)
>>>
>>> Ian.
>>>
>> Erm.  There probably should be.  Xen sets up the ring frontend
>> correctly, but nothing I can spot cleans up any stale backend state
>> which was preexisting in the page.
>>
>> It seems possible for a guest can map the affected pages and leave some
>> crafted backend replies which will be picked up as soon as mem_events
>> are enabled.  Combined with the lack of validation of responses in Xen,
>> this is quite bad.
> Indeed!
>
> BTW, I wonder why we don't make the initial P2M mapping R/O. That would
> still allow the tools to use the gpfn as a handle to pickup the page
> later but would stop the guest messing with it in the meantime.
>
> Ian.
>

Because the nominated pfn is in a RW hvmparam, so free to be altered by
the guest before mem_events are set up.

The correct solution to a whole slue of problems along these lines is
for an explicit notion of emulator pages for a domain, accounted to that
domain, but have never been part of the guest p2m.  Also, far more
restrictions on hvmparams. 

~Andrew

      reply	other threads:[~2014-07-23 10:46 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-16 18:20 [PATCH v2 0/3] Refactoring mempaging code from xenpaging to libxc and few updates Dushyant Behl
2014-06-16 18:20 ` [PATCH v2 1/3] [GSOC14] refactored mempaging code from xenpaging to libxc Dushyant Behl
2014-06-27 10:27   ` Ian Campbell
2014-06-27 10:37     ` Ian Campbell
2014-06-27 10:41       ` Andrew Cooper
2014-06-27 10:39     ` Dushyant Behl
2014-06-27 12:39       ` Ian Campbell
2014-06-28  3:32         ` Dushyant Behl
2014-06-30 10:37           ` Ian Campbell
2014-06-27 10:39   ` Ian Campbell
2014-06-16 18:20 ` [PATCH v2 2/3] [GSOC14] Replacing Deprecated Function Calls Dushyant Behl
2014-06-16 18:20 ` [PATCH v2 3/3] [GSOC14] FIX:- Race condition between initializing shared ring and mempaging Dushyant Behl
2014-06-27 10:33   ` Ian Campbell
2014-07-20 21:49     ` Dushyant Behl
2014-07-21  7:31       ` Andres Lagar Cavilla
2014-07-21  9:01         ` Andrew Cooper
2014-07-21 14:11           ` Andres Lagar Cavilla
2014-07-21 14:40             ` Andrew Cooper
2014-07-21 15:59               ` Andres Lagar Cavilla
2014-07-22 18:21                 ` Dushyant Behl
2014-07-23 10:14               ` Ian Campbell
2014-07-23 10:32                 ` Andrew Cooper
2014-07-23 10:35                   ` Ian Campbell
2014-07-23 10:46                     ` Andrew Cooper [this message]

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=53CF9295.9000308@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=andres@lagarcavilla.org \
    --cc=dave.scott@eu.citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=myselfdushyantbehl@gmail.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=xen-devel@lists.xen.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).