Skip PMU portion of vmware_backdoors test if PMU is not enabled.
PATCH 1/1 Skip PMU portion of vmware_backdoors test if PMU is not enabled.
Since 2019, KVM has an explicit check that if guest's PMC is disabled, then VMware backdoor via RDPCM is disabled as well.
commit 672ff6cff80ca43bf3258410d2b887036969df5f
Author: Liran Alon <[email protected]>
Date: Mon Mar 25 21:10:17 2019 +0200
KVM: x86: Raise #GP when guest vCPU do not support PMU
Fix the test failure by checking if PMU is enabled first.
--- x86/vmware_backdoors.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
x86/vmware_backdoors.c +15 -3
@@ -1,5 +1,6 @@#include "x86/msr.h" +#include "x86/pmu.h" #include "x86/processor.h" #include "x86/apic-defs.h" #include "x86/apic.h"
@@ -101,7 +102,7 @@ static uint64_t vmware_backdoor_port(uint64_t vmport, uint64_t vmport_magic, PORT_ARG(a, b, c, m, sf)) -struct fault_test vmware_backdoor_tests[] = { +struct fault_test vmware_backdoor_tests_rdpcm[] = {RDPMC_TEST ("HOST_TSC kernel" ,VMWARE_BACKDOOR_PMC_HOST_TSC ,KERNEL_MODE ,NO_FAULT ), RDPMC_TEST("REAL_TIME kernel", VMWARE_BACKDOOR_PMC_REAL_TIME,
@@ -116,6 +117,10 @@ struct fault_test vmware_backdoor_tests[] = { USER_MODE, NO_FAULT), RDPMC_TEST("RANDOM PMC user", 0xfff, USER_MODE, FAULT), + { NULL }, +}; + +struct fault_test vmware_backdoor_tests_ioport[] = {PORT_TEST ("CMD_GETVERSION user" ,VMWARE_BACKDOOR_PORT ,VMWARE_MAGIC ,VMPORT_CMD_GETVERSION ,USER_MODE ,NO_FAULT ), PORT_TEST("CMD_GETVERSION kernel", VMWARE_BACKDOOR_PORT, VMWARE_MAGIC,
@@ -165,8 +170,15 @@ static void check_vmware_backdoors(void)report_prefix_push ("vmware_backdoors" ); -for (i =0 ; vmware_backdoor_tests[i].name !=NULL ; i++) -test_run (&vmware_backdoor_tests[i]); +if (this_cpu_has_pmu ()) { +for (i =0 ; vmware_backdoor_tests_rdpcm[i].name !=NULL ; i++) +test_run (&vmware_backdoor_tests_rdpcm[i]); + }else { +report_skip ("Skipping VMWARE pseudo RDPCM tests, PMU not enabled" ); + } + +for (i =0 ; vmware_backdoor_tests_ioport[i].name !=NULL ; i++) +test_run (&vmware_backdoor_tests_ioport[i]);report_prefix_pop (); }
Signature · 1 line
2.49.0
Quoted 11 lines · Maxim Levitsky
Since 2019, KVM has an explicit check that if guest's PMC is disabled, then VMware backdoor via RDPCM is disabled as well.
commit
672ff6cff80ca43bf3258410d2b887036969df5f
Author: Liran Alon <[email protected]> Date: Mon Mar 25 21:10:17 2019 +0200
KVM: x86: Raise #GP when guest vCPU do not support PMUFix the test failure by checking if PMU is enabled first.
Signed-off-by Maxim Levitsky <[email protected]>
Hi,
Any update?
Best regards,
Maxim Levitsky
Quoted 53 lines
---
x86/vmware_backdoors.c | 18 +++++++++++++++---1 file changed, 15 insertions(+), 3 deletions(-)x86/vmware_backdoors.c +0
-0@@ -1,5 +1,6 @@
#include "x86/msr.h"
+#include "x86/pmu.h"
#include "x86/processor.h"
#include "x86/apic-defs.h"
#include "x86/apic.h"x86/vmware_backdoors.c +0
-0@@ -101,7 +102,7 @@ static uint64_t vmware_backdoor_port(uint64_t vmport, uint64_t vmport_magic, PORT_ARG(a, b, c, m, sf))
x86/vmware_backdoors.c +1
-1-struct fault_test vmware_backdoor_tests[] = { +struct fault_test vmware_backdoor_tests_rdpcm[] = {
RDPMC_TEST("HOST_TSC kernel", VMWARE_BACKDOOR_PMC_HOST_TSC, KERNEL_MODE, NO_FAULT), RDPMC_TEST("REAL_TIME kernel",VMWARE_BACKDOOR_PMC_REAL_TIME,x86/vmware_backdoors.c +0
-0@@ -116,6 +117,10 @@ struct fault_test vmware_backdoor_tests[] = { USER_MODE, NO_FAULT), RDPMC_TEST("RANDOM PMC user", 0xfff, USER_MODE, FAULT),x86/vmware_backdoors.c +4
-0+ { NULL }, +}; + +struct fault_test vmware_backdoor_tests_ioport[] = {PORT_TEST("CMD_GETVERSION user",
VMWARE_BACKDOOR_PORT,VMWARE_MAGIC,VMPORT_CMD_GETVERSION,USER_MODE,NO_FAULT), PORT_TEST("CMD_GETVERSION kernel",VMWARE_BACKDOOR_PORT,VMWARE_MAGIC,x86/vmware_backdoors.c +0
-0@@ -165,8 +170,15 @@ static void check_vmware_backdoors(void)
report_prefix_push("vmware_backdoors");x86/vmware_backdoors.c +9
-2-for (i =0 ; vmware_backdoor_tests[i].name !=NULL ; i++) -test_run (&vmware_backdoor_tests[i]); +if (this_cpu_has_pmu ()) { +for (i =0 ; vmware_backdoor_tests_rdpcm[i].name !=NULL ; i++) +test_run (&vmware_backdoor_tests_rdpcm[i]); + }else { +report_skip ("Skipping VMWARE pseudo RDPCM tests, PMU not enabled" ); + } + +for (i =0 ; vmware_backdoor_tests_ioport[i].name !=NULL ; i++) +test_run (&vmware_backdoor_tests_ioport[i]);
report_prefix_pop();
}
Quoted 9 lines · Maxim Levitsky
Since 2019, KVM has an explicit check that if guest's PMC is disabled, then VMware backdoor via RDPCM is disabled as well.
commit
672ff6cff80ca43bf3258410d2b887036969df5f
Author: Liran Alon <[email protected]>
Date: Mon Mar 25 21:10:17 2019 +0200
KVM: x86: Raise #GP when guest vCPU do not support PMU[...]
Applied to kvm-x86 next, thanks!
[1/1] Skip PMU portion of vmware_backdoors test if PMU is not enabled.
https://github.com/kvm-x86/kvm-unit-tests/commit/bf60564d1994