All of lore.kernel.org
 help / color / mirror / Atom feed
From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: tim@xen.org, kevin.tian@intel.com, wei.liu2@citrix.com,
	ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com,
	jun.nakajima@intel.com, andrew.cooper3@citrix.com,
	ian.jackson@eu.citrix.com, xen-devel@lists.xen.org,
	eddie.dong@intel.com, Aravind.Gopalakrishnan@amd.com,
	suravee.suthikulpanit@amd.com, keir@xen.org,
	boris.ostrovsky@oracle.com
Subject: Re: [PATCH V2 2/3] xen/vm_event: Support for guest-requested events
Date: Thu, 25 Jun 2015 12:09:34 +0300	[thread overview]
Message-ID: <558BC54E.30206@bitdefender.com> (raw)
In-Reply-To: <558BD9F10200007800089610@mail.emea.novell.com>

On 06/25/2015 11:37 AM, Jan Beulich wrote:
>>>> On 25.06.15 at 09:55, <rcojocaru@bitdefender.com> wrote:
>> On 06/24/2015 06:03 PM, Jan Beulich wrote:
>>>>>> On 24.06.15 at 16:56, <rcojocaru@bitdefender.com> wrote:
>>>> Would it be fair to say that HVMOP_request_vm_event should be an
>>>> exception to this rule (i.e. something along the lines of "if (
>>>> unlikely(r12 == HVMOP_request_vm_event) && orig_pc == regs->pc )",
>>>> etc.)? Even in debug mode, a GUEST_REQUEST vm_event should keep the
>>>> state of the guest intact.
>>>
>>> It's a hypercall, and hence should follow hypercall rules. If the
>>> guest wants certain registers preserved, it should do so itself.
>>
>> Right, that's sensible, hypercalls should behave in a consistent manner.
>> The only issue here is that (and I think this would prove useful for
>> many future introspection clients), the trigger VMCALL doesn't often
>> happen from an in-guest driver.
>>
>> From what I understand from our introspection logic team (maybe they'll
>> chime in), VMCALLs are being used as markers in the code the OS is
>> running: "now we've reached this function, check out the guest
>> environment", "now we've reached this other function", etc.
>>
>> They seem to be doing this often by overwriting (from the dom0
>> application) the beginning of a function that needs hooked, and the
>> larger this custom code becomes, the more problems arise. In the
>> registers clobber scenario, both registers holding HVMOP and
>> HVMOP_request_vm_event need to be saved and restored (pushed and
>> popped), and now additionally, for safety, all the clobbered registers,
>> so the necessary code has increased several times since the early days
>> of "push eax, mov eax MAGIC_CONSTANT, vmcall, pop eax".
>>
>> Hence the request to at least not clobber the registers in this case,
>> and a reason why this initally was not a hypercall although the code
>> _almost_ acted like one.
>>
>> Any suggestions (other than to just live with the situation)? :)
> 
> Even for the original code sequence you quote above it would be
> less intrusive to the patched code if they just patched in a call.
> Namely in Windows, with its reportedly pretty uniform function
> prologues, there shouldn't be too many stub variants necessary
> that such calls would target.

That makes great sense, that's very likely going to be the way to go
forward, so the patch can stay as it is.


Thanks,
Razvan

  reply	other threads:[~2015-06-25  9:09 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15  9:03 Vm_event memory introspection helpers Razvan Cojocaru
2015-06-15  9:03 ` [PATCH V2 1/3] xen/vm_access: Support for memory-content hiding Razvan Cojocaru
2015-06-25 15:57   ` Jan Beulich
2015-06-26  8:22     ` Razvan Cojocaru
2015-06-26  8:44       ` Jan Beulich
2015-06-26  9:49         ` Razvan Cojocaru
2015-06-26  9:59           ` Jan Beulich
2015-06-15  9:03 ` [PATCH V2 2/3] xen/vm_event: Support for guest-requested events Razvan Cojocaru
2015-06-24 14:56   ` Razvan Cojocaru
2015-06-24 15:03     ` Jan Beulich
2015-06-25  7:55       ` Razvan Cojocaru
2015-06-25  8:37         ` Jan Beulich
2015-06-25  9:09           ` Razvan Cojocaru [this message]
2015-06-26  7:02   ` Jan Beulich
2015-06-26  7:17     ` Razvan Cojocaru
2015-06-26  8:45       ` Jan Beulich
2015-06-30 14:48       ` Lengyel, Tamas
2015-06-30 15:22         ` Razvan Cojocaru
2015-07-01  8:24         ` Razvan Cojocaru
2015-07-06 10:26         ` Jan Beulich
2015-07-06 13:46           ` Lengyel, Tamas
2015-06-30 14:23     ` Razvan Cojocaru
2015-07-06 10:27       ` Jan Beulich
2015-07-06 14:35         ` Razvan Cojocaru
2015-06-15  9:03 ` [PATCH V2 3/3] xen/vm_event: Deny register writes if refused by vm_event reply Razvan Cojocaru
2015-06-26  8:28   ` Jan Beulich
2015-06-26  9:17     ` Razvan Cojocaru
2015-06-26  9:39       ` Jan Beulich
2015-06-26 10:33         ` Razvan Cojocaru
2015-07-01 15:21     ` Razvan Cojocaru

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=558BC54E.30206@bitdefender.com \
    --to=rcojocaru@bitdefender.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=eddie.dong@intel.com \
    --cc=ian.campbell@citrix.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=wei.liu2@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 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.