From: Yu Zhang <yu.c.zhang@linux.intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
min.he@intel.com, xen-devel@lists.xen.org, yi.z.zhang@intel.com
Subject: Re: [PATCH] x86/mm: fix a potential race condition in map_pages_to_xen().
Date: Thu, 9 Nov 2017 18:32:26 +0800 [thread overview]
Message-ID: <d375d4dd-d0ac-a371-f0bc-3d2e5181b55b@linux.intel.com> (raw)
In-Reply-To: <5A042C7A020000780018D740@prv-mh.provo.novell.com>
On 11/9/2017 5:22 PM, Jan Beulich wrote:
>>>> On 09.11.17 at 16:29, <yu.c.zhang@linux.intel.com> wrote:
>> In map_pages_to_xen(), a L2 page table entry may be reset to point to
>> a superpage, and its corresponding L1 page table need be freed in such
>> scenario, when these L1 page table entries are mapping to consecutive
>> page frames and having the same mapping flags.
>>
>> However, variable `pl1e` is not protected by the lock before L1 page table
>> is enumerated. A race condition may happen if this code path is invoked
>> simultaneously on different CPUs.
>>
>> For example, `pl1e` value on CPU0 may hold an obsolete value, pointing
>> to a page which has just been freed on CPU1. Besides, before this page
>> is reused, it will still be holding the old PTEs, referencing consecutive
>> page frames. Consequently the `free_xen_pagetable(l2e_to_l1e(ol2e))` will
>> be triggered on CPU0, resulting the unexpected free of a normal page.
>>
>> Protecting the `pl1e` with the lock will fix this race condition.
>>
>> Signed-off-by: Min He <min.he@intel.com>
>> Signed-off-by: Yi Zhang <yi.z.zhang@intel.com>
>> Signed-off-by: Yu Zhang <yu.c.zhang@linux.intel.com>
> Oh, one more thing: Is it really the case that all three of you
> contributed to the patch? We don't use the Linux model of
> everyone through whose hands a patch passes adding an
> S-o-b of their own - that would rather be Reviewed-by then (if
> applicable).
>
> Also generally I would consider the first S-o-b to be that of the
> original author, yet the absence of an explicit From: tag makes
> authorship ambiguous here. Please clarify this in v2.
Oh, we three found this issue when debugging a bug together. And Min is
the author of this patch. So I'd like to add
"From: Min He <min.he@intel.com> "
at the beginning of the commit message in v2. :-)
Yu
> Jan
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
prev parent reply other threads:[~2017-11-09 10:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-09 15:29 [PATCH] x86/mm: fix a potential race condition in map_pages_to_xen() Yu Zhang
2017-11-09 9:19 ` Jan Beulich
2017-11-09 10:24 ` Yu Zhang
2017-11-09 12:49 ` Jan Beulich
2017-11-09 9:22 ` Jan Beulich
2017-11-09 10:32 ` Yu Zhang [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=d375d4dd-d0ac-a371-f0bc-3d2e5181b55b@linux.intel.com \
--to=yu.c.zhang@linux.intel.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=min.he@intel.com \
--cc=xen-devel@lists.xen.org \
--cc=yi.z.zhang@intel.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).