From: Nai Xia <nai.xia@gmail.com>
To: Tim Deegan <tim@xen.org>
Cc: Lixiuchang <lixiuchang@huawei.com>,
Andres Lagar-Cavilla <andreslc@gridcentric.ca>,
Xiaowei Yang <xiaowei.yang@huawei.com>,
"Luohao (brian)" <brian.luohao@huawei.com>,
xen-devel@lists.xensource.com
Subject: Re: Is this a racing bug in page_make_sharable()?
Date: Fri, 11 Jan 2013 10:46:31 +0800 [thread overview]
Message-ID: <50EF7D07.2000601@gmail.com> (raw)
In-Reply-To: <20130110172535.GI99373@ocelot.phlegethon.org>
On 2013年01月11日 01:25, Tim Deegan wrote:
> At 11:36 -0500 on 10 Jan (1357817806), Andres Lagar-Cavilla wrote:
>> Hi there, thanks for the report. Sorry I didn't respond earlier, fell through the cracks.
>>
>> Having said that...
>> On Jan 10, 2013, at 8:00 AM, Tim Deegan <tim@xen.org> wrote:
>>
>>> Hi,
>>>
>>> At 23:35 +0800 on 27 Dec (1356651327), Nai Xia wrote:
>>>> I think I can construct a bug by interleaving the two code paths:
>>>>
>>>> in guest_remove_page() | in page_make_sharable()
>>>> ------------------------------------------------------------------------------------------------------------------------------
>>>> if ( p2m_is_shared(p2mt) ) .....
>>>> ... .....
>>>> page = mfn_to_page(mfn); .....
>>>> .....
>>>>
>>>> if (
>>>> !get_page_and_type(page,
>>>> d, PGT_shared_page) )
>>>> // success
>>>>
>>>> .........
>>>> if ( page->count_info !=
>>>> (PGC_allocated | (2 +
>>>> expected_refcnt)) ) //
>>>> also pass
>>>>
>>>>
>>>> if ( unlikely(!get_page(page, d)) )
>>>>
>>>> /* go on to remove page */ /* go on to add page to
>>>> cow domain */
>>>> -------------------------------------------------------------------------------------------------------------------------------------
>>>>
>>>>
>>>> is there anything that can already prevent such racing or is this really
>>>> can happen?
>>>
>>> I think this race can happen.
>>
>> Through a p2m entry in a domain. Is this the same domain as the one
>> for which quest_remove_page is executing? Then all is serialized
>> through the p2m lock, no race.
>
> Right, that's what I was missing. Because guest_remove_page has called
> get_gfn_query on the gfn, and not yet called put_gfn(),
> page_make_sharable() can't be running. All is well. :)
I see. Good to see everything working well. :)
Thanks,
Nai
>
> Thanks,
>
> Tim.
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2013-01-11 2:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4F14345B.4040807@gmail.com>
2012-01-16 14:43 ` Is this a racing bug in page_make_sharable()? Nai Xia
2012-01-17 10:53 ` Tim Deegan
2012-12-27 15:35 ` Nai Xia
2013-01-10 13:00 ` Tim Deegan
2013-01-10 16:36 ` Andres Lagar-Cavilla
2013-01-10 17:25 ` Tim Deegan
2013-01-11 2:46 ` Nai Xia [this message]
2012-01-16 14:51 Nai Xia
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=50EF7D07.2000601@gmail.com \
--to=nai.xia@gmail.com \
--cc=andreslc@gridcentric.ca \
--cc=brian.luohao@huawei.com \
--cc=lixiuchang@huawei.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xensource.com \
--cc=xiaowei.yang@huawei.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 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).