xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: StefanoStabellini <stefano.stabellini@citrix.com>,
	Ian Campbell <ian.campbell@citrix.com>,
	Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH] x86/hvm: Allow the guest to permit the use of userspace hypercalls
Date: Tue, 12 Jan 2016 10:57:18 +0000	[thread overview]
Message-ID: <5694DC0E.7020001@citrix.com> (raw)
In-Reply-To: <5694BA6202000078000C5C6A@prv-mh.provo.novell.com>

On 12/01/16 07:33, Jan Beulich wrote:
>>>> On 11.01.16 at 18:17, <andrew.cooper3@citrix.com> wrote:
>> On 11/01/16 14:44, Jan Beulich wrote:
>>>>>> On 11.01.16 at 14:59, <andrew.cooper3@citrix.com> wrote:
>>>> Currently, hypercalls issued from HVM userspace will unconditionally fail
>>>> with -EPERM.
>>>>
>>>> This is inflexible, and a guest may wish to allow userspace to make
>>>> hypercalls.
>>> I thought previous discussion had made clear that routing these
>>> through ioctls or alike is the right approach, and hence the patch
>>> isn't needed. The more that an all-or-nothing approach seems
>>> pretty bold.
>> All other issues fixed in v2, but to answer this one specifically.
>>
>> In it inappropriate for Xen to presume that all guests want Linux-like
>> handing of situations like this.  It is simply not true.
>>
>> As part of getting my test framework ready to publish, I attempted to
>> port my XSA-106 unit tests to PV guests.  I have shelved that work as I
>> don't have sufficient time to fix PV trap handing in Xen at this present
>> time, but do plan to fix them in due course.
>>
>> The bugs I have identified so far are:
>> * "INT n" handling assumes the instruction was 2 bytes long
>> * In some circumstances, Xen crashes the domain rather than injecting
>> #NP[sel]
>> * In most circumstances, Xen delivers #GP[sel] where #NP[sel] would be
>> correct
> All of these could be considered part of the awareness
> requirements towards guests.

The first causes corruption of process state in circumstances which
wouldn't under native, including userspace state.

You could make that argument for the final two.  I reckon it is an
unreasonable requirement.

>
>> * Not possible to have non-dpl3 descriptors for #BP and #OF
> Actually the issue is broader I think (I've stumbled across this
> limitation before, namely in the context of the #AC issue having
> been the subject of a recent XSA) - you can't associate a DPL
> with any exception vector.

Ah - I had not patched Xen up sufficiently for the unit test to notice
this (the domain crashes rather than #NP exceptions were prohibitive).

>
>> * Not possible to mark an existing descriptor as not-present
> "Not easily possible" I suppose you mean, since one can by re-
> writing the entire table.

Can't be done atomically.  Even if interrupts are disabled, there is a
window where NMIs and MCEs would be lost.


Writing a PV guest from scratch has been very enlightening to
demonstrate how much of a trainwreck the ABI is.  Almost nothing is
documented.  Some bits which are documented are misleading.  Several
areas needlessly deviate from x86 architectural behaviour.  Almost any
deviation from the way Linux does things ends up in situations which
don't function.

~Andrew

  reply	other threads:[~2016-01-12 10:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 13:59 [PATCH] x86/hvm: Allow the guest to permit the use of userspace hypercalls Andrew Cooper
2016-01-11 14:32 ` Paul Durrant
2016-01-11 14:44 ` Jan Beulich
2016-01-11 17:17   ` Andrew Cooper
2016-01-11 18:26     ` David Vrabel
2016-01-11 18:32       ` Andrew Cooper
2016-01-11 18:40         ` David Vrabel
2016-01-11 18:50           ` Andrew Cooper
2016-01-12 12:07       ` Stefano Stabellini
2016-01-12 15:06         ` Jan Beulich
2016-01-12 17:05           ` Stefano Stabellini
2016-01-12 17:10             ` Juergen Gross
2016-01-12 17:23               ` Stefano Stabellini
2016-01-13  5:12                 ` Juergen Gross
2016-01-13 10:41                   ` Stefano Stabellini
2016-01-13 11:14                     ` Juergen Gross
2016-01-13 11:26                       ` Stefano Stabellini
2016-01-13 11:32                         ` Juergen Gross
2016-01-13 11:42         ` David Vrabel
2016-01-13 12:51           ` Stefano Stabellini
2016-01-12  7:33     ` Jan Beulich
2016-01-12 10:57       ` Andrew Cooper [this message]
2016-01-12 11:03         ` George Dunlap
2016-01-14 10:50 ` Ian Campbell

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=5694DC0E.7020001@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=ian.campbell@citrix.com \
    --cc=stefano.stabellini@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).