[xen stable-4.9] x86/VT-x: Fix determination of EFER.LMA in vmcs_dump_vcpu()

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen stable-4.9] x86/VT-x: Fix determination of EFER.LMA in vmcs_dump_vcpu()

patchbot
commit c147505114c03fe14afa9ba6a6b436d7ee4b6835
Author:     Andrew Cooper <[hidden email]>
AuthorDate: Wed Apr 18 16:42:49 2018 +0200
Commit:     Jan Beulich <[hidden email]>
CommitDate: Wed Apr 18 16:42:49 2018 +0200

    x86/VT-x: Fix determination of EFER.LMA in vmcs_dump_vcpu()
   
    The LMA setting comes from the entry controls.
   
    Signed-off-by: Andrew Cooper <[hidden email]>
    Acked-by: Kevin Tian <[hidden email]>
    master commit: 82540b66ceb9318aa185f2488cbbbe479694de8f
    master date: 2018-04-11 11:06:55 +0100
---
 xen/arch/x86/hvm/vmx/vmcs.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 2648f7804b..4efd48fd0e 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -1806,7 +1806,10 @@ void vmcs_dump_vcpu(struct vcpu *v)
     vmentry_ctl = vmr32(VM_ENTRY_CONTROLS),
     vmexit_ctl = vmr32(VM_EXIT_CONTROLS);
     cr4 = vmr(GUEST_CR4);
-    efer = vmr(GUEST_EFER);
+
+    /* EFER.LMA is read as zero, and is loaded from vmentry_ctl on entry. */
+    BUILD_BUG_ON(VM_ENTRY_IA32E_MODE << 1 != EFER_LMA);
+    efer = vmr(GUEST_EFER) | ((vmentry_ctl & VM_ENTRY_IA32E_MODE) << 1);
 
     printk("*** Guest State ***\n");
     printk("CR0: actual=0x%016lx, shadow=0x%016lx, gh_mask=%016lx\n",
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog