Skip to contentSkip to conversation

tests/xen-access: disable CR4 write events on application exit

PATCH Superseded Razvan Cojocaru 2 participants 3 messages Jan 29, 2018 – Feb 1, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 tests/xen-access: disable CR4 write events on application exit

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

---
Changes since V1:
- Made all the ignored parameters of xc_monitor_write_ctrlreg() zeroes.

---
 tools/tests/xen-access/xen-access.c | 2 ++
 1 file changed, 2 insertions(+)
tools/tests/xen-access/xen-access.c +2 -0
index 9d960e2109..a081168dea 100644
@@ -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, 0, 0, 0);
 
             if ( privcall )
                 rc = xc_monitor_privileged_call(xch, domain_id, 0);
Signature · 7 lines
2.16.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 18 lines · Razvan Cojocaru

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

---
Changes since V1:
- Made all the ignored parameters of xc_monitor_write_ctrlreg() zeroes.

---
 tools/tests/xen-access/xen-access.c | 2 ++
 1 file changed, 2 insertions(+)
tools/tests/xen-access/xen-access.c +0 -0
index 9d960e2109..a081168dea 100644

tools/tests/xen-access/xen-access.c int main(int argc, char *argv[]) · line 661

Quoted 8 lines
tools/tests/xen-access/xen-access.c +2 -0
@@ -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, 0, 0, 0);
 
             if ( privcall )
                 rc = xc_monitor_privileged_call(xch, domain_id, 0);

Tamas, could we get an ack (or otherwise) on this? This is probably small and out-of-the-way enough to make it in with the proper acks even with all the Spectre / Meltdown activity.

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
Quoted 5 lines · Razvan Cojocaru
Quoted 4 lines · Razvan Cojocaru

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

Quoted 28 lines
Quoted 14 lines

---
Changes since V1:
- Made all the ignored parameters of xc_monitor_write_ctrlreg() zeroes.

---
 tools/tests/xen-access/xen-access.c | 2 ++
 1 file changed, 2 insertions(+)
tools/tests/xen-access/xen-access.c +0 -0
index 9d960e2109..a081168dea 100644

tools/tests/xen-access/xen-access.c int main(int argc, char *argv[]) · line 661

Quoted 8 lines
tools/tests/xen-access/xen-access.c +2 -0
@@ -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, 0, 0, 0);
 
             if ( privcall )
                 rc = xc_monitor_privileged_call(xch, domain_id, 0);

Tamas, could we get an ack (or otherwise) on this? This is probably small and out-of-the-way enough to make it in with the proper acks even with all the Spectre / Meltdown activity.

Quoted 2 lines

Thanks,
Razvan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel