xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Paul Durrant <Paul.Durrant@citrix.com>
To: 'Jan Beulich' <JBeulich@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	Andrew Cooper <Andrew.Cooper3@citrix.com>,
	"Tim (Xen.org)" <tim@xen.org>,
	George Dunlap <George.Dunlap@citrix.com>,
	Ian Jackson <Ian.Jackson@citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v14 07/11] x86/mm: add an extra command to HYPERVISOR_mmu_update...
Date: Wed, 13 Dec 2017 17:03:57 +0000	[thread overview]
Message-ID: <896e6087717e450cadaa6adbdd9d4d44@AMSPEX02CL03.citrite.net> (raw)
In-Reply-To: <5A31545302000078001972D9@prv-mh.provo.novell.com>

> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: 13 December 2017 15:25
> To: Paul Durrant <Paul.Durrant@citrix.com>
> Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>; George Dunlap
> <George.Dunlap@citrix.com>; Ian Jackson <Ian.Jackson@citrix.com>; Wei Liu
> <wei.liu2@citrix.com>; Stefano Stabellini <sstabellini@kernel.org>; xen-
> devel@lists.xenproject.org; Tim (Xen.org) <tim@xen.org>
> Subject: RE: [PATCH v14 07/11] x86/mm: add an extra command to
> HYPERVISOR_mmu_update...
> 
> >>> On 13.12.17 at 15:49, <Paul.Durrant@citrix.com> wrote:
> >> From: Jan Beulich [mailto:JBeulich@suse.com]
> >> Sent: 13 December 2017 14:36
> >>  >>> On 13.12.17 at 13:06, <Paul.Durrant@citrix.com> wrote:
> >> >> From: Jan Beulich [mailto:JBeulich@suse.com]
> >> >> Sent: 12 December 2017 14:39
> >> >> >>> On 12.12.17 at 14:52, <andrew.cooper3@citrix.com> wrote:
> >> >> > We are deliberately trying to introducing a mechanism whereby a
> >> >> > toolstack/device-mode/other semi-privileged entity can map
> resources
> >> >> > belonging to a guest which are not part of the guests physmap.  This
> is
> >> >> > because we deliberately want to move things like emulator rings out
> of
> >> >> > the guest physmap for attack surface reduction purposes.
> >> >>
> >> >> Correct. What I was trying to point out with my reply is that the
> >> >> bypass here removes a check which previously we've been
> >> >> relying on: By finding the page in the guest's physmap, we can
> >> >> at least be certain that access to the page from outside of Xen is
> >> >> expected. With it removed, the only other check is the
> >> >> ownership one; the bypass in get_page_from_l1e() then blindly
> >> >> allows writable mappings to pages owned by the guest, even if
> >> >> they were shared r/o.
> >> >>
> >> >> So while the relaxation here is deliberate _for the purposes the
> >> >> series intends_, we still need to make sure we don't open a path
> >> >> for device models to gain access to memory which they aren't
> >> >> supposed to be able to write (or just read).
> >> >
> >> > So, a suggestion would be to use some form of flag on the page
> (probably a
> >> > PGC_ flag?) to tag it as a mappable resource. We can then white-list
> grant
> >> > frames and ioreq frames with the new flag and then make sure use of
> >> > MMU_PT_UPDATE_NO_TRANSLATE checks that the mfn is either in the
> >> guest P2M
> >> > anyway, or tagged as a mappable resource?
> >>
> >> This doesn't look to be race free: What about a page having the
> >> new flag removed while the page is still mapped, or in the process
> >> of being mapped (but already past the check of the flag)?
> >>
> >
> > Maybe that wouldn't work then. I don't really have any further
> suggestions.
> > The big question seems to be what does page ownership actually mean?
> 
> Maybe there was a misunderstanding in the first place: Unless you
> found an issue with the current version of the patch, I wasn't
> actually asking to add any further checking logic. Instead I was
> asking to double check that with the remaining (after XSA-248)
> ownership assignments we don't have any pages left which could
> have a mapping established, _despite_ the new bypass.
> 

Looking through the code, the only one thing that bothers me is the page_set_owner() done in shadow_enable() for the page used for HVM guest vcpus that have paging disabled. AFAICT that page would become mappable by an emulating domain with MMU_PT_UPDATE_NO_TRANSLATE, if it figured out or guessed the correct MFN, but I'm not sure whether damage could be done to Xen using that.

  Paul

> Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2017-12-13 17:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-28 15:08 [PATCH v14 00/11] x86: guest resource mapping Paul Durrant
2017-11-28 15:08 ` [PATCH v14 01/11] x86/hvm/ioreq: maintain an array of ioreq servers rather than a list Paul Durrant
2017-11-28 15:08 ` [PATCH v14 02/11] x86/hvm/ioreq: simplify code and use consistent naming Paul Durrant
2017-11-28 15:08 ` [PATCH v14 03/11] x86/hvm/ioreq: use gfn_t in struct hvm_ioreq_page Paul Durrant
2017-11-28 15:08 ` [PATCH v14 04/11] x86/hvm/ioreq: defer mapping gfns until they are actually requsted Paul Durrant
2017-12-06 21:49   ` Chao Gao
2017-12-07  8:38     ` Paul Durrant
2017-11-28 15:08 ` [PATCH v14 05/11] x86/mm: add HYPERVISOR_memory_op to acquire guest resources Paul Durrant
2017-11-28 18:50   ` Daniel De Graaf
2017-11-28 15:08 ` [PATCH v14 06/11] x86/hvm/ioreq: add a new mappable resource type Paul Durrant
2017-12-14  9:51   ` Paul Durrant
2017-12-14  9:52     ` Paul Durrant
2017-12-14 10:31     ` Paul Durrant
2017-12-14 13:46     ` Jan Beulich
2017-12-14 13:46       ` Paul Durrant
2017-11-28 15:08 ` [PATCH v14 07/11] x86/mm: add an extra command to HYPERVISOR_mmu_update Paul Durrant
2017-12-12 13:25   ` Jan Beulich
2017-12-12 13:52     ` Andrew Cooper
2017-12-12 14:38       ` Jan Beulich
2017-12-13 12:06         ` Paul Durrant
2017-12-13 14:35           ` Jan Beulich
2017-12-13 14:49             ` Paul Durrant
2017-12-13 15:24               ` Jan Beulich
2017-12-13 17:03                 ` Paul Durrant [this message]
2017-12-14 13:50                   ` Jan Beulich
2017-12-12 14:54     ` Paul Durrant
2017-11-28 15:08 ` [PATCH v14 08/11] tools/libxenforeignmemory: add support for resource mapping Paul Durrant
2017-11-28 15:08 ` [PATCH v14 09/11] tools/libxenforeignmemory: reduce xenforeignmemory_restrict code footprint Paul Durrant
2017-11-28 15:08 ` [PATCH v14 10/11] common: add a new mappable resource type: XENMEM_resource_grant_table Paul Durrant
2017-11-28 15:08 ` [PATCH v14 11/11] tools/libxenctrl: use new xenforeignmemory API to seed grant table Paul Durrant

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=896e6087717e450cadaa6adbdd9d4d44@AMSPEX02CL03.citrite.net \
    --to=paul.durrant@citrix.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=George.Dunlap@citrix.com \
    --cc=Ian.Jackson@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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).