Skip to contentSkip to conversation

x86/vmx: Fixup removals from MSR load-lists

PATCH In review Igor Druzhinin 4 participants 4 messages Apr 4, 2019 – Apr 9, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/vmx: Fixup removals from MSR load-lists

Commit fd32dcfe ("x86/vmx: Don't leak EFER.NXE into guest context") introduced a regression on Harpertown and earlier cores (Gen 1 VT-x) where as soon as guest EFER becomes equal to Xen EFER (almost any 64-bit VM) stale version of EFER is incorrectly loaded into a guest causing almost immediate guest failure.

---
I assume this is a candidate for backporting to stable-4.12.

---
 xen/arch/x86/hvm/vmx/vmcs.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/x86/hvm/vmx/vmcs.c +3 -3
index 74f2a08..45d1849 100644
@@ -1490,15 +1490,15 @@ int vmx_del_msr(struct vcpu *v, uint32_t msr, enum vmx_msr_list_type type)
     switch ( type )
     {
     case VMX_MSR_HOST:
-        __vmwrite(VM_EXIT_MSR_LOAD_COUNT, vmx->host_msr_count--);
+        __vmwrite(VM_EXIT_MSR_LOAD_COUNT, --vmx->host_msr_count);
         break;
 
     case VMX_MSR_GUEST:
-        __vmwrite(VM_EXIT_MSR_STORE_COUNT, vmx->msr_save_count--);
+        __vmwrite(VM_EXIT_MSR_STORE_COUNT, --vmx->msr_save_count);
 
         /* Fallthrough */
     case VMX_MSR_GUEST_LOADONLY:
-        __vmwrite(VM_ENTRY_MSR_LOAD_COUNT, vmx->msr_load_count--);
+        __vmwrite(VM_ENTRY_MSR_LOAD_COUNT, --vmx->msr_load_count);
         break;
     }
 
Signature · 7 lines
2.7.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw

On 04/04/2019 15:42, Igor Druzhinin wrote:

I'd add "entries" to the subject, which can be done on commit.

Quoted 7 lines

Commit fd32dcfe ("x86/vmx: Don't leak EFER.NXE into guest context") introduced a regression on Harpertown and earlier cores (Gen 1 VT-x) where as soon as guest EFER becomes equal to Xen EFER (almost any 64-bit VM) stale version of EFER is incorrectly loaded into a guest causing almost immediate guest failure.

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

Reviewed-by on v1 1/1
#2 lore raw
In reply to Igor Druzhinin
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 04.04.19 at 16:42, <[email protected]> wrote:

Commit fd32dcfe ("x86/vmx: Don't leak EFER.NXE into guest context") introduced a regression on Harpertown and earlier cores (Gen 1 VT-x) where as soon as guest EFER becomes equal to Xen EFER (almost any 64-bit VM) stale version of EFER is incorrectly loaded into a guest causing almost immediate guest failure.

I'm afraid this is not an overly helpful description, considering the actual fix. It's definitely not that commit which has introduced the bug - vmx_del_msr() has been there before. Hence the bug was only uncovered by the referenced commit.

With a reference to the actual faulty commit added

Jan

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

Acked-by on v1 1/1
#3 lore raw
In reply to Igor Druzhinin
Quoted 10 lines

From: Igor Druzhinin [mailto:[email protected]]
Sent: Thursday, April 4, 2019 10:42 PM

Commit fd32dcfe ("x86/vmx: Don't leak EFER.NXE into guest context") introduced a regression on Harpertown and earlier cores (Gen 1 VT-x) where as soon as guest EFER becomes equal to Xen EFER (almost any 64-bit VM) stale version of EFER is incorrectly loaded into a guest causing almost immediate guest failure.

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