All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andres Lagar-Cavilla <andres@lagarcavilla.org>
To: xen-devel@lists.xensource.com
Cc: ian.jackson@citrix.com, andres@gridcentric.ca, tim@xen.org,
	olaf@aepfle.de, adin@gridcentric.ca
Subject: [PATCH 0 of 3] Resend: correctness race when paging-in
Date: Thu, 01 Dec 2011 12:21:11 -0500	[thread overview]
Message-ID: <patchbomb.1322760071@xdev.gridcentric.ca> (raw)

P2m_mem_paging_prep ensures that an mfn is backing the paged-out gfn, and
transitions to the next state in the paging state machine for this page. 
Foreign mappings of the gfn will now succeed. This is the key idea, as it 
allows the pager to now map the gfn and fill in its contents.

Unfortunately, it also allows any other foreign mapper to map the gfn and read
its contents. This is particularly dangerous when the populate is launched
by a foreign mapper in the first place, which will be actively retrying the
map operation and might race with the pager. Qemu-dm being a prime example.

Fix the race by allowing a buffer to be optionally passed in the prep
operation, and having the hypervisor memcpy from that buffer into the newly
prepped page before promoting the gfn type.

Second patch is a tools patch.

Resent after feedback: xenpaging patch attached, simplified with use of 
copy_from_guest. Left potntial short-cut to avoid pging_resume for further 
discussion.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
 xen/arch/x86/mm/mem_event.c  |   2 +-
 xen/arch/x86/mm/mem_paging.c |   2 +-
 xen/arch/x86/mm/p2m.c        |  32 ++++++++++++++++++++++++++++++--
 xen/include/asm-x86/p2m.h    |   2 +-
 xen/include/public/domctl.h  |   8 ++++++--
 tools/libxc/xc_mem_event.c   |   4 ++--
 tools/libxc/xc_mem_paging.c  |  23 +++++++++++++++++++++++
 tools/libxc/xenctrl.h        |   2 ++
 tools/xenpaging/xenpaging.c  |  43 +++++++++++++++++++++----------------------
 9 files changed, 87 insertions(+), 31 deletions(-)

             reply	other threads:[~2011-12-01 17:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-01 17:21 Andres Lagar-Cavilla [this message]
2011-12-01 17:21 ` [PATCH 1 of 3] After preparing a page for page-in, allow immediate fill-in of the page contents Andres Lagar-Cavilla
2011-12-01 17:39   ` Tim Deegan
2011-12-01 17:21 ` [PATCH 2 of 3] Tools: Libxc wrappers to automatically fill in page oud page contents on prepare Andres Lagar-Cavilla
2011-12-01 17:23   ` Ian Jackson
2011-12-01 17:21 ` [PATCH 3 of 3] Teach xenpaging to use the new and non-racy xc_mem_paging_load Andres Lagar-Cavilla
2011-12-01 17:24   ` Ian Jackson
2011-12-01 18:00   ` Olaf Hering
2011-12-01 18:21 ` [PATCH 0 of 3] Resend: correctness race when paging-in Tim Deegan

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=patchbomb.1322760071@xdev.gridcentric.ca \
    --to=andres@lagarcavilla.org \
    --cc=adin@gridcentric.ca \
    --cc=andres@gridcentric.ca \
    --cc=ian.jackson@citrix.com \
    --cc=olaf@aepfle.de \
    --cc=tim@xen.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.