diff mbox series

[kvm-unit-tests,2/2] nVMX: Use the standard non-canonical value in test_mtf3

Message ID 20200714002355.538-3-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series nVMX: Two PCIDE related fixes | expand

Commit Message

Sean Christopherson July 14, 2020, 12:23 a.m. UTC
Use the standard non-canonical value of repeating 'a' instead of a
custom (1 << 63) value in test_mtf3.  When PCID is enabled, bit 63 is
a flag that controls TLB swithching on MOV CR3 and is not included in
the canonical check of CR3, i.e. if CR4.PCIDE=1 then the test will load
0 into CR3 and all manner of confusion things happen.

Fixes: 46cc038c6afb8 ("x86: VMX: Add tests for monitor trap flag")
Cc: Oliver Upton <oupton@google.com>
Cc: Jim Mattson <jmattson@google.com>
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 x86/vmx_tests.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Oliver Upton July 14, 2020, 4:41 a.m. UTC | #1
On Mon, Jul 13, 2020 at 5:24 PM Sean Christopherson
<sean.j.christopherson@intel.com> wrote:
>
> Use the standard non-canonical value of repeating 'a' instead of a
> custom (1 << 63) value in test_mtf3.  When PCID is enabled, bit 63 is
> a flag that controls TLB swithching on MOV CR3 and is not included in
> the canonical check of CR3, i.e. if CR4.PCIDE=1 then the test will load
> 0 into CR3 and all manner of confusion things happen.
>
> Fixes: 46cc038c6afb8 ("x86: VMX: Add tests for monitor trap flag")
> Cc: Oliver Upton <oupton@google.com>
> Cc: Jim Mattson <jmattson@google.com>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>

Reviewed-by: Oliver Upton <oupton@google.com>

> ---
>  x86/vmx_tests.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> index cb42a2d..32e3d4f 100644
> --- a/x86/vmx_tests.c
> +++ b/x86/vmx_tests.c
> @@ -5107,7 +5107,7 @@ static void test_mtf_guest(void)
>               * MOV RAX is done before the VMCALL such that MTF is only enabled
>               * for the instruction under test.
>               */
> -            "mov $0x8000000000000000, %rax;\n\t"
> +            "mov $0xaaaaaaaaaaaaaaaa, %rax;\n\t"
>              "vmcall;\n\t"
>              "mov %rax, %cr3;\n\t"
>              "test_mtf3:\n\t"
> --
> 2.26.0
>
diff mbox series

Patch

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index cb42a2d..32e3d4f 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -5107,7 +5107,7 @@  static void test_mtf_guest(void)
 	      * MOV RAX is done before the VMCALL such that MTF is only enabled
 	      * for the instruction under test.
 	      */
-	     "mov $0x8000000000000000, %rax;\n\t"
+	     "mov $0xaaaaaaaaaaaaaaaa, %rax;\n\t"
 	     "vmcall;\n\t"
 	     "mov %rax, %cr3;\n\t"
 	     "test_mtf3:\n\t"