xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: George Dunlap <george.dunlap@eu.citrix.com>
To: Don Slutz <dslutz@verizon.com>, Jan Beulich <JBeulich@suse.com>
Cc: Tim Deegan <tim@xen.org>, 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>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	xen-devel@lists.xen.org, Eddie Dong <eddie.dong@intel.com>,
	AravindGopalakrishnan <Aravind.Gopalakrishnan@amd.com>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH for-4.5 v6 00/16] Xen VMware tools support
Date: Tue, 30 Sep 2014 11:09:43 +0100	[thread overview]
Message-ID: <542A8167.5080809@eu.citrix.com> (raw)
In-Reply-To: <5429E77F.6080601@terremark.com>

On 09/30/2014 12:13 AM, Don Slutz wrote:
> On 09/29/14 09:27, George Dunlap wrote:
>> On 09/29/2014 07:50 AM, Jan Beulich wrote:
>>>>>> On 26.09.14 at 22:00, <dslutz@verizon.com> wrote:
>>>> On 09/25/14 06:37, Tim Deegan wrote:
>>>>> At 17:18 +0100 on 22 Sep (1411402700), Jan Beulich wrote:
>>>>>> That's indeed what was said so far. I wonder though whether opening
>>>>>> this up without guest OS consent isn't gong to introduce a security
>>>>>> issue inside the guest (depending on the exact functionality of 
>>>>>> these
>>>>>> hypercalls).
>>>>> Yes indeed.  VMware seems to have CPL checks on some of the commands
>>>>> (but not all).  I guess Xen will be no worse than VMware if we do the
>>>>> same, though I'd like to have an official spec to follow for that.
>>>> Yes, VMware has CPL checks on some of the commands.  Not at all
>>>> clear the include file has the correct statement.  I have not do any
>>>> checking of CPL nor does QEMU.  And the RPC (which is CPL 3) is
>>>> one of the most likely to have a security issue.
>>>>
>>>> I do not know of an official spec to follow.  The best I have the
>>>> the provided include file and testing on VMware.
>>>>
>>>> I do know that BDOOR_CMD_GETHZ is one that is not allowed in
>>>> ring 3, but this makes no sense to me.  I do not see why tsc_freq
>>>> and apic bus speed to be things to hide.  And VMware is not
>>>> consistent.  On newer configs this same info is available via
>>>> cpuid leaf in ring 3.
>>>>
>>>> Also I have not idea if VMware did the CPL checking "correctly".
>>>> I.E. is a #GP => CPL 3, or do they check CPL?
>>>>
>>>> All this leads to I current do not check CPL on any VMware commands.
>>>>
>>>> I could look into doing this, but with the xl.cfg flag vmware_port=0
>>>> turns this all off, I do not see any need for CPL checking.
>>> Hmm, I think we need to settle on certain things here:
>>> a) I don't think it is okay to base our emulation layer entirely
>>> on observed behavior. At least some form of specification should
>>> be there to follow. This is both for reviewing the code you want
>>> committed and maintainability.
>>
>> While that would be nice, I think that's unlikely; and overall I 
>> think it would be better to have a reverse-engineered implementation 
>> than no implementation at all.  Having a reverse-engineered spec 
>> might be a good idea though.
>>
>
> I could work on a reverse-engineered spec.  Is having this on the wiki
> good enough or does it need to be in the code?
>
> There is a old but useful web page:
>
> https://sites.google.com/site/chitchatvmback/backdoor
>
> Which is basicly the start of a reverse-engineered spec.
>
> Since I am not proposing to implement all the listed commands
> on that web page, I could see some use in listing the currently
> supported VMware backdoor commands.
>
>>> b) I don't think it is okay to introduce security issues into a guest
>>> even if that is something that isn't enabled by default.
>>
>> I agree with this; in particular, it's quite possible that someone 
>> will decide to enable VMWare functionality by default, "just in 
>> case", and then forget that they've done so.
>>
>
> I am assuming that the phrase "security issues" is used as a
> reference to things like http://xenbits.xen.org/xsa/ or
> http://wiki.xen.org/wiki/Securing_Xen.
>
> Or as it might be stated -- A way to cause a guest to crash or have
> a DoS (/Denial of Service) or a way in from outside (like "/SMASH the
> Bash bug".
>
>
> But not the area of
> http://en.wikipedia.org/wiki/Rainbow_Series or
> http://en.wikipedia.org/wiki/Trusted_Computer_System_Evaluation_Criteria
>
> Which talks about "Covert Channel Analysis" and other complex
> security issues. (like *"Evaluation Assurance Level", **"Trusted 
> Computer System Evaluation Criteria", etc.)*
>
>
> I feel it is "safe" to run all guests with vmware_port=1 and
> vmware_hw=7.  However I am not stating that all guests function
> the same with just this.  I do know that xen_platform_pci=0
> may also need to be specified to get expected results.
>
> I also do not understand the statement "enable VMWare functionality by
> default".  I must be missing something because as far as I know each
> guest (domU) has it's own config.  Is this a xl tool stack feature (some
> common config for guests)? Or is it some other tool stack feature?
>
>
>>> c) Apparent or real flaws with VMware's native implementation
>>> should be brought up with VMware. While mimicking their behavior
>>> as closely as possible is certainly a desirable goal, reproducing
>>> flaws their code has should imo be avoided if at all possible.
>>
>> If our goal is compatibility with exiting tools, is there really such 
>> a thing as "reproducing flaws"?  Obviously we shouldn't reproduce a 
>> real security flaw, but for everything else, if the feature is "Looks 
>> just like VMWare", then being as close as possible in behavior is the 
>> ideal.
>>
>
> I can agree that is it ideal.  However getting to this ideal place can 
> have
> a high cost.  Case in point "BDOOR_CMD_GETHZ".  The VMware provided
> include file has no CPL comments.  The same include file in "open vm
> tools" does, but not for BDOOR_CMD_GETHZ.  However a VMware
> test system does different things for ring 0 (aka a Linux kernel module)
> and ring 3.  Neither one report a fault, but the ring 3 one does not
> return any data.  I do not know that the result is if I enable ring 3 I/O
> via the TSS (since I do not know of a simple way to do that).  If I 
> change
> IOPL then it still hides information.
>
> Now there is also the "BDOOR_CMD_GETMHZ".  It also has no CPL
> statement but does return the tsc_freq in MHZ.  So why is tsc_freq
> in HZ considered sensitive information, but in MHZ it is not?
>
> Just to confuse this more, for vmware_hw=7, cpuid leave 0x40000010
> has tsc_freq in KHZ.  So again why is tsc_freq in HZ special?
>
> How about the comment on other commands "/* CPL 0 only. */"
> which appears to apply here, but the comment is missing.  So
> do I check the segment register SS's DPL (what I know of as CPL),
> or is it the segment register CS's DPL (which has been mistakenly called
> CPL by some programs)?  Or is it something else which VMware has
> decided to mean "ring 3"?
>
>
> Based on all this, and since I do not see how tsc_freq in HZ could be
> a "real security flaw", I do not see a reason to spend a lot of time
> attempting to reverse engineer this strange behavior.
>
> I am not saying that I would not add some type of check for "ring 3"
> for this one command, but I do not see a good reason for it.  The only
> case I could see is that it is one of many ways to determine that you
> are running under Xen and not VMware.

Sure; the actual "feature" is for VMWare tools to work as expected 
within the guest.  Having the behavior be exactly the same as VMWare is 
one way of making sure those tools work; the amount of time you spend 
duplicating the exact behavior vs just making sure the tools work as 
expected is a sort of cost/benefits analysis.

The main risk of deviating from VMWare is if there are corners of the 
tool functionality you don't test, or if VMWare updates their tools and 
the new version is compatible with old VMWare hypervisors but not old 
Xen hypervisors.

  -George

  parent reply	other threads:[~2014-09-30 10:09 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-20 18:07 [PATCH for-4.5 v6 00/16] Xen VMware tools support Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 01/16] xen: Add support for VMware cpuid leaves Don Slutz
2014-09-22 11:49   ` Andrew Cooper
2014-09-22 16:53     ` Don Slutz
2014-09-24 14:33   ` George Dunlap
2014-09-20 18:07 ` [PATCH for-4.5 v6 02/16] tools: Add vmware_hw support Don Slutz
2014-09-22 13:34   ` Ian Campbell
2014-09-22 22:08     ` Don Slutz
2014-09-24 14:44   ` George Dunlap
2014-09-24 21:06     ` Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 03/16] vmware: Add VMware provided include files Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 04/16] xen: Add vmware_port support Don Slutz
2014-09-23 17:16   ` Boris Ostrovsky
2014-09-24  8:28     ` Jan Beulich
2014-09-26 19:09     ` Don Slutz
2014-09-24 16:01   ` George Dunlap
2014-09-24 16:48     ` Don Slutz
2014-09-24 17:42       ` Andrew Cooper
2014-09-20 18:07 ` [PATCH for-4.5 v6 05/16] tools: " Don Slutz
2014-09-22 13:41   ` Ian Campbell
2014-09-22 16:34     ` Andrew Cooper
2014-09-22 21:22       ` Don Slutz
2014-09-24 16:24         ` George Dunlap
2014-09-24 18:25           ` Don Slutz
2014-09-22 16:42     ` Don Slutz
2014-09-23 12:20       ` Ian Campbell
2014-09-24 16:31         ` Don Slutz
2014-09-24 16:44           ` George Dunlap
2014-09-24 18:29             ` Don Slutz
2014-09-25 11:24           ` Ian Campbell
2014-09-25 14:17             ` George Dunlap
2014-09-25 14:21               ` Ian Campbell
2014-09-26 19:19             ` Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 06/16] xen: Convert vmware_port to xentrace usage Don Slutz
2014-09-24 17:27   ` George Dunlap
2014-09-24 19:07     ` Don Slutz
2014-09-25 15:14       ` George Dunlap
2014-09-29 18:10         ` Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 07/16] tools: " Don Slutz
2014-09-25 15:18   ` George Dunlap
2014-09-20 18:07 ` [PATCH for-4.5 v6 08/16] xen: Add limited support of VMware's hyper-call rpc Don Slutz
2014-09-22 13:47   ` Ian Campbell
2014-09-22 21:18     ` Don Slutz
2014-09-23 12:34       ` Ian Campbell
2014-09-23 22:03         ` Slutz, Donald Christopher
2014-09-25 16:28     ` George Dunlap
2014-09-20 18:07 ` [PATCH for-4.5 v6 09/16] tools: " Don Slutz
2014-09-22 13:52   ` Ian Campbell
2014-09-22 21:32     ` Don Slutz
2014-09-23 12:35       ` Ian Campbell
2014-09-20 18:07 ` [PATCH for-4.5 v6 10/16] Add VMware tool's triggers Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 11/16] Add live migration of VMware's hyper-call RPC Don Slutz
2014-09-20 18:07 ` [PATCH for-4.5 v6 12/16] Add dump of HVM_SAVE_CODE(VMPORT) to xen-hvmctx Don Slutz
2014-09-20 18:07 ` [OPTIONAL][PATCH for-4.5 v6 13/16] Add xen-hvm-param Don Slutz
2014-09-20 18:07 ` [OPTIONAL][PATCH for-4.5 v6 14/16] Add xen-vmware-guestinfo Don Slutz
2014-09-20 18:07 ` [OPTIONAL][PATCH for-4.5 v6 15/16] Add xen-list-vmware-guestinfo Don Slutz
2014-09-20 18:07 ` [OPTIONAL][PATCH for-4.5 v6 16/16] Add xen-hvm-send-trigger Don Slutz
2014-09-22 13:56 ` [PATCH for-4.5 v6 00/16] Xen VMware tools support Ian Campbell
2014-09-22 15:19   ` George Dunlap
2014-09-22 15:34     ` Ian Campbell
2014-09-22 15:38       ` George Dunlap
2014-09-22 15:50         ` Ian Campbell
2014-09-22 15:55           ` George Dunlap
2014-09-22 17:19             ` Don Slutz
2014-09-22 22:00               ` Tian, Kevin
2014-09-23 12:30               ` Ian Campbell
2014-09-23 12:35                 ` George Dunlap
2014-09-23 12:40                   ` Ian Campbell
2014-09-24 15:52                 ` George Dunlap
2014-09-24 18:09                   ` Don Slutz
2014-09-24 17:19                 ` Don Slutz
2014-09-24 20:21                   ` Konrad Rzeszutek Wilk
2014-09-26 19:03                     ` Don Slutz
2014-09-26 19:28                       ` Konrad Rzeszutek Wilk
2014-09-25 11:35                   ` Ian Campbell
2014-09-22 16:18         ` Jan Beulich
2014-09-22 18:32           ` Don Slutz
2014-09-25 10:37           ` Tim Deegan
2014-09-26 20:00             ` Don Slutz
2014-09-29  6:50               ` Jan Beulich
2014-09-29 13:27                 ` George Dunlap
2014-09-29 13:49                   ` Jan Beulich
2014-09-29 23:13                   ` Don Slutz
2014-09-30  7:05                     ` Jan Beulich
2014-09-30 10:02                       ` George Dunlap
2014-09-30 22:11                         ` Slutz, Donald Christopher
2014-09-30 10:09                     ` George Dunlap [this message]
2014-09-30 22:23                       ` Slutz, Donald Christopher
2014-10-02 10:05               ` Tim Deegan
2014-10-02 19:20                 ` Don Slutz
2014-10-03  7:09                   ` Tim Deegan
2014-09-22 15:52       ` Andrew Cooper
2014-09-22 18:39         ` 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=542A8167.5080809@eu.citrix.com \
    --to=george.dunlap@eu.citrix.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=Ian.Campbell@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=dslutz@verizon.com \
    --cc=eddie.dong@intel.com \
    --cc=ian.jackson@eu.citrix.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 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).