xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tests/xen-access: disable CR4 write events on application exit
@ 2018-01-29 17:10 Razvan Cojocaru
  2018-01-29 17:58 ` Tamas K Lengyel
  0 siblings, 1 reply; 4+ messages in thread
From: Razvan Cojocaru @ 2018-01-29 17:10 UTC (permalink / raw)
  To: xen-devel; +Cc: wei.liu2, tamas, ian.jackson, Razvan Cojocaru

On exit, xen-access did not unsubscribe from CR4 write vm_events,
potentially leaving the guest stuck.

Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
---
 tools/tests/xen-access/xen-access.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/tests/xen-access/xen-access.c b/tools/tests/xen-access/xen-access.c
index 9d960e2..c572550 100644
--- a/tools/tests/xen-access/xen-access.c
+++ b/tools/tests/xen-access/xen-access.c
@@ -654,6 +654,8 @@ int main(int argc, char *argv[])
                 rc = xc_monitor_cpuid(xch, domain_id, 0);
             if ( desc_access )
                 rc = xc_monitor_descriptor_access(xch, domain_id, 0);
+            if ( write_ctrlreg_cr4 )
+                rc = xc_monitor_write_ctrlreg(xch, domain_id, VM_EVENT_X86_CR4, 0, 1, 0, 1);
 
             if ( privcall )
                 rc = xc_monitor_privileged_call(xch, domain_id, 0);
-- 
2.7.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests/xen-access: disable CR4 write events on application exit
  2018-01-29 17:10 [PATCH] tests/xen-access: disable CR4 write events on application exit Razvan Cojocaru
@ 2018-01-29 17:58 ` Tamas K Lengyel
  2018-01-29 18:03   ` Razvan Cojocaru
  0 siblings, 1 reply; 4+ messages in thread
From: Tamas K Lengyel @ 2018-01-29 17:58 UTC (permalink / raw)
  To: Razvan Cojocaru; +Cc: wei.liu2, Ian Jackson, Xen-devel

On Mon, Jan 29, 2018 at 10:10 AM, Razvan Cojocaru
<rcojocaru@bitdefender.com> wrote:
> On exit, xen-access did not unsubscribe from CR4 write vm_events,
> potentially leaving the guest stuck.
>
> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
> ---
>  tools/tests/xen-access/xen-access.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/tests/xen-access/xen-access.c b/tools/tests/xen-access/xen-access.c
> index 9d960e2..c572550 100644
> --- a/tools/tests/xen-access/xen-access.c
> +++ b/tools/tests/xen-access/xen-access.c
> @@ -654,6 +654,8 @@ int main(int argc, char *argv[])
>                  rc = xc_monitor_cpuid(xch, domain_id, 0);
>              if ( desc_access )
>                  rc = xc_monitor_descriptor_access(xch, domain_id, 0);
> +            if ( write_ctrlreg_cr4 )
> +                rc = xc_monitor_write_ctrlreg(xch, domain_id, VM_EVENT_X86_CR4, 0, 1, 0, 1);

Any reason for the sync and onchangeonly parts to be set to 1 here? I
don't think it has any effect when you are disabling an event.

Tamas

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests/xen-access: disable CR4 write events on application exit
  2018-01-29 17:58 ` Tamas K Lengyel
@ 2018-01-29 18:03   ` Razvan Cojocaru
  2018-01-29 21:01     ` Tamas K Lengyel
  0 siblings, 1 reply; 4+ messages in thread
From: Razvan Cojocaru @ 2018-01-29 18:03 UTC (permalink / raw)
  To: Tamas K Lengyel; +Cc: wei.liu2, Ian Jackson, Xen-devel

On 01/29/2018 07:58 PM, Tamas K Lengyel wrote:
> On Mon, Jan 29, 2018 at 10:10 AM, Razvan Cojocaru
> <rcojocaru@bitdefender.com> wrote:
>> On exit, xen-access did not unsubscribe from CR4 write vm_events,
>> potentially leaving the guest stuck.
>>
>> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
>> ---
>>  tools/tests/xen-access/xen-access.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/tools/tests/xen-access/xen-access.c b/tools/tests/xen-access/xen-access.c
>> index 9d960e2..c572550 100644
>> --- a/tools/tests/xen-access/xen-access.c
>> +++ b/tools/tests/xen-access/xen-access.c
>> @@ -654,6 +654,8 @@ int main(int argc, char *argv[])
>>                  rc = xc_monitor_cpuid(xch, domain_id, 0);
>>              if ( desc_access )
>>                  rc = xc_monitor_descriptor_access(xch, domain_id, 0);
>> +            if ( write_ctrlreg_cr4 )
>> +                rc = xc_monitor_write_ctrlreg(xch, domain_id, VM_EVENT_X86_CR4, 0, 1, 0, 1);
> 
> Any reason for the sync and onchangeonly parts to be set to 1 here? I
> don't think it has any effect when you are disabling an event.

Nope, they don't matter at all. I've just copied the "enable" line,
removed the mask so that the line would not go beyond 80 columns and
kept the rest as it was.

If the parameter after the index (VM_EVENT_X86_CR4) is 0, the others
don't matter.

But I can set them all to 0 if you prefer.


Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tests/xen-access: disable CR4 write events on application exit
  2018-01-29 18:03   ` Razvan Cojocaru
@ 2018-01-29 21:01     ` Tamas K Lengyel
  0 siblings, 0 replies; 4+ messages in thread
From: Tamas K Lengyel @ 2018-01-29 21:01 UTC (permalink / raw)
  To: Razvan Cojocaru; +Cc: wei.liu2, Ian Jackson, Xen-devel

On Mon, Jan 29, 2018 at 11:03 AM, Razvan Cojocaru
<rcojocaru@bitdefender.com> wrote:
> On 01/29/2018 07:58 PM, Tamas K Lengyel wrote:
>> On Mon, Jan 29, 2018 at 10:10 AM, Razvan Cojocaru
>> <rcojocaru@bitdefender.com> wrote:
>>> On exit, xen-access did not unsubscribe from CR4 write vm_events,
>>> potentially leaving the guest stuck.
>>>
>>> Signed-off-by: Razvan Cojocaru <rcojocaru@bitdefender.com>
>>> ---
>>>  tools/tests/xen-access/xen-access.c | 2 ++
>>>  1 file changed, 2 insertions(+)
>>>
>>> diff --git a/tools/tests/xen-access/xen-access.c b/tools/tests/xen-access/xen-access.c
>>> index 9d960e2..c572550 100644
>>> --- a/tools/tests/xen-access/xen-access.c
>>> +++ b/tools/tests/xen-access/xen-access.c
>>> @@ -654,6 +654,8 @@ int main(int argc, char *argv[])
>>>                  rc = xc_monitor_cpuid(xch, domain_id, 0);
>>>              if ( desc_access )
>>>                  rc = xc_monitor_descriptor_access(xch, domain_id, 0);
>>> +            if ( write_ctrlreg_cr4 )
>>> +                rc = xc_monitor_write_ctrlreg(xch, domain_id, VM_EVENT_X86_CR4, 0, 1, 0, 1);
>>
>> Any reason for the sync and onchangeonly parts to be set to 1 here? I
>> don't think it has any effect when you are disabling an event.
>
> Nope, they don't matter at all. I've just copied the "enable" line,
> removed the mask so that the line would not go beyond 80 columns and
> kept the rest as it was.
>
> If the parameter after the index (VM_EVENT_X86_CR4) is 0, the others
> don't matter.
>
> But I can set them all to 0 if you prefer.

Just to keep things clean I would appreciate that.

Thanks,
Tamas

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-01-29 21:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-29 17:10 [PATCH] tests/xen-access: disable CR4 write events on application exit Razvan Cojocaru
2018-01-29 17:58 ` Tamas K Lengyel
2018-01-29 18:03   ` Razvan Cojocaru
2018-01-29 21:01     ` Tamas K Lengyel

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).