From: George Dunlap <george.dunlap@eu.citrix.com>
To: Don Slutz <don.slutz@gmail.com>,
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>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Eddie Dong <eddie.dong@intel.com>, Tim Deegan <tim@xen.org>,
Jan Beulich <jbeulich@suse.com>,
Aravind Gopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
Jun Nakajima <jun.nakajima@intel.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:50:07 +0100 [thread overview]
Message-ID: <556F303F.6040707@eu.citrix.com> (raw)
In-Reply-To: <556F2D27.1060301@Gmail.com>
On 06/03/2015 05:36 PM, Don Slutz wrote:
> On 06/03/15 11:58, 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?
>
> Yes, however it is missing that Jan Beulich wanted the emulator in Xen
> to be used. I had started with code that did not use the emulator.
I agree with him that the emulator should be used to emulate the
instructions we *want* to emulate. I'm just not happy with using the
emulator to emulate all the instructions we *don't* want to emulate
(i.e., all the ones that really do need to #GP).
>>> 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.
>
> Not sure how you moved from attack surface to "real clock frequency"
> (which I am not sure which of the many "clock frequency" you are
> referring to. The only new one that leaps to mind is the emulated lapic
> bus frequency (which Linux attempts to determine from other clocks).
I'm talking about cost-benefits analysis. What's the benefit of
accepting this patch, and is it worth the cost?
My argument here is that the cost of this change is opening up a massive
attack surface on the Xen emulation code.
The benefit of this change: Allowing guest processes access to the
VMWare backdoor without guest OS cooperation. (Guest OSes can access
the backdoor without this patch.)
I hadn't gotten to the part of the series where Qemu was roped in to do
mouse and clipboard stuff; so at the time I wrote that, the only
functionality that it looked like was being made available to the guest
was reading the clock and a couple of other random bits.
But I see I have another e-mail from Andy with information of material
importance to this discussion.
-George
next prev parent reply other threads:[~2015-06-03 16:50 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
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 [this message]
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=556F303F.6040707@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=don.slutz@gmail.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.