From: Razvan Cojocaru <rcojocaru@bitdefender.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>, xen-devel@lists.xen.org
Cc: keir@xen.org, jbeulich@suse.com
Subject: Re: [PATCH] x86/monitor: Disallow setting mem_access_emulate_each_rep when vm_event is NULL
Date: Fri, 8 Apr 2016 11:29:27 +0300 [thread overview]
Message-ID: <57076BE7.5090008@bitdefender.com> (raw)
In-Reply-To: <5707691E.2010000@citrix.com>
On 04/08/16 11:17, Andrew Cooper wrote:
> On 08/04/2016 08:16, Razvan Cojocaru wrote:
>> On 04/08/16 10:10, Razvan Cojocaru wrote:
>>> It is meaningless (and potentially dangerous - see hvmemul_virtual_to_linear())
>>> to set mem_access_emulate_each_rep before xc_monitor_enable() (which allocates
>>> vcpu->arch.vm_event) has been called, so return an error from the
>>> XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP hypercall when that is the case.
>>>
>>> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
>>> ---
>>> xen/include/asm-x86/monitor.h | 15 +++++++++++++--
>>> 1 file changed, 13 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/xen/include/asm-x86/monitor.h b/xen/include/asm-x86/monitor.h
>>> index 0954b59..0544836 100644
>>> --- a/xen/include/asm-x86/monitor.h
>>> +++ b/xen/include/asm-x86/monitor.h
>>> @@ -35,11 +35,22 @@ int arch_monitor_domctl_op(struct domain *d, struct xen_domctl_monitor_op *mop)
>>> switch ( mop->op )
>>> {
>>> case XEN_DOMCTL_MONITOR_OP_EMULATE_EACH_REP:
>>> + {
>>> + bool_t value = !!mop->event;
>
> While you are at at, one extra newline here please.
>
>>> domain_pause(d);
>>> - d->arch.mem_access_emulate_each_rep = !!mop->event;
>>> + /*
>>> + * Enabling emulate_each_rep without a vm_event subscriber
>>> + * is meaningless.
>>> + */
>>> + if ( !d->vcpu || !d->vcpu[0]->arch.vm_event )
>> Sorry, this is a bit convoluted, and wrong: if d->vcpu != NULL it will
>> return -EINVAL even if d->vcpu[0]->arch.vm_event is NULL. I'll rework
>> it. Apologies for the noise.
>
> The issue comes about because d->arch.mem_access_emulate_each_rep is a
> per-domain variable, whereas vm_event listeners are per-vcpu.
>
> In principle, it would be legitimate for an introspection engine to only
> want to introspect a single vcpu.
>
> Either we need to enforce that every vcpu has vm_event infrastructure
> set up (and allow for delivery of events is disabled on a per-vcpu
> basis), or settings such as emulate_each_rep needs to be made per-vcpu.
Xc_monitor_enable() does set vm_event up for all of the domain's VCPUs,
so at least for now it is a fair assumption that if it is set for the
first one, it's set for all of them. In other words, your first
requirement is currently being implicitly enforced.
Introspecting a single VCPU is an interesting idea, but not terribly
useful at this point.
Thanks,
Razvan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
prev parent reply other threads:[~2016-04-08 8:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-08 7:10 [PATCH] x86/monitor: Disallow setting mem_access_emulate_each_rep when vm_event is NULL Razvan Cojocaru
2016-04-08 7:16 ` Razvan Cojocaru
2016-04-08 8:17 ` Andrew Cooper
2016-04-08 8:29 ` Razvan Cojocaru [this message]
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=57076BE7.5090008@bitdefender.com \
--to=rcojocaru@bitdefender.com \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=keir@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.