From: George Dunlap <george.dunlap@eu.citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
Don Slutz <dslutz@verizon.com>,
xen-devel@lists.xen.org
Cc: Kevin Tian <kevin.tian@intel.com>, Keir Fraser <keir@xen.org>,
Ian Campbell <ian.campbell@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Jun Nakajima <jun.nakajima@intel.com>,
Eddie Dong <eddie.dong@intel.com>,
Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
Jan Beulich <jbeulich@suse.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Subject: Re: [PATCH v11 6/9] xen: Add ring 3 vmware_port support
Date: Wed, 3 Jun 2015 17:23:30 +0100 [thread overview]
Message-ID: <556F2A02.9010207@eu.citrix.com> (raw)
In-Reply-To: <556F2434.60004@citrix.com>
On 06/03/2015 04:58 PM, Andrew Cooper wrote:
> On 03/06/15 16:26, George Dunlap wrote:
>> On 05/22/2015 04:50 PM, Don Slutz wrote:
>>> Summary is that VMware treats "in (%dx),%eax" (or "out %eax,(%dx)")
>>> to port 0x5658 specially. Note: since many operations return data
>>> in EAX, "in (%dx),%eax" is the one to use. The other lengths like
>>> "in (%dx),%al" will still do things, only AL part of EAX will be
>>> changed. For "out %eax,(%dx)" of all lengths, EAX will remain
>>> unchanged.
>>>
>>> This instruction is allowed to be used from ring 3. To
>>> support this the vmexit for GP needs to be enabled. I have not
>>> fully tested that nested HVM is doing the right thing for this.
>>>
>>> Enable no-fault of pio in x86_emulate for VMware port
>>>
>>> Also adjust the emulation registers after doing a VMware
>>> backdoor operation.
>>>
>>> Add new routine hvm_emulate_one_gp() to be used by the #GP fault
>>> handler.
>>>
>>> Some of the best info is at:
>>>
>>> https://sites.google.com/site/chitchatvmback/backdoor
>>>
>>> Signed-off-by: Don Slutz <dslutz@verizon.com>
>> So let me get this straight.
>>
>> VMWare allows ring3 to access the magic port regardless of whether the
>> guest OS has enabled access to that IO port or not.
>>
>> In order to emulate this, we need to:
>> * Trap to Xen on #GPs rather than just letting the hardware handle it
>> * Emulate all instructions which cause a #GP, just to see if they might
>> be an IO instruction accessing the magic port.
>> * If it is an IO instruction, and it's accessing the magic port, then we
>> skip the ioport access checks (which will cause the instruction to
>> execute as though it had been given access).
>> * Under all other circumstances (we hope) the emulator in Xen will do
>> exactly what the hardware just did, and deliver a #GP to the guest.
>>
>> In an attempt to make this more safe, emulation ops that write (such as
>> write and cmpxchg) are replaced with stubs which always return an error.
>>
>> Is that about right?
>>
>> That sounds completely insane. It opens up an almost infinite surface
>> of attack onto the Xen emulator.
>>
>> I understand that having the "VMWare compatible" is a nice tick-box to
>> have, but seriously, I cannot imagine that having unprivileged
>> user-space tools know the real clock frequency without having to involve
>> the OS is anywhere close to worth the risk involved.
>
> The attack surface sadly is not enlarged in the slightest by this change.
>
> We already trap and emulate all #UD exceptions in an attempt to support
> migration of VMs between Intel and AMD hardware. See XSA-105. (There
> is a good argument to be made for not trapping #UD, but that doesn't
> completely close the hole)
So at the moment, an attacker on Intel can force the emulation of any
AMD-only instruction (and vice versa), is that right?
This would allow an attacker to force the emulation of every #GP
condition of every instruction we emulate.
Those two sets may be within an order of magnitude of each other, but
they will only overlap a little bit. So my guess is that enabling this
would double the surface of attack (give or take).
I'd be a lot happier with this patch if we could make it so that on a
#GP the only instruction that could get emulated would be an IO instruction.
-George
next prev parent reply other threads:[~2015-06-03 16:23 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-22 15:50 [PATCH v11 0/9] Xen VMware tools support Don Slutz
2015-05-22 15:50 ` [PATCH v11 1/9] tools: Add vga=vmware Don Slutz
2015-05-22 15:50 ` [PATCH v11 2/9] xen: Add support for VMware cpuid leaves Don Slutz
2015-05-22 15:50 ` [PATCH v11 3/9] tools: Add vmware_hwver support Don Slutz
2015-06-03 14:53 ` George Dunlap
2015-06-04 15:15 ` Ian Campbell
2015-06-04 15:46 ` Don Slutz
2015-06-04 15:17 ` Ian Campbell
2015-06-04 15:59 ` Don Slutz
2015-05-22 15:50 ` [PATCH v11 4/9] vmware: Add VMware provided include file Don Slutz
2015-05-22 15:50 ` [PATCH v11 5/9] xen: Add vmware_port support Don Slutz
2015-06-05 9:52 ` Jan Beulich
2015-06-05 13:18 ` Don Slutz
2015-05-22 15:50 ` [PATCH v11 6/9] xen: Add ring 3 " Don Slutz
2015-06-03 15:26 ` George Dunlap
2015-06-03 15:58 ` Andrew Cooper
2015-06-03 16:23 ` George Dunlap [this message]
2015-06-03 16:40 ` Andrew Cooper
2015-06-03 17:00 ` George Dunlap
2015-06-03 16:41 ` Don Slutz
2015-06-03 16:58 ` George Dunlap
2015-06-04 12:37 ` Don Slutz
2015-06-04 14:14 ` George Dunlap
2015-06-04 16:17 ` Don Slutz
2015-06-03 16:36 ` Don Slutz
2015-06-03 16:50 ` George Dunlap
2015-06-05 9:31 ` Jan Beulich
2015-06-05 10:54 ` Ian Campbell
2015-06-11 22:10 ` Don Slutz
2015-06-12 6:25 ` Jan Beulich
2015-06-12 12:52 ` Don Slutz
2015-06-23 16:14 ` Jan Beulich
2015-06-26 14:54 ` Don Slutz
2015-05-22 15:50 ` [PATCH v11 7/9] tools: Add " Don Slutz
2015-06-03 17:06 ` George Dunlap
2015-06-04 15:49 ` Ian Campbell
2015-06-04 16:09 ` Don Slutz
2015-06-04 15:20 ` Ian Campbell
2015-05-22 15:50 ` [PATCH v11 8/9] Add IOREQ_TYPE_VMWARE_PORT Don Slutz
2015-06-03 17:09 ` George Dunlap
2015-06-04 11:28 ` Don Slutz
2015-06-05 9:35 ` Jan Beulich
2015-06-05 10:03 ` Paul Durrant
2015-06-08 10:05 ` George Dunlap
2015-06-11 21:51 ` Don Slutz
2015-05-22 15:50 ` [PATCH v11 9/9] Add xentrace to vmware_port Don Slutz
2015-06-04 11:20 ` George Dunlap
2015-06-04 12:31 ` Don Slutz
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=556F2A02.9010207@eu.citrix.com \
--to=george.dunlap@eu.citrix.com \
--cc=Aravind.Gopalakrishnan@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=dslutz@verizon.com \
--cc=eddie.dong@intel.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jbeulich@suse.com \
--cc=jun.nakajima@intel.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=tim@xen.org \
--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 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.